If you're using the Eclipse IDE workbench, you don't. When it shuts down, the workbench will automatically save the workspace. The workspace will also perform its own periodic workspace saves, called ''snapshots'', every once in a while. Note that the most essential information in the workspace&#151;the files and folders that the user is working with&#151;are always

+

If you're using the Eclipse IDE workbench, you don't. When it shuts down, the workbench will automatically save the workspace. The workspace will also perform its own periodic workspace saves, called ''snapshots'', every once in a while. Note that the most essential information in the workspace&#151;such as newly created files and folders within Eclipse&#151;are always stored on disk immediately. Saving the workspace simply involves storing away metadata, such as markers, and its in-memory picture of the projects. The workspace is designed so that if a user pulls the computer power cord from the wall at any moment, the resource tree will still be in a good state so that the workspace will be able to restart in a consistent state with minimal loss of information.

away metadata, such as markers, and its in-memory picture of the projects.

+

−

The workspace is designed so that if a user pulls the computer power

+

−

cord from the wall at any moment, the workspace will be able to restart in a

+

−

consistent state with minimal loss of information.

+

+

''Please note that this state information is not related to the list of currently opened editors, views, and perspectives in the workbench windows.''

+

+

Nonetheless, it is possible for your plug-in to explicitly request a workspace save or snapshot. If you are writing an RCP Application, you are responsible for minimally invoking save before shutdown.

−

Nonetheless, it is possible for your plug-in to explicitly request a

−

workspace save or snapshot. If you are writing an RCP Application,

−

you are responsible for minimally invoking save before shutdown.

The following example saves the workspace:

The following example saves the workspace:

Line 28:

Line 23:

ErrorDialog.openError(...);

ErrorDialog.openError(...);

</source>

</source>

−

Note that the <tt>save</tt> method can indicate minor problems

+

−

by returning an <tt>IStatus</tt> object, or major problems by throwing

+

Note that the <tt>save</tt> method can indicate minor problems by returning an <tt>IStatus</tt> object, or major problems by throwing an exception. You should check both of these results and react accordingly. To request a workspace snapshot, the code is almost identical: pass <tt>false</tt> as the first parameter to the <tt>save</tt> method.

−

an exception. You should check both of these results and react accordingly.

+

−

To request a workspace snapshot, the code is almost identical:

+

−

pass <tt>false</tt> as the first parameter to the <tt>save</tt>

+

−

method.

+

Revision as of 09:49, 21 February 2011

If you're using the Eclipse IDE workbench, you don't. When it shuts down, the workbench will automatically save the workspace. The workspace will also perform its own periodic workspace saves, called snapshots, every once in a while. Note that the most essential information in the workspace&#151;such as newly created files and folders within Eclipse&#151;are always stored on disk immediately. Saving the workspace simply involves storing away metadata, such as markers, and its in-memory picture of the projects. The workspace is designed so that if a user pulls the computer power cord from the wall at any moment, the resource tree will still be in a good state so that the workspace will be able to restart in a consistent state with minimal loss of information.

Please note that this state information is not related to the list of currently opened editors, views, and perspectives in the workbench windows.

Nonetheless, it is possible for your plug-in to explicitly request a workspace save or snapshot. If you are writing an RCP Application, you are responsible for minimally invoking save before shutdown.

Note that the save method can indicate minor problems by returning an IStatus object, or major problems by throwing an exception. You should check both of these results and react accordingly. To request a workspace snapshot, the code is almost identical: pass false as the first parameter to the save method.