diff options
author | spingel | 2011-05-24 00:08:58 +0000 |
---|---|---|
committer | spingel | 2011-05-24 00:08:58 +0000 |
commit | 3426b36eef93ff999e00f2753c73d5ac1dd023bc (patch) | |
tree | fc3897cae9a0d4e3fb914ce296a1f9f8f9a2c34b /org.eclipse.mylyn.commons.ui | |
parent | 67b421697c81ae46b81a38bfee0cb7cf9e4b26e7 (diff) | |
download | org.eclipse.mylyn.commons-3426b36eef93ff999e00f2753c73d5ac1dd023bc.tar.gz org.eclipse.mylyn.commons-3426b36eef93ff999e00f2753c73d5ac1dd023bc.tar.xz org.eclipse.mylyn.commons-3426b36eef93ff999e00f2753c73d5ac1dd023bc.zip |
NEW - bug 346153: Double clicking a repository in the team repositories view should open the repository properties
https://bugs.eclipse.org/bugs/show_bug.cgi?id=346153
Diffstat (limited to 'org.eclipse.mylyn.commons.ui')
2 files changed, 53 insertions, 0 deletions
diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchUtil.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchUtil.java index 0d058434..9072a26c 100644 --- a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchUtil.java +++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/WorkbenchUtil.java @@ -17,6 +17,7 @@ import java.net.MalformedURLException; import java.net.URL; import java.util.Calendar; +import org.eclipse.core.commands.NotEnabledException; import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.QualifiedName; import org.eclipse.core.runtime.Status; @@ -40,8 +41,11 @@ import org.eclipse.ui.activities.IIdentifier; import org.eclipse.ui.activities.IWorkbenchActivitySupport; import org.eclipse.ui.browser.IWebBrowser; import org.eclipse.ui.browser.IWorkbenchBrowserSupport; +import org.eclipse.ui.handlers.IHandlerService; import org.eclipse.ui.internal.browser.WebBrowserPreference; import org.eclipse.ui.internal.browser.WorkbenchBrowserSupport; +import org.eclipse.ui.services.IServiceLocator; +import org.eclipse.ui.texteditor.IWorkbenchActionDefinitionIds; /** * @author Mik Kersten @@ -313,4 +317,21 @@ public class WorkbenchUtil { menuManager.add(new Separator(GROUP_PROPERTIES)); } + public static Object openProperties(IServiceLocator serviceLocator) { + IHandlerService service = (IHandlerService) serviceLocator.getService(IHandlerService.class); + if (service != null) { + try { + return service.executeCommand(IWorkbenchActionDefinitionIds.PROPERTIES, null); + } catch (NotEnabledException e) { + // ignore + } catch (Exception e) { + CommonsUiPlugin.getDefault() + .getLog() + .log(new Status(IStatus.ERROR, CommonsUiPlugin.ID_PLUGIN, + "Opening repository properties failed", e)); //$NON-NLS-1$ + } + } + return IStatus.CANCEL; + } + } diff --git a/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/PropertiesAction.java b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/PropertiesAction.java new file mode 100644 index 00000000..61720b6d --- /dev/null +++ b/org.eclipse.mylyn.commons.ui/src/org/eclipse/mylyn/internal/provisional/commons/ui/actions/PropertiesAction.java @@ -0,0 +1,32 @@ +/******************************************************************************* + * Copyright (c) 2011 Tasktop Technologies 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: + * Tasktop Technologies - initial API and implementation + *******************************************************************************/ + +package org.eclipse.mylyn.internal.provisional.commons.ui.actions; + +import org.eclipse.mylyn.internal.provisional.commons.ui.WorkbenchUtil; +import org.eclipse.ui.PlatformUI; +import org.eclipse.ui.actions.BaseSelectionListenerAction; + +/** + * @author Steffen Pingel + */ +public class PropertiesAction extends BaseSelectionListenerAction { + + public PropertiesAction() { + super("Properties"); + } + + @Override + public void run() { + WorkbenchUtil.openProperties(PlatformUI.getWorkbench()); + } + +} |