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 108533 Details for
Bug 239959
Adding content to "Compare with other resource" dialog by drag&dropping
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
patch #7
patch-239959-5 (text/plain), 10.18 KB, created by
Aleksandra Wozniak
on 2008-07-28 07:11:28 EDT
(
hide
)
Description:
patch #7
Filename:
MIME Type:
Creator:
Aleksandra Wozniak
Created:
2008-07-28 07:11:28 EDT
Size:
10.18 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.compare >Index: compare/org/eclipse/compare/internal/CompareMessages.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.java,v >retrieving revision 1.17.4.3 >diff -u -r1.17.4.3 CompareMessages.java >--- compare/org/eclipse/compare/internal/CompareMessages.java 21 Jul 2008 15:12:12 -0000 1.17.4.3 >+++ compare/org/eclipse/compare/internal/CompareMessages.java 28 Jul 2008 11:05:07 -0000 >@@ -118,6 +118,7 @@ > public static String CompareWithOther_error_empty; > public static String CompareWithOther_clear; > public static String CompareWithOther_warning_two_way; >+ public static String CompareWithOther_info; > > static { > NLS.initializeMessages(BUNDLE_NAME, CompareMessages.class); >Index: compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/Attic/CompareWithOtherResourceDialog.java,v >retrieving revision 1.1.2.3 >diff -u -r1.1.2.3 CompareWithOtherResourceDialog.java >--- compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java 21 Jul 2008 15:12:12 -0000 1.1.2.3 >+++ compare/org/eclipse/compare/internal/CompareWithOtherResourceDialog.java 28 Jul 2008 11:05:07 -0000 >@@ -166,7 +166,7 @@ > createContents(parent); > } > >- public InternalSection() { >+ private InternalSection() { > // not to instantiate > } > >@@ -398,6 +398,7 @@ > super.createButtonsForButtonBar(parent); > okButton = getButton(IDialogConstants.OK_ID); > updateErrorInfo(); >+ setMessage(CompareMessages.CompareWithOther_info); > } > > private void setSelection(ISelection selection) { >@@ -419,7 +420,7 @@ > } > } > >- private boolean comparePossible() { >+ private boolean isComparePossible() { > IResource[] resources; > if (ancestorPanel.getResource() == null) { > resources = new IResource[] { leftPanel.getResource(), >@@ -445,13 +446,13 @@ > && ancestorPanel.fileText.getText() != "") { //$NON-NLS-1$ > setMessage(CompareMessages.CompareWithOther_warning_two_way, > IMessageProvider.WARNING); >- } else if (!comparePossible()) { >+ } else if (!isComparePossible()) { > setMessage( > CompareMessages.CompareWithOther_error_not_comparable, > IMessageProvider.ERROR); > okButton.setEnabled(false); > } else { >- setMessage(null); >+ setMessage(CompareMessages.CompareWithOther_info); > okButton.setEnabled(true); > } > } >Index: compare/org/eclipse/compare/internal/CompareWithOtherResourceAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/Attic/CompareWithOtherResourceAction.java,v >retrieving revision 1.1.2.2 >diff -u -r1.1.2.2 CompareWithOtherResourceAction.java >--- compare/org/eclipse/compare/internal/CompareWithOtherResourceAction.java 16 Jul 2008 10:45:52 -0000 1.1.2.2 >+++ compare/org/eclipse/compare/internal/CompareWithOtherResourceAction.java 28 Jul 2008 11:05:07 -0000 >@@ -10,51 +10,29 @@ > *******************************************************************************/ > package org.eclipse.compare.internal; > >-import org.eclipse.core.resources.IResource; >-import org.eclipse.jface.action.IAction; >-import org.eclipse.jface.dialogs.IDialogConstants; >+import org.eclipse.compare.CompareConfiguration; > import org.eclipse.jface.viewers.ISelection; >-import org.eclipse.jface.viewers.StructuredSelection; >-import org.eclipse.swt.widgets.Shell; >-import org.eclipse.ui.IObjectActionDelegate; >-import org.eclipse.ui.IWorkbenchPart; >-import org.eclipse.ui.PlatformUI; >+ > > /** > * The "Compare with other resource" action >- * >+ * > * @since 3.4 > */ >-public class CompareWithOtherResourceAction implements IObjectActionDelegate { >- >- private Shell shell; >- private ISelection fSelection; >- private IWorkbenchPart fWorkbenchPart; >- >- public CompareWithOtherResourceAction() { >- shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); >- } >+public class CompareWithOtherResourceAction extends CompareAction { > >- public void setActivePart(IAction action, IWorkbenchPart targetPart) { >- fWorkbenchPart = targetPart; >+ public void run(ISelection selection) { >+ selectAncestor = false; >+ super.run(selection); > } > >- public void run(IAction action) { >- CompareWithOtherResourceDialog dialog = new CompareWithOtherResourceDialog(shell, fSelection); >- int returnCode = dialog.open(); >- >- if (returnCode == IDialogConstants.OK_ID) { >- IResource[] resources = dialog.getResult(); >- StructuredSelection ss = new StructuredSelection(resources); >- CompareAction ca = new CompareAction(); >- ca.setActivePart(null, fWorkbenchPart); >- if (ca.isEnabled(ss)) >- ca.run(ss); >+ protected boolean isEnabled(ISelection selection) { >+ if (fInput == null) { >+ CompareConfiguration cc= new CompareConfiguration(); >+ cc.setProperty(CompareEditor.CONFIRM_SAVE_PROPERTY, new Boolean(false)); >+ fInput= new ResourceCompareInput(cc); > } >- } >- >- public void selectionChanged(IAction action, ISelection selection) { >- fSelection = selection; >+ return true; > } > > } >Index: compare/org/eclipse/compare/internal/CompareMessages.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareMessages.properties,v >retrieving revision 1.27.4.3 >diff -u -r1.27.4.3 CompareMessages.properties >--- compare/org/eclipse/compare/internal/CompareMessages.properties 21 Jul 2008 15:12:12 -0000 1.27.4.3 >+++ compare/org/eclipse/compare/internal/CompareMessages.properties 28 Jul 2008 11:05:07 -0000 >@@ -128,5 +128,6 @@ > CompareWithOther_dialogMessage=Select resources to compare > CompareWithOther_error_not_comparable=Selected resources are not comparable. > CompareWithOther_error_empty=Both left and right panel must contain a valid path. >-CompareWithOther_warning_two_way=Ancestor is not a valid resource. Two-way compare will be performed. >-CompareWithOther_clear=Clear >\ No newline at end of file >+CompareWithOther_warning_two_way=Ancestor is not a valid resource. Two-way compare will be performed. >+CompareWithOther_clear=Clear >+CompareWithOther_info=Drag files from Package Explorer or from another field within the dialog. >Index: compare/org/eclipse/compare/internal/CompareAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareAction.java,v >retrieving revision 1.20.8.2 >diff -u -r1.20.8.2 CompareAction.java >--- compare/org/eclipse/compare/internal/CompareAction.java 16 Jul 2008 10:45:52 -0000 1.20.8.2 >+++ compare/org/eclipse/compare/internal/CompareAction.java 28 Jul 2008 11:05:07 -0000 >@@ -26,16 +26,17 @@ > */ > public class CompareAction extends BaseCompareAction implements IObjectActionDelegate { > >- private ResourceCompareInput fInput; >- private IWorkbenchPage fWorkbenchPage; >- >+ protected ResourceCompareInput fInput; >+ protected IWorkbenchPage fWorkbenchPage; >+ protected boolean selectAncestor = true; > > public void run(ISelection selection) { >+ boolean ok; > if (fInput != null) { > // Pass the shell so setSelection can prompt the user for which > // resource should be the ancestor >- boolean ok = fInput.setSelection(selection, >- fWorkbenchPage.getWorkbenchWindow().getShell()); >+ ok = fInput.setSelection(selection, >+ fWorkbenchPage.getWorkbenchWindow().getShell(), selectAncestor); > if (!ok) return; > fInput.initializeCompareConfiguration(); > CompareUI.openCompareEditorOnPage(fInput, fWorkbenchPage); >Index: compare/org/eclipse/compare/internal/ResourceCompareInput.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/ResourceCompareInput.java,v >retrieving revision 1.38.8.2 >diff -u -r1.38.8.2 ResourceCompareInput.java >--- compare/org/eclipse/compare/internal/ResourceCompareInput.java 16 Jul 2008 10:45:52 -0000 1.38.8.2 >+++ compare/org/eclipse/compare/internal/ResourceCompareInput.java 28 Jul 2008 11:05:07 -0000 >@@ -200,8 +200,11 @@ > // If the compare is three-way, this method asks the user which resource > // to use as the ancestor. Returns false if the user cancels the prompt, > // true otherwise. >- boolean setSelection(ISelection s, Shell shell) { >- >+ boolean setSelection(ISelection s, Shell shell, boolean selectAncestor) { >+ >+ if (!selectAncestor) >+ return showDialog(shell, s); >+ > IResource[] selection= Utilities.getResources(s); > > fThreeWay= selection.length == 3; >@@ -223,12 +226,43 @@ > fLeftResource= selection[0]; > fRightResource= selection[1]; > } >+ fLeft= getStructure(fLeftResource); >+ fRight= getStructure(fRightResource); >+ return true; >+ } >+ >+ private boolean showDialog(Shell shell, ISelection s) { >+ CompareWithOtherResourceDialog dialog = new CompareWithOtherResourceDialog(shell, s); >+ if (dialog.open() != IDialogConstants.OK_ID) >+ return false; >+ IResource[] selection = dialog.getResult(); >+ if (!resourcesOK(selection)) >+ return false; > >+ fThreeWay = selection.length == 3; >+ if (fThreeWay) { >+ fAncestorResource = selection[0]; >+ fAncestor = getStructure(fAncestorResource); >+ fLeftResource = selection[1]; >+ fRightResource = selection[2]; >+ } else { >+ fAncestorResource = null; >+ fAncestor = null; >+ fLeftResource = selection[0]; >+ fRightResource = selection[1]; >+ } > fLeft= getStructure(fLeftResource); > fRight= getStructure(fRightResource); > return true; > } >- >+ >+ private boolean resourcesOK(IResource[] resources) { >+ for (int i = 0; i < resources.length; i++) >+ if (resources[i] == null) >+ return false; >+ return true; >+ } >+ > /* > * Returns true if compare can be executed for the given selection. > */
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 239959
:
106813
|
106961
|
107452
|
107717
|
107944
|
108052
|
108194
|
108533
|
108951