### Eclipse Workspace Patch 1.0 #P org.eclipse.compare Index: compare/org/eclipse/compare/internal/CompareWithOtherResourceAction.java =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/internal/CompareWithOtherResourceAction.java,v retrieving revision 1.3 diff -u -r1.3 CompareWithOtherResourceAction.java --- compare/org/eclipse/compare/internal/CompareWithOtherResourceAction.java 16 Sep 2008 14:03:31 -0000 1.3 +++ compare/org/eclipse/compare/internal/CompareWithOtherResourceAction.java 20 Mar 2009 09:39:20 -0000 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2008 Aleksandra Wozniak and others. + * Copyright (c) 2008, 2009 Aleksandra Wozniak and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -7,7 +7,7 @@ * * Contributors: * Aleksandra Wozniak (aleksandra.k.wozniak@gmail.com) - initial implementation - * IBM Corporation - Bug 73923 (major refactoring and adjustments) + * IBM Corporation - maintenance *******************************************************************************/ package org.eclipse.compare.internal; @@ -15,7 +15,10 @@ import org.eclipse.jface.viewers.IStructuredSelection; /** - * The "Compare with other resource" action + * The "Compare with other resource" action. + * + * @deprecated Temporarily replaced by CompareWithOtherResourceHandler. See bug + * 264498. */ public class CompareWithOtherResourceAction extends CompareAction { Index: plugin.xml =================================================================== RCS file: /cvsroot/eclipse/org.eclipse.compare/plugins/org.eclipse.compare/plugin.xml,v retrieving revision 1.69 diff -u -r1.69 plugin.xml --- plugin.xml 27 Feb 2009 12:44:07 -0000 1.69 +++ plugin.xml 20 Mar 2009 09:39:20 -0000 @@ -166,6 +166,7 @@ @@ -207,15 +208,6 @@ enablesFor="2+" id="compareWithEachOther"> - - Other Resource...". See bug 264498. + */ +public class CompareWithOtherResourceHandler extends AbstractHandler { + + public Object execute(ExecutionEvent event) throws ExecutionException { + ISelection selection = HandlerUtil.getCurrentSelection(event); + IWorkbenchPage workbenchPage = HandlerUtil.getActiveWorkbenchWindow(event).getActivePage(); + + // CompareAction#isEnabled(ISelection) + CompareConfiguration cc= new CompareConfiguration(); + cc.setProperty(CompareEditor.CONFIRM_SAVE_PROPERTY, new Boolean(false)); + ResourceCompareInput input= new ResourceCompareInput(cc); + + int selectionSize = 0; + if (selection instanceof IStructuredSelection) { + selectionSize = ((IStructuredSelection) selection).toArray().length; + } + if (input.isEnabled(selection) || selectionSize == 1) { + + // CompareAction#run(ISelection) + if (!input.setSelection(selection, workbenchPage.getWorkbenchWindow().getShell(), false)) + return null; + input.initializeCompareConfiguration(); + CompareUI.openCompareEditorOnPage(input, workbenchPage); + } + return null; + } + +}