diff options
Diffstat (limited to 'plugins/uml')
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()); |