Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 87202 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/team/internal/ccvs/ui/CVSUIMessages.java (+6 lines)
Lines 700-705 Link Here
700
	public static String WatchEditPreferencePage_neverPrompt;
700
	public static String WatchEditPreferencePage_neverPrompt;
701
	public static String WatchEditPreferencePage_alwaysPrompt;
701
	public static String WatchEditPreferencePage_alwaysPrompt;
702
	public static String WatchEditPreferencePage_onlyPrompt;
702
	public static String WatchEditPreferencePage_onlyPrompt;
703
	public static String WatchEditPreferencePage_updatePrompt;
704
	public static String WatchEditPreferencePage_autoUpdate;
705
	public static String WatchEditPreferencePage_promptUpdate;
706
	public static String WatchEditPreferencePage_neverUpdate;
703
707
704
	public static String Uneditaction_confirmMessage;
708
	public static String Uneditaction_confirmMessage;
705
	public static String Uneditaction_confirmTitle;
709
	public static String Uneditaction_confirmTitle;
Lines 871-876 Link Here
871
875
872
	public static String FileModificationValidator_3;
876
	public static String FileModificationValidator_3;
873
	public static String FileModificationValidator_4;
877
	public static String FileModificationValidator_4;
878
    public static String FileModificationValidator_5;
879
    public static String FileModificationValidator_6;
874
	public static String CVSSynchronizeWizard_0;
880
	public static String CVSSynchronizeWizard_0;
875
	public static String Participant_comparing;
881
	public static String Participant_comparing;
876
	public static String Participant_merging;
882
	public static String Participant_merging;
(-)src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java (+1 lines)
Lines 563-568 Link Here
563
		store.setDefault(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY, corePrefs.getDefaultBoolean(CVSProviderPlugin.READ_ONLY));
563
		store.setDefault(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY, corePrefs.getDefaultBoolean(CVSProviderPlugin.READ_ONLY));
564
		store.setDefault(ICVSUIConstants.PREF_EDIT_ACTION, ICVSUIConstants.PREF_EDIT_IN_BACKGROUND);
564
		store.setDefault(ICVSUIConstants.PREF_EDIT_ACTION, ICVSUIConstants.PREF_EDIT_IN_BACKGROUND);
565
		store.setDefault(ICVSUIConstants.PREF_EDIT_PROMPT, ICVSUIConstants.PREF_EDIT_PROMPT_IF_EDITORS);
565
		store.setDefault(ICVSUIConstants.PREF_EDIT_PROMPT, ICVSUIConstants.PREF_EDIT_PROMPT_IF_EDITORS);
566
        store.setDefault(ICVSUIConstants.PREF_UPDATE_PROMPT, ICVSUIConstants.PREF_UPDATE_PROMPT_IF_OUTDATED);
566
		// Ensure that the preference values in UI match Core
567
		// Ensure that the preference values in UI match Core
567
		store.setValue(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY, corePrefs.getBoolean(CVSProviderPlugin.READ_ONLY));
568
		store.setValue(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY, corePrefs.getBoolean(CVSProviderPlugin.READ_ONLY));
568
		
569
		
(-)src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java (+66 lines)
Lines 66-71 Link Here
66
					throw new InterruptedException();
66
					throw new InterruptedException();
67
				}
67
				}
68
				
68
				
69
                // see if the file is up to date
70
                if (shell != null && promptToUpdateFiles(files, shell)) {
71
                    // The user wants to update the file
72
                    // Run the update in a runnable in order to get a busy cursor.
73
                    // This runnable is syncExeced in order to get a busy cursor
74
                    IRunnableWithProgress updateRunnable = new IRunnableWithProgress() {
75
                        public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
76
                            try {
77
                                performUpdate(files, monitor);
78
                            } catch (CVSException e) {
79
                                new InvocationTargetException(e);
80
                            }
81
                        }
82
                    };
83
                    if (isRunningInUIThread()) {
84
                        // Only show a busy cursor if validate edit is blocking the UI
85
                        CVSUIPlugin.runWithProgress(shell, false, updateRunnable);
86
                    } else {
87
                        // We can't show a busy cursor (i.e., run in the UI thread)
88
                        // since this thread may hold locks and
89
                        // running an edit in the UI thread could try to obtain the
90
                        // same locks, resulting in a deadlock.
91
                        updateRunnable.run(new NullProgressMonitor());
92
                    }
93
                }
94
                
69
				// Run the edit in a runnable in order to get a busy cursor.
95
				// Run the edit in a runnable in order to get a busy cursor.
70
				// This runnable is syncExeced in order to get a busy cursor
96
				// This runnable is syncExeced in order to get a busy cursor
71
				IRunnableWithProgress editRunnable = new IRunnableWithProgress() {
97
				IRunnableWithProgress editRunnable = new IRunnableWithProgress() {
Lines 139-144 Link Here
139
		}
165
		}
140
	}
166
	}
141
	
167
	
168
    private boolean promptToUpdateFiles(IFile[] files, Shell shell) throws InvocationTargetException, InterruptedException {
169
        if (files.length == 0)
170
            return false;
171
        
172
        if (isNeverUpdate())
173
            return false;
174
        
175
        // Contact the server to see if the files are up-to-date
176
        for (int i = 0; i < files.length; i++) {
177
            if (needsUpdate(files[i], new NullProgressMonitor())) {
178
                if (isPromptUpdate())
179
                    return (promptUpdate(shell));
180
                return true; // auto update
181
            }
182
        }
183
        
184
        return false;
185
    }
186
142
	private boolean promptEdit(Shell shell) {
187
	private boolean promptEdit(Shell shell) {
143
		// Open the dialog using a sync exec (there are no guarentees that we
188
		// Open the dialog using a sync exec (there are no guarentees that we
144
		// were called from the UI thread
189
		// were called from the UI thread
Lines 152-157 Link Here
152
		return result[0];
197
		return result[0];
153
	}
198
	}
154
199
200
    private boolean promptUpdate(Shell shell) {
201
        // Open the dialog using a sync exec (there are no guarentees that we
202
        // were called from the UI thread
203
        final boolean[] result = new boolean[] { false };
204
        int flags = isRunningInUIThread() ? 0 : CVSUIPlugin.PERFORM_SYNC_EXEC;
205
        CVSUIPlugin.openDialog(shell, new CVSUIPlugin.IOpenableInShell() {
206
            public void open(Shell shell) {
207
                result[0] = MessageDialog.openQuestion(shell,CVSUIMessages.FileModificationValidator_5,CVSUIMessages.FileModificationValidator_6);
208
            }
209
        }, flags);
210
        return result[0];
211
    }
212
155
	private boolean isPerformEdit() {
213
	private boolean isPerformEdit() {
156
		return ICVSUIConstants.PREF_EDIT_PROMPT_EDIT.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_ACTION));
214
		return ICVSUIConstants.PREF_EDIT_PROMPT_EDIT.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_ACTION));
157
	}
215
	}
Lines 187-190 Link Here
187
	private boolean isAlwaysPrompt() {
245
	private boolean isAlwaysPrompt() {
188
		return ICVSUIConstants.PREF_EDIT_PROMPT_ALWAYS.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_PROMPT));
246
		return ICVSUIConstants.PREF_EDIT_PROMPT_ALWAYS.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_PROMPT));
189
	}
247
	}
248
    
249
    private boolean isPromptUpdate() {
250
        return ICVSUIConstants.PREF_UPDATE_PROMPT_IF_OUTDATED.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_UPDATE_PROMPT));
251
    }
252
    
253
    private boolean isNeverUpdate() {
254
        return ICVSUIConstants.PREF_UPDATE_PROMPT_NEVER.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_UPDATE_PROMPT));
255
    }
190
}
256
}
(-)src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java (+6 lines)
Lines 132-137 Link Here
132
	public final String PREF_EDIT_PROMPT_NEVER = "never"; //$NON-NLS-1$
132
	public final String PREF_EDIT_PROMPT_NEVER = "never"; //$NON-NLS-1$
133
	public final String PREF_EDIT_PROMPT_ALWAYS = "always";	 //$NON-NLS-1$
133
	public final String PREF_EDIT_PROMPT_ALWAYS = "always";	 //$NON-NLS-1$
134
	public final String PREF_EDIT_PROMPT_IF_EDITORS = "only";	 //$NON-NLS-1$
134
	public final String PREF_EDIT_PROMPT_IF_EDITORS = "only";	 //$NON-NLS-1$
135
    
136
    // update preferences
137
    public final String PREF_UPDATE_PROMPT = "pref_upate_prompt";
138
    public final String PREF_UPDATE_PROMPT_NEVER = "never";    //$NON-NLS-1$
139
    public final String PREF_UPDATE_PROMPT_AUTO = "auto"; //$NON-NLS-1$
140
    public final String PREF_UPDATE_PROMPT_IF_OUTDATED = "only";  //$NON-NLS-1$
135
	
141
	
136
	// Repositories view preferences
142
	// Repositories view preferences
137
	public final String PREF_GROUP_VERSIONS_BY_PROJECT = "pref_group_versions_by_project"; //$NON-NLS-1$
143
	public final String PREF_GROUP_VERSIONS_BY_PROJECT = "pref_group_versions_by_project"; //$NON-NLS-1$
(-)src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java (-5 / +18 lines)
Lines 21-26 Link Here
21
public class WatchEditPreferencePage extends CVSFieldEditorPreferencePage {
21
public class WatchEditPreferencePage extends CVSFieldEditorPreferencePage {
22
	
22
	
23
	private RadioGroupFieldEditor promptEditor;
23
	private RadioGroupFieldEditor promptEditor;
24
    private RadioGroupFieldEditor updateEditor;
24
	private RadioGroupFieldEditor actionEditor;
25
	private RadioGroupFieldEditor actionEditor;
25
	private IPreferenceStore store;
26
	private IPreferenceStore store;
26
27
Lines 58-64 Link Here
58
							}, 	//$NON-NLS-1$ //$NON-NLS-2$
59
							}, 	//$NON-NLS-1$ //$NON-NLS-2$
59
			getFieldEditorParent(), true);
60
			getFieldEditorParent(), true);
60
		addField(actionEditor);
61
		addField(actionEditor);
61
62
		
62
		
63
		promptEditor = new RadioGroupFieldEditor(
63
		promptEditor = new RadioGroupFieldEditor(
64
			ICVSUIConstants.PREF_EDIT_PROMPT,
64
			ICVSUIConstants.PREF_EDIT_PROMPT,
Lines 69-76 Link Here
69
							{CVSUIMessages.WatchEditPreferencePage_neverPrompt, ICVSUIConstants.PREF_EDIT_PROMPT_NEVER}, //$NON-NLS-1$
69
							{CVSUIMessages.WatchEditPreferencePage_neverPrompt, ICVSUIConstants.PREF_EDIT_PROMPT_NEVER}, //$NON-NLS-1$
70
							},	//$NON-NLS-1$ //$NON-NLS-2$
70
							},	//$NON-NLS-1$ //$NON-NLS-2$
71
			getFieldEditorParent(), true);
71
			getFieldEditorParent(), true);
72
        
73
        updateEditor = new RadioGroupFieldEditor(
74
                ICVSUIConstants.PREF_UPDATE_PROMPT,
75
                CVSUIMessages.WatchEditPreferencePage_updatePrompt, //$NON-NLS-1$
76
                1,
77
                new String[][] {{CVSUIMessages.WatchEditPreferencePage_autoUpdate, ICVSUIConstants.PREF_UPDATE_PROMPT_AUTO}, //$NON-NLS-1$
78
                                {CVSUIMessages.WatchEditPreferencePage_promptUpdate, ICVSUIConstants.PREF_UPDATE_PROMPT_IF_OUTDATED}, //$NON-NLS-1$
79
                                {CVSUIMessages.WatchEditPreferencePage_neverUpdate, ICVSUIConstants.PREF_UPDATE_PROMPT_NEVER}, //$NON-NLS-1$
80
                                },  //$NON-NLS-1$ //$NON-NLS-2$
81
                getFieldEditorParent(), true);
82
        
72
		store = getCVSPreferenceStore();
83
		store = getCVSPreferenceStore();
73
		addField(promptEditor);
84
		addField(promptEditor);
85
        addField(updateEditor);
74
	}
86
	}
75
87
76
	private boolean isEditEnabled() {
88
	private boolean isEditEnabled() {
Lines 93-102 Link Here
93
	 */
105
	 */
94
	public void propertyChange(PropertyChangeEvent event) {
106
	public void propertyChange(PropertyChangeEvent event) {
95
		if (event.getSource() == actionEditor) {
107
		if (event.getSource() == actionEditor) {
96
			promptEditor.setEnabled(
108
            boolean enabled = event.getNewValue().equals(ICVSUIConstants.PREF_EDIT_PROMPT_EDIT);
97
				event.getNewValue().equals(ICVSUIConstants.PREF_EDIT_PROMPT_EDIT), 
109
			promptEditor.setEnabled(enabled, getFieldEditorParent());
98
				getFieldEditorParent());
110
            updateEditor.setEnabled(enabled, getFieldEditorParent());
99
		}
111
        }
100
		super.propertyChange(event);
112
		super.propertyChange(event);
101
	}
113
	}
102
114
Lines 107-111 Link Here
107
	protected void initialize() {
119
	protected void initialize() {
108
		super.initialize();
120
		super.initialize();
109
		promptEditor.setEnabled(isEditEnabled(), getFieldEditorParent());
121
		promptEditor.setEnabled(isEditEnabled(), getFieldEditorParent());
122
        updateEditor.setEnabled(isEditEnabled(), getFieldEditorParent());
110
	}
123
	}
111
}
124
}
(-)src/org/eclipse/team/internal/ccvs/ui/messages.properties (+6 lines)
Lines 730-735 Link Here
730
WatchEditPreferencePage_neverPrompt=&Never prompt
730
WatchEditPreferencePage_neverPrompt=&Never prompt
731
WatchEditPreferencePage_alwaysPrompt=Always &prompt
731
WatchEditPreferencePage_alwaysPrompt=Always &prompt
732
WatchEditPreferencePage_onlyPrompt=&Only prompt if there are other editors
732
WatchEditPreferencePage_onlyPrompt=&Only prompt if there are other editors
733
WatchEditPreferencePage_updatePrompt=Automatically perform a CVS update
734
WatchEditPreferencePage_autoUpdate=Always &update
735
WatchEditPreferencePage_promptUpdate=Only prompt if out of &date
736
WatchEditPreferencePage_neverUpdate=Ne&ver update
733
737
734
Uneditaction_confirmMessage=Overwrite local changes to edited files?
738
Uneditaction_confirmMessage=Overwrite local changes to edited files?
735
Uneditaction_confirmTitle=Confirm Unedit
739
Uneditaction_confirmTitle=Confirm Unedit
Lines 930-935 Link Here
930
934
931
FileModificationValidator_3=Perform Edit?
935
FileModificationValidator_3=Perform Edit?
932
FileModificationValidator_4=A CVS edit notification is required to be sent to the server in order to allow editing of one or more selected files. Continue?
936
FileModificationValidator_4=A CVS edit notification is required to be sent to the server in order to allow editing of one or more selected files. Continue?
937
FileModificationValidator_5=Perform Update?
938
FileModificationValidator_6=This resource is out of date.  Would you like to update it before continuing?
933
CVSSynchronizeWizard_0=Unknown
939
CVSSynchronizeWizard_0=Unknown
934
Participant_comparing=Comparing
940
Participant_comparing=Comparing
935
Participant_merging=Merging
941
Participant_merging=Merging

Return to bug 87202