RelatedDocumentHelper Class
- public class RelatedDocumentHelper
extends Object
This has methods used by control and controlcontainer handlers and documents
to implement IRelatedDocument. It searches through files on disk looking for
specific tags that indicate autogeneration. Note that autogen tags are somewhat
different than javelin-parsed annotations. They are scanned in text, and only valid
in the first comment in the file. Care should be taken when autogenning files not to
create attributes before the autogen tag which can be confused for comments.
-
Hierarchy
-
Object
RelatedDocumentHelper
Methods from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AUTOGEN_ATTR
public static String
AUTOGEN_ATTR
- The attribute name for autogen status (value will be true/false).
LINK_PREFIX
public static String
LINK_PREFIX
- The prefix of an autogen tag.
LINK_TAG
public static String
LINK_TAG
- The tag part of an autogen tag.
SOURCE_ATTR
public static String
SOURCE_ATTR
- The attribute name for autogen source.
RelatedDocumentHelper
public RelatedDocumentHelper()
breakRelationship(ISourceDocument) Method
public static boolean breakRelationship(ISourceDocument
doc)
set the given document to non-autogenerated.
Parameters
-
doc
- the document to set as not autogenerated.
Returns
- true if the change succeeded, false if something went wrong.
confirmBreakDialog(ISourceDocument) Method
public static boolean confirmBreakDialog(ISourceDocument
doc)
show a dialog asking the user if she wants to break the link between documents.
Parameters
-
doc
- the document which will be set to non-autogenerated.
Returns
- true if the user agreed, false if the user cancelled.
findRelatedFiles(URI, Map) Method
public static List
findRelatedFiles(URI
sourceURI,
Map
actionMap)
Find related files. This searches all files in the same directory as the source,
and returns a list of those which are autogenerated from the source.
Parameters
-
sourceURI
- the source document which will be the parent of any files returned.
-
actionMap
- a Map of DocumentHandler ID to AbstractFilegenAction which indicates how
to regenerate the file. Not actually used by this method.
getParentDocument(ISourceDocument) Method
public static URI
getParentDocument(ISourceDocument
doc)
Determine the parent document of the autogenerated document.
Parameters
-
doc
- the Document to examine
Returns
- the URI of it's parent file, or null if there is none.
getParentDocument(URI) Method
public static URI
getParentDocument(URI
docUri)
Determine the parent document of the autogenerated document.
Parameters
-
docUri
- the document to examine.
Returns
- the URI of it's parent file, or null if there is none.
isAutoGenerated(ISourceDocument) Method
public static boolean isAutoGenerated(ISourceDocument
doc)
Determine if the given document is autogenerated.
Parameters
-
doc
- the document to look at.
Returns
- true if doc is flagged as autogen="true", false otherwise.
isAutoGenerated(URI) Method
public static boolean isAutoGenerated(URI
docUri)
Determine if the given document is autogenerated.
Parameters
-
docUri
- the document URI to look at.
Returns
- true if doc is flagged as autogen="true", false otherwise.
regenerate(URI, URI, Map) Method
public static boolean regenerate(URI
sourceURI,
URI
destinationURI,
Map
actionMap)
Regenerate the specified file.
Parameters
-
sourceURI
- the URI of the source document.
-
destinationURI
- the URI of the destination document.
-
actionMap
- a map of destination handlerId to AbstractFileGenAction. May be
null if ControlSvc knows how to generate the file.
Returns
- true if the generation succeeded or was queued for later execution (because
a refactor is in progress), false if it failed.