Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-04-19 01:09:36 -0400
committerJean Michel-Lemieux2002-04-19 01:09:36 -0400
commit0c1e47eab188af5e5d47e412a3db24c82937cfb9 (patch)
tree439d449d2b37c7e691927a3f7a64a5279c610a36
parent72e19e1a3690e8a798ec149f7cbf25500bc6c879 (diff)
downloadeclipse.platform.team-saveDirtyEditorsBranch.tar.gz
eclipse.platform.team-saveDirtyEditorsBranch.tar.xz
eclipse.platform.team-saveDirtyEditorsBranch.zip
*** empty log message ***saveDirtyEditorsBranch
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java3
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java28
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java5
5 files changed, 41 insertions, 2 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
index ab933300a..92b1e030e 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java
@@ -44,6 +44,7 @@ import org.eclipse.ui.texteditor.WorkbenchChainedTextFontFieldEditor;
* UI Plugin for CVS provider-specific workbench functionality.
*/
public class CVSUIPlugin extends AbstractUIPlugin {
+
/**
* The id of the CVS plug-in
*/
@@ -53,6 +54,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
private Hashtable imageDescriptors = new Hashtable(20);
public final static String ICON_PATH;
+
static {
if (Display.getCurrent().getIconDepth() > 4) {
ICON_PATH = ICVSUIConstants.ICON_PATH_FULL;
@@ -203,6 +205,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
store.setDefault(ICVSUIConstants.PREF_DIRTY_FLAG, CVSDecoratorConfiguration.DEFAULT_DIRTY_FLAG);
store.setDefault(ICVSUIConstants.PREF_CALCULATE_DIRTY, true);
store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS, true);
+ store.setDefault(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS, ICVSUIConstants.OPTION_PROMPT);
// Forward the values to the CVS plugin
CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(store.getBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES));
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
index ba4a674bc..fa55cac37 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java
@@ -55,6 +55,7 @@ public interface ICVSUIConstants {
public final String PREF_COMPRESSION_LEVEL = "pref_compression_level"; //$NON-NLS-1$
public final String PREF_TEXT_KSUBST = "pref_text_ksubst"; //$NON-NLS-1$
public final String PREF_PROMPT_ON_MIXED_TAGS = "pref_prompt_on_mixed_tags"; //$NON-NLS-1$
+ public final String PREF_SAVE_DIRTY_EDITORS = "pref_save_dirty_editors"; //$NON-NLS-1$
// console preferences
public final String PREF_CONSOLE_COMMAND_COLOR = "pref_console_command_color"; //$NON-NLS-1$
@@ -98,5 +99,10 @@ public interface ICVSUIConstants {
public final String PROP_METHOD = "cvs.method"; //$NON-NLS-1$
public final String PROP_PORT = "cvs.port"; //$NON-NLS-1$
public final String PROP_ROOT = "cvs.root"; //$NON-NLS-1$
+
+ // preference options
+ public final int OPTION_NEVER = 1; //$NON-NLS-1$
+ public final int OPTION_PROMPT = 2; //$NON-NLS-1$
+ public final int OPTION_AUTOMATIC = 3; //$NON-NLS-1$
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
index a3a6c4268..6e9eb431b 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java
@@ -77,5 +77,4 @@ public class AddAction extends TeamAction {
}
return true;
}
-
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
index a5daff07e..2f4169018 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java
@@ -16,6 +16,7 @@ import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -33,6 +34,10 @@ import org.eclipse.team.internal.ccvs.ui.CVSUIPlugin;
import org.eclipse.team.internal.ccvs.ui.ICVSUIConstants;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.ui.actions.TeamAction;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
/**
* Contains helper methods for CVS actions.
@@ -43,6 +48,29 @@ import org.eclipse.team.ui.actions.TeamAction;
* if they have failed.]
*/
abstract public class CVSAction extends TeamAction {
+
+ public static boolean saveAllDirtyEditors() {
+ IPreferenceStore store = CVSUIPlugin.getPlugin().getPreferenceStore();
+ int saveOption = store.getInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS);
+ boolean confirmWithUser = true;
+ boolean continueWithOperation = false;
+
+ switch(saveOption) {
+ case ICVSUIConstants.OPTION_AUTOMATIC:
+ confirmWithUser = false;
+ case ICVSUIConstants.OPTION_PROMPT:
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ IWorkbenchWindow activeWindow = workbench.getActiveWorkbenchWindow();
+ IWorkbenchPage activePage = activeWindow.getActivePage();
+ continueWithOperation = activePage.saveAllEditors(confirmWithUser);
+ break;
+ case ICVSUIConstants.OPTION_NEVER:
+ continueWithOperation = true;
+ break;
+ }
+ return continueWithOperation;
+ }
+
/**
* Answers <code>true</code> if the current selection contains resource that don't
* have overlapping paths and <code>false</code> otherwise.
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
index f1fea585f..b20f7302c 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java
@@ -19,11 +19,14 @@ import org.eclipse.ui.PartInitException;
/**
* Action for catchup/release in popup menus.
*/
-public class SyncAction extends TeamAction {
+public class SyncAction extends CVSAction {
/*
* Method declared on IActionDelegate.
*/
public void run(IAction action) {
+ if(!saveAllDirtyEditors()) {
+ return;
+ }
IResource[] resources = getSelectedResources();
SyncView view = (SyncView)CVSUIPlugin.getActivePage().findView(SyncView.VIEW_ID);
if (view == null) {

Back to the top