Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnsgar Radermacher2014-04-03 10:09:34 -0400
committerAnsgar Radermacher2014-04-03 10:11:19 -0400
commit9cc170f5b06b629a7b75772cd8caf850cc3aaa30 (patch)
tree0d67fb3dd1e0383b0c5810255e11b228aa09b47d
parent7c060d07079865052f139b083cee1e4bfd8b43c7 (diff)
downloadorg.eclipse.papyrus-9cc170f5b06b629a7b75772cd8caf850cc3aaa30.tar.gz
org.eclipse.papyrus-9cc170f5b06b629a7b75772cd8caf850cc3aaa30.tar.xz
org.eclipse.papyrus-9cc170f5b06b629a7b75772cd8caf850cc3aaa30.zip
Bug 431841 - [C++ view] The C++ view does not handle selections within model explorer
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.views.cpp/.settings/org.eclipse.jdt.core.prefs7
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.views.cpp/META-INF/MANIFEST.MF3
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.views.cpp/src/org/eclipse/papyrus/views/cpp/CppPanelView.java22
-rw-r--r--extraplugins/codegen/org.eclipse.papyrus.views.cpp/src/org/eclipse/papyrus/views/panels/CppAbstractPanel.java22
4 files changed, 23 insertions, 31 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.views.cpp/.settings/org.eclipse.jdt.core.prefs b/extraplugins/codegen/org.eclipse.papyrus.views.cpp/.settings/org.eclipse.jdt.core.prefs
new file mode 100644
index 00000000000..c537b63063c
--- /dev/null
+++ b/extraplugins/codegen/org.eclipse.papyrus.views.cpp/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
diff --git a/extraplugins/codegen/org.eclipse.papyrus.views.cpp/META-INF/MANIFEST.MF b/extraplugins/codegen/org.eclipse.papyrus.views.cpp/META-INF/MANIFEST.MF
index 19fc7907330..fab154a1744 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.views.cpp/META-INF/MANIFEST.MF
+++ b/extraplugins/codegen/org.eclipse.papyrus.views.cpp/META-INF/MANIFEST.MF
@@ -14,7 +14,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.gmf.runtime.common.core;bundle-version="1.4.1",
org.eclipse.gmf.runtime.emf.commands.core;bundle-version="1.4.0",
org.eclipse.papyrus.acceleo;bundle-version="1.0.0",
- org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0"
+ org.eclipse.papyrus.uml.tools.utils;bundle-version="1.0.0",
+ org.eclipse.papyrus.infra.emf;bundle-version="1.0.0"
Export-Package: org.eclipse.papyrus.views.cpp;
uses:="org.eclipse.ui,
com.cea.papyrus.views.panels,
diff --git a/extraplugins/codegen/org.eclipse.papyrus.views.cpp/src/org/eclipse/papyrus/views/cpp/CppPanelView.java b/extraplugins/codegen/org.eclipse.papyrus.views.cpp/src/org/eclipse/papyrus/views/cpp/CppPanelView.java
index 0e6e7452753..8edc83aec64 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.views.cpp/src/org/eclipse/papyrus/views/cpp/CppPanelView.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.views.cpp/src/org/eclipse/papyrus/views/cpp/CppPanelView.java
@@ -11,12 +11,10 @@
package org.eclipse.papyrus.views.cpp;
-import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.gef.GraphicalEditPart;
-import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.infra.emf.utils.EMFHelper;
import org.eclipse.papyrus.views.panels.CppAbstractPanel;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbenchPart;
@@ -78,22 +76,8 @@ public class CppPanelView extends AbstractCppPanelView {
}
// Retrieve selected object
- Object currentObject = sSelection.getFirstElement();
- // If the object is an edit part, try to get semantic bridge
- if(currentObject instanceof GraphicalEditPart) {
- GraphicalEditPart editPart = (GraphicalEditPart)currentObject;
- if(editPart.getModel() instanceof View) {
- View view = (View)editPart.getModel();
- if(view.getElement() instanceof Element) {
- currentObject = (Element)view.getElement();
- }
- }
- }
- else if(currentObject instanceof IAdaptable) {
- // modisco ModelElementItem supports IAdaptable (cleaner than cast / dependency with modisco)
- currentObject = ((IAdaptable)currentObject).getAdapter(EObject.class);
- }
-
+ EObject currentObject = EMFHelper.getEObject(sSelection.getFirstElement());
+
if(currentObject instanceof Element) {
if(currentTarget != currentObject) {
currentTarget = (Element)currentObject;
diff --git a/extraplugins/codegen/org.eclipse.papyrus.views.cpp/src/org/eclipse/papyrus/views/panels/CppAbstractPanel.java b/extraplugins/codegen/org.eclipse.papyrus.views.cpp/src/org/eclipse/papyrus/views/panels/CppAbstractPanel.java
index aa7a0ba16d2..d8cbc5766c5 100644
--- a/extraplugins/codegen/org.eclipse.papyrus.views.cpp/src/org/eclipse/papyrus/views/panels/CppAbstractPanel.java
+++ b/extraplugins/codegen/org.eclipse.papyrus.views.cpp/src/org/eclipse/papyrus/views/panels/CppAbstractPanel.java
@@ -44,18 +44,18 @@ public abstract class CppAbstractPanel extends Composite {
// string representing the ID of the language
// this is the string contained in the language attribute of Activity
- protected static final String C_CPP_ID = "C/C++";
+ protected static final String C_CPP_ID = "C/C++"; //$NON-NLS-1$
- protected static final String CPP_ID = "C++";
+ protected static final String CPP_ID = "C++"; //$NON-NLS-1$
- protected static final String C_ID = "C";
+ protected static final String C_ID = "C"; //$NON-NLS-1$
// CppInclude text area
protected Button buttonSave;
protected Button buttonCancel;
- /** Listener for modifications on the uml element */
+ /** Listener for modifications on the UML element */
protected UMLElementPanelListener umlListener = null;
public CppAbstractPanel(Composite parent, int style) {
@@ -129,7 +129,7 @@ public abstract class CppAbstractPanel extends Composite {
groupBody.setBackground(textArea.getBackground());
groupBody.setLayout(new FormLayout());
- groupBody.setText(" " + name + " ");
+ groupBody.setText(" " + name + " "); //$NON-NLS-1$ //$NON-NLS-2$
groupBody.setFont(Activator.VIEW_FONT);
FormData data = new FormData();
@@ -235,7 +235,7 @@ public abstract class CppAbstractPanel extends Composite {
buttonSave = new Button(this, SWT.PUSH);
buttonSave.setImage(Activator.getImage(Activator.SAVE_IMAGE));
- buttonSave.setToolTipText(Activator.getResourceString("panel.class.button.save.tooltip"));
+ buttonSave.setToolTipText(Activator.getResourceString("panel.class.button.save.tooltip")); //$NON-NLS-1$
buttonSave.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
@@ -245,7 +245,7 @@ public abstract class CppAbstractPanel extends Composite {
buttonCancel = new Button(this, SWT.PUSH);
buttonCancel.setImage(Activator.getImage(Activator.UNDO_IMAGE));
- buttonCancel.setToolTipText(Activator.getResourceString("panel.class.button.cancel.tooltip"));
+ buttonCancel.setToolTipText(Activator.getResourceString("panel.class.button.cancel.tooltip")); //$NON-NLS-1$
buttonCancel.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent arg0) {
@@ -337,13 +337,13 @@ public abstract class CppAbstractPanel extends Composite {
if(modelChanged) {
MessageDialog dialog = new MessageDialog(
Display.getCurrent().getActiveShell(),
- Activator.getResourceString("panel.property.dialog.saveorignore.title"),
+ Activator.getResourceString("panel.property.dialog.saveorignore.title"), //$NON-NLS-1$
Activator.getImage(Activator.WARNING_IMAGE),
- Activator.getResourceString("panel.property.dialog.saveorignore"),
+ Activator.getResourceString("panel.property.dialog.saveorignore"), //$NON-NLS-1$
0,
new String[]{
- Activator.getResourceString("panel.property.dialog.saveorignore.button.save"),
- Activator.getResourceString("panel.property.dialog.saveorignore.button.ignore") },
+ Activator.getResourceString("panel.property.dialog.saveorignore.button.save"), //$NON-NLS-1$
+ Activator.getResourceString("panel.property.dialog.saveorignore.button.ignore") }, //$NON-NLS-1$
0);
dialog.open();
if(dialog.getReturnCode() == 0) { //saveButton pressed

Back to the top