IDocumentInfo Interface

com.bea.ide.document
IDocumentInfo Interface

public interface IDocumentInfo

This interface is used to describe a document type within the IDE. It is built primarly from the information contained in the com-bea-ide:document extension xml (see DocumentSvc). The information is primarily used to display information to the user. The underlying handler object actually performs the operations. An important concept is the idea that the document info for a paritcular URI can change. This information is important for caching. If the handler relies on the contents of the URI for either displaying icon information, or for resolving its fluency, the document info or handler may change. The IDocumentInfo records this information in the methods IDocumentInfo.canInfoChange() and IDocumentInfo.canHandlerChange() so code that caches IDocumentInfo objects for URIs can know that it cannot cache the particular information for the URI.

Nested Class Summary

public static interfaceIDocumentInfo.ITemplate
           The ITemplate interface is used for creation of new documents.

Method Summary

public boolean
canCreate()
Indicates whether documents of this type can be created within the IDE.
public boolean
canHandlerChange()
Determines whether the IDocumentInfo's handler examined the file contents to assign this info to the URI.
public boolean
canInfoChange()
Determines whether the values returned by the IDocumentInfo methods may change if the contents of the document change.
public String
getBaseName(String sFile)
Derives the base name for the given file, stripping away all extension and name suffix information.
public String
getHandlerId()
String identifying the handler that generated this document info.
public Icon
getIcon()
An icon representing this document type.
public String
getLabel()
A string description of the document type that this information represents.
public URI
getParentDocument(URI uriFile)
Obtain the parent document for the given file.
public IDocumentInfo.ITemplate[]
getTemplates()
The set of creation templates available for this document type.
public String
getVirtualName(URI uri)
Obtain the virtual name for this document.
public String
invalidNameCheck(String sFile)
Checks the given filename to see if it is a valid name for this handler.
public boolean
isAutogenerated(URI uriFile)
This method allows the caller to determine if the specified file is autogenerated.
public boolean
isDefaultVersion(URI uri)
Determines whether this document instance is the default version.
public boolean
isValidVersion(URI uri)
Indicates whether the document is currently a valid version.
public String
suggestValidName(String sFile)
Examine the given filename and derive a valid filename from it.

Method Detail

canCreate() Method

public boolean canCreate()
Indicates whether documents of this type can be created within the IDE. If so, the document handler has implemented the newDocument interface. An appropriate template may be passed to the newDocument method

Returns

true if this document info has a handler and it can create documents of this type, false otherwise

Related Topics

IDocumentInfo.ITemplate


canHandlerChange() Method

public boolean canHandlerChange()
Determines whether the IDocumentInfo's handler examined the file contents to assign this info to the URI. If so this method should return true, meaning that changes to the contents of the file could result in a different document handler being used. This has implications for the cachability of this IDocumentInfo object

Returns

true if the handler that generated this IDocumentInfo requires knowledge of the files contents and therefore may not handle the file if it's contents change. False if the handling was statically determined.

canInfoChange() Method

public boolean canInfoChange()
Determines whether the values returned by the IDocumentInfo methods may change if the contents of the document change. A return value of true from this method implies that the return values can change. If the {#canHandlerChange()} method returns true, then this method is irrelevant as it implies that the data returned can change.

Returns

true if the IDocumentInfo methods can return different information can change false if it cannot change (and can therefore be safely cached)

getBaseName(String) Method

public String getBaseName(String sFile)
Derives the base name for the given file, stripping away all extension and name suffix information. Generally, it simply removes the extension, but some handlers may also add a pre-extension suffix to a file. This method strips all of that out to determine the original name.

Parameters

sFile
The filename that should be examined to find the original name. This should not contain any path information (i.e. directory or separators)

Returns

The base name that the given name was derived from.

Related Topics

IDocumentHandler.getBaseName(String)


getHandlerId() Method

public String getHandlerId()
String identifying the handler that generated this document info. The handler id is unique for each handler thus, comparing handler id strings is the correct way to determine if to document info objects represent the same handler.

Returns

String id of the document handler for this info object or null if there is no handler associated with the info.

getIcon() Method

public Icon getIcon()
An icon representing this document type.


getLabel() Method

public String getLabel()
A string description of the document type that this information represents.

Returns

string description of the document type

getParentDocument(URI) Method

public URI getParentDocument(URI uriFile)
Obtain the parent document for the given file. If the isAutogenerated method returns true for a URI, this method should return the document from which the first was generated. This method should simply call through to the document handler to retrieve this information.

Parameters

uriFile
URI of autogenerated file

Returns

URI of the file associated with this file, or null if the file is not associated with any other file. if the file is autogenerated, this method returns the file used to generate the given uri

getTemplates() Method

public IDocumentInfo.ITemplate[] getTemplates()
The set of creation templates available for this document type. Valid only if canCreate() returns true. There will always be at least a single ITemplate if canCreate is true representing the null (default) template.

Returns

Array of ITemplate objects available for this document type

Related Topics

IDocumentInfo.ITemplate


getVirtualName(URI) Method

public String getVirtualName(URI uri)
Obtain the virtual name for this document. All documents that share a virtual name are versions of the same document.

Returns

String representing the virtual name for this document or null if the URI does not refer to a version instance

invalidNameCheck(String) Method

public String invalidNameCheck(String sFile)
Checks the given filename to see if it is a valid name for this handler. This check may include verification of the extension and any other requirements on the filename. For example, the java handler can require that the filename be a valid java identifier.

Parameters

sFile
The filename that should be examined for validity. This should not contain any path information (i.e. directory or separators).

Returns

String value indicating the error message that should be shown to the user or null if the name is valid.

Related Topics

IDocumentHandler.invalidNameCheck(String)


isAutogenerated(URI) Method

public boolean isAutogenerated(URI uriFile)
This method allows the caller to determine if the specified file is autogenerated. This is the equivalent of instantiating the document for the file and using the IRelatedDocument interface to make the same method call. This method does not require instantiating the document however and is therefore lighter weight.

Parameters

uriFile
File to check for autogeneration

Returns

true if the given uri is a file that was completely generated from the contents of another file.

isDefaultVersion(URI) Method

public boolean isDefaultVersion(URI uri)
Determines whether this document instance is the default version. The default version is the one that will be associated with the virtual name when invoked (ex. when invoking a webservice using the virtual .jws. Note that if the URI does not refer to a version instance (i.e. getVirtualName() returns null), this method should return false

Returns

true if this instance is the default version, false otherwise

isValidVersion(URI) Method

public boolean isValidVersion(URI uri)
Indicates whether the document is currently a valid version. If the document does not properly implement the version's interface, then this method should return true in order to allow feedback to the user.

Returns

true if the document implements the versions interface correctly, false otherwise

suggestValidName(String) Method

public String suggestValidName(String sFile)
Examine the given filename and derive a valid filename from it. This method differs from IDocumentInfo.invalidNameCheck(String) in that rather than returning an error, it will attempt to address any invalid characters in the name and correct them. An example is an implementation that replaces spaces with '_' in a handler that does not allow spaces.

Parameters

sFile
The filename that should be examined for validity. This should not contain any path information (i.e. directory or separators).

Returns

A valid filename for which invalidNameCheck will return null, indicating a valid name.

Related Topics

IDocumentHandler.suggestValidName(String)