Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEd Merks2020-06-30 06:43:22 +0000
committerEd Merks2020-06-30 06:43:22 +0000
commitc21506dc5fa6bc4932f0506c6d4fda390d6ab08d (patch)
treebafb23d339dcfb89b2dcb87b0f42bc89f4097dfa
parent5f80491e94ad2528651f61a22367eb1f6e4d4a36 (diff)
downloadorg.eclipse.emf-c21506dc5fa6bc4932f0506c6d4fda390d6ab08d.tar.gz
org.eclipse.emf-c21506dc5fa6bc4932f0506c6d4fda390d6ab08d.tar.xz
org.eclipse.emf-c21506dc5fa6bc4932f0506c6d4fda390d6ab08d.zip
[564761] Provide a Show Properties View action on the context menu of
the Xcore editor
-rw-r--r--plugins/org.eclipse.emf.ecore.xcore.ui/plugin.properties6
-rw-r--r--plugins/org.eclipse.emf.ecore.xcore.ui/plugin.xml54
-rw-r--r--plugins/org.eclipse.emf.ecore.xcore.ui/src/org/eclipse/emf/ecore/xcore/ui/ShowPropertiesViewHandler.java44
3 files changed, 90 insertions, 14 deletions
diff --git a/plugins/org.eclipse.emf.ecore.xcore.ui/plugin.properties b/plugins/org.eclipse.emf.ecore.xcore.ui/plugin.properties
index 96549b8c4..494f38123 100644
--- a/plugins/org.eclipse.emf.ecore.xcore.ui/plugin.properties
+++ b/plugins/org.eclipse.emf.ecore.xcore.ui/plugin.properties
@@ -52,4 +52,8 @@ command.tooltip.7 = Copy Qualified Name
extension.name = Xcore Problem
extension.name.0 = Xcore Problem
extension.name.1 = Xcore Problem
-command.tooltip.8 = Open Call Hierarchy \ No newline at end of file
+command.tooltip.8 = Open Call Hierarchy
+content-type.name = Xcore File
+command.showProperties.description = Show the Properties view
+command.showProperties.name = Show &Properties View
+command.showProperties.tooltip = Show the Properties view \ No newline at end of file
diff --git a/plugins/org.eclipse.emf.ecore.xcore.ui/plugin.xml b/plugins/org.eclipse.emf.ecore.xcore.ui/plugin.xml
index 70b5059c4..60a1c30f3 100644
--- a/plugins/org.eclipse.emf.ecore.xcore.ui/plugin.xml
+++ b/plugins/org.eclipse.emf.ecore.xcore.ui/plugin.xml
@@ -211,7 +211,7 @@
base-type="org.eclipse.core.runtime.text"
file-extensions="xcore"
id="org.eclipse.emf.ecore.xcore.Xcore.contenttype"
- name="Xcore File"
+ name="%content-type.name"
priority="normal">
</content-type>
</extension>
@@ -541,6 +541,15 @@
</reference>
</activeWhen>
</handler>
+ <handler
+ class="org.eclipse.emf.ecore.xcore.ui.XcoreExecutableExtensionFactory:org.eclipse.emf.ecore.xcore.ui.ShowPropertiesViewHandler"
+ commandId="org.eclipse.emf.ecore.xcore.ui.ShowPropertiesView">
+ <activeWhen>
+ <reference
+ definitionId="org.eclipse.emf.ecore.xcore.Xcore.Editor.opened">
+ </reference>
+ </activeWhen>
+ </handler>
</extension>
<extension point="org.eclipse.ui.commands">
@@ -550,6 +559,12 @@
id="org.eclipse.emf.ecore.xcore.ui.CreateDynamicInstance"
name="%command.name.1">
</command>
+ <command
+ categoryId="org.eclipse.ui.category.file"
+ description="%command.showProperties.description"
+ id="org.eclipse.emf.ecore.xcore.ui.ShowPropertiesView"
+ name="%command.showProperties.name">
+ </command>
</extension>
<extension
@@ -579,12 +594,12 @@
commandId="org.eclipse.emf.ecore.xcore.ui.CreateDynamicInstance"
style="push"
tooltip="%command.tooltip.1">
- <visibleWhen checkEnabled="false">
- <reference
- definitionId="org.eclipse.emf.ecore.xcore.Xcore.Editor.opened">
- </reference>
- </visibleWhen>
- </command>
+ <visibleWhen checkEnabled="false">
+ <reference
+ definitionId="org.eclipse.emf.ecore.xcore.Xcore.Editor.opened">
+ </reference>
+ </visibleWhen>
+ </command>
</menuContribution>
<menuContribution
locationURI="popup:#TextEditorContext?after=group.edit">
@@ -592,12 +607,25 @@
commandId="org.eclipse.xtext.xbase.ui.organizeImports"
style="push"
tooltip="%command.tooltip.2">
- <visibleWhen checkEnabled="false">
- <reference
- definitionId="org.eclipse.emf.ecore.xcore.Xcore.Editor.opened">
- </reference>
- </visibleWhen>
- </command>
+ <visibleWhen checkEnabled="false">
+ <reference
+ definitionId="org.eclipse.emf.ecore.xcore.Xcore.Editor.opened">
+ </reference>
+ </visibleWhen>
+ </command>
+ </menuContribution>
+ <menuContribution
+ locationURI="popup:#TextEditorContext?before=additions">
+ <command
+ commandId="org.eclipse.emf.ecore.xcore.ui.ShowPropertiesView"
+ style="push"
+ tooltip="%command.showProperties.tooltip">
+ <visibleWhen checkEnabled="false">
+ <reference
+ definitionId="org.eclipse.emf.ecore.xcore.Xcore.Editor.opened">
+ </reference>
+ </visibleWhen>
+ </command>
</menuContribution>
</extension>
diff --git a/plugins/org.eclipse.emf.ecore.xcore.ui/src/org/eclipse/emf/ecore/xcore/ui/ShowPropertiesViewHandler.java b/plugins/org.eclipse.emf.ecore.xcore.ui/src/org/eclipse/emf/ecore/xcore/ui/ShowPropertiesViewHandler.java
new file mode 100644
index 000000000..6e6807048
--- /dev/null
+++ b/plugins/org.eclipse.emf.ecore.xcore.ui/src/org/eclipse/emf/ecore/xcore/ui/ShowPropertiesViewHandler.java
@@ -0,0 +1,44 @@
+/**
+ * Copyright (c) 2020 Eclipse contributors and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v2.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v20.html
+ */
+package org.eclipse.emf.ecore.xcore.ui;
+
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.emf.ecore.xcore.XcorePlugin;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+
+public class ShowPropertiesViewHandler extends AbstractHandler
+{
+ public Object execute(ExecutionEvent event) throws ExecutionException
+ {
+ IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
+ if (activeWorkbenchWindow != null)
+ {
+ IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
+ if (activePage != null)
+ {
+ try
+ {
+ activePage.showView("org.eclipse.ui.views.PropertySheet");
+ }
+ catch (PartInitException exception)
+ {
+ XcorePlugin.INSTANCE.log(exception);
+ }
+ }
+ }
+
+ return null;
+ }
+}

Back to the top