File: ISaveablePart2.java

package info (click to toggle)
eclipse-platform-ui 4.10-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 71,188 kB
  • sloc: java: 611,660; xml: 21,221; sh: 602; makefile: 5
file content (74 lines) | stat: -rw-r--r-- 2,468 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/*******************************************************************************
 * Copyright (c) 2000, 2015 IBM Corporation and others.
 *
 * This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License 2.0
 * which accompanies this distribution, and is available at
 * https://www.eclipse.org/legal/epl-2.0/
 *
 * SPDX-License-Identifier: EPL-2.0
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/

package org.eclipse.ui;

/**
 * Workbench parts implement or adapt to this interface to participate
 * in actions that require a prompt for the user to provide input on
 * what to do with unsaved data when the part is closed or the Workbench
 * is shut down.
 * <p>
 * Note that if a part implements this interface, it is excluded from the
 * common "prompt to save" dialog, and instead opens its own dialog.  This may
 * cause multiple prompts to the end user during a single user operation.
 * Implementors should be aware that this may lead to a less than optimal
 * user experience.
 * </p>
 *
 * @since 3.1
 */
public interface ISaveablePart2 extends ISaveablePart {

	/**
	 * Standard return code constant (value 0) indicating that the part
	 * needs to be saved.
	 */
	int YES = 0;

	/**
	 * Standard return code constant (value 1) indicating that the part
	 * does not need to be saved and the part should be closed.
	 */
	int NO = 1;

	/**
	 * Standard return code constant (value 2) indicating that the part
	 * does not need to be saved and the part should not be closed.
	 */
	int CANCEL = 2;

	/**
	 * Standard return code constant (value 3) indicating that the default
	 * behavior for prompting the user to save will be used.
	 */
	int DEFAULT = 3;

    /**
     * Prompts the user for input on what to do with unsaved data.
     * This method is only called when the part is closed or when
     * the Workbench is shutting down.
     * <p>
     * Implementors are expected to open a custom dialog where the
     * user will be able to determine what to do with the unsaved data.
     * Implementors may also return a result of <code>DEFAULT</code>
     * to get the default prompt handling from the Workbench.
     * </p>
     *
	 * @return the return code, must be either <code>YES</code>,
	 * <code>NO</code>, <code>CANCEL</code> or <code>DEFAULT</code>.
	 */
	int promptToSaveOnClose();

}