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 117786 Details for
Bug 255201
[WorkingSet UI] Missing "Merge All" in "Import Project Set"
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]
Adds Merge All (and more) buttons
mergeAll.txt (text/plain), 9.10 KB, created by
Lars Millberg
on 2008-11-13 10:47:17 EST
(
hide
)
Description:
Adds Merge All (and more) buttons
Filename:
MIME Type:
Creator:
Lars Millberg
Created:
2008-11-13 10:47:17 EST
Size:
9.10 KB
patch
obsolete
>Index: src/org/eclipse/team/internal/ui/ProjectSetImporter.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/ProjectSetImporter.java,v >retrieving revision 1.9 >diff -u -r1.9 ProjectSetImporter.java >--- src/org/eclipse/team/internal/ui/ProjectSetImporter.java 25 Aug 2008 15:02:34 -0000 1.9 >+++ src/org/eclipse/team/internal/ui/ProjectSetImporter.java 13 Nov 2008 15:15:25 -0000 >@@ -13,13 +13,15 @@ > import java.io.*; > import java.lang.reflect.InvocationTargetException; > import java.util.*; >+import java.util.List; > > import org.eclipse.core.resources.IProject; > import org.eclipse.core.runtime.*; > import org.eclipse.jface.dialogs.IDialogConstants; > import org.eclipse.jface.dialogs.MessageDialog; > import org.eclipse.osgi.util.NLS; >-import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.graphics.Image; >+import org.eclipse.swt.widgets.*; > import org.eclipse.team.core.*; > import org.eclipse.team.internal.core.TeamPlugin; > import org.eclipse.ui.*; >@@ -89,6 +91,9 @@ > //try working sets > IMemento[] sets = xmlMemento.getChildren("workingSets"); //$NON-NLS-1$ > IWorkingSetManager wsManager = TeamUIPlugin.getPlugin().getWorkbench().getWorkingSetManager(); >+ boolean replaceAll = false; >+ boolean mergeAll = false; >+ boolean skipAll = false; > > for (int i = 0; i < sets.length; i++) { > IWorkingSet newWs = wsManager.createWorkingSet(sets[i]); >@@ -97,22 +102,48 @@ > .getName()); > if (oldWs == null) { > wsManager.addWorkingSet(newWs); >- } else { >+ } else if (replaceAll) { >+ replaceWorkingSet(wsManager, newWs, oldWs); >+ } else if (mergeAll) { >+ mergeWorkingSets(newWs, oldWs); >+ } else if (!skipAll) { > // a working set with the same name has been found > String title = TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_title; > String msg = NLS > .bind( > TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_message, > newWs.getName()); >- String[] buttons = new String[] { >- TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_replace, >- TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_merge, >- TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_skip, >- IDialogConstants.CANCEL_LABEL }; >- >- final MessageDialog dialog = new MessageDialog( >+ String[] buttons; >+ int[] returnCodes; >+ final int REPLACE = 0; >+ final int MERGE = 1; >+ final int SKIP = 2; >+ final int REPLACE_ALL = 3; >+ final int MERGE_ALL = 4; >+ final int SKIP_ALL = 5; >+ final int CANCEL = 6; >+ if ((i + 1) < sets.length) { >+ // Only show the "all" buttons if there are more sets to deal with. >+ buttons = new String[] { >+ TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_replace, >+ TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_merge, >+ TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_skip, >+ TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_replaceAll, >+ TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_mergeAll, >+ TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_skipAll, >+ IDialogConstants.CANCEL_LABEL }; >+ returnCodes = new int[]{REPLACE, MERGE, SKIP, REPLACE_ALL, MERGE_ALL, SKIP_ALL, CANCEL}; >+ } else { >+ buttons = new String[] { >+ TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_replace, >+ TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_merge, >+ TeamUIMessages.ImportProjectSetDialog_duplicatedWorkingSet_skip, >+ IDialogConstants.CANCEL_LABEL }; >+ returnCodes = new int[]{REPLACE, MERGE, SKIP, CANCEL}; >+ } >+ final MessageDialog dialog = new CustomReturnCodesMessageDialog( > shell, title, null, msg, >- MessageDialog.QUESTION, buttons, 0); >+ MessageDialog.QUESTION, buttons, returnCodes, 0); > > shell.getDisplay().syncExec(new Runnable() { > public void run() { >@@ -121,24 +152,25 @@ > }); > > switch (dialog.getReturnCode()) { >- case 0: // overwrite >- if (oldWs != null) >- wsManager.removeWorkingSet(oldWs); >- wsManager.addWorkingSet(newWs); >+ case REPLACE: // overwrite >+ replaceWorkingSet(wsManager, newWs, oldWs); >+ break; >+ case REPLACE_ALL: >+ replaceWorkingSet(wsManager, newWs, oldWs); >+ replaceAll = true; >+ break; >+ case MERGE: // combine >+ mergeWorkingSets(newWs, oldWs); > break; >- case 1: // combine >- IAdaptable[] oldElements = oldWs.getElements(); >- IAdaptable[] newElements = newWs.getElements(); >- >- Set combinedElements = new HashSet(); >- combinedElements.addAll(Arrays.asList(oldElements)); >- combinedElements.addAll(Arrays.asList(newElements)); >- >- oldWs.setElements((IAdaptable[]) combinedElements.toArray(new IAdaptable[0])); >+ case MERGE_ALL: >+ mergeWorkingSets(newWs, oldWs); >+ mergeAll = true; >+ case SKIP: // skip > break; >- case 2: // skip >+ case SKIP_ALL: >+ skipAll = true; > break; >- case 3: // cancel >+ case CANCEL: // cancel > default: > throw new OperationCanceledException(); > } >@@ -184,4 +216,43 @@ > } > } > >+ private static void mergeWorkingSets(IWorkingSet newWs, IWorkingSet oldWs) { >+ IAdaptable[] oldElements = oldWs.getElements(); >+ IAdaptable[] newElements = newWs.getElements(); >+ >+ Set combinedElements = new HashSet(); >+ combinedElements.addAll(Arrays.asList(oldElements)); >+ combinedElements.addAll(Arrays.asList(newElements)); >+ >+ oldWs.setElements((IAdaptable[]) combinedElements.toArray(new IAdaptable[0])); >+ } >+ >+ private static void replaceWorkingSet(IWorkingSetManager wsManager, IWorkingSet newWs, IWorkingSet oldWs) { >+ if (oldWs != null) >+ wsManager.removeWorkingSet(oldWs); >+ wsManager.addWorkingSet(newWs); >+ } >+ >+ protected static class CustomReturnCodesMessageDialog extends MessageDialog { >+ private int[] returnCodes; >+ public CustomReturnCodesMessageDialog( >+ Shell parentShell, >+ String dialogTitle, >+ Image dialogTitleImage, >+ String dialogMessage, >+ int dialogImageType, >+ String[] dialogButtonLabels, >+ int[] returnCodes, >+ int defaultIndex) { >+ super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels, defaultIndex); >+ this.returnCodes = returnCodes; >+ } >+ >+ protected Button createButton(Composite parent, int id, String label, boolean defaultButton) { >+ Button button = super.createButton(parent, id, label, defaultButton); >+ button.setData(new Integer(returnCodes[id])); >+ return button; >+ } >+ } >+ > } >Index: src/org/eclipse/team/internal/ui/messages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/messages.properties,v >retrieving revision 1.242 >diff -u -r1.242 messages.properties >--- src/org/eclipse/team/internal/ui/messages.properties 13 Nov 2008 10:31:12 -0000 1.242 >+++ src/org/eclipse/team/internal/ui/messages.properties 13 Nov 2008 15:15:26 -0000 >@@ -120,6 +120,9 @@ > ImportProjectSetDialog_duplicatedWorkingSet_replace=Replace > ImportProjectSetDialog_duplicatedWorkingSet_merge=Merge > ImportProjectSetDialog_duplicatedWorkingSet_skip=Skip >+ImportProjectSetDialog_duplicatedWorkingSet_replaceAll=Replace All >+ImportProjectSetDialog_duplicatedWorkingSet_mergeAll=Merge All >+ImportProjectSetDialog_duplicatedWorkingSet_skipAll=Skip All > > ProjectSetContentHandler_Element_provider_must_be_contained_in_element_psf_4=Element provider must be contained in element psf > ProjectSetContentHandler_Element_project_must_be_contained_in_element_provider_7=Element project must be contained in element provider >Index: src/org/eclipse/team/internal/ui/TeamUIMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/TeamUIMessages.java,v >retrieving revision 1.74 >diff -u -r1.74 TeamUIMessages.java >--- src/org/eclipse/team/internal/ui/TeamUIMessages.java 13 Nov 2008 10:31:12 -0000 1.74 >+++ src/org/eclipse/team/internal/ui/TeamUIMessages.java 13 Nov 2008 15:15:25 -0000 >@@ -113,6 +113,9 @@ > public static String ImportProjectSetDialog_duplicatedWorkingSet_replace; > public static String ImportProjectSetDialog_duplicatedWorkingSet_merge; > public static String ImportProjectSetDialog_duplicatedWorkingSet_skip; >+ public static String ImportProjectSetDialog_duplicatedWorkingSet_replaceAll; >+ public static String ImportProjectSetDialog_duplicatedWorkingSet_mergeAll; >+ public static String ImportProjectSetDialog_duplicatedWorkingSet_skipAll; > > public static String information; >
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 255201
: 117786