Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Michel-Lemieux2002-05-02 14:40:35 +0000
committerJean Michel-Lemieux2002-05-02 14:40:35 +0000
commit354bd604f1c2f7e7281c9fffff0b0f537b534f86 (patch)
tree05e78e96ec6e01f81cadf57617387843637067ad
parent014b02455e6286097b4b1d83ba8b7f6bd6651833 (diff)
downloadeclipse.platform.team-354bd604f1c2f7e7281c9fffff0b0f537b534f86.tar.gz
eclipse.platform.team-354bd604f1c2f7e7281c9fffff0b0f537b534f86.tar.xz
eclipse.platform.team-354bd604f1c2f7e7281c9fffff0b0f537b534f86.zip
Bug 88: Save modified files before release (1GE7K8N)
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java10
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java69
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java1
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java8
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddAction.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddToWorkspaceAction.java6
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CVSAction.java75
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteResourcesAction.java14
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java15
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoView.java11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ContentAction.java17
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java5
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java2
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SyncAction.java11
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java4
-rw-r--r--bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties6
24 files changed, 227 insertions, 68 deletions
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java
index 37a87693f..eee0a059a 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSLocalCompareEditorInput.java
@@ -24,19 +24,13 @@ public class CVSLocalCompareEditorInput extends CVSSyncCompareInput {
CVSTag[] tags;
public CVSLocalCompareEditorInput(IResource[] resources, CVSTag[] tags) {
- // we have to perform content comparison since files in different branches
- // may have different revisions but the same contents. Consider these files
- // for merge purposes as equal.
- super(resources, IRemoteSyncElement.GRANULARITY_CONTENTS);
+ super(resources);
Assert.isTrue(resources.length == tags.length);
this.tags = tags;
}
public CVSLocalCompareEditorInput(IResource[] resources, CVSTag tag) {
- // we have to perform content comparison since files in different branches
- // may have different revisions but the same contents. Consider these files
- // for merge purposes as equal.
- super(resources, IRemoteSyncElement.GRANULARITY_CONTENTS);
+ super(resources);
Assert.isTrue(tag != null);
this.tags = new CVSTag[] {tag};
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
index b31d312c2..1fb9e72fa 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/CVSPreferencesPage.java
@@ -21,6 +21,7 @@ import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.preference.RadioGroupFieldEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -32,6 +33,7 @@ import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin;
@@ -52,9 +54,7 @@ import org.eclipse.ui.IWorkbenchPreferencePage;
* 1. The Repository view is not refreshed when the show CVSROOT option is changed
* 2. There is no help associated with the page
*/
-public class CVSPreferencesPage
- extends PreferencePage
- implements IWorkbenchPreferencePage {
+public class CVSPreferencesPage extends PreferencePage implements IWorkbenchPreferencePage, ICVSUIConstants {
private Button pruneEmptyDirectoriesField;
private Text timeoutValue;
@@ -68,6 +68,10 @@ public class CVSPreferencesPage
private Button promptOnFolderDelete;
private Button showMarkers;
private Button replaceUnmanaged;
+
+ private Button never;
+ private Button prompt;
+ private Button auto;
public CVSPreferencesPage() {
// sort the options by display text
@@ -195,6 +199,8 @@ public class CVSPreferencesPage
replaceUnmanaged = createCheckBox(composite, Policy.bind("CVSPreferencePage.replaceUnmanaged")); //$NON-NLS-1$
replaceUnmanaged.setToolTipText(Policy.bind("CVSPreferencePage.replaceUnmanagedTooltip")); //$NON-NLS-1$
+ createSaveCombo(composite);
+
initializeValues();
quietnessCombo.addSelectionListener(new SelectionListener() {
@@ -265,6 +271,8 @@ public class CVSPreferencesPage
promptOnFolderDelete.setSelection(store.getBoolean(ICVSUIConstants.PREF_PROMPT_ON_FOLDER_DELETE));
showMarkers.setSelection(store.getBoolean(ICVSUIConstants.PREF_SHOW_MARKERS));
replaceUnmanaged.setSelection(store.getBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED));
+
+ initializeSaveRadios(store.getInt(PREF_SAVE_DIRTY_EDITORS));
}
/**
@@ -296,6 +304,8 @@ public class CVSPreferencesPage
store.setValue(ICVSUIConstants.PREF_PROMPT_ON_FOLDER_DELETE, promptOnFolderDelete.getSelection());
store.setValue(ICVSUIConstants.PREF_SHOW_MARKERS, showMarkers.getSelection());
store.setValue(ICVSUIConstants.PREF_REPLACE_UNMANAGED, replaceUnmanaged.getSelection());
+ store.setValue(PREF_SAVE_DIRTY_EDITORS, getSaveRadio());
+
CVSProviderPlugin.getPlugin().setPruneEmptyDirectories(
store.getBoolean(ICVSUIConstants.PREF_PRUNE_EMPTY_DIRECTORIES));
@@ -317,10 +327,15 @@ public class CVSPreferencesPage
CVSProviderPlugin.getPlugin().setReplaceUnmanaged(
store.getBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED));
+
+
+
// changing the default keyword substitution mode for text files may affect
// information displayed in the decorators
if (! oldKSubst.equals(newKSubst)) CVSDecorator.refresh();
+
+
return true;
}
@@ -342,9 +357,31 @@ public class CVSPreferencesPage
promptOnFolderDelete.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_PROMPT_ON_FOLDER_DELETE));
showMarkers.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_SHOW_MARKERS));
replaceUnmanaged.setSelection(store.getDefaultBoolean(ICVSUIConstants.PREF_REPLACE_UNMANAGED));
+ initializeSaveRadios(store.getDefaultInt(PREF_SAVE_DIRTY_EDITORS));
}
- /**
+ private void createSaveCombo(Composite composite) {
+ Group group = new Group(composite, SWT.LEFT);
+ GridLayout layout = new GridLayout();
+ group.setLayout(layout);
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
+ group.setLayoutData(data);
+ group.setText(Policy.bind("CVSPreferencePage.Save_dirty_editors_before_CVS_operations_1")); //$NON-NLS-1$
+
+ never = new Button(group, SWT.RADIO | SWT.LEFT);
+ never.setLayoutData(new GridData());
+ never.setText(Policy.bind("CVSPreferencePage.&Never_2")); //$NON-NLS-1$
+
+ prompt = new Button(group, SWT.RADIO | SWT.LEFT);
+ prompt.setLayoutData(new GridData());
+ prompt.setText(Policy.bind("CVSPreferencePage.&Prompt_3")); //$NON-NLS-1$
+
+ auto = new Button(group, SWT.RADIO | SWT.LEFT);
+ auto.setLayoutData(new GridData());
+ auto.setText(Policy.bind("CVSPreferencePage.Auto-&save_4")); //$NON-NLS-1$
+ }
+
+ /**
* Returns preference store that belongs to the our plugin.
* This is important because we want to store
* our preferences separately from the desktop.
@@ -377,4 +414,28 @@ public class CVSPreferencesPage
ksubstCombo.add(ksubst.getLongDisplayText());
return i;
}
+
+ protected void initializeSaveRadios(int option) {
+ auto.setSelection(false);
+ never.setSelection(false);
+ prompt.setSelection(false);
+ switch(option) {
+ case OPTION_AUTOMATIC:
+ auto.setSelection(true); break;
+ case OPTION_NEVER:
+ never.setSelection(true); break;
+ case OPTION_PROMPT:
+ prompt.setSelection(true); break;
+ }
+ }
+
+ protected int getSaveRadio() {
+ if(auto.getSelection()) {
+ return OPTION_AUTOMATIC;
+ } else if(never.getSelection()) {
+ return OPTION_NEVER;
+ } else {
+ return OPTION_PROMPT;
+ }
+ }
} \ No newline at end of file
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 ee2551aaf..651922a2c 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
@@ -269,6 +269,7 @@ public class CVSUIPlugin extends AbstractUIPlugin {
store.setDefault(ICVSUIConstants.PREF_CALCULATE_DIRTY, true);
store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_MIXED_TAGS, true);
store.setDefault(ICVSUIConstants.PREF_PROMPT_ON_SAVING_IN_SYNC, 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 28ba97319..ea39c95ea 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
@@ -56,8 +56,9 @@ public interface ICVSUIConstants {
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_PROMPT_ON_SAVING_IN_SYNC = "pref_prompt_on_saving_in_sync"; //$NON-NLS-1$
+ public final String PREF_SAVE_DIRTY_EDITORS = "pref_save_dirty_editors"; //$NON-NLS-1$
public final String PREF_PROMPT_ON_CHANGE_GRANULARITY = "pref_prompt_on_change_granularity"; //$NON-NLS-1$
-
+
// console preferences
public final String PREF_CONSOLE_COMMAND_COLOR = "pref_console_command_color"; //$NON-NLS-1$
public final String PREF_CONSOLE_MESSAGE_COLOR = "pref_console_message_color"; //$NON-NLS-1$
@@ -100,5 +101,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..873af6f53 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
@@ -30,11 +30,11 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation;
* AddAction performs a 'cvs add' command on the selected resources. If a
* container is selected, its children are recursively added.
*/
-public class AddAction extends TeamAction {
+public class AddAction extends CVSAction {
/*
- * @see IActionDelegate#run(IAction)
+ * @see CVSAction#execute()
*/
- public void run(IAction action) {
+ public void execute(IAction action) {
run(new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
try {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddToWorkspaceAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddToWorkspaceAction.java
index aec747fb9..4fe2a1f3f 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddToWorkspaceAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/AddToWorkspaceAction.java
@@ -36,7 +36,7 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation;
* -Works only for remote folders
* -Does not prompt for project name; uses folder name instead
*/
-public class AddToWorkspaceAction extends TeamAction {
+public class AddToWorkspaceAction extends CVSAction {
/**
* Returns the selected remote folders
*/
@@ -72,9 +72,9 @@ public class AddToWorkspaceAction extends TeamAction {
}
/*
- * @see IActionDelegate#run(IAction)
+ * @see CVSAction#execute()
*/
- public void run(IAction action) {
+ public void execute(IAction action) {
run(new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
try {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
index 8872b261f..fb5719042 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/BranchAction.java
@@ -23,9 +23,9 @@ import org.eclipse.team.internal.ccvs.ui.wizards.BranchWizard;
*/
public class BranchAction extends CVSAction {
/*
- * @see IActionDelegate#run(IAction)
+ * @see CVSAction#execute()
*/
- public void run(IAction action) {
+ public void execute(IAction action) {
final Shell shell = getShell();
shell.getDisplay().syncExec(new Runnable() {
public void run() {
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..3f827dec0 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,9 +16,11 @@ 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;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.team.core.RepositoryProvider;
import org.eclipse.team.core.TeamException;
@@ -33,16 +35,48 @@ 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.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
/**
- * Contains helper methods for CVS actions.
- *
- * [Note: it would be nice to have common CVS error handling
- * placed here and have all CVS actions subclass. For example
- * error handling UI could provide a retry facility for actions
- * if they have failed.]
+ * Superclass for all CVS actions. It provides helper enablement
+ * methods and common pre-run and post-run hadling.
*/
abstract public class CVSAction extends TeamAction {
+
+ /**
+ * Common run method for all CVS actions.
+ *
+ * [Note: it would be nice to have common CVS error handling
+ * placed here and have all CVS actions subclass. For example
+ * error handling UI could provide a retry facility for actions
+ * if they have failed.]
+ */
+ final public void run(IAction action) {
+ if(needsToSaveDirtyEditors()) {
+ if(!saveAllEditors()) {
+ return;
+ }
+ }
+ execute(action);
+ }
+
+ /**
+ * Actions must override to do their work.
+ */
+ abstract protected void execute(IAction action);
+
+ /**
+ * Answers if the action would like dirty editors to saved
+ * based on the CVS preference before running the action. By
+ * default most CVS action modify the workspace and thus should
+ * save dirty editors.
+ */
+ protected boolean needsToSaveDirtyEditors() {
+ return true;
+ }
+
/**
* Answers <code>true</code> if the current selection contains resource that don't
* have overlapping paths and <code>false</code> otherwise.
@@ -129,4 +163,31 @@ abstract public class CVSAction extends TeamAction {
}
return result[0];
}
-}
+
+ /**
+ * Based on the CVS preference for saving dirty editors this method will either
+ * ignore dirty editors, save them automatically, or prompt the user to save them.
+ *
+ * @return <code>true</code> if the command succeeded, and <code>false</code>
+ * if at least one editor with unsaved changes was not saved
+ */
+ private boolean saveAllEditors() {
+ final int option = CVSUIPlugin.getPlugin().getPreferenceStore().getInt(ICVSUIConstants.PREF_SAVE_DIRTY_EDITORS);
+ final boolean[] okToContinue = new boolean[] {true};
+ if(option != ICVSUIConstants.OPTION_NEVER) {
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ boolean confirm = option == ICVSUIConstants.OPTION_PROMPT;
+ IWorkbenchWindow[] windows = PlatformUI.getWorkbench().getWorkbenchWindows();
+ for (int i = 0; i < windows.length; i++) {
+ IWorkbenchPage[] pages = windows[i].getPages();
+ for (int j = 0; j < pages.length; j++) {
+ okToContinue[0] = pages[j].saveAllEditors(confirm);
+ }
+ }
+ }
+ });
+ }
+ return okToContinue[0];
+ }
+} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java
index 0e4a29790..12eeae941 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CheckoutAsAction.java
@@ -37,7 +37,7 @@ public class CheckoutAsAction extends AddToWorkspaceAction {
/*
* @see IActionDelegate#run(IAction)
*/
- public void run(IAction action) {
+ public void execute(IAction action) {
run(new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
try {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
index 362c3df9f..0af81ec95 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CommitAction.java
@@ -25,11 +25,11 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation;
* Action for checking in files to a CVS provider.
* Prompts the user for a release comment.
*/
-public class CommitAction extends TeamAction {
+public class CommitAction extends CVSAction {
/*
* @see IActionDelegate#run(IAction)
*/
- public void run(IAction action) {
+ public void execute(IAction action) {
run(new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
try {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteResourcesAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteResourcesAction.java
index ff3af4653..5238f3e55 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteResourcesAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareRemoteResourcesAction.java
@@ -24,11 +24,9 @@ import org.eclipse.team.ui.actions.TeamAction;
* This action is used for comparing two arbitrary remote resources. This is
* enabled in the repository explorer.
*/
-public class CompareRemoteResourcesAction extends TeamAction {
- /* (non-Javadoc)
- * Method declared in IActionDelegate.
- */
- public void run(IAction action) {
+public class CompareRemoteResourcesAction extends CVSAction {
+
+ public void execute(IAction action) {
ICVSRemoteResource[] editions = getSelectedRemoteResources();
if (editions == null || editions.length != 2) {
MessageDialog.openError(getShell(), Policy.bind("CompareRemoteResourcesAction.unableToCompare"), Policy.bind("CompareRemoteResourcesAction.selectTwoResources")); //$NON-NLS-1$ //$NON-NLS-2$
@@ -81,4 +79,10 @@ public class CompareRemoteResourcesAction extends TeamAction {
ICVSRemoteResource[] resources = getSelectedRemoteResources();
return resources.length == 2;
}
+ /*
+ * @see CVSAction#needsToSaveDirtyEditors()
+ */
+ protected boolean needsToSaveDirtyEditors() {
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
index 1a3149117..427edfafd 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRemoteAction.java
@@ -23,7 +23,7 @@ import org.eclipse.team.internal.ccvs.ui.Policy;
public class CompareWithRemoteAction extends CompareWithTagAction {
- public void run(IAction action) {
+ public void execute(IAction action) {
IResource[] resources;
resources = getSelectedResources();
CVSTag[] tags = new CVSTag[resources.length];
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
index 227cfaa97..42eb7beef 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithRevisionAction.java
@@ -23,7 +23,7 @@ import org.eclipse.team.internal.ccvs.ui.CVSCompareRevisionsInput;
import org.eclipse.team.internal.ccvs.ui.Policy;
import org.eclipse.team.ui.actions.TeamAction;
-public class CompareWithRevisionAction extends TeamAction {
+public class CompareWithRevisionAction extends CVSAction {
/**
* Returns the selected remote file
*/
@@ -39,10 +39,8 @@ public class CompareWithRevisionAction extends TeamAction {
return null;
}
}
- /*
- * @see IActionDelegate#run(IAction)
- */
- public void run(IAction action) {
+
+ public void execute(IAction action) {
// Setup holders
final ICVSRemoteFile[] file = new ICVSRemoteFile[] { null };
@@ -92,4 +90,11 @@ public class CompareWithRevisionAction extends TeamAction {
ICVSResource cvsResource = CVSWorkspaceRoot.getCVSResourceFor(resources[0]);
return cvsResource.isManaged();
}
+
+ /*
+ * @see CVSAction#needsToSaveDirtyEditors()
+ */
+ protected boolean needsToSaveDirtyEditors() {
+ return false;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
index 2c568dc85..c5013faf1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/CompareWithTagAction.java
@@ -23,7 +23,7 @@ import org.eclipse.team.ui.actions.TeamAction;
public class CompareWithTagAction extends CVSAction {
- public void run(IAction action) {
+ public void execute(IAction action) {
final CVSTag tag;
final ICVSRemoteResource[] remoteResource = new ICVSRemoteResource[] { null };
final IResource[] resources = getSelectedResources();
@@ -43,6 +43,8 @@ public class CompareWithTagAction extends CVSAction {
CompareUI.openCompareEditor(new CVSLocalCompareEditorInput(resources, tag));
}
+
+
protected boolean isEnabled() {
try {
return isSelectionNonOverlapping();
@@ -51,4 +53,11 @@ public class CompareWithTagAction extends CVSAction {
return false;
}
}
+
+ /*
+ * @see CVSAction#needsToSaveDirtyEditors()
+ */
+ protected boolean needsToSaveDirtyEditors() {
+ return false;
+ }
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoView.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoView.java
index f3354fb87..2101701b2 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoView.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ConfigureTagsFromRepoView.java
@@ -32,7 +32,7 @@ import org.eclipse.team.ui.actions.TeamAction;
/**
* DefineTagAction remembers a tag by name
*/
-public class ConfigureTagsFromRepoView extends TeamAction {
+public class ConfigureTagsFromRepoView extends CVSAction {
IInputValidator validator = new IInputValidator() {
public String isValid(String newText) {
IStatus status = CVSTag.validateTagName(newText);
@@ -80,7 +80,7 @@ public class ConfigureTagsFromRepoView extends TeamAction {
/*
* @see IActionDelegate#run(IAction)
*/
- public void run(IAction action) {
+ public void execute(IAction action) {
run(new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) throws InvocationTargetException {
final ICVSRepositoryLocation[] roots = getSelectedRemoteRoots();
@@ -113,4 +113,11 @@ public class ConfigureTagsFromRepoView extends TeamAction {
if (roots.length != 1) return false;
return true;
}
+
+ /*
+ * @see CVSAction#needsToSaveDirtyEditors()
+ */
+ protected boolean needsToSaveDirtyEditors() {
+ return false;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ContentAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ContentAction.java
index 15e24faf0..4b2bfd486 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ContentAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ContentAction.java
@@ -6,7 +6,7 @@
* http://www.eclipse.org/legal/cpl-v05.html
*
* Contributors:
- * IBM - Initial API and implementation
+ * IBM - Initial implementation
******************************************************************************/
package org.eclipse.team.internal.ccvs.ui.actions;
@@ -27,9 +27,18 @@ import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.actions.ActionDelegate;
public class ContentAction extends ActionDelegate implements IEditorActionDelegate {
- CVSSyncCompareInput syncInput;
/**
+ * Is <code>null</code> if the current active editor is not a compare editor
+ * with a CVS editor input. Or else this input refer to the input in the active
+ * CVS compare editor.
+ */
+ private CVSSyncCompareInput syncInput;
+
+ /**
+ * Should only be called if action is enabled and the current active editor is a
+ * CVS compare editor.
+ *
* @see IActionDelegate#run(IAction)
*/
public void run(IAction action) {
@@ -55,6 +64,9 @@ public class ContentAction extends ActionDelegate implements IEditorActionDelega
}
/**
+ * Called when the active editor changes. Enablement of this action depends
+ * on the editor type and editr input of the active editor.
+ *
* @see IEditorActionDelegate#setActiveEditor(IAction, IEditorPart)
*/
public void setActiveEditor(IAction action, IEditorPart targetEditor) {
@@ -70,5 +82,4 @@ public class ContentAction extends ActionDelegate implements IEditorActionDelega
syncInput = null;
action.setEnabled(false);
}
-
}
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
index 6e708efbf..f6d2ab200 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/GenerateDiffFileAction.java
@@ -23,7 +23,7 @@ import org.eclipse.team.ui.actions.TeamAction;
* NOTE: This is a temporary action and should eventually be replaced
* by a create patch command in the compare viewer.
*/
-public class GenerateDiffFileAction extends TeamAction {
+public class GenerateDiffFileAction extends CVSAction {
/**
* Makes sure that the projects of all selected resources are shared.
* Returns true if all resources are shared, and false otherwise.
@@ -43,7 +43,7 @@ public class GenerateDiffFileAction extends TeamAction {
/** (Non-javadoc)
* Method declared on IActionDelegate.
*/
- public void run(IAction action) {
+ public void execute(IAction action) {
final String title = Policy.bind("GenerateCVSDiff.title"); //$NON-NLS-1$
final IResource[] resources = getSelectedResources();
GenerateDiffFileWizard wizard = new GenerateDiffFileWizard(new StructuredSelection(resources), resources[0]);
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
index 1bd1c021f..e1b49c206 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/MergeAction.java
@@ -17,10 +17,11 @@ import org.eclipse.team.core.TeamException;
import org.eclipse.team.internal.ccvs.ui.merge.MergeWizard;
public class MergeAction extends CVSAction {
+
/*
- * @see IActionDelegate#run(IAction)
+ * @see CVSAction#execute()
*/
- public void run(IAction action) {
+ public void execute(IAction action) {
final Shell shell = getShell();
shell.getDisplay().syncExec(new Runnable() {
public void run() {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
index cb9ded86b..5a9b7bb4d 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithRemoteAction.java
@@ -25,8 +25,8 @@ import org.eclipse.team.internal.ccvs.ui.PromptingDialog;
import org.eclipse.team.ui.actions.TeamAction;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
-public class ReplaceWithRemoteAction extends TeamAction {
- public void run(IAction action) {
+public class ReplaceWithRemoteAction extends CVSAction {
+ public void execute(IAction action) {
run(new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
try {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
index 47125f5d8..77c0fc334 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/ReplaceWithTagAction.java
@@ -41,7 +41,7 @@ public class ReplaceWithTagAction extends CVSAction {
/*
* Method declared on IActionDelegate.
*/
- public void run(IAction action) {
+ public void execute(IAction action) {
// Setup the holders
final IResource[] resource = new IResource[] {null};
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java
index 7320b3d6a..36f4adc16 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/SetKeywordSubstitutionAction.java
@@ -21,13 +21,13 @@ import org.eclipse.team.ui.actions.TeamAction;
/**
* TagAction tags the selected resources with a version tag specified by the user.
*/
-public class SetKeywordSubstitutionAction extends TeamAction {
+public class SetKeywordSubstitutionAction extends CVSAction {
private KSubstOption previousOption = null; // automatic
/*
* @see IActionDelegate#run(IAction)
*/
- public void run(IAction action) {
+ public void execute(IAction action) {
final IResource[] resources = getSelectedResources();
KSubstWizard wizard = new KSubstWizard(resources, IResource.DEPTH_INFINITE, previousOption);
WizardDialog dialog = new ResizableWizardDialog(getShell(), wizard);
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..1a742ce09 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,8 @@ import org.eclipse.ui.PartInitException;
/**
* Action for catchup/release in popup menus.
*/
-public class SyncAction extends TeamAction {
- /*
- * Method declared on IActionDelegate.
- */
- public void run(IAction action) {
+public class SyncAction extends CVSAction {
+ public void execute(IAction action) {
IResource[] resources = getSelectedResources();
SyncView view = (SyncView)CVSUIPlugin.getActivePage().findView(SyncView.VIEW_ID);
if (view == null) {
@@ -39,10 +36,6 @@ public class SyncAction extends TeamAction {
view.showSync(new CVSSyncCompareInput(resources));
}
}
-
- /*
- * Method declared on IActionDelegate.
- */
protected boolean isEnabled() throws TeamException {
IResource[] resources = getSelectedResources();
for (int i = 0; i < resources.length; i++) {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
index 124e28d02..1bae83db1 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/actions/UpdateAction.java
@@ -35,11 +35,11 @@ import org.eclipse.ui.actions.WorkspaceModifyOperation;
* resolve the conflicts. This action is temporary code; it will be removed
* when a functional synchronize view has been implemented.
*/
-public class UpdateAction extends TeamAction {
+public class UpdateAction extends CVSAction {
/*
* @see IActionDelegate#run(IAction)
*/
- public void run(IAction action) {
+ public void execute(IAction action) {
run(new WorkspaceModifyOperation() {
public void execute(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
try {
diff --git a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
index f91abec4b..1efe98db8 100644
--- a/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
+++ b/bundles/org.eclipse.team.cvs.ui/src/org/eclipse/team/internal/ccvs/ui/messages.properties
@@ -175,6 +175,8 @@ CVSPreferencePage.replaceUnmanaged=&Delete unmanaged resources on any Replace Wi
CVSPreferencePage.replaceUnmanagedTooltip=On a Replace With... operation, files that are not under CVS control can be left as is or deleted automatically.
CVSPreferencePage.defaultTextKSubst=Default &keyword substitution mode for text files
+CVSPreferencePage.title=General settings CVS.
+
CVSRemoteFilePropertySource.name=Name
CVSRemoteFilePropertySource.revision=Revision
CVSRemoteFilePropertySource.date=Date
@@ -695,3 +697,7 @@ CVSProjectSetSerializer.Confirm_Overwrite_Project_8=Confirm Overwrite Project
CVSProjectSetSerializer.The_project_{0}_already_exists._Do_you_wish_to_overwrite_it__9=The project {0} already exists. Do you wish to overwrite it?
ContentAction.Confirm_Long_Operation_1=Confirm Long Operation
ContentAction.Changing_this_setting_will_involve_contacting_the_server_and_may_be_long-running_2=Changing this setting will involve contacting the server and may be long-running
+CVSPreferencePage.Save_dirty_editors_before_CVS_operations_1=Save dirty editors before CVS operations
+CVSPreferencePage.&Never_2=&Never
+CVSPreferencePage.&Prompt_3=&Prompt
+CVSPreferencePage.Auto-&save_4=Auto-&save

Back to the top