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 59355 Details for
Bug 173457
[Actions] Convert Team action set to new menu support
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]
Updated version of the patch
patch_173457_20070220.txt (text/plain), 45.17 KB, created by
Tomasz Zarna
on 2007-02-20 04:31:29 EST
(
hide
)
Description:
Updated version of the patch
Filename:
MIME Type:
Creator:
Tomasz Zarna
Created:
2007-02-20 04:31:29 EST
Size:
45.17 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.team.ui >Index: plugin.properties >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/plugin.properties,v >retrieving revision 1.1 >diff -u -r1.1 plugin.properties >--- plugin.properties 13 Feb 2007 17:27:24 -0000 1.1 >+++ plugin.properties 20 Feb 2007 16:23:26 -0000 >@@ -23,17 +23,20 @@ > TextPreferencePage.name=File Content > IgnorePreferencePage.name=Ignored Resources > >-ConfigureProject.label=&Share Project... >+ConfigureProject.label=Share Project... > ConfigureProject.tooltip=Share the project with others using a version and configuration management system. >+ConfigureProject.mnemonic=S > >-ApplyPatch.label=Appl&y Patch... >+ApplyPatch.label=Apply Patch... > ApplyPatch.tooltip=Apply a patch to one or more workspace projects. >+ApplyPatch.mnemonic=y > Command.applyPatch.name=Apply Patch... > Command.applyPatch.description=Apply a patch to one or more workspace projects. > > ImportProjectSet.label=Import Project &Set... > >-TeamGroupMenu.label=T&eam >+TeamGroupMenu.label=Team >+TeamGroupMenu.mnemonic=e > Team.viewCategory=Team > > Synchronizing.perspective=Team Synchronizing >@@ -60,6 +63,17 @@ > Command.syncLast.name=Repeat last synchronization > Command.syncLast.description=Repeat the last synchronization > >+Command.importProjectSet.name=Import Project Set... >+Command.importProjectSet.description=Import Project Set into the workspace >+ >+Command.showLocalHistory.name=Show Local History >+Command.showLocalHistory.description=Show Local History >+ >+Command.compareLocalHistory.name=Local History... >+Command.compareLocalHistory.description=Compare the Selected Resource with Local History >+ >+Command.configureProject.name=Share Project... >+ > CompressFolderView.name=Compress Folders > CompressFolderView.description=Compress in-sync folders paths > >@@ -74,8 +88,11 @@ > EnabledModels = Models > Workspace=Workspace > >-ShowLocalHistory.label=Show Local &History >-CompareLocalHistory.label= &Local History... >-CompareLocalHistory.tooltip= Compare the Selected Resource with Local History >-ReplaceLocalHistory.label= &Local History... >+ShowLocalHistory.label=Show Local History >+ShowLocalHistory.mnemonic=H >+CompareLocalHistory.label=Local History... >+CompareLocalHistory.tooltip=Compare the Selected Resource with Local History >+CompareLocalHistory.mnemonic=L >+ReplaceLocalHistory.label= Local History... > ReplaceLocalHistory.tooltip= Replace the Selected Resource with Local History >+ReplaceLocalHistory.mnemonic=L >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/plugin.xml,v >retrieving revision 1.1 >diff -u -r1.1 plugin.xml >--- plugin.xml 13 Feb 2007 17:27:24 -0000 1.1 >+++ plugin.xml 20 Feb 2007 16:23:26 -0000 >@@ -49,7 +49,7 @@ > <!-- ****************** POPUP ACTIONS *************** --> > <extension > point="org.eclipse.ui.popupMenus"> >- <objectContribution >+ <!--objectContribution > objectClass="org.eclipse.core.resources.mapping.ResourceMapping" > adaptable="true" > id="org.eclipse.team.ui.ResourceContributions"> >@@ -94,8 +94,8 @@ > name="projectGroup"> > </separator> > </menu> >- </objectContribution> >- <objectContribution >+ </objectContribution--> >+ <!--objectContribution > objectClass="org.eclipse.core.resources.mapping.ResourceMapping" > adaptable="true" > id="org.eclipse.team.ui.ProjectContributions"> >@@ -114,8 +114,8 @@ > </adapt> > </not> > </enablement> >- </objectContribution> >- <objectContribution >+ </objectContribution--> >+ <!--objectContribution > objectClass="org.eclipse.core.resources.IFile" > nameFilter="*.psf" > id="org.eclipse.team.ui.ProjectSetFileContributions"> >@@ -126,26 +126,26 @@ > enablesFor="*" > id="nonbound.org.eclipse.team.ui.ImportProjectSetAction"> > </action> >- </objectContribution> >+ </objectContribution--> > <objectContribution > adaptable="true" > id="org.eclipse.team.ui.UnmanagedFileContributions" > objectClass="org.eclipse.core.resources.IFile"> >- <action >+ <!--action > class="org.eclipse.team.internal.ui.history.ShowLocalHistory" > id="org.eclipse.team.ui.showLocalHistory" > label="%ShowLocalHistory.label" > menubarPath="team.main/group4" > enablesFor="1" >- tooltip="%ShowLocalHistory.label"/> >- <action >+ tooltip="%ShowLocalHistory.label"/--> >+ <!--action > class="org.eclipse.team.internal.ui.history.CompareLocalHistory" > id="org.eclipse.team.ui.compareLocalHistory" > label="%CompareLocalHistory.label" > menubarPath="compareWithMenu/compareWithGroup" > enablesFor="1" > overrideActionId="compareWithHistory" >- tooltip="%CompareLocalHistory.tooltip"/> >+ tooltip="%CompareLocalHistory.tooltip"/--> > <action > class="org.eclipse.team.internal.ui.history.ReplaceLocalHistory" > id="org.eclipse.team.ui.replaceLocalHistory" >@@ -317,6 +317,48 @@ > description="%ViewCommand.historyView.description" > categoryId="org.eclipse.ui.category.views" > id="org.eclipse.team.ui.GenericHistoryView"/> >+ <!-- TZarna: added commands --> >+ <command >+ categoryId="org.eclipse.team.ui.category.team" >+ defaultHandler="org.eclipse.team.internal.ui.handlers.ApplyPatchHandler" >+ description="%Command.applyPatch.description" >+ id="org.eclipse.team.ui.applyPatch" >+ name="%Command.applyPatch.name"> >+ </command> >+ <command >+ categoryId="org.eclipse.team.ui.category.team" >+ defaultHandler="org.eclipse.team.internal.ui.handlers.ConfigureProjectHandler" >+ id="org.eclipse.team.ui.configureProject" >+ name="%Command.configureProject.name"> >+ </command> >+ <command >+ categoryId="org.eclipse.team.ui.category.team" >+ defaultHandler="org.eclipse.team.internal.ui.handlers.SynchronizeHandler" >+ description="%Command.syncAll.description" >+ id="org.eclipse.team.ui.synchronizeAll" >+ name="%Command.syncAll.name"> >+ </command> >+ <command >+ categoryId="org.eclipse.team.ui.category.team" >+ defaultHandler="org.eclipse.team.internal.ui.handlers.ImportProjectSetHandler" >+ description="%Command.importProjectSet.description" >+ id="org.eclipse.team.ui.importProjectSet" >+ name="%Command.importProjectSet.name"> >+ </command> >+ <command >+ categoryId="org.eclipse.team.ui.category.team" >+ defaultHandler="org.eclipse.team.internal.ui.history.ShowLocalHistoryHandler" >+ description="%Command.showLocalHistory.description" >+ id="org.eclipse.team.ui.showLocalHistory" >+ name="%Command.showLocalHistory.name"> >+ </command> >+ <command >+ categoryId="org.eclipse.team.ui.category.team" >+ defaultHandler="org.eclipse.team.internal.ui.history.CompareLocalHistoryHandler" >+ description="%Command.compareLocalHistory.description" >+ id="org.eclipse.team.ui.compareLocalHistory" >+ name="%Command.compareLocalHistory.name"> >+ </command> > </extension> > > <extension >@@ -333,7 +375,7 @@ > schemeId="org.eclipse.ui.defaultAcceleratorConfiguration"/> > </extension> > <!-- action sets --> >- <extension >+ <!--extension > point="org.eclipse.ui.actionSets"> > <actionSet > label="%Command.category.name" >@@ -366,7 +408,7 @@ > menubarPath="project/additions" > tooltip="%ApplyPatch.tooltip"/> > </actionSet> >- </extension> >+ </extension--> > > <!-- file modification validator --> > >@@ -494,4 +536,161 @@ > </triggerPoint> > </extension> > >+ <!-- *************** Menus **************** --> >+ <extension >+ point="org.eclipse.ui.menus"> >+ <menuContribution >+ locationURI="menu:project?after=additions"> >+ <!-- always enabled --> >+ <command >+ commandId="org.eclipse.team.ui.applyPatch" >+ label="%ApplyPatch.label" >+ mnemonic="%ApplyPatch.mnemonic" >+ style="push" >+ tooltip="%ApplyPatch.tooltip"> >+ <visibleWhen >+ checkEnabled="false"> >+ </visibleWhen> >+ </command> >+ </menuContribution> >+ <menuContribution >+ locationURI="menu:project?after=open.ext"> >+ <!-- enablement? --> >+ <command >+ commandId="org.eclipse.team.ui.configureProject" >+ id="org.eclipse.team.ui.ConfigureProject" >+ label="%ConfigureProject.label" >+ mnemonic="%ConfigureProject.mnemonic" >+ style="push" >+ tooltip="%ConfigureProject.tooltip"> >+ </command> >+ </menuContribution> >+ <menuContribution >+ locationURI="toolbar:org.eclipse.ui.main.toolbar"> >+ <toolbar >+ id="whatever"> >+ <command >+ commandId="org.eclipse.team.ui.synchronizeAll" >+ icon="$nl$/icons/full/elcl16/synch_participants.gif" >+ label="%Command.syncAll.name" >+ style="pulldown"> >+ </command> >+ </toolbar> >+ <!--toolbar >+ id="toolbar:org.eclipse.ui.main.toolbar?after=search"> >+ <command >+ commandId="org.eclipse.team.ui.synchronizeAll2" >+ icon="$nl$/icons/full/elcl16/synch_participants.gif" >+ label="%Command.syncAll.name" >+ style="pulldown"> >+ </command> >+ </toolbar--> >+ </menuContribution> >+ <menuContribution >+ locationURI="popup:org.eclipse.ui.popup.any?after=team.main"> >+ <!-- should be enabled only for IFiles with *.psf extension, multiselection is allowed --> >+ <command >+ commandId="org.eclipse.team.ui.importProjectSet" >+ label="%Command.importProjectSet.name" >+ style="push"> >+ </command> >+ </menuContribution> >+ <menuContribution >+ locationURI="popup:team.main?after=projectGroup"> >+ <command >+ commandId="org.eclipse.team.ui.configureProject" >+ id="nonbound.org.eclipse.team.ui.ConfigureProject" >+ label="%ConfigureProject.label" >+ mnemonic="%ConfigureProject.mnemonic" >+ style="push" >+ tooltip="%ConfigureProject.tooltip"> >+ </command> >+ </menuContribution> >+ <menuContribution >+ locationURI="popup:org.eclipse.ui.popup.any"> >+ <menu >+ id="team.main" >+ label="%TeamGroupMenu.label" >+ mnemonic="%TeamGroupMenu.mnemonic"> >+ <separator >+ name="group1" >+ visible="true"> >+ </separator> >+ <separator >+ name="group2" >+ visible="true"> >+ </separator> >+ <separator >+ name="group3" >+ visible="true"> >+ </separator> >+ <separator >+ name="group4" >+ visible="true"> >+ </separator> >+ <separator >+ name="group5" >+ visible="true"> >+ </separator> >+ <separator >+ name="group6" >+ visible="true"> >+ </separator> >+ <separator >+ name="group7" >+ visible="true"> >+ </separator> >+ <separator >+ name="group8" >+ visible="true"> >+ </separator> >+ <separator >+ name="group9" >+ visible="true"> >+ </separator> >+ <separator >+ name="group10" >+ visible="true"> >+ </separator> >+ <separator >+ name="targetGroup" >+ visible="true"> >+ </separator> >+ <separator >+ name="projectGroup" >+ visible="true"> >+ </separator> >+ </menu> >+ </menuContribution> >+ <menuContribution >+ locationURI="popup:compareWithMenu?after=compareWithGroup"> >+ <command >+ commandId="org.eclipse.team.ui.compareLocalHistory" >+ label="%CompareLocalHistory.label" >+ style="push" >+ tooltip="%CompareLocalHistory.tooltip"> >+ </command> >+ </menuContribution> >+ <menuContribution >+ locationURI="popup:team.main?after=group4"> >+ <command >+ commandId="org.eclipse.team.ui.showLocalHistory" >+ label="%ShowLocalHistory.label" >+ mnemonic="%ShowLocalHistory.mnemonic" >+ style="push" >+ > >+ </command> >+ </menuContribution> >+ <menuContribution >+ locationURI="popup:compareWithMenu?after=compareWithGroup"> >+ <command >+ commandId="org.eclipse.team.ui.compareLocalHistory" >+ label="%CompareLocalHistory.label" >+ mnemonic="%CompareLocalHistory.mnemonic" >+ style="push" >+ tooltip="%CompareLocalHistory.tooltip"> >+ </command> >+ </menuContribution> >+ </extension> >+ > </plugin> >Index: src/org/eclipse/team/internal/ui/actions/ImportProjectSetAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ImportProjectSetAction.java,v >retrieving revision 1.1 >diff -u -r1.1 ImportProjectSetAction.java >--- src/org/eclipse/team/internal/ui/actions/ImportProjectSetAction.java 13 Feb 2007 17:27:24 -0000 1.1 >+++ src/org/eclipse/team/internal/ui/actions/ImportProjectSetAction.java 20 Feb 2007 16:23:26 -0000 >@@ -30,31 +30,45 @@ > import org.eclipse.ui.IWorkbenchPart; > import org.eclipse.ui.actions.ActionDelegate; > >-public class ImportProjectSetAction extends ActionDelegate implements IObjectActionDelegate { >- >+/** >+ * @deprecated Use >+ * <code>org.eclipse.team.internal.ui.handlers.ImportProjectSetHandler</code> >+ * instead. >+ */ >+public class ImportProjectSetAction extends ActionDelegate implements >+ IObjectActionDelegate { >+ > private IStructuredSelection fSelection; >- >+ > public void run(IAction action) { >- final Shell shell= Display.getDefault().getActiveShell(); >+ final Shell shell = Display.getDefault().getActiveShell(); > try { >- new ProgressMonitorDialog(shell).run(true, true, new IRunnableWithProgress() { >- public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { >- Iterator iterator= fSelection.iterator(); >- while (iterator.hasNext()) { >- IFile file= (IFile) iterator.next(); >- ProjectSetImporter.importProjectSet(file.getLocation().toString(), shell, monitor); >- } >- } >- }); >+ new ProgressMonitorDialog(shell).run(true, true, >+ new IRunnableWithProgress() { >+ public void run(IProgressMonitor monitor) >+ throws InvocationTargetException, >+ InterruptedException { >+ Iterator iterator = fSelection.iterator(); >+ while (iterator.hasNext()) { >+ IFile file = (IFile) iterator.next(); >+ ProjectSetImporter.importProjectSet(file >+ .getLocation().toString(), shell, >+ monitor); >+ } >+ } >+ }); > } catch (InvocationTargetException exception) { >- ErrorDialog.openError(shell, null, null, new Status(IStatus.ERROR, TeamUIPlugin.PLUGIN_ID, IStatus.ERROR, TeamUIMessages.ImportProjectSetAction_0, exception.getTargetException())); >+ ErrorDialog.openError(shell, null, null, new Status(IStatus.ERROR, >+ TeamUIPlugin.PLUGIN_ID, IStatus.ERROR, >+ TeamUIMessages.ImportProjectSetAction_0, exception >+ .getTargetException())); > } catch (InterruptedException exception) { > } > } >- >+ > public void selectionChanged(IAction action, ISelection sel) { > if (sel instanceof IStructuredSelection) { >- fSelection= (IStructuredSelection) sel; >+ fSelection = (IStructuredSelection) sel; > } > } > >Index: src/org/eclipse/team/internal/ui/actions/ApplyPatchAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ApplyPatchAction.java,v >retrieving revision 1.1 >diff -u -r1.1 ApplyPatchAction.java >--- src/org/eclipse/team/internal/ui/actions/ApplyPatchAction.java 13 Feb 2007 17:27:24 -0000 1.1 >+++ src/org/eclipse/team/internal/ui/actions/ApplyPatchAction.java 20 Feb 2007 16:23:26 -0000 >@@ -17,20 +17,27 @@ > import org.eclipse.swt.widgets.Display; > import org.eclipse.team.core.TeamException; > >+/** >+ * @deprecated Use >+ * <code>org.eclipse.team.internal.ui.handlers.ApplyPatchHandler</code> >+ * instead. >+ */ > public class ApplyPatchAction extends TeamAction { > > protected boolean isEnabled() throws TeamException { > return true; > } >- >+ > public void run(IAction action) { >+ System.out.println("applyPatchAction"); > IResource[] resources = getSelectedResources(); > IResource resource = null; > if (resources.length > 0) { > resource = resources[0]; > } >- ApplyPatchOperation op = new ApplyPatchOperation(getTargetPart(), resource); >- BusyIndicator.showWhile(Display.getDefault(), op); >+ ApplyPatchOperation op = new ApplyPatchOperation(getTargetPart(), >+ resource); >+ BusyIndicator.showWhile(Display.getDefault(), op); > } > > } >Index: src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.team.ui/src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java,v >retrieving revision 1.1 >diff -u -r1.1 ConfigureProjectAction.java >--- src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java 13 Feb 2007 17:27:24 -0000 1.1 >+++ src/org/eclipse/team/internal/ui/actions/ConfigureProjectAction.java 20 Feb 2007 16:23:26 -0000 >@@ -31,6 +31,8 @@ > * Action for configuring a project. Configuring involves associating > * the project with a Team provider and performing any provider-specific > * configuration that is necessary. >+ * >+ * @deprecated Use <code>org.eclipse.team.internal.ui.handlers.ConfigureProjectHandler</code> instead. > */ > public class ConfigureProjectAction extends TeamAction implements IWorkbenchWindowActionDelegate { > private static class ResizeWizardDialog extends WizardDialog { >Index: src/org/eclipse/team/internal/ui/history/CompareLocalHistoryHandler.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ui/history/CompareLocalHistoryHandler.java >diff -N src/org/eclipse/team/internal/ui/history/CompareLocalHistoryHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ui/history/CompareLocalHistoryHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,24 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.team.internal.ui.history; >+ >+import org.eclipse.team.internal.ui.TeamUIMessages; >+ >+public class CompareLocalHistoryHandler extends ShowLocalHistoryHandler { >+ >+ protected boolean isCompare() { >+ return true; >+ } >+ >+ protected String getPromptTitle() { >+ return TeamUIMessages.CompareLocalHistory_0; >+ } >+} >Index: src/org/eclipse/team/internal/ui/handlers/TeamHandler.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ui/handlers/TeamHandler.java >diff -N src/org/eclipse/team/internal/ui/handlers/TeamHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ui/handlers/TeamHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,167 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.team.internal.ui.handlers; >+ >+import java.lang.reflect.InvocationTargetException; >+import java.util.ArrayList; >+ >+import org.eclipse.core.commands.AbstractHandler; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.core.runtime.NullProgressMonitor; >+import org.eclipse.jface.dialogs.ProgressMonitorDialog; >+import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.jface.viewers.*; >+import org.eclipse.swt.custom.BusyIndicator; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.team.internal.ui.TeamUIPlugin; >+import org.eclipse.team.internal.ui.Utils; >+import org.eclipse.ui.*; >+import org.eclipse.ui.handlers.HandlerUtil; >+ >+public abstract class TeamHandler extends AbstractHandler { >+ >+ // Constants for determining the type of progress. Subclasses may >+ // pass one of these values to the run method. >+ public final static int PROGRESS_DIALOG = 1; >+ public final static int PROGRESS_BUSYCURSOR = 2; >+ >+ /** >+ * Convenience method for running an operation with progress and error >+ * feedback. >+ * >+ * @param runnable >+ * the runnable which executes the operation >+ * @param problemMessage >+ * the message to display in the case of errors >+ * @param progressKind >+ * one of PROGRESS_BUSYCURSOR or PROGRESS_DIALOG >+ */ >+ final protected void run(final IRunnableWithProgress runnable, >+ final String problemMessage, int progressKind, ExecutionEvent event) { >+ final Exception[] exceptions = new Exception[] { null }; >+ switch (progressKind) { >+ case PROGRESS_BUSYCURSOR: >+ BusyIndicator.showWhile(Display.getCurrent(), new Runnable() { >+ public void run() { >+ try { >+ runnable.run(new NullProgressMonitor()); >+ } catch (InvocationTargetException e) { >+ exceptions[0] = e; >+ } catch (InterruptedException e) { >+ exceptions[0] = null; >+ } >+ } >+ }); >+ break; >+ default: >+ case PROGRESS_DIALOG: >+ try { >+ new ProgressMonitorDialog(HandlerUtil.getActiveShell(event)) >+ .run(true, true, runnable); >+ } catch (InvocationTargetException e) { >+ exceptions[0] = e; >+ } catch (InterruptedException e) { >+ exceptions[0] = null; >+ } >+ break; >+ } >+ if (exceptions[0] != null) { >+ handle(exceptions[0], null, problemMessage, event); >+ } >+ } >+ >+ /** >+ * Shows the given errors to the user. >+ * >+ * @param exception >+ * the status containing the error >+ * @param title >+ * the title of the error dialog >+ * @param message >+ * the message for the error dialog >+ */ >+ protected void handle(Exception exception, String title, String message, >+ ExecutionEvent event) { >+ Utils.handleError(HandlerUtil.getActiveShell(event), exception, title, >+ message); >+ } >+ >+ protected IResource[] getSelectedResources(ExecutionEvent event) { >+ ISelection currentSelection = HandlerUtil.getCurrentSelection(event); >+ if (currentSelection == null >+ || !(currentSelection instanceof IStructuredSelection)) >+ currentSelection = StructuredSelection.EMPTY; >+ >+ return Utils >+ .getContributedResources(((IStructuredSelection) currentSelection) >+ .toArray()); >+ } >+ >+ protected IProject[] getSelectedProjects(ExecutionEvent event) { >+ IResource[] selectedResources = getSelectedResources(event); >+ if (selectedResources.length == 0) >+ return new IProject[0]; >+ ArrayList projects = new ArrayList(); >+ for (int i = 0; i < selectedResources.length; i++) { >+ IResource resource = selectedResources[i]; >+ if (resource.getType() == IResource.PROJECT) { >+ projects.add(resource); >+ } >+ } >+ return (IProject[]) projects.toArray(new IProject[projects.size()]); >+ } >+ >+ protected IWorkbenchPart getTargetPart(ExecutionEvent event) { >+ return HandlerUtil.getActivePart(event); >+ } >+ >+ protected Shell getShell(ExecutionEvent event) { >+ Shell shell = HandlerUtil.getActiveShell(event); >+ if (shell != null) { >+ return shell; >+ } else if (HandlerUtil.getActivePart(event) != null) { >+ return HandlerUtil.getActivePart(event).getSite().getShell(); >+ } else if (HandlerUtil.getActiveWorkbenchWindow(event) != null) { >+ return HandlerUtil.getActiveWorkbenchWindow(event).getShell(); >+ } else { >+ IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench(); >+ if (workbench == null) >+ return null; >+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); >+ if (window == null) >+ return null; >+ return window.getShell(); >+ } >+ >+ } >+ >+ protected ISelection getSelection(ExecutionEvent event) { >+ // ISelection selection = (ISelection) context >+ // .getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME); >+ ISelection selection = HandlerUtil.getCurrentSelection(event); >+ if (selection != null) >+ return selection; >+ // IWorkbenchWindow activeWorkbenchWindow = >+ // getActiveWorkbenchWindow(context); >+ IWorkbenchWindow activeWorkbenchWindow = HandlerUtil >+ .getActiveWorkbenchWindow(event); >+ if (activeWorkbenchWindow != null) { >+ IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage(); >+ if (activePage != null) { >+ return activePage.getSelection(); >+ } >+ } >+ return null; >+ } >+} >Index: src/org/eclipse/team/internal/ui/handlers/ApplyPatchHandler.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ui/handlers/ApplyPatchHandler.java >diff -N src/org/eclipse/team/internal/ui/handlers/ApplyPatchHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ui/handlers/ApplyPatchHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,41 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.team.internal.ui.handlers; >+ >+import org.eclipse.compare.patch.ApplyPatchOperation; >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.core.resources.IResource; >+import org.eclipse.swt.custom.BusyIndicator; >+import org.eclipse.swt.widgets.Display; >+ >+public class ApplyPatchHandler extends TeamHandler { >+ >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ System.out.println("applyPatchHandler"); >+ IResource[] resources = getSelectedResources(event); >+ >+ IResource resource = null; >+ if (resources.length > 0) { >+ resource = resources[0]; >+ } >+ ApplyPatchOperation op = new ApplyPatchOperation(getTargetPart(event), >+ resource); >+ BusyIndicator.showWhile(Display.getDefault(), op); >+ >+ return null; >+ } >+ >+ public boolean isEnabled() { >+ return true; >+ } >+ >+} >Index: src/org/eclipse/team/internal/ui/handlers/ConfigureProjectHandler.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ui/handlers/ConfigureProjectHandler.java >diff -N src/org/eclipse/team/internal/ui/handlers/ConfigureProjectHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ui/handlers/ConfigureProjectHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,66 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.team.internal.ui.handlers; >+ >+import java.lang.reflect.InvocationTargetException; >+ >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.core.resources.IProject; >+import org.eclipse.core.runtime.IProgressMonitor; >+import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.jface.wizard.IWizard; >+import org.eclipse.jface.wizard.WizardDialog; >+import org.eclipse.swt.SWT; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.team.internal.ui.TeamUIMessages; >+import org.eclipse.team.internal.ui.actions.TeamAction; >+import org.eclipse.team.internal.ui.wizards.ConfigureProjectWizard; >+ >+public class ConfigureProjectHandler extends TeamHandler { >+ >+ private static class ResizeWizardDialog extends WizardDialog { >+ public ResizeWizardDialog(Shell parentShell, IWizard newWizard) { >+ super(parentShell, newWizard); >+ setShellStyle(getShellStyle() | SWT.RESIZE); >+ } >+ } >+ >+ public Object execute(final ExecutionEvent event) throws ExecutionException { >+ System.out.println("ConfigureProjectHandler:execute"); >+ run(new IRunnableWithProgress() { >+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { >+ try { >+ IProject project = getSelectedProjects(event)[0]; >+ ConfigureProjectWizard wizard = new ConfigureProjectWizard(); >+ wizard.init(null, project); >+ WizardDialog dialog = new ResizeWizardDialog(getShell(event), wizard); >+ //dialog. >+ dialog.open(); >+ } catch (Exception e) { >+ throw new InvocationTargetException(e); >+ } >+ } >+ }, TeamUIMessages.ConfigureProjectAction_configureProject, TeamAction.PROGRESS_BUSYCURSOR,event); >+ >+ return null; >+ } >+ >+ public boolean isEnabled() { >+// IProject[] selectedProjects = getSelectedProjects(); >+// if (selectedProjects.length != 1) return false; >+// if (!selectedProjects[0].isAccessible()) return false; >+// if (!RepositoryProvider.isShared(selectedProjects[0])) return true; >+// return false; >+ return true; >+ } >+ >+} >Index: src/org/eclipse/team/internal/ui/handlers/ImportProjectSetHandler.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ui/handlers/ImportProjectSetHandler.java >diff -N src/org/eclipse/team/internal/ui/handlers/ImportProjectSetHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ui/handlers/ImportProjectSetHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,62 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.team.internal.ui.handlers; >+ >+import java.lang.reflect.InvocationTargetException; >+import java.util.Iterator; >+ >+import org.eclipse.core.commands.ExecutionEvent; >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.core.resources.IFile; >+import org.eclipse.core.runtime.*; >+import org.eclipse.jface.dialogs.ErrorDialog; >+import org.eclipse.jface.dialogs.ProgressMonitorDialog; >+import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.jface.viewers.ITreeSelection; >+import org.eclipse.swt.widgets.Display; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.team.internal.ui.*; >+import org.eclipse.ui.handlers.HandlerUtil; >+ >+public class ImportProjectSetHandler extends TeamHandler { >+ >+ public Object execute(final ExecutionEvent event) throws ExecutionException { >+ >+ final ITreeSelection treeSelection = ((ITreeSelection) HandlerUtil >+ .getCurrentSelection(event)); >+ >+ final Shell shell = Display.getDefault().getActiveShell(); >+ try { >+ new ProgressMonitorDialog(shell).run(true, true, >+ new IRunnableWithProgress() { >+ public void run(IProgressMonitor monitor) >+ throws InvocationTargetException, >+ InterruptedException { >+ Iterator iterator = treeSelection.iterator(); >+ while (iterator.hasNext()) { >+ IFile file = (IFile) iterator.next(); >+ ProjectSetImporter.importProjectSet(file >+ .getLocation().toString(), shell, >+ monitor); >+ } >+ } >+ }); >+ } catch (InvocationTargetException exception) { >+ ErrorDialog.openError(shell, null, null, new Status(IStatus.ERROR, >+ TeamUIPlugin.PLUGIN_ID, IStatus.ERROR, >+ TeamUIMessages.ImportProjectSetAction_0, exception >+ .getTargetException())); >+ } catch (InterruptedException exception) { >+ } >+ >+ return null; >+ } >+} >Index: src/org/eclipse/team/internal/ui/history/ShowLocalHistoryHandler.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ui/history/ShowLocalHistoryHandler.java >diff -N src/org/eclipse/team/internal/ui/history/ShowLocalHistoryHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ui/history/ShowLocalHistoryHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,158 @@ >+/******************************************************************************* >+ * Copyright (c) 2006 IBM Corporation 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.team.internal.ui.history; >+ >+import java.lang.reflect.InvocationTargetException; >+ >+import org.eclipse.core.commands.*; >+import org.eclipse.core.resources.*; >+import org.eclipse.core.runtime.*; >+import org.eclipse.jface.dialogs.ErrorDialog; >+import org.eclipse.jface.dialogs.MessageDialog; >+import org.eclipse.jface.operation.IRunnableWithProgress; >+import org.eclipse.jface.viewers.*; >+import org.eclipse.swt.widgets.Shell; >+import org.eclipse.team.internal.ui.TeamUIMessages; >+import org.eclipse.team.internal.ui.TeamUIPlugin; >+import org.eclipse.team.ui.TeamUI; >+import org.eclipse.team.ui.history.IHistoryPage; >+import org.eclipse.team.ui.history.IHistoryView; >+import org.eclipse.ui.*; >+import org.eclipse.ui.handlers.HandlerUtil; >+ >+public class ShowLocalHistoryHandler extends AbstractHandler /*ActionDelegate implements IObjectActionDelegate */{ >+ >+// private IStructuredSelection fSelection; >+// private IWorkbenchPart targetPart; >+ >+ public Object execute(final ExecutionEvent event) throws ExecutionException { >+ System.out.println("ShowLocalHistoryHandler:execute"); >+ IFileState states[]= getLocalHistory(event); >+ if (states == null || states.length == 0) >+ return null; >+ try { >+ PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { >+ public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { >+ final IResource resource = (IResource) getSelection(event).getFirstElement(); >+ Runnable r = new Runnable() { >+ public void run() { >+ IHistoryView view = TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), resource, LocalHistoryPageSource.getInstance()); >+ IHistoryPage page = view.getHistoryPage(); >+ if (page instanceof LocalHistoryPage){ >+ LocalHistoryPage historyPage = (LocalHistoryPage) page; >+ historyPage.setClickAction(isCompare()); >+ } >+ } >+ }; >+ TeamUIPlugin.getStandardDisplay().asyncExec(r); >+ } >+ }); >+ } catch (InvocationTargetException exception) { >+ ErrorDialog.openError(getShell(event), null, null, new Status(IStatus.ERROR, TeamUIPlugin.PLUGIN_ID, IStatus.ERROR, TeamUIMessages.ShowLocalHistory_1, exception.getTargetException())); >+ } catch (InterruptedException exception) { >+ } >+ return null; >+ } >+ >+// public void run(IAction action) { >+// IFileState states[]= getLocalHistory(); >+// if (states == null || states.length == 0) >+// return; >+// try { >+// PlatformUI.getWorkbench().getProgressService().busyCursorWhile(new IRunnableWithProgress() { >+// public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { >+// final IResource resource = (IResource) fSelection.getFirstElement(); >+// Runnable r = new Runnable() { >+// public void run() { >+// IHistoryView view = TeamUI.showHistoryFor(TeamUIPlugin.getActivePage(), resource, LocalHistoryPageSource.getInstance()); >+// IHistoryPage page = view.getHistoryPage(); >+// if (page instanceof LocalHistoryPage){ >+// LocalHistoryPage historyPage = (LocalHistoryPage) page; >+// historyPage.setClickAction(isCompare()); >+// } >+// } >+// }; >+// TeamUIPlugin.getStandardDisplay().asyncExec(r); >+// } >+// }); >+// } catch (InvocationTargetException exception) { >+// ErrorDialog.openError(getShell(), null, null, new Status(IStatus.ERROR, TeamUIPlugin.PLUGIN_ID, IStatus.ERROR, TeamUIMessages.ShowLocalHistory_1, exception.getTargetException())); >+// } catch (InterruptedException exception) { >+// } >+// } >+ >+// public void selectionChanged(IAction action, ISelection sel) { >+// if (sel instanceof IStructuredSelection) { >+// fSelection= (IStructuredSelection) sel; >+// } >+// } >+// public void setActivePart(IAction action, IWorkbenchPart targetPart) { >+// this.targetPart = targetPart; >+// } >+ >+ protected Shell getShell(ExecutionEvent event) { >+// if (targetPart != null) >+// return targetPart.getSite().getShell(); >+// return TeamUIPlugin.getActivePage().getActivePart().getSite().getShell(); >+ Shell shell = HandlerUtil.getActiveShell(event); >+ if (shell != null) { >+ return shell; >+ } else if (HandlerUtil.getActivePart(event) != null) { >+ return HandlerUtil.getActivePart(event).getSite().getShell(); >+ } else if (HandlerUtil.getActiveWorkbenchWindow(event) != null) { >+ return HandlerUtil.getActiveWorkbenchWindow(event).getShell(); >+ } else { >+ IWorkbench workbench = TeamUIPlugin.getPlugin().getWorkbench(); >+ if (workbench == null) >+ return null; >+ IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); >+ if (window == null) >+ return null; >+ return window.getShell(); >+ } >+ } >+ >+ protected boolean isCompare() { >+ return false; >+ } >+ >+ public IStructuredSelection getSelection(ExecutionEvent event) { >+// return fSelection; >+ ISelection currentSelection = HandlerUtil.getCurrentSelection(event); >+ if (currentSelection == null >+ || !(currentSelection instanceof IStructuredSelection)) >+ currentSelection = StructuredSelection.EMPTY; >+ >+ return (IStructuredSelection) currentSelection; >+ } >+ >+ protected IFileState[] getLocalHistory(ExecutionEvent event) { >+ final IFile file = (IFile) getSelection(event).getFirstElement(); >+ IFileState states[]; >+ try { >+ states= file.getHistory(null); >+ } catch (CoreException ex) { >+ MessageDialog.openError(getShell(event), getPromptTitle(), ex.getMessage()); >+ return null; >+ } >+ >+ if (states == null || states.length <= 0) { >+ MessageDialog.openInformation(getShell(event), getPromptTitle(), TeamUIMessages.ShowLocalHistory_0); >+ return states; >+ } >+ return states; >+ } >+ >+ protected String getPromptTitle() { >+ return TeamUIMessages.ShowLocalHistory_2; >+ } >+ >+} >Index: src/org/eclipse/team/internal/ui/handlers/SynchronizeHandler.java >=================================================================== >RCS file: src/org/eclipse/team/internal/ui/handlers/SynchronizeHandler.java >diff -N src/org/eclipse/team/internal/ui/handlers/SynchronizeHandler.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/internal/ui/handlers/SynchronizeHandler.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,29 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.team.internal.ui.handlers; >+ >+import org.eclipse.core.commands.*; >+import org.eclipse.jface.dialogs.MessageDialog; >+import org.eclipse.ui.IWorkbenchWindow; >+import org.eclipse.ui.handlers.HandlerUtil; >+ >+public class SynchronizeHandler extends AbstractHandler { >+ >+ public Object execute(ExecutionEvent event) throws ExecutionException { >+ IWorkbenchWindow window = HandlerUtil >+ .getActiveWorkbenchWindowChecked(event); >+ MessageDialog.openInformation(window.getShell(), "Synchronize", >+ "Synchronize Handler Dialog!"); >+ >+ return null; >+ } >+ >+} >Index: src/org/eclipse/team/ui/CompoundContributionItem2.java >=================================================================== >RCS file: src/org/eclipse/team/ui/CompoundContributionItem2.java >diff -N src/org/eclipse/team/ui/CompoundContributionItem2.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/team/ui/CompoundContributionItem2.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/******************************************************************************* >+ * Copyright (c) 2007 IBM Corporation 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 >+ * http://www.eclipse.org/legal/epl-v10.html >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.team.ui; >+ >+import java.util.ArrayList; >+ >+import org.eclipse.jface.action.*; >+import org.eclipse.ui.actions.CompoundContributionItem; >+import org.eclipse.ui.internal.WorkbenchMessages; >+ >+public class CompoundContributionItem2 extends CompoundContributionItem { >+ >+ public CompoundContributionItem2() { >+ super(); >+ } >+ >+ public CompoundContributionItem2(String id) { >+ super(id); >+ // TODO Auto-generated constructor stub >+ } >+ >+ protected IContributionItem[] getContributionItems() { >+ ArrayList list = new ArrayList(); >+ >+ String text = WorkbenchMessages.Workbench_noApplicableItems; >+ Action dummyAction = new Action(text) { >+ // dummy inner class; no methods >+ }; >+ dummyAction.setEnabled(false); >+ list.add(new ActionContributionItem(dummyAction)); >+ >+ return (IContributionItem[]) list.toArray(new IContributionItem[list.size()]); >+ >+// return null; >+ } >+ >+}
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 173457
:
59139
|
59140
|
59355
|
59496