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 7565 Details for
Bug 30657
Better CVS watch/edit options needed for prompts when a read-only file is modified in an editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Prompt choices are provided when editing read-only files
watchEditPatch (text/plain), 13.59 KB, created by
Zhiyong Liu
on 2004-01-26 11:41:23 EST
(
hide
)
Description:
Prompt choices are provided when editing read-only files
Filename:
MIME Type:
Creator:
Zhiyong Liu
Created:
2004-01-26 11:41:23 EST
Size:
13.59 KB
patch
obsolete
>Index: .project >=================================================================== >retrieving revision 1.9 >diff -u -r1.9 .project >--- .project 11 Dec 2003 15:49:47 -0000 1.9 >+++ .project 26 Jan 2004 16:24:15 -0000 >@@ -18,6 +18,7 @@ > <project>org.eclipse.ui.editors</project> > <project>org.eclipse.ui.ide</project> > <project>org.eclipse.ui.views</project> >+ <project>org.eclipse.ui.workbench</project> > <project>org.eclipse.ui.workbench.texteditor</project> > </projects> > <buildSpec> >Index: src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java >=================================================================== >retrieving revision 1.121 >diff -u -r1.121 CVSUIPlugin.java >--- src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java 14 Jan 2004 04:11:12 -0000 1.121 >+++ src/org/eclipse/team/internal/ccvs/ui/CVSUIPlugin.java 26 Jan 2004 16:24:15 -0000 >@@ -98,7 +98,9 @@ > // constants used by watch/edit as values for string preference > public static final String EDIT = "edit"; //$NON-NLS-1$ > public static final String HIGHJACK = "highjack"; //$NON-NLS-1$ >- >+ public static final String NEVERPROMPT = "neverPompt"; >+ public static final String ALWAYSPROMPT = "alwaysPompt"; >+ public static final String ONLYPROMPT = "onlyPompt"; > /** > * CVSUIPlugin constructor > * >@@ -644,6 +646,7 @@ > // Set the watch/edit preferences defaults and values > store.setDefault(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY, corePrefs.getDefaultBoolean(CVSProviderPlugin.READ_ONLY)); > store.setDefault(ICVSUIConstants.PREF_EDIT_ACTION, EDIT); >+ store.setDefault(ICVSUIConstants.PREF_EDIT_PROMPT,ALWAYSPROMPT); > // Ensure that the preference values in UI match Core > store.setValue(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY, corePrefs.getBoolean(CVSProviderPlugin.READ_ONLY)); > >Index: src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java >=================================================================== >retrieving revision 1.8 >diff -u -r1.8 FileModificationValidator.java >--- src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java 10 Mar 2003 21:24:14 -0000 1.8 >+++ src/org/eclipse/team/internal/ccvs/ui/FileModificationValidator.java 26 Jan 2004 16:24:15 -0000 >@@ -19,6 +19,7 @@ > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.Status; >+import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.jface.operation.IRunnableWithProgress; > import org.eclipse.swt.widgets.Shell; > import org.eclipse.team.core.RepositoryProvider; >@@ -30,6 +31,7 @@ > import org.eclipse.team.internal.ccvs.core.ICVSFileModificationValidator; > import org.eclipse.team.internal.ccvs.core.resources.CVSWorkspaceRoot; > import org.eclipse.team.internal.ccvs.ui.actions.EditorsAction; >+import org.eclipse.team.internal.ccvs.ui.Policy; > > /** > * IFileModificationValidator that is pluged into the CVS Repository Provider >@@ -118,7 +120,7 @@ > } > return new Status(IStatus.ERROR, CVSUIPlugin.ID, 0, Policy.bind("internal"), target); //$NON-NLS-1$ > } >- >+ > private IStatus edit(final IFile[] files, Shell shell) { > try { > if (!promptToEditFiles(files, shell)) { >@@ -152,14 +154,23 @@ > > private boolean promptToEditFiles(IFile[] files, Shell shell) throws InvocationTargetException, InterruptedException { > if (files.length == 0) >- return true; >- >- EditorsAction editors = new EditorsAction(getProvider(files),files); >- if (editors.isPerformEdit()) { >- // determine if there are any editors of the file registered on the server >- run(shell, editors); >- // prompt if there are >- return editors.promptToEdit(shell); >+ return true; >+ >+ if (isPerformEdit() ) { >+ if(isNeverPrompt()) >+ return true; >+ >+ // Contact the server to see if anyone else is editing the files >+ EditorsAction editors = fetchEditors(files, shell); >+ if (editors.isEmpty()) { >+ if (isAlwaysPrompt()) >+ return (promptEdit(shell)); >+ else >+ return true; >+ } else { >+ return (editors.promptToEdit(shell)); >+ } >+ > } else { > // Allow the files to be edited without notifying the server > for (int i = 0; i < files.length; i++) { >@@ -171,6 +182,29 @@ > > } > >+ private boolean promptEdit(Shell shell) { >+ return MessageDialog.openQuestion(shell,Policy.bind("FileModificationValidator.3"),Policy.bind("FileModificationValidator.4")); //$NON-NLS-1$ //$NON-NLS-2$ >+ } >+ >+ public boolean isPerformEdit() { >+ return CVSUIPlugin.EDIT.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_ACTION)); >+ } >+ >+ private EditorsAction fetchEditors(IFile[] files, Shell shell) throws InvocationTargetException, InterruptedException { >+ EditorsAction editors = new EditorsAction(getProvider(files),files); >+ run(shell, editors); >+ return editors; >+ } >+ >+ private boolean isNeverPrompt() { >+ return CVSUIPlugin.NEVERPROMPT.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_PROMPT)); >+ } >+ >+ private boolean isAlwaysPrompt() { >+ return CVSUIPlugin.ALWAYSPROMPT.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_PROMPT)); >+ } >+ >+ > private void run(Shell shell, final IRunnableWithProgress runnable) throws InvocationTargetException, InterruptedException { > final InvocationTargetException[] exception = new InvocationTargetException[] { null }; > CVSUIPlugin.runWithProgress(shell, false, runnable, CVSUIPlugin.PERFORM_SYNC_EXEC); >@@ -179,4 +213,5 @@ > private void edit(IFile[] files, IProgressMonitor monitor) throws CVSException { > getProvider(files).edit(files, false /* recurse */, true /* notify server */, ICVSFile.NO_NOTIFICATION, monitor); > } >+ > } >Index: src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java >=================================================================== >retrieving revision 1.61 >diff -u -r1.61 ICVSUIConstants.java >--- src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java 14 Nov 2003 20:55:00 -0000 1.61 >+++ src/org/eclipse/team/internal/ccvs/ui/ICVSUIConstants.java 26 Jan 2004 16:24:15 -0000 >@@ -102,6 +102,7 @@ > // watch/edit preferences > public final String PREF_CHECKOUT_READ_ONLY = "pref_checkout_read_only"; //$NON-NLS-1$ > public final String PREF_EDIT_ACTION = "pref_edit_action"; //$NON-NLS-1$ >+ public final String PREF_EDIT_PROMPT = "pref_edit_prompt"; > > // Repositories view preferences > public final String PREF_GROUP_VERSIONS_BY_PROJECT = "pref_group_versions_by_project"; //$NON-NLS-1$ >Index: src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java >=================================================================== >retrieving revision 1.5 >diff -u -r1.5 WatchEditPreferencePage.java >--- src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java 10 Mar 2003 21:24:14 -0000 1.5 >+++ src/org/eclipse/team/internal/ccvs/ui/WatchEditPreferencePage.java 26 Jan 2004 16:24:15 -0000 >@@ -14,6 +14,7 @@ > import org.eclipse.jface.preference.BooleanFieldEditor; > import org.eclipse.jface.preference.IPreferenceStore; > import org.eclipse.jface.preference.RadioGroupFieldEditor; >+import org.eclipse.jface.util.PropertyChangeEvent; > import org.eclipse.team.internal.ccvs.core.CVSProviderPlugin; > > /** >@@ -21,6 +22,11 @@ > */ > public class WatchEditPreferencePage extends CVSFieldEditorPreferencePage { > >+ private RadioGroupFieldEditor promptEditor; >+ private RadioGroupFieldEditor actionEditor; >+ private IPreferenceStore source; >+ private IPreferenceStore store; >+ > /** > * @see org.eclipse.team.internal.ccvs.ui.CVSPreferencePage#getPageHelpContextId() > */ >@@ -43,13 +49,30 @@ > Policy.bind("WatchEditPreferencePage.checkoutReadOnly"), //$NON-NLS-1$ > BooleanFieldEditor.DEFAULT, > getFieldEditorParent())); >- addField(new RadioGroupFieldEditor( >+ >+ actionEditor = new RadioGroupFieldEditor( > ICVSUIConstants.PREF_EDIT_ACTION, > Policy.bind("WatchEditPreferencePage.validateEditSaveAction"), //$NON-NLS-1$ > 1, >- new String[][] {{Policy.bind("WatchEditPreferencePage.edit"), CVSUIPlugin.EDIT}, {Policy.bind("WatchEditPreferencePage.highjack"), CVSUIPlugin.HIGHJACK}}, //$NON-NLS-1$ //$NON-NLS-2$ >- getFieldEditorParent(), true)); >- } >+ new String[][] {{Policy.bind("WatchEditPreferencePage.edit"), CVSUIPlugin.EDIT}, //$NON-NLS-1$ >+ {Policy.bind("WatchEditPreferencePage.highjack"), CVSUIPlugin.HIGHJACK}, //$NON-NLS-1$ >+ }, //$NON-NLS-1$ //$NON-NLS-2$ >+ getFieldEditorParent(), true); >+ addField(actionEditor); >+ >+ >+ promptEditor = new RadioGroupFieldEditor( >+ ICVSUIConstants.PREF_EDIT_PROMPT, >+ Policy.bind("WatchEditPreferencePage.editPrompt"), //$NON-NLS-1$ >+ 1, >+ new String[][] {{Policy.bind("WatchEditPreferencePage.alwaysPrompt"), CVSUIPlugin.ALWAYSPROMPT}, //$NON-NLS-1$ >+ {Policy.bind("WatchEditPreferencePage.onlyPrompt"), CVSUIPlugin.ONLYPROMPT}, //$NON-NLS-1$ >+ {Policy.bind("WatchEditPreferencePage.neverPrompt"), CVSUIPlugin.NEVERPROMPT}, //$NON-NLS-1$ >+ }, //$NON-NLS-1$ //$NON-NLS-2$ >+ getFieldEditorParent(), true); >+ store = getCVSPreferenceStore(); >+ addField(promptEditor); >+ } > > /** > * @see org.eclipse.jface.preference.IPreferencePage#performOk() >@@ -61,11 +84,31 @@ > } > > private void pushPreferences() { >- IPreferenceStore source = getCVSPreferenceStore(); >+ store = getCVSPreferenceStore(); > Preferences target = CVSProviderPlugin.getPlugin().getPluginPreferences(); > target.setValue( > CVSProviderPlugin.READ_ONLY, >- source.getBoolean(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY)); >+ store.getBoolean(ICVSUIConstants.PREF_CHECKOUT_READ_ONLY)); > } > >+ /* (non-Javadoc) >+ * @see org.eclipse.jface.util.IPropertyChangeListener#propertyChange(org.eclipse.jface.util.PropertyChangeEvent) >+ */ >+ public void propertyChange(PropertyChangeEvent event) { >+ if (event.getNewValue().equals(CVSUIPlugin.HIGHJACK)) >+ { >+ promptEditor.loadDefault(); >+ promptEditor.setEnabled(false,getFieldEditorParent()); >+ } >+ else if (event.getNewValue().equals(CVSUIPlugin.EDIT)) >+ { >+ promptEditor.loadDefault(); >+ promptEditor.setEnabled(true,getFieldEditorParent()); >+ } >+ else >+ promptEditor.setEnabled(true,getFieldEditorParent()); >+ super.propertyChange(event); >+ } >+ >+ > } >Index: src/org/eclipse/team/internal/ccvs/ui/messages.properties >=================================================================== >retrieving revision 1.299 >diff -u -r1.299 messages.properties >--- src/org/eclipse/team/internal/ccvs/ui/messages.properties 14 Jan 2004 04:09:49 -0000 1.299 >+++ src/org/eclipse/team/internal/ccvs/ui/messages.properties 26 Jan 2004 16:24:15 -0000 >@@ -863,8 +863,12 @@ > WatchEditPreferencePage.description=Settings for CVS Watch/Edit. > WatchEditPreferencePage.checkoutReadOnly=&Configure projects to use Watch/Edit on checkout > WatchEditPreferencePage.validateEditSaveAction=When read-only files are modified in an editor >-WatchEditPreferencePage.edit=Send a cvs &edit notification to the server >+WatchEditPreferencePage.edit=Send a CVS &edit notification to the server > WatchEditPreferencePage.highjack=Edit the file &without informing the server >+WatchEditPreferencePage.editPrompt=Before a CVS edit notification is sent to server >+WatchEditPreferencePage.neverPrompt=&Never prompt >+WatchEditPreferencePage.alwaysPrompt=Always &prompt >+WatchEditPreferencePage.onlyPrompt=&Only prompt if there are other editors > > Uneditaction.confirmMessage=Overwrite local changes to edited files? > Uneditaction.confirmTitle=Confirm Unedit >@@ -886,7 +890,7 @@ > EditorsView.computer=Computer name > > EditorsDialog.title=Editors >-EditorsDialog.question=The resource already has editors. Do you still want to edit the resource? >+EditorsDialog.question=The resource already has editors. Do you still want to edit the resource and send a CVS edit notification to server? > EditorsAction.classNotInitialized={0} not initialized > > TargetLocationSelectionDialog.projectNameLabel=&Project Name: >@@ -1053,3 +1057,5 @@ > SubscriberConfirmMergedAction.0=Synchronization information is missing for resource {0} > SubscriberConfirmMergedAction.jobName=Performing a CVS Mark as Merged operation on {0} resources. > CVSSubscriberAction.0=Invalid attemp to make unsupervised resource {0} in-sync. >+FileModificationValidator.3=Perform Edit? >+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? >Index: src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java >=================================================================== >retrieving revision 1.6 >diff -u -r1.6 EditorsAction.java >--- src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java 11 Mar 2003 19:17:55 -0000 1.6 >+++ src/org/eclipse/team/internal/ccvs/ui/actions/EditorsAction.java 26 Jan 2004 16:24:15 -0000 >@@ -57,17 +57,10 @@ > f_editorsInfo = provider.editors(resources, monitor); > return Team.OK_STATUS; > } >- >- public boolean isPerformEdit() { >- return CVSUIPlugin.EDIT.equals(CVSUIPlugin.getPlugin().getPreferenceStore().getString(ICVSUIConstants.PREF_EDIT_ACTION)); >- } >- > > public boolean promptToEdit(Shell shell) { > >- if (!isPerformEdit()) return true; >- >- if (f_editorsInfo.length > 0) { >+ if (!isEmpty()) { > final EditorsDialog view = new EditorsDialog(shell, f_editorsInfo); > // Open the dialog using a sync exec (there are no guarentees that we > // were called from the UI thread >@@ -105,6 +98,11 @@ > */ > public EditorsInfo[] getEditorsInfo() { > return f_editorsInfo; >+ } >+ >+ >+ public boolean isEmpty() { >+ return f_editorsInfo.length == 0; > } > > }
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 30657
: 7565