Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2018-04-12 23:07:28 +0000
committerAnsgar Radermacher2018-05-03 12:06:27 +0000
commit01066f7dc803d8d164913ea65da5ee76bf62976e (patch)
tree19fb865147e58f856876ad171526ad3f009b8977
parent6a600cef62cdb3724538e7abec7cbcca5ae4e86f (diff)
downloadorg.eclipse.papyrus-01066f7dc803d8d164913ea65da5ee76bf62976e.tar.gz
org.eclipse.papyrus-01066f7dc803d8d164913ea65da5ee76bf62976e.tar.xz
org.eclipse.papyrus-01066f7dc803d8d164913ea65da5ee76bf62976e.zip
Bug 533527 - [xtext, properties] The xtext editor in the property view is not shown correctly
- Pass current object as semantic as well as selected object (instead of null) - Pass by editor to get selection. This assures that we get the right selection, even if the properties view is selected Signed-off-by: Ansgar Radermacher <ansgar.radermacher@cea.fr> (cherry picked from commit 48211c68d3cf207dec41f1f697d08b7db987fde1) Change-Id: I3b6fd04b828a9594057ff44c3ee4a77fd29ea491
-rw-r--r--plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/property/AbstractXtextPropertyEditor.java5
-rw-r--r--plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java25
2 files changed, 22 insertions, 8 deletions
diff --git a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/property/AbstractXtextPropertyEditor.java b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/property/AbstractXtextPropertyEditor.java
index 944a8c093d4..8ddd5701171 100644
--- a/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/property/AbstractXtextPropertyEditor.java
+++ b/plugins/uml/properties/org.eclipse.papyrus.uml.properties.xtext/src/org/eclipse/papyrus/uml/properties/xtext/widget/property/AbstractXtextPropertyEditor.java
@@ -1,5 +1,5 @@
/*****************************************************************************
- * Copyright (c) 2017 CEA LIST.
+ * Copyright (c) 2017, 2018 CEA LIST.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,6 +8,7 @@
*
* Contributors:
* Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Initial API and implementation
+ * Bug 533527
*
*****************************************************************************/
@@ -113,7 +114,7 @@ public abstract class AbstractXtextPropertyEditor extends AbstractPropertyEditor
* Display the editor contents, calculate the initial text via the editor configuration.
*/
public void display() {
- IDirectEditorConfiguration configuration = DirectEditorsUtil.findEditorConfiguration(language, elementToEdit, null);
+ IDirectEditorConfiguration configuration = DirectEditorsUtil.findEditorConfiguration(language, elementToEdit, elementToEdit);
String initialText = configuration.getTextToEdit(elementToEdit);// use xtext UI editor
xtextEditor.setInput(initialText);
diff --git a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java
index 9e03b2d11a3..fa0b143dec5 100644
--- a/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java
+++ b/plugins/uml/textedit/org.eclipse.papyrus.uml.textedit.common.xtext.ui/src/org/eclipse/papyrus/uml/textedit/common/xtext/ui/contentassist/UmlCommonProposalProvider.java
@@ -1,6 +1,16 @@
-/*
- * generated by Xtext
- */
+/*****************************************************************************
+ * Copyright (c) 2012, 2018 CEA LIST.
+ *
+ * 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:
+ * Ansgar Radermacher (CEA LIST) ansgar.radermacher@cea.fr - Bug 533527
+ *
+ *****************************************************************************/
+
package org.eclipse.papyrus.uml.textedit.common.xtext.ui.contentassist;
import java.util.ArrayList;
@@ -24,7 +34,7 @@ import org.eclipse.papyrus.uml.textedit.common.xtext.ui.internal.UmlCommonActiva
import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.MultiplicityRule;
import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.QualifiedName;
import org.eclipse.papyrus.uml.textedit.common.xtext.umlCommon.TypeRule;
-import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Element;
import org.eclipse.uml2.uml.NamedElement;
@@ -90,8 +100,11 @@ public class UmlCommonProposalProvider extends AbstractUmlCommonProposalProvider
*
*/
protected void initModel() {
- IWorkbenchPage activePage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- ISelection mySelection = activePage.getSelection();
+ // get selection from active editor, this assures that suitable selection is obtained if triggered
+ // from property view (fix for bug 533527)
+ IEditorPart activeEditor = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ ISelection mySelection = activeEditor.getEditorSite().getSelectionProvider().getSelection();
+
if (mySelection instanceof IStructuredSelection) {
EObject first = EMFHelper.getEObject(((IStructuredSelection) mySelection).getFirstElement());

Back to the top