Package ghidra.framework.plugintool
Class PluginTool
java.lang.Object
docking.AbstractDockingTool
ghidra.framework.plugintool.PluginTool
- All Implemented Interfaces:
Tool
,ServiceProvider
- Direct Known Subclasses:
FrontEndTool
,GhidraTool
,ModalPluginTool
,StandAlonePluginTool
Base class that is a container to manage plugins and their actions, and to coordinate the
firing of plugin events and tool events. A PluginTool may have visible components supplied by
ComponentProviders. These components may be docked within the tool, or moved out into their own windows.
Plugins normally add actions via AbstractDockingTool.addAction(DockingActionIf)
. There is also
an alternate method for getting actions to appear in the popup context menu (see
AbstractDockingTool.addPopupActionProvider(PopupActionProvider)
). The popup listener mechanism is generally not
needed and should only be used in special circumstances (see PopupActionProvider
).
The PluginTool also manages tasks that run in the background, and options used by the plugins.
-
Field Summary
Modifier and TypeFieldDescriptionstatic final String
Name of the property for the description of the tool.static final String
Name of the property for the tool icon.protected ToolIconURL
protected boolean
protected ManagePluginsDialog
static final String
Name of the property for the number of plugins the tool has.static final String
Name of the property for the tool name.protected String
Fields inherited from class docking.AbstractDockingTool
optionsMap, toolActions, winMgr
-
Constructor Summary
ModifierConstructorDescriptionprotected
PluginTool
(Project project, ProjectManager projectManager, ToolServices toolServices, String name, boolean isDockable, boolean hasStatus, boolean isModal) PluginTool
(Project project, ToolTemplate template) Construct a new PluginTool.PluginTool
(Project project, String name, boolean isDockable, boolean hasStatus, boolean isModal) Construct a new PluginTool. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Request tool to accept specified URL.boolean
acceptDomainFiles
(DomainFile[] data) void
addEventListener
(Class<? extends PluginEvent> eventClass, PluginEventListener listener) protected void
protected void
protected void
void
protected void
Adds actions to the tool for transferring focus to the first component in the next or previous dockable component provider.protected void
void
void
Add a plugin to the tool.void
addPlugins
(String[] classNames) Deprecated, for removal: This API element is subject to removal in a future version.void
addPlugins
(Collection<String> classNames) Add plugins to the tool.void
protected void
void
addServiceListener
(ServiceListener listener) Adds a listener that will be called as services are added and removed from this ServiceProvider.void
addStatusComponent
(JComponent c, boolean addBorder, boolean rightSide) Add a status component to the tool.void
addToolListener
(ToolListener listener) protected boolean
Normally, tools are not allowed to close while tasks are running in that tool as it could leave the application in an unstable state.void
beep()
A convenience method to make an attention-grabbing noise to the uservoid
Cancel the current task in the tool.protected boolean
canClose()
boolean
canCloseDomainFile
(DomainFile domainFile) boolean
canCloseDomainObject
(DomainObject domainObject) Can the domain object be closed?
Note: This forces plugins to terminate any tasks they have running for the indicated domain object and apply any unsaved data to the domain object.protected boolean
Checks if this tool's plugins are in a state to be closed.protected boolean
Checks if this tool has running tasks, with optionally giving the user an opportunity to cancel them.void
Clear the list of events that were last generated.void
close()
Closes this tool, possibly with input from the user.void
contextChanged
(ComponentProvider provider) Signals to the tool that the provider's context has changed.protected DockingWindowManager
createDockingWindowManager
(boolean isDockable, boolean hasStatus, boolean isModal) This method exists here, as opposed to inline in the constructor, so that subclasses can alter the behavior of the DockingWindowManager construction.protected PluginsConfiguration
protected void
dispose()
protected boolean
Called when it is time to save the tool.<T extends DomainObject>
booleanCall the applyTo() method on the given command to make some change to the domain object; the command is done in the AWT thread, therefore, the command that is to be executed should be a relatively quick operation so that the event queue does not appear to "hang." For lengthy operations, the command should be done in a background task.void
Launch the task in a new threadvoid
Launch the task in a new thread<T extends DomainObject>
voidExecute the given command in the foreground.<T extends DomainObject>
booleanExecute the given command in the foreground.<T extends DomainObject>
voidexecuteBackgroundCommand
(BackgroundCommand<T> cmd, T obj) Start a new thread that will call the given command's applyTo() method to make some change in the domain object.void
firePluginEvent
(PluginEvent event) Returns the active component provider, that which has focusString[]
getIcon()
Get the icon that the tool is usingReturn the location of this tool's frame on the screen.Return a list of plugins in the toolReturns the manage plugins dialog that is currently being used.getName()
Returns a combination of the tool name and the instance name of the form tool name(instance name), e.g., SomeTool(2)Get all options.getOptions
(String categoryName) Get the options for the given category name; if no options exist with the given name, then one is created.Get the project associated with this tool.Returns the project manager associated with this tool.<T> T
getService
(Class<T> c) Returns the Service object that implements the given service interface.<T> T[]
getServices
(Class<T> c) Get the objects that implement the given service.getSize()
Return the dimension of this tool's frame.Class<?>[]
String[]
Returns an object that provides fundamental services that plugins can usegetToolTemplate
(boolean includeConfigState) getUndoRedoToolState
(DomainObject domainObject) boolean
hasOptions
(String category) Return true if there is an options category with the given nameboolean
Returns true if there is at least one tool listening to this tool's plugin eventsboolean
protected void
Placeholder for subclasses to get a chance to install actions before plugins.protected void
protected void
Loads all application-level utility classes into this tool.boolean
boolean
Return whether there is a command being executedboolean
boolean
Returns true if the specifiedserviceInterface
is a valid service that exists in this tool.boolean
Return the value of the Tool option (GhidraOptions.OPTION_DOCKING_WINDOWS_ON_TOP) for whether docked windows will always be shown on top of their parent windows.protected void
optionsChanged
(Options options, String name, Object oldValue, Object newValue) void
prepareToSave
(DomainObject dobj) Called when the domain object is about to be saved; this allows any plugin that has a cache to flush out to the domain object.void
processToolEvent
(PluginEvent toolEvent) void
putInstanceName
(String newInstanceName) void
registerDefaultContextProvider
(Class<? extends ActionContext> type, ActionContextProvider provider) Registers an action context provider as the default provider for a specific action context type.void
registerOptionsNameChange
(String oldName, String newName) Updates saved options from an old name to a new name.void
removeEventListener
(Class<? extends PluginEvent> eventClass, PluginEventListener listener) void
void
removePlugins
(Plugin[] plugins) Deprecated, for removal: This API element is subject to removal in a future version.void
removePlugins
(List<Plugin> plugins) Remove the array of plugins from the tool.void
removePreferenceState
(String name) void
void
removeServiceListener
(ServiceListener listener) Removes the given listener from this ServiceProvider.void
Remove the status component.void
removeToolListener
(ToolListener listener) void
restoreDataStateFromXml
(org.jdom.Element root) protected boolean
restoreFromXml
(org.jdom.Element root) protected void
restoreOptionsFromXml
(org.jdom.Element root) protected void
restorePluginsFromXml
(org.jdom.Element elem) void
restoreWindowingDataFromXml
(org.jdom.Element element) org.jdom.Element
saveDataStateToXml
(boolean savingProject) void
saveTool()
Save this tool's configuration.boolean
Triggers a 'Save As' dialog that allows the user to save off the tool under a different name.org.jdom.Element
saveToXml
(boolean includeConfigState) org.jdom.Element
<T extends DomainObject>
voidscheduleFollowOnCommand
(BackgroundCommand<T> cmd, T obj) Add the given background command to a queue that is processed after the main background command completes.void
setConfigChanged
(boolean changed) Toggles the "change" state of the tool...void
setDefaultComponent
(ComponentProvider provider) Sets the provider that should get the default focus when no component has focus.void
setIconURL
(ToolIconURL newIconURL) void
setLocation
(int x, int y) Set the location of this tool's frame on the screen.protected void
setProject
(Project project) void
setSize
(int width, int height) Sets the size of the tool's main windowvoid
setSubTitle
(String subTitle) Sets the subtitle on the tool; the subtitle is extra text in the title.void
setToolName
(String name) void
void
setWindowsOnTop
(boolean b) Set the Tool option (GhidraOptions.OPTION_DOCKING_WINDOWS_ON_TOP) for whether a docked window will always be shown on top of its parent window.boolean
Returns true if this tool needs savingvoid
showComponentHeader
(ComponentProvider provider, boolean b) Set whether a component's header should be shown; the header is the component that is dragged in order to move the component within the tool, or out of the tool into a separate windowvoid
showConfig
(boolean addSaveActions, boolean isNewTool) Displays the manage plugins dialog.void
showDialog
(DialogComponentProvider dialogComponent, ComponentProvider centeredOnProvider) Shows the dialog using the window containing the given componentProvider as its parent window.void
showDialog
(DialogComponentProvider dialogComponent, Component centeredOnComponent) Shows the dialog using the tool's parent frame, but centers the dialog on the given componentvoid
showDialogOnActiveWindow
(DialogComponentProvider dialogComponent) Deprecated.dialogs are now always shown over the active window when possiblevoid
Displays the extensions installation dialog.boolean
void
unregisterDefaultContextProvider
(Class<? extends ActionContext> type, ActionContextProvider provider) Removes the default provider for the given ActionContext type.Methods inherited from class docking.AbstractDockingTool
addAction, addComponentProvider, addContextListener, addLocalAction, addPopupActionProvider, clearStatusInfo, getAllActions, getComponentProvider, getDockingActionsByOwnerName, getGlobalActions, getLocalActions, getProviderWindow, getStatusInfo, getToolActions, getToolFrame, getWindowManager, hasConfigChanged, isActive, isVisible, isVisible, removeAction, removeComponentProvider, removeContextListener, removeLocalAction, removePopupActionProvider, setMenuGroup, setMenuGroup, setStatusInfo, setStatusInfo, setVisible, showComponentProvider, showDialog, toFront, toFront, updateTitle
-
Field Details
-
TOOL_NAME_PROPERTY
Name of the property for the tool name.- See Also:
-
ICON_PROPERTY_NAME
Name of the property for the tool icon.- See Also:
-
DESCRIPTION_PROPERTY_NAME
Name of the property for the description of the tool.- See Also:
-
PLUGIN_COUNT_PROPERTY_NAME
Name of the property for the number of plugins the tool has.- See Also:
-
toolName
-
manageDialog
-
iconURL
-
isDisposed
protected boolean isDisposed
-
-
Constructor Details
-
PluginTool
Construct a new PluginTool.- Parameters:
project
- project that contains this tooltemplate
- the template from which to load this tool
-
PluginTool
public PluginTool(Project project, String name, boolean isDockable, boolean hasStatus, boolean isModal) Construct a new PluginTool.- Parameters:
project
- project that contains the toolname
- the name of the toolisDockable
- true if the tool contains components that can be dockedhasStatus
- true if the tool should display a status componentisModal
- true if the tool is modal, meaning that while this tool is visible, no other tool or dialog in Ghidra can have focus
-
PluginTool
public PluginTool(Project project, ProjectManager projectManager, ToolServices toolServices, String name, boolean isDockable, boolean hasStatus, boolean isModal) -
PluginTool
protected PluginTool()
-
-
Method Details
-
createPluginsConfigurations
-
getPluginsConfiguration
-
createDockingWindowManager
protected DockingWindowManager createDockingWindowManager(boolean isDockable, boolean hasStatus, boolean isModal) This method exists here, as opposed to inline in the constructor, so that subclasses can alter the behavior of the DockingWindowManager construction.- Parameters:
isDockable
- true if the tool contains components that can be dockedhasStatus
- true if the tool should display a status componentisModal
- true if the tool is modal, meaning that while this tool is visible, no other tool or dialog in Ghidra can have focus- Returns:
- a new DockingWindowManager
-
installHomeButton
protected void installHomeButton() -
installUtilityPlugins
protected void installUtilityPlugins()Loads all application-level utility classes into this tool. This should only be called by tools that represent the global application tool and not for sub-tools. -
initActions
protected void initActions()Placeholder for subclasses to get a chance to install actions before plugins. -
optionsChanged
-
setWindowsOnTop
public void setWindowsOnTop(boolean b) Set the Tool option (GhidraOptions.OPTION_DOCKING_WINDOWS_ON_TOP) for whether a docked window will always be shown on top of its parent window.- Parameters:
b
- true means that the docked window will always appear on top of its parent window; false means to allow the docked window to be "hidden" under its parent dialog
-
isWindowsOnTop
public boolean isWindowsOnTop()Return the value of the Tool option (GhidraOptions.OPTION_DOCKING_WINDOWS_ON_TOP) for whether docked windows will always be shown on top of their parent windows.- Returns:
- value of the Tool option, GhidraOptions.OPTION_DOCKING_WINDOWS_ON_TOP
-
getManagePluginsDialog
Returns the manage plugins dialog that is currently being used.- Returns:
- the current manage plugins dialog
-
showConfig
public void showConfig(boolean addSaveActions, boolean isNewTool) Displays the manage plugins dialog.- Parameters:
addSaveActions
- if true show save actionsisNewTool
- true if creating a new tool
-
showExtensions
public void showExtensions()Displays the extensions installation dialog. -
showComponentHeader
Set whether a component's header should be shown; the header is the component that is dragged in order to move the component within the tool, or out of the tool into a separate window- Parameters:
provider
- provider of the visible component in the toolb
- true means to show the header
-
isService
Returns true if the specifiedserviceInterface
is a valid service that exists in this tool.- Parameters:
serviceInterface
- the service interface- Returns:
- true if the specified
serviceInterface
-
getService
Description copied from interface:ServiceProvider
Returns the Service object that implements the given service interface.- Parameters:
c
- the interface class.
-
getServices
Get the objects that implement the given service.- Parameters:
c
- service class- Returns:
- array of Objects that implement the service, c.
-
addServiceListener
Description copied from interface:ServiceProvider
Adds a listener that will be called as services are added and removed from this ServiceProvider.- Parameters:
listener
- The listener to add.
-
removeServiceListener
Description copied from interface:ServiceProvider
Removes the given listener from this ServiceProvider. This method does nothing if the given listener is not contained by this ServiceProvider.- Parameters:
listener
-
-
beep
public void beep()A convenience method to make an attention-grabbing noise to the user -
setDefaultComponent
Sets the provider that should get the default focus when no component has focus.- Parameters:
provider
- the provider that should get the default focus when no component has focus.
-
registerDefaultContextProvider
public void registerDefaultContextProvider(Class<? extends ActionContext> type, ActionContextProvider provider) Registers an action context provider as the default provider for a specific action context type. Note that this registers a default provider for exactly that type and not a subclass of that type. If the provider want to support a hierarchy of types, then it must register separately for each type. SeeActionContext
for details on how the action context system works.- Parameters:
type
- the ActionContext class to register a default provider forprovider
- the ActionContextProvider that provides default tool context for actions that consume the given ActionContext type
-
unregisterDefaultContextProvider
public void unregisterDefaultContextProvider(Class<? extends ActionContext> type, ActionContextProvider provider) Removes the default provider for the given ActionContext type.- Parameters:
type
- the subclass of ActionContext to remove a provider forprovider
- the ActionContextProvider to remove for the given ActionContext type
-
getToolTemplate
-
saveToolToToolTemplate
-
saveWindowingDataToXml
public org.jdom.Element saveWindowingDataToXml() -
restoreWindowingDataFromXml
public void restoreWindowingDataFromXml(org.jdom.Element element) -
acceptDomainFiles
-
accept
Request tool to accept specified URL. Acceptance of URL depends greatly on the plugins configured into tool. If no plugin accepts URL it will be rejected and false returned. If a plugin can accept the specified URL it will attempt to process and return true if successful. The user may be prompted if connecting to the URL requires user authentication.- Parameters:
url
- read-only resource URL- Returns:
- true if URL accepted and processed else false
-
addPropertyChangeListener
-
addToolListener
-
hasToolListeners
public boolean hasToolListeners()Returns true if there is at least one tool listening to this tool's plugin events- Returns:
- true if there is at least one tool listening to this tool's plugin events
-
dispose
protected void dispose() -
firePluginEvent
-
getConsumedToolEventNames
-
getDomainFiles
-
getIcon
Description copied from interface:Tool
Get the icon that the tool is using- Returns:
- the icon that the tool is using
-
getIconURL
-
getInstanceName
-
getName
Description copied from interface:Tool
Returns a combination of the tool name and the instance name of the form tool name(instance name), e.g., SomeTool(2)- Returns:
- the tool name
-
getSupportedDataTypes
-
getToolEventNames
-
getToolName
-
putInstanceName
-
removePropertyChangeListener
-
removeToolListener
-
restoreDataStateFromXml
public void restoreDataStateFromXml(org.jdom.Element root) -
saveDataStateToXml
public org.jdom.Element saveDataStateToXml(boolean savingProject) -
restoreFromXml
protected boolean restoreFromXml(org.jdom.Element root) -
saveToXml
public org.jdom.Element saveToXml(boolean includeConfigState) -
setConfigChanged
public void setConfigChanged(boolean changed) Description copied from interface:Tool
Toggles the "change" state of the tool...- Specified by:
setConfigChanged
in interfaceTool
- Overrides:
setConfigChanged
in classAbstractDockingTool
- Parameters:
changed
- true indicates that the tool config has changed.
-
setIconURL
-
setToolName
-
processToolEvent
-
execute
public <T extends DomainObject> boolean execute(String commandName, T domainObject, Function<T, Boolean> f) Execute the given command in the foreground. Required domain object transaction will be started with delayed end to ensure that any follow-on analysis starts prior to transaction end.- Type Parameters:
T
-DomainObject
implementation interface- Parameters:
commandName
- command name to be associated with transactiondomainObject
- domain object to be modifiedf
- command function callback which should return true on success or false on failure.- Returns:
- result from command function callback
-
execute
Execute the given command in the foreground. Required domain object transaction will be started with delayed end to ensure that any follow-on analysis starts prior to transaction end.- Type Parameters:
T
-DomainObject
implementation interface- Parameters:
commandName
- command name to be associated with transactiondomainObject
- domain object to be modifiedr
- command function runnable
-
execute
Call the applyTo() method on the given command to make some change to the domain object; the command is done in the AWT thread, therefore, the command that is to be executed should be a relatively quick operation so that the event queue does not appear to "hang." For lengthy operations, the command should be done in a background task.- Parameters:
command
- command to applyobj
- domain object that the command will be applied to- Returns:
- status of the command's applyTo() method
- See Also:
-
isExecutingCommand
public boolean isExecutingCommand()Return whether there is a command being executed- Returns:
- true if there is a command being executed
-
threadIsBackgroundTaskThread
public boolean threadIsBackgroundTaskThread()- Returns:
- true if the current thread group or its ancestors is a member of this tools background task thread group, else false
-
executeBackgroundCommand
Start a new thread that will call the given command's applyTo() method to make some change in the domain object. This method should be called for an operation that could potentially take a long time to complete.- Parameters:
cmd
- command that will be executed in another thread (not the AWT Thread)obj
- domain object that the command will be applied to
-
scheduleFollowOnCommand
Add the given background command to a queue that is processed after the main background command completes.- Parameters:
cmd
- background command to submitobj
- the domain object to be modified by the command.
-
execute
Launch the task in a new thread- Parameters:
task
- task to run in a new threaddelay
- number of milliseconds to delay the display of task monitor dialog
-
execute
Launch the task in a new thread- Parameters:
task
- task to run in a new thread
-
getOptions
Description copied from interface:Tool
Get the options for the given category name; if no options exist with the given name, then one is created.- Parameters:
categoryName
- the category name- Returns:
- the options
-
registerOptionsNameChange
Updates saved options from an old name to a new name. NOTE: this must be called before any calls to register or get options.- Parameters:
oldName
- the old name of the options.newName
- the new name of the options.
-
hasOptions
Return true if there is an options category with the given name- Parameters:
category
- name of the options set- Returns:
- true if there is an options category with the given name
-
getOptions
Get all options.- Returns:
- zero-length array if no options exist.
-
getProject
Get the project associated with this tool. Null will be returned if there is no project open or if this tool does not use projects.- Returns:
- null if there is no open project
-
getProjectManager
Returns the project manager associated with this tool.Null will be returned if this tool does not use projects.
- Returns:
- the project manager associated with this tool
-
getToolServices
Returns an object that provides fundamental services that plugins can use- Returns:
- the services instance
-
setSubTitle
Sets the subtitle on the tool; the subtitle is extra text in the title.- Parameters:
subTitle
- the subtitle to display on the tool
-
addPlugin
Add a plugin to the tool.- Parameters:
className
- name of the plugin class, e.g., "MyPlugin.class.getName()"- Throws:
PluginException
- if the plugin could not be constructed, or there was problem executing its init() method, or if a plugin of this class already exists in the tool
-
addPlugins
@Deprecated(since="10.2", forRemoval=true) public void addPlugins(String[] classNames) throws PluginException Deprecated, for removal: This API element is subject to removal in a future version.Add plugins to the tool.- Parameters:
classNames
- array of plugin class names- Throws:
PluginException
- if a plugin could not be constructed, or there was problem executing its init() method, or if a plugin of this class already exists in the tool
-
addPlugins
Add plugins to the tool.- Parameters:
classNames
- collection of plugin class names- Throws:
PluginException
- if a plugin could not be constructed, or there was problem executing its init() method, or if a plugin of this class already exists in the tool
-
addPlugin
- Throws:
PluginException
-
removePlugins
Deprecated, for removal: This API element is subject to removal in a future version.Remove the array of plugins from the tool.- Parameters:
plugins
- array of plugins to remove
-
removePlugins
Remove the array of plugins from the tool.- Parameters:
plugins
- array of plugins to remove
-
hasUnsavedData
public boolean hasUnsavedData() -
getManagedPlugins
Return a list of plugins in the tool- Returns:
- list of plugins in the tool
-
saveTool
public void saveTool()Save this tool's configuration. -
saveToolAs
public boolean saveToolAs()Triggers a 'Save As' dialog that allows the user to save off the tool under a different name. This returns true if the user performed a save.- Returns:
- true if a save happened
-
addStatusComponent
Add a status component to the tool.- Parameters:
c
- component to addaddBorder
- true if a border should be added to the componentrightSide
- true if the component should be placed in the right side of the tool
-
removeStatusComponent
Remove the status component.- Parameters:
c
- status component to remove
-
addExitAction
protected void addExitAction() -
addOptionsAction
protected void addOptionsAction() -
addSaveToolAction
protected void addSaveToolAction() -
addNextPreviousProviderActions
protected void addNextPreviousProviderActions()Adds actions to the tool for transferring focus to the first component in the next or previous dockable component provider. -
addExportToolAction
protected void addExportToolAction() -
addHelpActions
protected void addHelpActions() -
clearLastEvents
public void clearLastEvents()Clear the list of events that were last generated. -
close
public void close()Closes this tool, possibly with input from the user. The following conditions are checked and can prompt the user for more info and allow them to cancel the close.- Running tasks. Closing with running tasks could lead to data loss.
- Plugins get asked if they can be closed. They may prompt the user to resolve some plugin specific state.
- The user is prompted to save any data changes.
- Tools are saved, possibly asking the user to resolve any conflicts caused by changing multiple instances of the same tool in different ways.
- If all the above conditions passed, the tool is closed and disposed.
-
canClose
protected boolean canClose() -
allowTerminatingTasksWhenClosing
protected boolean allowTerminatingTasksWhenClosing()Normally, tools are not allowed to close while tasks are running in that tool as it could leave the application in an unstable state. Tools that exit the application (such as the FrontEndTool) can override this so that the user can terminate running tasks and not have that prevent exiting the application.- Returns:
- whether the user is allowed to terminate tasks so that the tool can be closed.
-
canClosePlugins
protected boolean canClosePlugins()Checks if this tool's plugins are in a state to be closed.- Returns:
- true if all the plugins in the tool can be closed without further user input.
-
canStopTasks
protected boolean canStopTasks()Checks if this tool has running tasks, with optionally giving the user an opportunity to cancel them.- Returns:
- true if this tool has running tasks
-
shouldSave
public boolean shouldSave()Returns true if this tool needs saving- Returns:
- true if this tool needs saving
-
doSaveTool
protected boolean doSaveTool()Called when it is time to save the tool. Handles auto-saving logic.- Returns:
- true if a save happened
-
canCloseDomainObject
Can the domain object be closed?
Note: This forces plugins to terminate any tasks they have running for the indicated domain object and apply any unsaved data to the domain object. If they can't do this or the user cancels then this returns false.- Parameters:
domainObject
- the domain object to check- Returns:
- false any of the plugins reports that the domain object should not be closed
-
canCloseDomainFile
-
prepareToSave
Called when the domain object is about to be saved; this allows any plugin that has a cache to flush out to the domain object.- Parameters:
dobj
- domain object that is about to be saved
-
setSize
public void setSize(int width, int height) Sets the size of the tool's main window- Parameters:
width
- width in pixelsheight
- height in pixels
-
getSize
Return the dimension of this tool's frame.- Returns:
- dimension of this tool's frame
-
setLocation
public void setLocation(int x, int y) Set the location of this tool's frame on the screen.- Parameters:
x
- screen x coordinatey
- screen y coordinate
-
getLocation
Return the location of this tool's frame on the screen.- Returns:
- location of this tool's frame
-
restoreOptionsFromXml
protected void restoreOptionsFromXml(org.jdom.Element root) -
setProject
-
restorePluginsFromXml
- Throws:
PluginException
-
addEventListener
-
addListenerForAllPluginEvents
-
removeListenerForAllPluginEvents
-
removeEventListener
public void removeEventListener(Class<? extends PluginEvent> eventClass, PluginEventListener listener) -
cancelCurrentTask
public void cancelCurrentTask()Cancel the current task in the tool. -
getTransientState
-
getUndoRedoToolState
-
showDialogOnActiveWindow
Deprecated.dialogs are now always shown over the active window when possibleShows the dialog using the tool's currently active window as a parent. Also, remembers any size and location adjustments made by the user for the next time the dialog is shown.- Parameters:
dialogComponent
- the DialogComponentProvider object to be shown in a dialog.
-
showDialog
public void showDialog(DialogComponentProvider dialogComponent, ComponentProvider centeredOnProvider) Shows the dialog using the window containing the given componentProvider as its parent window. Remembers the last location and size of this dialog for the next time it is shown.- Parameters:
dialogComponent
- the DialogComponentProvider object to be shown in a dialog.centeredOnProvider
- the component provider that is used to find a parent window for this dialog. The dialog is centered on this component provider's component.
-
showDialog
Shows the dialog using the tool's parent frame, but centers the dialog on the given component- Parameters:
dialogComponent
- the DialogComponentProvider object to be shown in a dialog.centeredOnComponent
- the component on which to center the dialog.
-
getActiveWindow
-
getActiveComponentProvider
Description copied from interface:Tool
Returns the active component provider, that which has focus- Specified by:
getActiveComponentProvider
in interfaceTool
- Overrides:
getActiveComponentProvider
in classAbstractDockingTool
- Returns:
- the active provider
-
setUnconfigurable
public void setUnconfigurable() -
isConfigurable
public boolean isConfigurable() -
removePreferenceState
-
contextChanged
Description copied from interface:Tool
Signals to the tool that the provider's context has changed. This lets toolbar and menu actions update enablement based on current context.Pass
null
to signal that the entire tool's context has changed- Specified by:
contextChanged
in interfaceTool
- Overrides:
contextChanged
in classAbstractDockingTool
- Parameters:
provider
- the provider whose context changed; null to signal the tool's context
-
isRestoringDataState
public boolean isRestoringDataState()
-
addPlugins(Collection)