public class ZipFileStructureCreator extends Object implements IStructureCreator
IStructureCreator
interface
makes the contents of a zip archive available as a
hierarchical structure of IStructureComparator
s.
It is used when comparing the internal structure of a zip archive.
Constructor and Description |
---|
ZipFileStructureCreator()
Create a new ZipFileStructureCreator.
|
ZipFileStructureCreator(String title)
Create a new ZipFileStructureCreator with the given title.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canRewriteTree()
Returns
false since this IStructureCreator
cannot rewrite the diff tree in order to fold certain combinations of
additions and deletions. |
boolean |
canSave()
Returns
false since we cannot update a zip archive. |
String |
getContents(Object o,
boolean ignoreWhitespace)
Returns the contents of the given node as a string for the purpose
of performing a content comparison only (that is the string will not be visible in the UI).
|
String |
getName()
Returns a descriptive name which can be used in the UI of the
StructureDiffViewer . |
IStructureComparator |
getStructure(Object input)
Creates a tree structure consisting of
IStructureComparator s
from the given object and returns its root object. |
IStructureComparator |
locate(Object path,
Object source)
Creates the single node specified by path from the given input object.
|
void |
rewriteTree(Differencer differencer,
IDiffContainer root)
Empty implementation since this
IStructureCreator
cannot rewrite the diff tree in order to fold certain combinations of
additions and deletions. |
void |
save(IStructureComparator structure,
Object input)
Called whenever a copy operation has been performed on a tree node.
|
public ZipFileStructureCreator()
public ZipFileStructureCreator(String title)
getName()
.title
- the title of this structure creatorpublic String getName()
IStructureCreator
StructureDiffViewer
.getName
in interface IStructureCreator
IStructureCreator
public IStructureComparator getStructure(Object input)
IStructureCreator
IStructureComparator
s
from the given object and returns its root object.
Implementing this method typically involves parsing the input object.
In case of an error (e.g. a parsing error) the value null
is returned.getStructure
in interface IStructureCreator
input
- the object from which to create the tree of IStructureComparator
null
in case of errorpublic String getContents(Object o, boolean ignoreWhitespace)
IStructureCreator
ignoreWhitespace
is true
all character sequences considered
whitespace should be removed from the returned string.getContents
in interface IStructureCreator
o
- the node for which to return a string representationignoreWhitespace
- if true
the returned string should not contain whitespacepublic boolean canSave()
false
since we cannot update a zip archive.false
public void save(IStructureComparator structure, Object input)
AssertionFailedException
since we cannot update a zip archive.save
in interface IStructureCreator
structure
- the node for which to save the new contentinput
- the object from which the structure tree was created in getStructure
public IStructureComparator locate(Object path, Object source)
IStructureCreator
null
is returned.
This method is similar to getStructure
but in
contrast to getStructure
only a single node without any children must be returned.
This method is used in the ReplaceWithEditionDialog
to locate a sub element
(e.g. a method) within an input object (e.g. a file containing source code).
One (not optimized) approach to implement this method is calling getStructure(input)
to build the full tree, and then finding that node within the tree that is specified
by path
.
The syntax of path
is not specified, because it is treated by the compare subsystem
as an opaque entity and is not further interpreted. Clients using this functionality
will pass a value of path
to the selectEdition
method of ReplaceWithEditionDialog
and will receive this value unchanged
as an argument to locate
.
locate
in interface IStructureCreator
path
- specifies a sub object within the input objectsource
- the object from which to create the IStructureComparator
path
or null
public boolean canRewriteTree()
false
since this IStructureCreator
cannot rewrite the diff tree in order to fold certain combinations of
additions and deletions.
Note: this method is for internal use only. Clients should not call this method.
false
public void rewriteTree(Differencer differencer, IDiffContainer root)
IStructureCreator
cannot rewrite the diff tree in order to fold certain combinations of
additions and deletions.
Note: this method is for internal use only. Clients should not call this method.
differencer
- root
-
Copyright (c) 2000, 2018 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.