KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > ISaveablePart2


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11
12 package org.eclipse.ui;
13
14 /**
15  * Workbench parts implement or adapt to this interface to participate
16  * in actions that require a prompt for the user to provide input on
17  * what to do with unsaved data when the part is closed or the Workbench
18  * is shut down.
19  * <p>
20  * Note that if a part implements this interface, it is excluded from the
21  * common "prompt to save" dialog, and instead opens its own dialog. This may
22  * cause multiple prompts to the end user during a single user operation.
23  * Implementors should be aware that this may lead to a less than optimal
24  * user experience.
25  * </p>
26  *
27  * @since 3.1
28  */

29 public interface ISaveablePart2 extends ISaveablePart {
30     
31     /**
32      * Standard return code constant (value 0) indicating that the part
33      * needs to be saved.
34      */

35     public static final int YES = 0;
36     
37     /**
38      * Standard return code constant (value 1) indicating that the part
39      * does not need to be saved and the part should be closed.
40      */

41     public static final int NO = 1;
42     
43     /**
44      * Standard return code constant (value 2) indicating that the part
45      * does not need to be saved and the part should not be closed.
46      */

47     public static final int CANCEL = 2;
48     
49     /**
50      * Standard return code constant (value 3) indicating that the default
51      * behavior for prompting the user to save will be use.
52      */

53     public static final int DEFAULT = 3;
54         
55     /**
56      * Prompts the user for input on what to do with unsaved data.
57      * This method is only called when the part is closed or when
58      * the Workbench is shutting down.
59      * <p>
60      * Implementors are expected to open a custom dialog where the
61      * user will be able to determine what to do with the unsaved data.
62      * Implementors may also return a result of <code>DEFAULT</code>
63      * to get the default prompt handling from the Workbench.
64      * </p>
65      *
66      * @return the return code, must be either <code>YES</code>,
67      * <code>NO</code>, <code>CANCEL</code> or <code>DEFAULT</code>.
68      */

69     public int promptToSaveOnClose();
70
71 }
72
Popular Tags