public interface IWorkbenchConfigurer
Note that these objects are only available to the main application (the plug-in that creates and owns the workbench).
This interface is not intended to be implemented by clients.
WorkbenchAdvisor.initialize(org.eclipse.ui.application.IWorkbenchConfigurer)
Modifier and Type | Field and Description |
---|---|
static int |
RESTORE_CODE_EXIT
Restore status code indicating that the saved state
could not be restored, and that the application
must exit immediately without modifying any previously
saved workbench state.
|
static int |
RESTORE_CODE_RESET
Restore status code indicating that the saved state
could not be restored, but that startup should continue
with a reset state.
|
Modifier and Type | Method and Description |
---|---|
void |
declareImage(String symbolicName,
ImageDescriptor descriptor,
boolean shared)
Declares a workbench image.
|
void |
emergencyClose()
Forces the workbench to close due to an emergency.
|
boolean |
emergencyClosing()
Returns whether the workbench is being closed due to an emergency.
|
Object |
getData(String key)
Returns the data associated with the workbench at the given key.
|
boolean |
getExitOnLastWindowClose()
Returns
true if the workbench should exit when the last
window is closed, false if the window should just be
closed, leaving the workbench (and its event loop) running. |
boolean |
getSaveAndRestore()
Returns whether the workbench state should be saved on close and
restored on subsequent open.
|
IWorkbenchWindowConfigurer |
getWindowConfigurer(IWorkbenchWindow window)
Returns an object that can be used to configure the given window.
|
IWorkbench |
getWorkbench()
Returns the underlying workbench.
|
WindowManager |
getWorkbenchWindowManager()
Returns the workbench window manager.
|
void |
openFirstTimeWindow()
Opens the first time window, using the default perspective and
default page input.
|
IStatus |
restoreState()
Restores the workbench state saved from the previous session, if any.
|
IWorkbenchWindowConfigurer |
restoreWorkbenchWindow(IMemento memento)
Restores a workbench window from the given memento.
|
void |
setData(String key,
Object data)
Sets the data associated with the workbench at the given key.
|
void |
setExitOnLastWindowClose(boolean enabled)
Sets whether the workbench should exit when the last window is closed, or
whether the window should just be closed, leaving the workbench (and its
event loop) running.
|
void |
setSaveAndRestore(boolean enabled)
Sets whether the workbench state should be saved on close and
restored on subsequent open.
|
static final int RESTORE_CODE_RESET
restoreState()
,
Constant Field Valuesstatic final int RESTORE_CODE_EXIT
IWorkbench getWorkbench()
boolean getSaveAndRestore()
The initial value is false
.
true
to save and restore workbench state, or
false
to forget current workbench state on close.void setSaveAndRestore(boolean enabled)
enabled
- true
to save and restore workbench state, or
false
to forget current workbench state on close.IWorkbenchWindowConfigurer restoreWorkbenchWindow(IMemento memento) throws WorkbenchException
memento
- the memento from which to restore the window's stateWorkbenchException
- if an error occurred during the restoreIWorkbenchWindowConfigurer.saveState(IMemento)
WindowManager getWorkbenchWindowManager()
void declareImage(String symbolicName, ImageDescriptor descriptor, boolean shared)
The workbench remembers the given image descriptor under the given name,
and makes the image available to plug-ins via
IWorkbench.getSharedImages()
.
For "shared" images, the workbench remembers the image descriptor and
will manages the image object create from it; clients retrieve "shared"
images via
ISharedImages.getImage()
.
For the other, "non-shared" images, the workbench remembers only the
image descriptor; clients retrieve the image descriptor via
ISharedImages.getImageDescriptor()
and are entirely
responsible for managing the image objects they create from it.
(This is made confusing by the historical fact that the API interface
is called "ISharedImages".)
symbolicName
- the symbolic name of the imagedescriptor
- the image descriptorshared
- true
if this is a shared image, and
false
if this is not a shared imageISharedImages.getImage(java.lang.String)
,
ISharedImages.getImageDescriptor(java.lang.String)
void emergencyClose()
emergencyClosing
returns
true
. Workbench advisor methods should always check this
flag before communicating with the user.emergencyClosing()
boolean emergencyClosing()
true
, the workbench is in dire
straights and cannot continue. Indeed, things are so bad that we cannot
even risk a normal workbench close. Workbench advisor methods should
always check this flag before attempting to communicate with the user.true
if the workbench is in the process of being
closed under emergency conditions, and false
otherwiseIWorkbenchWindowConfigurer getWindowConfigurer(IWorkbenchWindow window)
window
- a workbench windowObject getData(String key)
key
- the keynull
if there is no data at the given
keyvoid setData(String key, Object data)
key
- the keydata
- the data, or null
to delete existing dataIStatus restoreState()
This is typically called from the advisor's openWindows()
method.
RESTORE_CODE_RESET
,
RESTORE_CODE_EXIT
,
WorkbenchAdvisor.openWindows()
void openFirstTimeWindow()
This is typically called from the advisor's openWindows()
method.
WorkbenchAdvisor.openWindows()
boolean getExitOnLastWindowClose()
true
if the workbench should exit when the last
window is closed, false
if the window should just be
closed, leaving the workbench (and its event loop) running.
If true
, the last window's state is saved before closing,
so that it will be restored in the next session. This applies only if
returns
).
true
If false
, the window is simply closed, losing its state.
If the workbench is left running, it can be closed using
IWorkbench.close()
, or a new window can be opened using
IWorkbench.openWorkbenchWindow(String, IAdaptable)
.
The initial value is true
.
true
if the workbench will exit when the last
window is closed, false
if the window should just
be closedvoid setExitOnLastWindowClose(boolean enabled)
For more details, see getExitOnLastWindowClose()
.
enabled
- true
if the workbench should exit when the last
window is closed, false
if the window should
just be closed
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.