org.eclipse.ui.application
Interface IWorkbenchConfigurer


public interface IWorkbenchConfigurer

Interface providing special access for configuring the workbench.

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.

Since:
3.0
See Also:
WorkbenchAdvisor.initialize(org.eclipse.ui.application.IWorkbenchConfigurer)

Field Summary
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.
 
Method Summary
 void declareImage(java.lang.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.
 java.lang.Object getData(java.lang.String key)
          Returns the data associated with the workbench at the given key.
 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 org.eclipse.jface.window.
 IWorkbench getWorkbench()
          Returns the underlying workbench.
 void openFirstTimeWindow()
          Opens the first time org.eclipse.jface.window, using the default perspective and default page input.
 IStatus restoreState()
          Restores the workbench state saved from the previous session, if any.
 void setData(java.lang.String key, java.lang.Object data)
          Sets the data associated with the workbench at the given key.
 void setSaveAndRestore(boolean enabled)
          Sets whether the workbench state should be saved on close and restored on subsequent open.
 

Field Detail

RESTORE_CODE_RESET

static final 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.

See Also:
restoreState(), Constant Field Values

RESTORE_CODE_EXIT

static final 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.

See Also:
Constant Field Values
Method Detail

getWorkbench

IWorkbench getWorkbench()
Returns the underlying workbench.

Returns:
the workbench

getSaveAndRestore

boolean getSaveAndRestore()
Returns whether the workbench state should be saved on close and restored on subsequent open.

The initial value is false.

Returns:
true to save and restore workbench state, or false to forget current workbench state on close.

setSaveAndRestore

void setSaveAndRestore(boolean enabled)
Sets whether the workbench state should be saved on close and restored on subsequent open.

Parameters:
enabled - true to save and restore workbench state, or false to forget current workbench state on close.

declareImage

void declareImage(java.lang.String symbolicName,
                  ImageDescriptor descriptor,
                  boolean shared)
Declares a workbench image.

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".)

Parameters:
symbolicName - the symbolic name of the image
descriptor - the image descriptor
shared - true if this is a shared image, and false if this is not a shared image
See Also:
ISharedImages.getImage(java.lang.String), ISharedImages.getImageDescriptor(java.lang.String)

emergencyClose

void emergencyClose()
Forces the workbench to close due to an emergency. This method should only be called when the workbench is in dire straights and cannot continue, and cannot even risk a normal workbench close (think "out of memory" or "unable to create shell"). When this method is called, an abbreviated workbench shutdown sequence is performed (less critical steps may be skipped). The workbench advisor is still called; however, it must not attempt to communicate with the user. While an emergency close is in progress, emergencyClosing returns true. Workbench advisor methods should always check this flag before communicating with the user.

See Also:
emergencyClosing()

emergencyClosing

boolean emergencyClosing()
Returns whether the workbench is being closed due to an emergency. When this method returns 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.

Returns:
true if the workbench is in the process of being closed under emergency conditions, and false otherwise

getWindowConfigurer

IWorkbenchWindowConfigurer getWindowConfigurer(IWorkbenchWindow window)
Returns an object that can be used to configure the given org.eclipse.jface.window.

Parameters:
org.eclipse.jface.window - a workbench org.eclipse.jface.window
Returns:
a workbench org.eclipse.jface.window configurer

getData

java.lang.Object getData(java.lang.String key)
Returns the data associated with the workbench at the given key.

Parameters:
key - the key
Returns:
the data, or null if there is no data at the given key

setData

void setData(java.lang.String key,
             java.lang.Object data)
Sets the data associated with the workbench at the given key.

Parameters:
key - the key
data - the data, or null to delete existing data

restoreState

IStatus restoreState()
Restores the workbench state saved from the previous session, if any. This includes any open windows and their open perspectives, open views and editors, layout information, and any customizations to the open perspectives.

This is typically called from the advisor's openWindows() method.

Returns:
a status object indicating whether the restore was successful
See Also:
RESTORE_CODE_RESET, RESTORE_CODE_EXIT, WorkbenchAdvisor.openWindows()

openFirstTimeWindow

void openFirstTimeWindow()
Opens the first time org.eclipse.jface.window, using the default perspective and default page input.

This is typically called from the advisor's openWindows() method.

See Also:
WorkbenchAdvisor.openWindows()