Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 15335 Details for
Bug 76768
[RCP] [ViewMgmt] [EditorMgmt] Need ability to provide custom save prompt when view implements ISaveablePart
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
allows for custom prompt dialog
save_with_custom_prompt_patch.txt (text/plain), 4.43 KB, created by
Matthew Hatem
on 2004-10-21 15:06:34 EDT
(
hide
)
Description:
allows for custom prompt dialog
Filename:
MIME Type:
Creator:
Matthew Hatem
Created:
2004-10-21 15:06:34 EDT
Size:
4.43 KB
patch
obsolete
>Index: .project >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/.project,v >retrieving revision 1.7 >diff -u -r1.7 .project >--- .project 28 Nov 2003 16:32:30 -0000 1.7 >+++ .project 21 Oct 2004 18:18:45 -0000 >@@ -1,6 +1,6 @@ > <?xml version="1.0" encoding="UTF-8"?> > <projectDescription> >- <name>org.eclipse.ui.workbench</name> >+ <name>org.eclipse.ui.workbench_save_with_prompt</name> > <comment></comment> > <projects> > <project>org.eclipse.core.boot</project> >Index: Eclipse UI/org/eclipse/ui/internal/SaveableHelper.java >=================================================================== >RCS file: /home/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/SaveableHelper.java,v >retrieving revision 1.1.2.1 >diff -u -r1.1.2.1 SaveableHelper.java >--- Eclipse UI/org/eclipse/ui/internal/SaveableHelper.java 7 Sep 2004 19:47:08 -0000 1.1.2.1 >+++ Eclipse UI/org/eclipse/ui/internal/SaveableHelper.java 21 Oct 2004 18:18:48 -0000 >@@ -21,6 +21,7 @@ > import org.eclipse.jface.operation.IRunnableWithProgress; > import org.eclipse.jface.window.ApplicationWindow; > import org.eclipse.ui.ISaveablePart; >+import org.eclipse.ui.ISaveablePartWithPrompt; > import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.IWorkbenchWindow; > import org.eclipse.ui.PlatformUI; >@@ -58,14 +59,19 @@ > // If confirmation is required .. > if (confirm) { > int choice = AutomatedResponse; >- if (choice == -1) { >- String message = WorkbenchMessages.format("EditorManager.saveChangesQuestion", new Object[] { part.getTitle()}); //$NON-NLS-1$ >- // Show a dialog. >- String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; >- MessageDialog d = new MessageDialog( >- window.getShell(), WorkbenchMessages.getString("Save_Resource"), //$NON-NLS-1$ >- null, message, MessageDialog.QUESTION, buttons, 0); >- choice = d.open(); >+ if (choice == -1) { >+ if (saveable instanceof ISaveablePartWithPrompt ) { >+ return ((ISaveablePartWithPrompt)saveable).doPrompt(); >+ } >+ else { >+ String message = WorkbenchMessages.format("EditorManager.saveChangesQuestion", new Object[] { part.getTitle()}); //$NON-NLS-1$ >+ // Show a dialog. >+ String[] buttons = new String[] { IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, IDialogConstants.CANCEL_LABEL }; >+ MessageDialog d = new MessageDialog( >+ window.getShell(), WorkbenchMessages.getString("Save_Resource"), //$NON-NLS-1$ >+ null, message, MessageDialog.QUESTION, buttons, 0); >+ choice = d.open(); >+ } > } > > // Branch on the user choice. >Index: Eclipse UI/org/eclipse/ui/ISaveablePartWithPrompt.java >=================================================================== >RCS file: Eclipse UI/org/eclipse/ui/ISaveablePartWithPrompt.java >diff -N Eclipse UI/org/eclipse/ui/ISaveablePartWithPrompt.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ Eclipse UI/org/eclipse/ui/ISaveablePartWithPrompt.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,37 @@ >+/******************************************************************************* >+ * Copyright (c) 2000, 2004 IBM Corporation and others. >+ * All rights reserved. This program and the accompanying materials >+ * are made available under the terms of the Common Public License v1.0 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/cpl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+ >+package org.eclipse.ui; >+ >+/** >+ * Workbench parts implement or adapt to this interface to participate >+ * in the enablement and execution of the <code>Save</code> and >+ * <code>Save As</code> actions and provide a custom prompt dialog. >+ * >+ * Implementers of this interface are responsible for calling the >+ * respective save actions based on user input. The Workbench >+ * will close the view if the user does not cancel or if doPrompt >+ * returns true. >+ * >+ * @since 3.0.2 >+ */ >+public interface ISaveablePartWithPrompt extends ISaveablePart { >+ >+ /** >+ * Prompts the user to respond to a close part event when >+ * the part contains dirty data. >+ * >+ * @return <code>true</code> if successful and >+ * <code>false</code> if the user cancels. >+ */ >+ public boolean doPrompt(); >+ >+}
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 76768
:
15335
|
18061
|
18505
|
18533
|
18768
|
18771