public abstract class ExternalTool extends java.lang.Object implements Copyable
Note that it's generally the responsibility of the tool manager
(in conjunction with type
implementations) to
create new instances of ExternalTools. If you construct a new tool manually,
it may not be initialized properly.
Many of the methods on this class are deprecated since the 11.1.1 release.
The external tools framework now uses HashStructure
to store
persistent properties for tools.
Following the standard idiom, you can
obtain a typesafe "bean-like" object that provides access to these
properties by using an appropriate implementation of
HashStructureAdapter
. A HashStructureAdapter
providing access to most of the deprecated properties on this class is
available in ExternalToolBaseProperties
. You can obtain an instance
like so:
ExternalToolBaseProperties props = ExternalToolBaseProperties.getInstance( tool ); String caption = props.getCaption();It is almost always better to access properties using the adapter than through the deprecated methods on this class, especially if you are applying batch operations to a single external tool.
Modifier and Type | Field and Description |
---|---|
static int |
AVAIL_ALWAYS
Deprecated.
|
static int |
AVAIL_REGEXP
Deprecated.
|
static int |
AVAIL_SELECTION
Deprecated.
|
static int |
AVAIL_TYPES
Deprecated.
|
static int |
INTEG_CODE_EDITOR_CONTEXT_MENU_ITEM
Deprecated.
|
static int |
INTEG_MAIN_WINDOW_TOOLBAR_BUTTON
Deprecated.
|
static int |
INTEG_NAVIGATOR_CONTEXT_MENU_ITEM
Deprecated.
|
static int |
INTEG_NAVIGATOR_TOOLBAR_BUTTON
Deprecated.
since 11.1.1. This integration has never been supported.
|
static int |
INTEG_TOOLS_MENU_ITEM
Deprecated.
|
Constructor and Description |
---|
ExternalTool() |
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
copyTo(java.lang.Object target)
Copies the internal state of
this object to the
specified copy . |
protected void |
copyToImpl(ExternalTool copy)
Deprecated.
since 11.1.1 with no replacement. The persistence mechanism
for external tools changed in the 11.1.1 release, and no longer
requires subclasses to implement this method.
|
boolean |
equals(java.lang.Object o) |
int |
getAvailability()
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.getAvailability() . |
java.lang.String |
getAvailabilityExpression()
Deprecated.
since 11.1.1 with no replacement. Support for regular
expression availability was dropped in 10.1.3.
|
java.util.List<java.lang.String> |
getAvailableTypes()
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.getAvailableTypes() . |
java.lang.String |
getCaption()
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.getCaption() . |
HashStructure |
getData()
Gets persistent properties of this tool.
|
java.net.URL |
getIconURL()
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.getIconURL() . |
javax.swing.Icon |
getIconWhenRequired()
If an external tool is displayed in the toolbar, an icon is required.
|
int |
getIntegrationMask()
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.isIntegrated(IntegrationPoint) . |
boolean |
getReloadBuffers()
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.getReloadBuffers() |
java.lang.String |
getScannerTag()
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.getScannerTag() |
java.lang.String |
getToolTipText()
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.getToolTipText() . |
int |
hashCode() |
boolean |
hasIntegration(int integrationType)
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.isIntegrated(IntegrationPoint) . |
void |
initializeExternalTool()
Perform any work necessary to initialize a newly-created instance of
the external tool
|
abstract void |
run(ExternalToolManager manager,
Context context)
Invoke the external tool instance on the specified context.
|
void |
setAvailability(int availability)
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.setAvailability(Availability) . |
void |
setAvailabilityExpression(java.lang.String expression)
Deprecated.
since 11.1.1 with no replacement. Support for regular
expression availability was dropped in 10.1.3.
|
void |
setAvailableTypes(java.util.List<java.lang.String> types)
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.setAvailableTypes(List) . |
void |
setCaption(java.lang.String caption)
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.setCaption(String) . |
void |
setData(HashStructure hs)
Sets persistent properties of this tool.
|
void |
setIconURL(java.net.URL u)
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.setIconURL(URL) . |
void |
setIntegrationMask(int integrationMask)
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.setIntegrated(IntegrationPoint,boolean) . |
void |
setReloadBuffers(boolean reload)
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.setReloadBuffers(boolean) |
void |
setScannerTag(java.lang.String tag)
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.setScannerTag(String) |
void |
setToolTipText(java.lang.String toolTipText)
Deprecated.
since 11.1.1 - use
ExternalToolBaseProperties.setToolTipText(String) . |
java.lang.String |
toString() |
public static final int INTEG_TOOLS_MENU_ITEM
ExternalToolBaseProperties.isIntegrated(IntegrationPoint)
or
ExternalToolBaseProperties.setIntegrated(IntegrationPoint, boolean)
public static final int INTEG_CODE_EDITOR_CONTEXT_MENU_ITEM
ExternalToolBaseProperties.isIntegrated(IntegrationPoint)
or
ExternalToolBaseProperties.setIntegrated(IntegrationPoint, boolean)
public static final int INTEG_NAVIGATOR_CONTEXT_MENU_ITEM
ExternalToolBaseProperties.isIntegrated(IntegrationPoint)
or
ExternalToolBaseProperties.setIntegrated(IntegrationPoint, boolean)
public static final int INTEG_MAIN_WINDOW_TOOLBAR_BUTTON
ExternalToolBaseProperties.isIntegrated(IntegrationPoint)
or
ExternalToolBaseProperties.setIntegrated(IntegrationPoint, boolean)
public static final int INTEG_NAVIGATOR_TOOLBAR_BUTTON
public static final int AVAIL_ALWAYS
ExternalToolBaseProperties.getAvailability()
or
ExternalToolBaseProperties.setAvailability(Availability)
.public static final int AVAIL_SELECTION
ExternalToolBaseProperties.getAvailability()
or
ExternalToolBaseProperties.setAvailability(Availability)
.public static final int AVAIL_REGEXP
ExternalToolBaseProperties.getAvailability()
or
ExternalToolBaseProperties.setAvailability(Availability)
.public static final int AVAIL_TYPES
ExternalToolBaseProperties.getAvailability()
or
ExternalToolBaseProperties.setAvailability(Availability)
.public final void setData(HashStructure hs)
hs
- persistent properties of this tool.java.lang.NullPointerException
- if hs is null.public final HashStructure getData()
Normally, an external tool implementation will retrieve specific typed
properties from this structure using a
HashStructureAdapter
. For example, to
obtain general properties of a tool, use:
ExternalToolProperties properties = ExternalToolProperties.getInstance( myTool )
public void setScannerTag(java.lang.String tag)
ExternalToolBaseProperties.setScannerTag(String)
tag
- a tag recognized by the scanner that created this toolpublic java.lang.String getScannerTag()
ExternalToolBaseProperties.getScannerTag()
public boolean getReloadBuffers()
ExternalToolBaseProperties.getReloadBuffers()
public void setReloadBuffers(boolean reload)
ExternalToolBaseProperties.setReloadBuffers(boolean)
reload
- if true, the tool will force a buffer reloadpublic javax.swing.Icon getIconWhenRequired()
Subclasses may override this to provide a type specific default icon. This implementation returns a default document icon.
public boolean hasIntegration(int integrationType)
ExternalToolBaseProperties.isIntegrated(IntegrationPoint)
.integrationType
- one of the INTEG_ constants defined in this class.public java.lang.String toString()
toString
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object o)
equals
in class java.lang.Object
public void setAvailableTypes(java.util.List<java.lang.String> types)
ExternalToolBaseProperties.setAvailableTypes(List)
.types
- a list of class names, which should match class names
in oracle.ide.config.DocumentExtensions.DocRecord.getDocClass().public java.util.List<java.lang.String> getAvailableTypes()
ExternalToolBaseProperties.getAvailableTypes()
.public java.net.URL getIconURL()
ExternalToolBaseProperties.getIconURL()
.public void setIconURL(java.net.URL u)
ExternalToolBaseProperties.setIconURL(URL)
.u
- a URL pointing to an icon file to use for this tool. If null,
no icon will be used.public java.lang.String getCaption()
ExternalToolBaseProperties.getCaption()
.public void setCaption(java.lang.String caption)
ExternalToolBaseProperties.setCaption(String)
.caption
- a String caption for the tool. Must not be null.public java.lang.String getToolTipText()
ExternalToolBaseProperties.getToolTipText()
.public void setToolTipText(java.lang.String toolTipText)
ExternalToolBaseProperties.setToolTipText(String)
.toolTipText
- a String to be used as tool tip text for the tool. May be null.public int getIntegrationMask()
ExternalToolBaseProperties.isIntegrated(IntegrationPoint)
.public void setIntegrationMask(int integrationMask)
ExternalToolBaseProperties.setIntegrated(IntegrationPoint,boolean)
.integrationMask
- a bitmask of IT_ constants from this interface.public int getAvailability()
ExternalToolBaseProperties.getAvailability()
.public void setAvailability(int availability)
ExternalToolBaseProperties.setAvailability(Availability)
.availability
- one of the AVAIL_ constants from this interface.public java.lang.String getAvailabilityExpression()
public void setAvailabilityExpression(java.lang.String expression)
expression
- ignored.protected void copyToImpl(ExternalTool copy)
public java.lang.Object copyTo(java.lang.Object target)
Copyable
this
object to the
specified copy
. If copy
is
null
, then this method should create a new instance
of this
class and proceed to copy the internal state
to the newly created object. Generally, only the persistent
state of the object should be copied, but whether or not it is
appropriate to copy transient properties is at the discretion
of the individual implementor.
Regardless of whether the copy occurs to an existing object or to
a newly created object, the return value is object to which
this
object's state was copied.
There is a standard implementation pattern for the
copyTo
method that helps avoid problems that arise
when a Copyable
object is subclassed. The pattern
is:
The parameter passed into thepublic Object copyTo( Object target ) { final <this_class> copy = target != null ? (<this_class>) target : new <this_class>(); copyToImpl( copy ); return copy; } protected final void copyToImpl( <this_class> copy ) { super.copyToImpl( copy ); // if necessary // put code here for copying the properties of <this_class> }
copyToImpl
method is
the same type of this
class. The responsibility of
copyToImpl
is to copy the state of this
class through direct access of the fields. The
copyToImpl
method should not use getters and setters
since these may be overridden, causing the state of
this
class to be incompletely copied.copyTo
in interface Copyable
target
- The target object to which the state of
this
object should be copied. If target
is null
, then the copyTo
method will
return a new instance of this
class.this
object was copied. If the target
was
non-null
, then the return value is the same as the
target
object that was passed in; otherwise, the
return value is a new instance of this
class.public abstract void run(ExternalToolManager manager, Context context) throws ToolRunException
context
- the IDE context the tool was invoked in.ToolRunException
- if the
tool failed to run.public void initializeExternalTool()