![]() |
![]() |
org.eclipse.team.ui_3.6.101.R37x_v20111109-0800teger mode = (Integer)event.getNewValue(); checkMode(mode.intValue()); } } public void dispose() { super.dispose(); } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.synchronize.actions.DirectionFilterActionGroup * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.synchronize.actions; import org.eclipse.jface.action.Action; import org.eclipse.jface.viewers.AbstractTreeViewer; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.SelectionChangedEvent; public class ExpandAllAction extends Action implements ISelectionChangedListener { private final AbstractTreeViewer viewer; public ExpandAllAction(AbstractTreeViewer viewer) { this.viewer = viewer; viewer.addSelectionChangedListener(this); } public void run() { expandAllFromSelection(); } /* Error */ protected void expandAllFromSelection() { // Byte code: // 0: aload_0 // 1: getfield 71 org/eclipse/team/internal/ui/synchronize/actions/ExpandAllAction:viewer Lorg/eclipse/jface/viewers/AbstractTreeViewer; // 4: astore_1 // 5: aload_1 // 6: ifnonnull +4 -> 10 // 9: return // 10: aload_1 // 11: invokevirtual 74 org/eclipse/jface/viewers/AbstractTreeViewer:getSelection ()Lorg/eclipse/jface/viewers/ISelection; // 14: astore_2 // 15: aload_2 // 16: invokeinterface 83 1 0 // 21: ifne +72 -> 93 // 24: aload_2 // 25: checkcast 39 org/eclipse/jface/viewers/IStructuredSelection // 28: invokeinterface 85 1 0 // 33: astore_3 // 34: aload_1 // 35: invokevirtual 76 org/eclipse/jface/viewers/AbstractTreeViewer:getControl ()Lorg/eclipse/swt/widgets/Control; // 38: iconst_0 // 39: invokevirtual 78 org/eclipse/swt/widgets/Control:setRedraw (Z)V // 42: goto +18 -> 60 // 45: aload_3 // 46: invokeinterface 82 1 0 // 51: astore 4 // 53: aload_1 // 54: aload 4 // 56: iconst_m1 // 57: invokevirtual 73 org/eclipse/jface/viewers/AbstractTreeViewer:expandToLevel (Ljava/lang/Object;I)V // 60: aload_3 // 61: invokeinterface 81 1 0 // 66: ifne -21 -> 45 // 69: goto +16 -> 85 // 72: astore 5 // 74: aload_1 // 75: invokevirtual 76 org/eclipse/jface/viewers/AbstractTreeViewer:getControl ()Lorg/eclipse/swt/widgets/Control; // 78: iconst_1 // 79: invokevirtual 78 org/eclipse/swt/widgets/Control:setRedraw (Z)V // 82: aload 5 // 84: athrow // 85: aload_1 // 86: invokevirtual 76 org/eclipse/jface/viewers/AbstractTreeViewer:getControl ()Lorg/eclipse/swt/widgets/Control; // 89: iconst_1 // 90: invokevirtual 78 org/eclipse/swt/widgets/Control:setRedraw (Z)V // 93: return // Line number table: // Java source line #32 -> byte code offset #0 // Java source line #33 -> byte code offset #5 // Java source line #34 -> byte code offset #10 // Java source line #35 -> byte code offset #15 // Java source line #36 -> byte code offset #24 // Java source line #38 -> byte code offset #34 // Java source line #39 -> byte code offset #42 // Java source line #40 -> byte code offset #45 // Java source line #41 -> byte code offset #53 // Java source line #39 -> byte code offset #60 // Java source line #43 -> byte code offset #72 // Java source line #44 -> byte code offset #74 // Java source line #45 -> byte code offset #82 // Java source line #44 -> byte code offset #85 // Java source line #47 -> byte code offset #93 // Local variable table: // start length slot name signature // 0 94 0 this ExpandAllAction // 4 82 1 tree AbstractTreeViewer // 14 11 2 selection ISelection // 33 28 3 elements java.util.Iterator // 51 4 4 next Object // 72 11 5 localObject1 Object // Exception table: // from to target type // 34 72 72 finally } public void selectionChanged(SelectionChangedEvent event) { ISelection selection = event.getSelection(); if ((selection instanceof IStructuredSelection)) { IStructuredSelection ss = (IStructuredSelection)selection; setEnabled(!ss.isEmpty()); return; } setEnabled(false); } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.synchronize.actions.ExpandAllAction * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.synchronize.actions; import org.eclipse.jface.action.Action; import org.eclipse.jface.wizard.IWizard; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.team.internal.ui.wizards.GlobalSynchronizeWizard; import org.eclipse.ui.IWorkbenchWindow; class GlobalRefreshAction$1 extends Action { final GlobalRefreshAction this$0; GlobalRefreshAction$1(GlobalRefreshAction paramGlobalRefreshAction, String $anonymous0) { super($anonymous0);this$0 = paramGlobalRefreshAction; } public void run() { IWizard wizard = new GlobalSynchronizeWizard(); WizardDialog dialog = new WizardDialog(GlobalRefreshAction.access$1(this$0).getShell(), wizard); dialog.open(); } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.synchronize.actions.GlobalRefreshAction.1 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.synchronize.actions; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.jface.action.Action; class GlobalRefreshAction$2 extends AbstractHandler { final GlobalRefreshAction this$0; GlobalRefreshAction$2(GlobalRefreshAction paramGlobalRefreshAction) { this$0 = paramGlobalRefreshAction; } public Object execute(ExecutionEvent event) throws ExecutionException { GlobalRefreshAction.access$2(this$0).run(); return null; } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.synchronize.actions.GlobalRefreshAction.2 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.synchronize.actions; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; class GlobalRefreshAction$3 extends AbstractHandler { final GlobalRefreshAction this$0; GlobalRefreshAction$3(GlobalRefreshAction paramGlobalRefreshAction) { this$0 = paramGlobalRefreshAction; } public Object execute(ExecutionEvent event) throws ExecutionException { this$0.run(); return null; } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.synchronize.actions.GlobalRefreshAction.3 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.synchronize.actions; import org.eclipse.jface.action.MenuManager; class GlobalRefreshAction$4 implements Runnable { final GlobalRefreshAction this$0; GlobalRefreshAction$4(GlobalRefreshAction paramGlobalRefreshAction) { this$0 = paramGlobalRefreshAction; } public void run() { if (GlobalRefreshAction.access$3(this$0) != null) { GlobalRefreshAction.access$3(this$0).dispose(); GlobalRefreshAction.access$4(this$0, null); } this$0.updateTooltipText(); } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.synchronize.actions.GlobalRefreshAction.4 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.synchronize.actions; import org.eclipse.jface.action.MenuManager; class GlobalRefreshAction$5 implements Runnable { final GlobalRefreshAction this$0; GlobalRefreshAction$5(GlobalRefreshAction paramGlobalRefreshAction) { this$0 = paramGlobalRefreshAction; } public void run() { if (GlobalRefreshAction.access$3(this$0) != null) { GlobalRefreshAction.access$3(this$0).dispose(); GlobalRefreshAction.access$4(this$0, null); } this$0.updateTooltipText(); } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.synchronize.actions.GlobalRefreshAction.5 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.synchronize.actions; import org.eclipse.jface.action.Action; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.team.internal.ui.TeamUIPlugin; import org.eclipse.team.internal.ui.Utils; import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor; import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference; class GlobalRefreshAction$RefreshParticipantAction extends Action { private ISynchronizeParticipantReference participant; final GlobalRefreshAction this$0; public void run() { TeamUIPlugin.getPlugin().getPreferenceStore().setValue("org.eclipse.team.ui.sychronizing_default_participant", participant.getId()); TeamUIPlugin.getPlugin().getPreferenceStore().setValue("org.eclipse.team.ui.sychronizing_default_participant_sec_id", participant.getSecondaryId()); GlobalRefreshAction.access$0(this$0, participant); } public GlobalRefreshAction$RefreshParticipantAction(GlobalRefreshAction paramGlobalRefreshAction, int prefix, ISynchronizeParticipantReference participant) { super("&" + prefix + " " + Utils.shortenText(100, participant.getDisplayName()));this$0 = paramGlobalRefreshAction; this.participant = participant; setImageDescriptor(participant.getDescriptor().getImageDescriptor()); } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.synchronize.actions.GlobalRefreshAction.RefreshParticipantAction * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.synchronize.actions; import org.eclipse.core.commands.AbstractHandler; import org.eclipse.core.commands.ExecutionEvent; import org.eclipse.core.commands.ExecutionException; import org.eclipse.core.commands.IHandler; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; import org.eclipse.jface.action.IMenuCreator; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.preference.IPreferenceStore; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.wizard.IWizard; import org.eclipse.jface.wizard.WizardDialog; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Menu; import org.eclipse.team.core.TeamException; import org.eclipse.team.internal.ui.TeamUIMessages; import org.eclipse.team.internal.ui.TeamUIPlugin; import org.eclipse.team.internal.ui.Utils; import org.eclipse.team.internal.ui.wizards.GlobalSynchronizeWizard; import org.eclipse.team.ui.TeamImages; import org.eclipse.team.ui.TeamUI; import org.eclipse.team.ui.synchronize.ISynchronizeManager; import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; import org.eclipse.team.ui.synchronize.ISynchronizeParticipantDescriptor; import org.eclipse.team.ui.synchronize.ISynchronizeParticipantListener; import org.eclipse.team.ui.synchronize.ISynchronizeParticipantReference; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.IWorkbenchWindowPulldownDelegate; import org.eclipse.ui.handlers.IHandlerActivation; import org.eclipse.ui.handlers.IHandlerService; public class GlobalRefreshAction extends Action implements IMenuCreator, IWorkbenchWindowPulldownDelegate, ISynchronizeParticipantListener { public static final String NO_DEFAULT_PARTICPANT = "none"; private MenuManager menuManager; private Action synchronizeAction; private IWorkbenchWindow window; private IAction actionProxy; private IHandlerActivation syncAll; private IHandlerActivation syncLatest; class RefreshParticipantAction extends Action { private ISynchronizeParticipantReference participant; public void run() { TeamUIPlugin.getPlugin().getPreferenceStore().setValue("org.eclipse.team.ui.sychronizing_default_participant", participant.getId()); TeamUIPlugin.getPlugin().getPreferenceStore().setValue("org.eclipse.team.ui.sychronizing_default_participant_sec_id", participant.getSecondaryId()); GlobalRefreshAction.this.run(participant); } public RefreshParticipantAction(int prefix, ISynchronizeParticipantReference participant) { super(); this.participant = participant; setImageDescriptor(participant.getDescriptor().getImageDescriptor()); } } public void dispose() { if (menuManager != null) { menuManager.dispose(); } TeamUI.getSynchronizeManager().removeSynchronizeParticipantListener(this); if (window != null) { IHandlerService hs = (IHandlerService)window.getService(IHandlerService.class); if (hs != null) { if (syncAll != null) { hs.deactivateHandler(syncAll); } if (syncLatest != null) { hs.deactivateHandler(syncLatest); } } } } public Menu getMenu(Menu parent) { return null; } public Menu getMenu(Control parent) { Menu fMenu = null; if (menuManager == null) { menuManager = new MenuManager(); fMenu = menuManager.createContextMenu(parent); menuManager.removeAll(); ISynchronizeParticipantReference[] participants = TeamUI.getSynchronizeManager().getSynchronizeParticipants(); for (int i = 0; i < participants.length; i++) { ISynchronizeParticipantReference description = participants[i]; Action action = new RefreshParticipantAction(i + 1, description); menuManager.add(action); } if (participants.length > 0) { menuManager.add(new Separator()); } menuManager.add(synchronizeAction); } else { fMenu = menuManager.getMenu(); } return fMenu; } public void init(IWorkbenchWindow window) { this.window = window; synchronizeAction = new Action(TeamUIMessages.GlobalRefreshAction_4) { public void run() { IWizard wizard = new GlobalSynchronizeWizard(); WizardDialog dialog = new WizardDialog(window.getShell(), wizard); dialog.open(); } }; synchronizeAction.setImageDescriptor(TeamImages.getImageDescriptor("eview16/synch_synch.gif")); synchronizeAction.setActionDefinitionId("org.eclipse.team.ui.synchronizeAll"); IHandlerService hs = (IHandlerService)window.getService(IHandlerService.class); if (hs != null) { IHandler handler = new AbstractHandler() { public Object execute(ExecutionEvent event) throws ExecutionException { synchronizeAction.run(); return null; } }; syncAll = hs.activateHandler("org.eclipse.team.ui.synchronizeAll", handler); handler = new AbstractHandler() { public Object execute(ExecutionEvent event) throws ExecutionException { run(); return null; } }; syncLatest = hs.activateHandler("org.eclipse.team.ui.synchronizeLast", handler); } setMenuCreator(this); TeamUI.getSynchronizeManager().addSynchronizeParticipantListener(this); } public void run() { String id = TeamUIPlugin.getPlugin().getPreferenceStore().getString("org.eclipse.team.ui.sychronizing_default_participant"); String secondaryId = TeamUIPlugin.getPlugin().getPreferenceStore().getString("org.eclipse.team.ui.sychronizing_default_participant_sec_id"); ISynchronizeParticipantReference participant = TeamUI.getSynchronizeManager().get(id, secondaryId); if (participant != null) { run(participant); } else { synchronizeAction.run(); } } public void run(IAction action) { run(); actionProxy = action; updateTooltipText(); } private void run(ISynchronizeParticipantReference participant) { try { ISynchronizeParticipant p = participant.getParticipant(); p.run(null); updateTooltipText(); } catch (TeamException e) { Utils.handle(e); } } public void participantsAdded(ISynchronizeParticipant[] consoles) { Display display = TeamUIPlugin.getStandardDisplay(); display.asyncExec(new Runnable() { public void run() { if (menuManager != null) { menuManager.dispose(); menuManager = null; } updateTooltipText(); } }); } public void participantsRemoved(ISynchronizeParticipant[] consoles) { Display display = TeamUIPlugin.getStandardDisplay(); display.asyncExec(new Runnable() { public void run() { if (menuManager != null) { menuManager.dispose(); menuManager = null; } updateTooltipText(); } }); } public void selectionChanged(IAction action, ISelection selection) { actionProxy = action; } protected void updateTooltipText() { if (actionProxy != null) { String id = TeamUIPlugin.getPlugin().getPreferenceStore().getString("org.eclipse.team.ui.sychronizing_default_participant"); String secondaryId = TeamUIPlugin.getPlugin().getPreferenceStore().getString("org.eclipse.team.ui.sychronizing_default_participant_sec_id"); if (!id.equals("none")) { ISynchronizeParticipantReference ref = TeamUI.getSynchronizeManager().get(id, secondaryId); if (ref != null) { actionProxy.setToolTipText(NLS.bind(TeamUIMessages.GlobalRefreshAction_5, new String[] { ref.getDisplayName() })); return; } } actionProxy.setToolTipText(TeamUIMessages.GlobalRefreshAction_4); } } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.synchronize.actions.GlobalRefreshAction * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.synchronize.actions; import org.eclipse.compare.ICompareNavigator; import org.eclipse.jface.action.Action; import org.eclipse.team.internal.ui.Utils; import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration; import org.eclipse.team.ui.synchronize.ISynchronizePageSite; import org.eclipse.ui.IActionBars; import org.eclipse.ui.actions.ActionFactory; public class NavigateAction extends Action { private final boolean next; private ISynchronizePageConfiguration configuration; public NavigateAction(ISynchronizePageConfiguration configuration, boolean next) { this.configuration = configuration; this.next = next; IActionBars bars = configuration.getSite().getActionBars(); if (next) { Utils.initAction(this, "action.navigateNext."); setActionDefinitionId(ActionFactory.NEXT.getCommandId()); if (bars != null) { bars.setGlobalActionHandler(ActionFactory.NEXT.getId(), this); } } else { Utils.initAction(this, "action.navigatePrevious."); setActionDefinitionId(ActionFactory.PREVIOUS.getCommandId()); if (bars != null) { bars.setGlobalActionHandler(ActionFactory.PREVIOUS.getId(), this); } } } public void run() { ICompareNavigator nav = (ICompareNavigator)configuration.getProperty("org.eclipse.team.ui.P_NAVIGATOR"); nav.selectChange(next); } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.synchronize.actions.NavigateAction * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.synchronize.actions; import java.util.Arrays; import java.util.Collections; import java.util.List; import org.eclipse.core.resources.IResource; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.team.internal.ui.Utils; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.actions.OpenFileAction; public class OpenFileInSystemEditorAction extends OpenFileAction { public OpenFileInSystemEditorAction(IWorkbenchPage page) { super(page); } protected List getSelectedResources() { IStructuredSelection selection = getStructuredSelection(); IResource[] resources = Utils.getResources(selection.toArray()); return Arrays.asList(resources); } protected List getSelectedNonResources() { return Collections.EMPTY_LIST; } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.synchronize.actions.OpenFileInSystemEditorAction * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.synchronize.actions; import java.lang.reflect.InvocationTargetException; import org.eclipse.compare.structuremergeviewer.ICompareInput; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.team.ui.mapping.ISynchronizationCompareInput; import org.eclipse.team.ui.synchronize.ISynchronizePageSite; import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant; class OpenInCompareAction$1 implements IRunnableWithProgress { private final boolean[] val$result; private final ModelSynchronizeParticipant val$msp; private final ISynchronizePageSite val$site; private final ICompareInput val$input; OpenInCompareAction$1(boolean[] paramArrayOfBoolean, ModelSynchronizeParticipant paramModelSynchronizeParticipant, ISynchronizePageSite paramISynchronizePageSite, ICompareInput paramICompareInput) { val$result = paramArrayOfBoolean;val$msp = paramModelSynchronizeParticipant;val$site = paramISynchronizePageSite;val$input = paramICompareInput; } public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { val$result[0] = val$msp.checkForBufferChange(val$site.getShell(), (ISynchronizationCompareInput)val$input, true, monitor); } catch (CoreException e) { throw new InvocationTargetException(e); } } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.synchronize.actions.OpenInCompareAction.1 * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.synchronize.actions; import java.lang.reflect.InvocationTargetException; import java.util.Iterator; import org.eclipse.compare.CompareEditorInput; import org.eclipse.compare.CompareUI; import org.eclipse.compare.structuremergeviewer.ICompareInput; import org.eclipse.core.resources.IResource; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.jface.action.Action; import org.eclipse.jface.operation.IRunnableWithProgress; import org.eclipse.jface.util.OpenStrategy; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.team.core.synchronize.SyncInfo; import org.eclipse.team.internal.ui.Utils; import org.eclipse.team.internal.ui.mapping.ModelCompareEditorInput; import org.eclipse.team.internal.ui.synchronize.SyncInfoModelElement; import org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchModelCompareEditorInput; import org.eclipse.team.internal.ui.synchronize.patch.ApplyPatchSubscriberMergeContext; import org.eclipse.team.ui.mapping.ISynchronizationCompareInput; import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration; import org.eclipse.team.ui.synchronize.ISynchronizePageSite; import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant; import org.eclipse.team.ui.synchronize.SyncInfoCompareInput; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IEditorReference; import org.eclipse.ui.IReusableEditor; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchPartSite; import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.progress.IProgressService; public class OpenInCompareAction extends Action { private final ISynchronizePageConfiguration configuration; public OpenInCompareAction(ISynchronizePageConfiguration configuration) { this.configuration = configuration; Utils.initAction(this, "action.openInCompareEditor."); } public void run() { ISelection selection = configuration.getSite().getSelectionProvider().getSelection(); if ((selection instanceof IStructuredSelection)) { if (!isOkToRun(selection)) { return; } boolean reuseEditorIfPossible = ((IStructuredSelection)selection).size() == 1; for (Iterator iterator = ((IStructuredSelection)selection).iterator(); iterator.hasNext();) { Object obj = iterator.next(); if ((obj instanceof SyncInfoModelElement)) { SyncInfo info = ((SyncInfoModelElement)obj).getSyncInfo(); if (info != null) { openCompareEditorOnSyncInfo(configuration, info, !OpenStrategy.activateOnOpen(), reuseEditorIfPossible); } } else if (obj != null) { openCompareEditor(configuration, obj, !OpenStrategy.activateOnOpen(), reuseEditorIfPossible); } } } } private boolean isOkToRun(ISelection selection) { Object[] elements = ((IStructuredSelection)selection).toArray(); ISynchronizeParticipant participant = configuration .getParticipant(); if ((participant instanceof ModelSynchronizeParticipant)) { ModelSynchronizeParticipant msp = (ModelSynchronizeParticipant)participant; for (int i = 0; i < elements.length; i++) { if (!msp.hasCompareInputFor(elements[i])) { return false; } } } else { IResource[] resources = Utils.getResources(elements); for (int i = 0; i < resources.length; i++) { if (resources[i].getType() != 1) { return false; } } } return true; } public static IEditorInput openCompareEditor(ISynchronizePageConfiguration configuration, Object object, boolean keepFocus, boolean reuseEditorIfPossible) { Assert.isNotNull(object); Assert.isNotNull(configuration); ISynchronizeParticipant participant = configuration.getParticipant(); ISynchronizePageSite site = configuration.getSite(); if ((object instanceof SyncInfoModelElement)) { SyncInfo info = ((SyncInfoModelElement)object).getSyncInfo(); if (info != null) { return openCompareEditorOnSyncInfo(configuration, info, keepFocus, reuseEditorIfPossible); } } if ((participant instanceof ModelSynchronizeParticipant)) { ModelSynchronizeParticipant msp = (ModelSynchronizeParticipant)participant; ICompareInput input = msp.asCompareInput(object); IWorkbenchPage workbenchPage = getWorkbenchPage(site); if ((input != null) && (workbenchPage != null) && (isOkToOpen(site, participant, input))) { if (isApplyPatchModelPresent(configuration)) { return openCompareEditor(workbenchPage, new ApplyPatchModelCompareEditorInput(msp, input, workbenchPage, configuration), keepFocus, site, reuseEditorIfPossible); } return openCompareEditor(workbenchPage, new ModelCompareEditorInput(msp, input, workbenchPage, configuration), keepFocus, site, reuseEditorIfPossible); } } return null; } private static boolean isApplyPatchModelPresent(ISynchronizePageConfiguration configuration) { Object object = configuration.getProperty("org.eclipse.team.ui.synchronizationContext"); return object instanceof ApplyPatchSubscriberMergeContext; } private static boolean isOkToOpen(ISynchronizePageSite site, ISynchronizeParticipant participant, ICompareInput input) { if (((participant instanceof ModelSynchronizeParticipant)) && ((input instanceof ISynchronizationCompareInput))) { ModelSynchronizeParticipant msp = (ModelSynchronizeParticipant)participant; boolean[] result = new boolean[1]; try { PlatformUI.getWorkbench().getProgressService().run(true, true, new IRunnableWithProgress() { private final ModelSynchronizeParticipant val$msp; private final ISynchronizePageSite val$site; private final ICompareInput val$input; public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { try { OpenInCompareAction.this[0] = val$msp.checkForBufferChange(val$site.getShell(), (ISynchronizationCompareInput)val$input, true, monitor); } catch (CoreException e) { throw new InvocationTargetException(e); } } }); } catch (InvocationTargetException e) { Utils.handleError(site.getShell(), e, null, null); } catch (InterruptedException localInterruptedException) { return false; } return result[0]; } return true; } public static CompareEditorInput openCompareEditorOnSyncInfo(ISynchronizePageConfiguration configuration, SyncInfo info, boolean keepFocus, boolean reuseEditorIfPossible) { Assert.isNotNull(info); Assert.isNotNull(configuration); if (info.getLocal().getType() != 1) { return null; } SyncInfoCompareInput input = new SyncInfoCompareInput(configuration, info); return openCompareEditor(getWorkbenchPage(configuration.getSite()), input, keepFocus, configuration.getSite(), reuseEditorIfPossible); } public static CompareEditorInput openCompareEditor(ISynchronizeParticipant participant, SyncInfo info, ISynchronizePageSite site) { Assert.isNotNull(info); Assert.isNotNull(participant); if (info.getLocal().getType() != 1) { return null; } SyncInfoCompareInput input = new SyncInfoCompareInput(participant, info); return openCompareEditor(getWorkbenchPage(site), input, false, site, false); } private static CompareEditorInput openCompareEditor(IWorkbenchPage page, CompareEditorInput input, boolean keepFocus, ISynchronizePageSite site, boolean reuseEditorIfPossible) { if (page == null) { return null; } openCompareEditor(input, page, reuseEditorIfPossible); if ((site != null) && (keepFocus)) { site.setFocus(); } return input; } private static IWorkbenchPage getWorkbenchPage(ISynchronizePageSite site) { IWorkbenchPage page = null; if ((site == null) || (site.getWorkbenchSite() == null)) { IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (window != null) { page = window.getActivePage(); } } else { page = site.getWorkbenchSite().getPage(); } return page; } public static void openCompareEditor(CompareEditorInput input, IWorkbenchPage page) { openCompareEditor(input, page, true); } public static void openCompareEditor(CompareEditorInput input, IWorkbenchPage page, boolean reuseEditorIfPossible) { if ((page == null) || (input == null)) { return; } IEditorPart editor = Utils.findReusableCompareEditor(input, page, new Class[] { SyncInfoCompareInput.class, ModelCompareEditorInput.class }); if ((editor != null) && (reuseEditorIfPossible)) { IEditorInput otherInput = editor.getEditorInput(); if (otherInput.equals(input)) { page.activate(editor); } else { CompareUI.reuseCompareEditor(input, (IReusableEditor)editor); page.activate(editor); } } else { CompareUI.openCompareEditorOnPage(input, page); } } public static IEditorPart findOpenCompareEditor(IWorkbenchPartSite site, IResource resource) { IWorkbenchPage page = site.getPage(); IEditorReference[] editorRefs = page.getEditorReferences(); for (int i = 0; i < editorRefs.length; i++) { IEditorPart part = editorRefs[i].getEditor(false); if (part != null) { IEditorInput input = part.getEditorInput(); if ((part != null) && ((input instanceof SyncInfoCompareInput))) { SyncInfo inputInfo = ((SyncInfoCompareInput)input).getSyncInfo(); if (inputInfo.getLocal().equals(resource)) { return part; } } } } return null; } public static IEditorPart findOpenCompareEditor(IWorkbenchPartSite site, Object object, ISynchronizeParticipant participant) { if ((object instanceof SyncInfoModelElement)) { SyncInfoModelElement element = (SyncInfoModelElement)object; SyncInfo info = element.getSyncInfo(); return findOpenCompareEditor(site, info.getLocal()); } IWorkbenchPage page = site.getPage(); IEditorReference[] editorRefs = page.getEditorReferences(); for (int i = 0; i < editorRefs.length; i++) { IEditorPart part = editorRefs[i].getEditor(false); if (part != null) { IEditorInput input = part.getEditorInput(); if (((input instanceof ModelCompareEditorInput)) && (((ModelCompareEditorInput)input).matches(object, participant))) { return part; } } } return null; } } /* Location: * Qualified Name: org.eclipse.team.internal.ui.synchronize.actions.OpenInCompareAction * Java Class Version: 1.2 (46.0) * JD-Core Version: 0.7.1 */ package org.eclipse.team.internal.ui.synchronize.actions; import org.eclipse.core.resources.IResource; import org.eclipse.jface.action.IContributionItem; import org.eclipse.jface.action.IMenuManager; import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.osgi.util.NLS; import org.eclipse.team.internal.ui.TeamUIMessages; import org.eclipse.team.internal.ui.Utils; import org.eclipse.team.ui.synchronize.ISynchronizePageConfiguration; import org.eclipse.team.ui.synchronize.ISynchronizePageSite; import org.eclipse.team.ui.synchronize.ISynchronizeParticipant; import org.eclipse.team.ui.synchronize.ModelSynchronizeParticipant; import org.eclipse.ui.IWorkbench; import org.eclipse.ui.IWorkbenchSite; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.actions.ActionGroup; import org.eclipse.ui.actions.ContributionItemFactory; import org.eclipse.ui.actions.OpenWithMenu; import org.eclipse.ui.keys.IBindingService; public class OpenWithActionGroup extends ActionGroup { private OpenFileInSystemEditorAction openFileAction; private OpenInCompareAction openInCompareAction; private final boolean includeOpenInCompare; private final ISynchronizePageConfiguration configuration; public OpenWithActionGroup(ISynchronizePageConfiguration configuration, boolean includeOpenInCompare) { this.configuration = configuration; this.includeOpenInCompare = includeOpenInCompare; makeActions(); } protected void makeActions() { IWorkbenchSite ws = getSite().getWorkbenchSite(); if (ws != null) { openFileAction = new OpenFileInSystemEditorAction(ws.getPage()); if (includeOpenInCompare) { openInCompareAction = new OpenInCompareAction(configuration); } } } private ISynchronizeParticipant getParticipant() { return configuration.getParticipant(); } private ISynchronizePageSite getSite() { return configuration.getSite(); } public void fillContextMenu(IMenuManager menu, String groupId) { ISelection selection = getSite().getSelectionProvider().getSelection(); if (((selection instanceof IStructuredSelection)) && (!hasFileMenu(menu))) { fillOpenWithMenu(menu, groupId, (IStructuredSelection)selection); } } private boolean hasFileMenu(IMenuManager menu) { return (menu.find(openFileAction.getId()) != null) || (menu.find("org.eclipse.ui.navigate.showInQuickMenu") != null); } private void fillOpenWithMenu(IMenuManager menu, String groupId, IStructuredSelection selection) { if ((selection == null) || (selection.size() < 1)) { return; } Object[] elements = selection.toArray(); IResource[] resources = Utils.getResources(elements); if (resources.length == 0) { if (openInCompareAction != null) { if (elements.length > 0) { ISynchronizeParticipant participant = getParticipant(); if ((participant instanceof ModelSynchronizeParticipant)) { ModelSynchronizeParticipant msp = (ModelSynchronizeParticipant)participant; boolean allElementsHaveCompareInput = true; for (int i = 0; i < elements.length; i++) { if (!msp.hasCompareInputFor(elements[i])) { allElementsHaveCompareInput = false; break; } } if (allElementsHaveCompareInput) { menu.appendToGroup(groupId, openInCompareAction); } } } } return; } if (elements.length != resources.length) { return; } boolean allFiles = true; for (int i = 0; i < resources.length; i++) { if (resources[i].getType() != 1) { allFiles = false; break; } } if ((allFiles) && (openInCompareAction != null)) { menu.appendToGroup(groupId, openInCompareAction); } for (int i = 0; i < resources.length; i++) { if (!resources[i].exists()) { return; } } if (allFiles) { if (openFileAction != null) { openFileAction.selectionChanged(selection); menu.appendToGroup(groupId, openFileAction); } if (resources.length == 1) { IWorkbenchSite ws = getSite().getWorkbenchSite(); if (ws != null) { MenuManager openWithSubmenu = new MenuManager(TeamUIMessages.OpenWithActionGroup_0); openWithSubmenu.add(new OpenWithMenu(ws.getPage(), resources[0])); menu.appendToGroup(groupId, openWithSubmenu); } } } IWorkbenchSite ws = getSite().getWorkbenchSite(); if (ws != null) { MenuManager showInSubmenu = new MenuManager(getShowInMenuLabel(), "org.eclipse.ui.navigate.showInQuickMenu"); IContributionItem showInMenu = ContributionItemFactory.VIEWS_SHOW_IN .create(ws.getWorkbenchWindow()); showInSubmenu.add(showInMenu); menu.appendToGroup(groupId, showInSubmenu); } } private static String getShowInMenuLabel() { String keyBinding = null; IBindingService bindingService = (IBindingService) PlatformUI.getWorkbench().getAdapter(IBindingService.class); if (bindingService != null) { keyBinding = bindingService.getBestActiveBindingFormattedFor("org.eclipse.ui.navigate.showInQuickMenu"); } if (keyBinding == null) { keyBinding = ""; } return NLS.bind(TeamUIMessages.SaveableCompareEditorInput_0, keyBinding); } public void openInCompareEditor() { if (openInCompareAction != null) { openInCompareAction.run(); } } } /* Location: * Qualified Further reading...For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.New!JAR listings
|