diff options
author | Ansgar Radermacher | 2013-11-01 13:33:15 +0000 |
---|---|---|
committer | Ansgar Radermacher | 2013-11-01 13:33:15 +0000 |
commit | 1d561eb93c4e7d5cde63a468d8553250c1e4a5d9 (patch) | |
tree | be7e04566a660768fc7bf9081af6fde580cb73ce | |
parent | e85383a1690684d8e6588db68c3129d0c8ed8bfe (diff) | |
download | org.eclipse.papyrus-1d561eb93c4e7d5cde63a468d8553250c1e4a5d9.tar.gz org.eclipse.papyrus-1d561eb93c4e7d5cde63a468d8553250c1e4a5d9.tar.xz org.eclipse.papyrus-1d561eb93c4e7d5cde63a468d8553250c1e4a5d9.zip |
- Added selectedElement to textModel, navigate to edited operation
context: bug 399864 [CDT/StateMachine] Papyrus shall enable to see code on transitions.
13 files changed, 449 insertions, 95 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.test/model/TestCDTintegration.di b/extraplugins/codegen/org.eclipse.papyrus.cpp.test/model/TestCDTintegration.di index 8a277e6db1e..5487592d61d 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.test/model/TestCDTintegration.di +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.test/model/TestCDTintegration.di @@ -5,7 +5,10 @@ <emfPageIdentifier href="TestCDTintegration.notation#_8vp88DcVEeO6UdbIk03c9Q"/> </availablePage> <availablePage> - <emfPageIdentifier href="TestCDTintegration.notation#_JY8YsDcWEeO6UdbIk03c9Q"/> + <emfPageIdentifier href="TestCDTintegration.notation"/> + </availablePage> + <availablePage> + <emfPageIdentifier href="TestCDTintegration.notation#_EItkYEG6EeOMv8cdTsw5Zg"/> </availablePage> </pageList> <sashModel currentSelection="//@sashModel/@windows.0/@children.0/@children.1"> @@ -18,7 +21,7 @@ </children> <children xsi:type="di:TabFolder"> <children> - <emfPageIdentifier href="TestCDTintegration.notation#_JY8YsDcWEeO6UdbIk03c9Q"/> + <emfPageIdentifier href="TestCDTintegration.notation#_EItkYEG6EeOMv8cdTsw5Zg"/> </children> </children> </children> diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.test/model/TestCDTintegration.notation b/extraplugins/codegen/org.eclipse.papyrus.cpp.test/model/TestCDTintegration.notation index 56f606875f2..5aefa72c8b9 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.test/model/TestCDTintegration.notation +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.test/model/TestCDTintegration.notation @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:texteditormodel="http://www.eclipse.org/Papyrus/Example/0.10.0/texteditormodel" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML"> +<xmi:XMI xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:texteditormodel="http://www.eclipse.org/Papyrus/Example/0.10.0/texteditormodel" xmlns:texteditormodel_1="http://www.eclipse.org/Papyrus/TextEditor/0.10.0/texteditormodel" xmlns:uml="http://www.eclipse.org/uml2/4.0.0/UML"> <notation:Diagram xmi:id="_8vp88DcVEeO6UdbIk03c9Q" type="PapyrusUMLClassDiagram" name="NewDiagram" measurementUnit="Pixel"> <children xmi:type="notation:Shape" xmi:id="__McvgDcVEeO6UdbIk03c9Q" type="2008" fontName="Sans Serif" lineColor="0"> <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="__Md9oDcVEeO6UdbIk03c9Q" source="ShadowFigure"> @@ -104,6 +104,9 @@ <element xmi:type="uml:Model" href="TestCDTintegration.uml#_Ae6MwPccEd-KM6l7lmIPkw"/> </notation:Diagram> <texteditormodel:TextEditorModel xmi:id="_JY8YsDcWEeO6UdbIk03c9Q" type="CDTEditorInPapyrus" name="CDT Class3"> + <editedObject xmi:type="uml:Class" href="TestCDTintegration.uml#_K8FLcB0LEeKlYLZOWTi6uw"/></texteditormodel:TextEditorModel> + <texteditormodel_1:TextEditorModel xmi:id="_EItkYEG6EeOMv8cdTsw5Zg" type="CDTEditorInPapyrus" name="CDT Class3"> <editedObject xmi:type="uml:Class" href="TestCDTintegration.uml#_K8FLcB0LEeKlYLZOWTi6uw"/> - </texteditormodel:TextEditorModel> + <selectedObject xmi:type="uml:Operation" href="TestCDTintegration.uml#_jnWMADcmEeO6UdbIk03c9Q"/> + </texteditormodel_1:TextEditorModel> </xmi:XMI> diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.test/model/TestCDTintegration.uml b/extraplugins/codegen/org.eclipse.papyrus.cpp.test/model/TestCDTintegration.uml index 3c80329d324..e40977792b5 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.test/model/TestCDTintegration.uml +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.test/model/TestCDTintegration.uml @@ -49,7 +49,7 @@ <packagedElement xmi:type="uml:Class" xmi:id="_419y0A7hEeKpbseGaEy1LA" name="Class2"/> <packagedElement xmi:type="uml:Class" xmi:id="_K8FLcB0LEeKlYLZOWTi6uw" name="Class3"> <ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_kTVuwP6QEeKlg5tzGV3QVQ" name="Operation1" isReentrant="false" specification="_TY18YB0LEeKlYLZOWTi6uw"> - <ownedParameter xmi:type="uml:Parameter" xmi:id="_8cplwDczEeOimIxd1A6OhA" name="arg"> + <ownedParameter xmi:type="uml:Parameter" xmi:id="_JPzkEEL5EeO1TdFz52di_Q" name="arg"> <type xmi:type="uml:PrimitiveType" href="pathmap://PapyrusC_Cpp_LIBRARIES/AnsiCLibrary.uml#_7wRIABydEduyofBvg4RL2w"/> </ownedParameter> <language>C/C++</language> @@ -57,7 +57,7 @@ cout << "value: " << arg;</body> </ownedBehavior> <ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_pX7DgDcmEeO6UdbIk03c9Q" name="Operation2" isReentrant="false" specification="_jnWMADcmEeO6UdbIk03c9Q"> - <ownedParameter xmi:type="uml:Parameter" xmi:id="_8cra8TczEeOimIxd1A6OhA" name="args"> + <ownedParameter xmi:type="uml:Parameter" xmi:id="_JPgCEEL5EeO1TdFz52di_Q" name="args"> <type xmi:type="uml:PrimitiveType" href="pathmap://PapyrusC_Cpp_LIBRARIES/AnsiCLibrary.uml#_5lVhgBydEduyofBvg4RL2w"/> </ownedParameter> <language>C/C++</language> @@ -68,7 +68,7 @@ args[0] = 2;</body> <ownedComment xmi:type="uml:Comment" xmi:id="_II4ccP6WEeKlg5tzGV3QVQ" annotatedElement="_II4ccP6WEeKlg5tzGV3QVQ"> <body></body> </ownedComment> - <ownedParameter xmi:type="uml:Parameter" xmi:id="_8co-sDczEeOimIxd1A6OhA" name="arg"> + <ownedParameter xmi:type="uml:Parameter" xmi:id="_JPy9AEL5EeO1TdFz52di_Q" name="arg"> <type xmi:type="uml:PrimitiveType" href="pathmap://PapyrusC_Cpp_LIBRARIES/AnsiCLibrary.uml#_7wRIABydEduyofBvg4RL2w"/> </ownedParameter> </ownedOperation> @@ -76,7 +76,7 @@ args[0] = 2;</body> <ownedComment xmi:type="uml:Comment" xmi:id="_rH4lQDcmEeO6UdbIk03c9Q" annotatedElement="_rH4lQDcmEeO6UdbIk03c9Q"> <body></body> </ownedComment> - <ownedParameter xmi:type="uml:Parameter" xmi:id="_8cra8DczEeOimIxd1A6OhA" name="args"> + <ownedParameter xmi:type="uml:Parameter" xmi:id="_JPbwoEL5EeO1TdFz52di_Q" name="args"> <type xmi:type="uml:PrimitiveType" href="pathmap://PapyrusC_Cpp_LIBRARIES/AnsiCLibrary.uml#_5lVhgBydEduyofBvg4RL2w"/> </ownedParameter> </ownedOperation> @@ -116,7 +116,7 @@ args[0] = 2;</body> </profileApplication> </uml:Model> <C_Cpp:Typedef xmi:id="_D6FjUDcWEeO6UdbIk03c9Q" definition="int" base_primitivetype="_DHJ24C-JEeObJ6ARx67E0g"/> - <C_Cpp:Const xmi:id="_8cvsYDczEeOimIxd1A6OhA" base_parameter="_8cra8DczEeOimIxd1A6OhA"/> - <C_Cpp:Ptr xmi:id="_8czWwDczEeOimIxd1A6OhA" base_parameter="_8cra8DczEeOimIxd1A6OhA"/> - <C_Cpp:Array xmi:id="_8c3oMDczEeOimIxd1A6OhA" base_parameter="_8cra8DczEeOimIxd1A6OhA" definition="[5]"/> + <C_Cpp:Const xmi:id="_JPmvwEL5EeO1TdFz52di_Q" base_parameter="_JPbwoEL5EeO1TdFz52di_Q"/> + <C_Cpp:Ptr xmi:id="_JProQEL5EeO1TdFz52di_Q" base_parameter="_JPbwoEL5EeO1TdFz52di_Q"/> + <C_Cpp:Array xmi:id="_JPxH0EL5EeO1TdFz52di_Q" base_parameter="_JPbwoEL5EeO1TdFz52di_Q" definition="[5]"/> </xmi:XMI> diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/META-INF/MANIFEST.MF b/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/META-INF/MANIFEST.MF index 715a6e6e386..288bbc369fb 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/META-INF/MANIFEST.MF +++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/META-INF/MANIFEST.MF @@ -30,6 +30,7 @@ Require-Bundle: org.eclipse.ui, org.eclipse.ui.ide;bundle-version="3.9.0", org.eclipse.papyrus.infra.gmfdiag.commands;bundle-version="0.10.1", org.eclipse.papyrus.acceleo;bundle-version="0.10.1", + org.eclipse.papyrus.acceleo.ui;bundle-version="0.10.1", org.eclipse.papyrus.infra.emf;bundle-version="0.10.1", org.eclipse.papyrus.infra.widgets;bundle-version="0.10.1", org.eclipse.papyrus.uml.tools.utils;bundle-version="0.10.1" diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/editor/PapyrusCDTEditor.java b/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/editor/PapyrusCDTEditor.java index 3b524fd2183..589a5aefb3f 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/editor/PapyrusCDTEditor.java +++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/editor/PapyrusCDTEditor.java @@ -14,11 +14,19 @@ package org.eclipse.papyrus.texteditor.cdt.editor;
import org.eclipse.cdt.codan.internal.ui.cxx.CodanCReconciler;
+import org.eclipse.cdt.core.model.ICElement;
+import org.eclipse.cdt.core.model.ISourceRange;
+import org.eclipse.cdt.core.model.ISourceReference;
+import org.eclipse.cdt.core.model.ITranslationUnit;
import org.eclipse.cdt.internal.ui.editor.CEditor;
+import org.eclipse.cdt.ui.CDTUITools;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EValidator;
import org.eclipse.emf.ecore.util.EcoreUtil;
@@ -35,6 +43,7 @@ import org.eclipse.papyrus.infra.core.lifecycleevents.ISaveEventListener; import org.eclipse.papyrus.infra.core.services.ServiceException;
import org.eclipse.papyrus.infra.core.services.ServicesRegistry;
import org.eclipse.papyrus.texteditor.cdt.Activator;
+import org.eclipse.papyrus.texteditor.cdt.sync.ObtainICElement;
import org.eclipse.papyrus.texteditor.cdt.sync.RevealCurrentOperation;
import org.eclipse.papyrus.texteditor.cdt.sync.SyncCDTtoModel;
import org.eclipse.papyrus.texteditor.cdt.sync.SyncModelToCDT;
@@ -57,6 +66,7 @@ import org.eclipse.ui.part.FileEditorInput; import org.eclipse.ui.texteditor.ITextEditorActionConstants;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Element;
+import org.eclipse.uml2.uml.NamedElement;
/**
* A specialization of the CDT editor made for integration into Papyrus
@@ -135,6 +145,35 @@ public class PapyrusCDTEditor extends CEditor { actionBars.setGlobalActionHandler(ITextEditorActionConstants.REDO, gmfRedo);
actionBars.updateActionBars();
}
+
+ papyrusTextInstance.eAdapters().add(new Adapter() {
+
+ public void notifyChanged(Notification notification) {
+ // TODO Auto-generated method stub
+ if (notification.getEventType() == Notification.SET) {
+ if (notification.getNewValue() instanceof NamedElement) {
+ gotoElement((NamedElement) notification.getNewValue());
+ }
+
+ }
+ }
+
+ public Notifier getTarget() {
+ return null;
+ }
+
+ public void setTarget(Notifier newTarget) {
+ }
+
+ public boolean isAdapterForType(Object type) {
+ return false;
+ }
+
+ });
+
+ if (papyrusTextInstance.getSelectedObject() instanceof NamedElement) {
+ gotoElement((NamedElement) papyrusTextInstance.getSelectedObject());
+ }
}
/**
@@ -150,9 +189,8 @@ public class PapyrusCDTEditor extends CEditor { @Override
public ISourceViewer createSourceViewer(Composite parent, IVerticalRuler ruler, int styles) {
- ISourceViewer viewer = super.createSourceViewer(parent, ruler, styles);
+ final ISourceViewer viewer = super.createSourceViewer(parent, ruler, styles);
// ISourceViewer viewer = new DelegatingSourceViewer(origViewer, (Classifier)papyrusTextInstance.getEditedObject());
-
focusListener = new FocusListener() {
public void focusLost(FocusEvent e) {
@@ -189,7 +227,6 @@ public class PapyrusCDTEditor extends CEditor { };
// register focus listener
viewer.getTextWidget().addFocusListener(focusListener);
-
SelectionListener selectionListener = new SelectionListener() {
public void widgetSelected(SelectionEvent e) {
@@ -236,6 +273,36 @@ public class PapyrusCDTEditor extends CEditor { return viewer;
}
+ /**
+ * Goto a specific element within the text editor. Currently, only methods are supported.
+ *
+ * @param element
+ * @throws CoreException
+ */
+ public void gotoElement(NamedElement element) {
+ // IFile srcFile = SyncModelToCDT.syncModelToCDT((Classifier) pe);
+ // ITranslationUnit itu2 = (ITranslationUnit) CoreModel.getDefault().create(srcFile);
+
+ ICElement ice = CDTUITools.getEditorInputCElement(m_input);
+
+ if(ice instanceof ITranslationUnit) {
+ ITranslationUnit itu = (ITranslationUnit) ice;
+ ICElement icElement = ObtainICElement.getICElement(itu, element);
+ if (icElement instanceof ISourceReference) {
+ try {
+ ISourceRange range = ((ISourceReference)icElement).getSourceRange();
+
+ ISourceViewer viewer = getSourceViewer();
+ viewer.revealRange(range.getStartPos(), 1);
+ viewer.setSelectedRange(range.getStartPos(), range.getLength());
+ return;
+ }
+ catch (CoreException e) {
+ }
+ }
+ }
+ }
+
@Override
public boolean isDirty() {
boolean isDirty = super.isDirty();
@@ -274,6 +341,7 @@ public class PapyrusCDTEditor extends CEditor { super.doSetInput(newInput);
syncCpp = new SyncCDTtoModel(newInput, classifier, uri.segment(1));
+ m_input = newInput;
reveal = new RevealCurrentOperation(newInput, classifier, uri.segment(1));
// add the reconciler to get syntax check and completion. (still no full checks)
@@ -314,4 +382,6 @@ public class PapyrusCDTEditor extends CEditor { protected IFile srcFile;
protected ISelectionProvider sp;
+
+ protected IEditorInput m_input;
}
diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/handler/PapyrusCDTEditorHandler.java b/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/handler/PapyrusCDTEditorHandler.java index d5b95fb7096..e8b66fb154f 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/handler/PapyrusCDTEditorHandler.java +++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/handler/PapyrusCDTEditorHandler.java @@ -14,12 +14,8 @@ *****************************************************************************/
package org.eclipse.papyrus.texteditor.cdt.handler;
-import java.util.ArrayList;
-import java.util.List;
-
import org.eclipse.cdt.core.CCProjectNature;
import org.eclipse.cdt.core.CProjectNature;
-import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
@@ -32,11 +28,9 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.workspace.AbstractEMFOperation;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.papyrus.acceleo.ui.handlers.CmdHandler;
import org.eclipse.papyrus.commands.CheckedOperationHistory;
import org.eclipse.papyrus.infra.core.resource.NotFoundException;
import org.eclipse.papyrus.infra.core.sasheditor.contentprovider.IPageManager;
@@ -49,17 +43,17 @@ import org.eclipse.papyrus.texteditor.cdt.editor.PapyrusCDTEditor; import org.eclipse.papyrus.texteditor.cdt.modelresource.TextEditorModelSharedResource;
import org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModel;
import org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModelFactory;
-import org.eclipse.ui.PlatformUI;
import org.eclipse.uml2.uml.Class;
+import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.DataType;
-import org.eclipse.uml2.uml.NamedElement;
import org.eclipse.uml2.uml.Operation;
+import org.eclipse.uml2.uml.Transition;
/**
* The handler creates a new CDT editor
*/
-public class PapyrusCDTEditorHandler extends AbstractHandler {
+public class PapyrusCDTEditorHandler extends CmdHandler {
public PapyrusCDTEditorHandler() {
@@ -73,64 +67,35 @@ public class PapyrusCDTEditorHandler extends AbstractHandler { */
@Override
public boolean isEnabled() {
- List<EObject> selected = getSelection();
- if(selected.size() == 1) {
- Object o = selected.get(0);
- if(o instanceof Class || o instanceof DataType) {
- URI uri = ((EObject) o).eResource().getURI();
-
- // URIConverter uriConverter = resource.getResourceSet().getURIConverter();
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
- if(uri.segmentCount() < 2) {
- return false;
- }
- IProject modelProject = root.getProject(uri.segment(1));
- if(modelProject.exists()) {
- try {
- // check whether the project is a C or C++ project
- if(modelProject.hasNature(CProjectNature.C_NATURE_ID) ||
- modelProject.hasNature(CCProjectNature.CC_NATURE_ID)) {
- return true;
- }
- }
- catch (CoreException e) {
- Activator.getDefault().getLog().log(
- new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not verify, if CDT project", e));
- }
- }
+ updateSelectedEObject();
+ if (selectedEObject instanceof Class ||
+ selectedEObject instanceof DataType ||
+ selectedEObject instanceof Operation ||
+ selectedEObject instanceof Transition)
+ {
+ URI uri = selectedEObject.eResource().getURI();
+
+ // URIConverter uriConverter = resource.getResourceSet().getURIConverter();
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+ if(uri.segmentCount() < 2) {
+ return false;
}
- }
- return false;
- }
-
- /**
- *
- * @return
- * the current selection
- */
- protected List<EObject> getSelection() {
- ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
- List<EObject> currentSelection = new ArrayList<EObject>();
- for(Object current : ((IStructuredSelection)selection).toArray()) {
- if(current instanceof IAdaptable) {
- EObject tmp = (EObject)((IAdaptable)current).getAdapter(EObject.class);
- if(tmp != null) {
- if((tmp instanceof Class) || (tmp instanceof DataType)) {
- currentSelection.add(tmp);
- }
- else if (tmp instanceof Operation) {
- Operation op = (Operation) tmp;
- if (op.getClass_() != null) {
- currentSelection.add(op.getDatatype());
- }
- else if (op.getDatatype() != null) {
- currentSelection.add(op.getDatatype());
- }
+ IProject modelProject = root.getProject(uri.segment(1));
+ if(modelProject.exists()) {
+ try {
+ // check whether the project is a C or C++ project
+ if(modelProject.hasNature(CProjectNature.C_NATURE_ID) ||
+ modelProject.hasNature(CCProjectNature.CC_NATURE_ID)) {
+ return true;
}
}
+ catch (CoreException e) {
+ Activator.getDefault().getLog().log(
+ new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Could not verify, if CDT project", e));
+ }
}
}
- return currentSelection;
+ return false;
}
/**
@@ -185,14 +150,16 @@ public class PapyrusCDTEditorHandler extends AbstractHandler { // Get the page manager allowing to add/open an editor.
IPageManager pageMngr = ServiceUtils.getInstance().getIPageManager(serviceRegistry);
- Object editorModel = getEditorModel(serviceRegistry);
+ Classifier classifierToEdit = getClassifierToEdit();
+
+ TextEditorModel editorModel = getEditorModel(serviceRegistry, classifierToEdit);
if (editorModel == null) {
// no editor exist for the given file => create
- editorModel = createEditorModel(serviceRegistry);
+ editorModel = createEditorModel(serviceRegistry, classifierToEdit);
// add the new editor model to the sash.
}
- // TODO: editorModel remains in notation, even if editor is closed
- if (pageMngr.isOpen(editorModel)) {
+ editorModel.setSelectedObject(selectedEObject);
+ if (pageMngr.isOpen(editorModel)) {
// select existing editor
pageMngr.selectPage(editorModel);
}
@@ -209,17 +176,12 @@ public class PapyrusCDTEditorHandler extends AbstractHandler { * @throws NotFoundException
* The model where to save the TableInstance is not found.
*/
- protected Object createEditorModel(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
+ protected TextEditorModel createEditorModel(final ServicesRegistry serviceRegistry, Classifier classifierToEdit) throws ServiceException, NotFoundException {
TextEditorModel editorModel = TextEditorModelFactory.eINSTANCE.createTextEditorModel();
- EObject editedObject = getSelection().get(0);
- editorModel.setEditedObject(editedObject);
+
+ editorModel.setEditedObject(classifierToEdit);
editorModel.setType(PapyrusCDTEditor.EDITOR_TYPE);
- if(editedObject instanceof NamedElement) {
- editorModel.setName("CDT " + ((NamedElement)editedObject).getName()); //$NON-NLS-1$
- }
- else {
- editorModel.setName(PapyrusCDTEditor.EDITOR_DEFAULT_NAME);
- }
+ editorModel.setName("CDT " + classifierToEdit.getName()); //$NON-NLS-1$
TextEditorModelSharedResource model = (TextEditorModelSharedResource)
ServiceUtils.getInstance().getModelSet(serviceRegistry).getModelChecked(TextEditorModelSharedResource.MODEL_ID);
model.addTextEditorModel(editorModel);
@@ -227,10 +189,36 @@ public class PapyrusCDTEditorHandler extends AbstractHandler { return editorModel;
}
- protected Object getEditorModel(final ServicesRegistry serviceRegistry) throws ServiceException, NotFoundException {
+ /**
+ * The classifier to edit - corresponding to the selected object.
+ * @return
+ */
+ protected Classifier getClassifierToEdit() {
+ if(selectedEObject instanceof Operation) {
+ return ((Operation) selectedEObject).getFeaturingClassifiers().get(0);
+ }
+ else if (selectedEObject instanceof Transition) {
+ return ((Transition) selectedEObject).getContainer().getStateMachine().getContext();
+ }
+ else if (selectedEObject instanceof Classifier) {
+ // must be class or datatype
+ return (Classifier) selectedEObject;
+ }
+ return null;
+ }
+
+ /**
+ * return the editor model corresponding to an EObject
+ *
+ * @param serviceRegistry the service registry
+ * @param classifierToEdit The classifier for which a CDT editor should be opened
+ * @return
+ * @throws ServiceException
+ * @throws NotFoundException
+ */
+ protected TextEditorModel getEditorModel(final ServicesRegistry serviceRegistry, Classifier classifierToEdit) throws ServiceException, NotFoundException {
TextEditorModelSharedResource model = (TextEditorModelSharedResource)
ServiceUtils.getInstance().getModelSet(serviceRegistry).getModelChecked(TextEditorModelSharedResource.MODEL_ID);
- EObject editedObject = getSelection().get(0);
- return model.getTextEditorModel(editedObject);
+ return model.getTextEditorModel(classifierToEdit);
}
}
diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/sync/ObtainICElement.java b/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/sync/ObtainICElement.java new file mode 100644 index 00000000000..d98da785558 --- /dev/null +++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/sync/ObtainICElement.java @@ -0,0 +1,39 @@ +package org.eclipse.papyrus.texteditor.cdt.sync; + +import org.eclipse.cdt.core.model.ICElement; +import org.eclipse.cdt.core.model.IFunctionDeclaration; +import org.eclipse.cdt.core.model.IParent; +import org.eclipse.core.runtime.CoreException; +import org.eclipse.uml2.uml.NamedElement; +import org.eclipse.uml2.uml.Operation; + +public class ObtainICElement { + /** + * Return the ICelement associated with a UML element. Currently, only methods are supported. + * @param parent the parent (typically the translation unit of a CDT file) + * @param element A named UML element + * @throws CoreException + */ + public static ICElement getICElement(IParent parent, NamedElement element) { + try { + for(ICElement child : parent.getChildren()) { + if(child instanceof IParent) { + getICElement((IParent)child, element); + } + if(child instanceof IFunctionDeclaration) { + // IFunctionDeclaration function = (IFunctionDeclaration) child; + + if (element instanceof Operation) { + if (child.getElementName().endsWith("::" + element.getName())) { + return child; + } + } + } + } + } + catch (CoreException e) { + } + return null; + } + +} diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/model/texteditormodel.ecore b/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/model/texteditormodel.ecore index ebd0b42107a..799415a4228 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/model/texteditormodel.ecore +++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/model/texteditormodel.ecore @@ -6,5 +6,7 @@ <eStructuralFeatures xsi:type="ecore:EReference" name="editedObject" eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EObject"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="type" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="name" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
+ <eStructuralFeatures xsi:type="ecore:EReference" name="selectedObject" eType="ecore:EClass platform:/plugin/org.eclipse.emf.ecore/model/Ecore.ecore#//EObject"/>
+ <eStructuralFeatures xsi:type="ecore:EAttribute" name="lineNumber" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EInt"/>
</eClassifiers>
</ecore:EPackage>
diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/model/texteditormodel.genmodel b/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/model/texteditormodel.genmodel index 371abd0640c..f779d1912fd 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/model/texteditormodel.genmodel +++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/model/texteditormodel.genmodel @@ -11,6 +11,8 @@ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference texteditormodel.ecore#//TextEditorModel/editedObject"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute texteditormodel.ecore#//TextEditorModel/type"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute texteditormodel.ecore#//TextEditorModel/name"/>
+ <genFeatures notify="false" createChild="false" propertySortChoices="true" ecoreFeature="ecore:EReference texteditormodel.ecore#//TextEditorModel/selectedObject"/>
+ <genFeatures createChild="false" ecoreFeature="ecore:EAttribute texteditormodel.ecore#//TextEditorModel/lineNumber"/>
</genClasses>
</genPackages>
</genmodel:GenModel>
diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/TextEditorModel.java b/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/TextEditorModel.java index ab1609add7c..47d1f510305 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/TextEditorModel.java +++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/TextEditorModel.java @@ -26,6 +26,8 @@ import org.eclipse.emf.ecore.EObject; * <li>{@link org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModel#getEditedObject <em>Edited Object</em>}</li> * <li>{@link org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModel#getType <em>Type</em>}</li> * <li>{@link org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModel#getName <em>Name</em>}</li> + * <li>{@link org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModel#getSelectedObject <em>Selected Object</em>}</li> + * <li>{@link org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModel#getLineNumber <em>Line Number</em>}</li> * </ul> * </p> * @@ -112,4 +114,56 @@ public interface TextEditorModel extends EModelElement { */ void setName(String value); + /** + * Returns the value of the '<em><b>Selected Object</b></em>' reference. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Selected Object</em>' reference isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Selected Object</em>' reference. + * @see #setSelectedObject(EObject) + * @see org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModelPackage#getTextEditorModel_SelectedObject() + * @model + * @generated + */ + EObject getSelectedObject(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModel#getSelectedObject <em>Selected Object</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Selected Object</em>' reference. + * @see #getSelectedObject() + * @generated + */ + void setSelectedObject(EObject value); + + /** + * Returns the value of the '<em><b>Line Number</b></em>' attribute. + * <!-- begin-user-doc --> + * <p> + * If the meaning of the '<em>Line Number</em>' attribute isn't clear, + * there really should be more of a description here... + * </p> + * <!-- end-user-doc --> + * @return the value of the '<em>Line Number</em>' attribute. + * @see #setLineNumber(int) + * @see org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModelPackage#getTextEditorModel_LineNumber() + * @model + * @generated + */ + int getLineNumber(); + + /** + * Sets the value of the '{@link org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModel#getLineNumber <em>Line Number</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @param value the new value of the '<em>Line Number</em>' attribute. + * @see #getLineNumber() + * @generated + */ + void setLineNumber(int value); + } // TextEditorModel diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/TextEditorModelPackage.java b/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/TextEditorModelPackage.java index d7220ce9d85..15f4f34afb4 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/TextEditorModelPackage.java +++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/TextEditorModelPackage.java @@ -48,7 +48,7 @@ public interface TextEditorModelPackage extends EPackage { * <!-- end-user-doc --> * @generated */ - String eNS_URI = "http://www.eclipse.org/Papyrus/Example/0.10.0/texteditormodel"; + String eNS_URI = "http://www.eclipse.org/Papyrus/TextEditor/0.10.0/texteditormodel"; /** * The package namespace name. @@ -113,13 +113,31 @@ public interface TextEditorModelPackage extends EPackage { int TEXT_EDITOR_MODEL__NAME = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 2; /** + * The feature id for the '<em><b>Selected Object</b></em>' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int TEXT_EDITOR_MODEL__SELECTED_OBJECT = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 3; + + /** + * The feature id for the '<em><b>Line Number</b></em>' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + * @ordered + */ + int TEXT_EDITOR_MODEL__LINE_NUMBER = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 4; + + /** * The number of structural features of the '<em>Text Editor Model</em>' class. * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated * @ordered */ - int TEXT_EDITOR_MODEL_FEATURE_COUNT = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 3; + int TEXT_EDITOR_MODEL_FEATURE_COUNT = EcorePackage.EMODEL_ELEMENT_FEATURE_COUNT + 5; /** @@ -166,6 +184,28 @@ public interface TextEditorModelPackage extends EPackage { EAttribute getTextEditorModel_Name(); /** + * Returns the meta object for the reference '{@link org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModel#getSelectedObject <em>Selected Object</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the reference '<em>Selected Object</em>'. + * @see org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModel#getSelectedObject() + * @see #getTextEditorModel() + * @generated + */ + EReference getTextEditorModel_SelectedObject(); + + /** + * Returns the meta object for the attribute '{@link org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModel#getLineNumber <em>Line Number</em>}'. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @return the meta object for the attribute '<em>Line Number</em>'. + * @see org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModel#getLineNumber() + * @see #getTextEditorModel() + * @generated + */ + EAttribute getTextEditorModel_LineNumber(); + + /** * Returns the factory that creates the instances of the model. * <!-- begin-user-doc --> * <!-- end-user-doc --> @@ -221,6 +261,22 @@ public interface TextEditorModelPackage extends EPackage { */ EAttribute TEXT_EDITOR_MODEL__NAME = eINSTANCE.getTextEditorModel_Name(); + /** + * The meta object literal for the '<em><b>Selected Object</b></em>' reference feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EReference TEXT_EDITOR_MODEL__SELECTED_OBJECT = eINSTANCE.getTextEditorModel_SelectedObject(); + + /** + * The meta object literal for the '<em><b>Line Number</b></em>' attribute feature. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + EAttribute TEXT_EDITOR_MODEL__LINE_NUMBER = eINSTANCE.getTextEditorModel_LineNumber(); + } } //TextEditorModelPackage diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/impl/TextEditorModelImpl.java b/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/impl/TextEditorModelImpl.java index fc2a229721d..66f75d80aff 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/impl/TextEditorModelImpl.java +++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/impl/TextEditorModelImpl.java @@ -34,6 +34,8 @@ import org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModelPacka * <li>{@link org.eclipse.papyrus.texteditor.model.texteditormodel.impl.TextEditorModelImpl#getEditedObject <em>Edited Object</em>}</li> * <li>{@link org.eclipse.papyrus.texteditor.model.texteditormodel.impl.TextEditorModelImpl#getType <em>Type</em>}</li> * <li>{@link org.eclipse.papyrus.texteditor.model.texteditormodel.impl.TextEditorModelImpl#getName <em>Name</em>}</li> + * <li>{@link org.eclipse.papyrus.texteditor.model.texteditormodel.impl.TextEditorModelImpl#getSelectedObject <em>Selected Object</em>}</li> + * <li>{@link org.eclipse.papyrus.texteditor.model.texteditormodel.impl.TextEditorModelImpl#getLineNumber <em>Line Number</em>}</li> * </ul> * </p> * @@ -91,6 +93,36 @@ public class TextEditorModelImpl extends EModelElementImpl implements TextEditor protected String name = NAME_EDEFAULT; /** + * The cached value of the '{@link #getSelectedObject() <em>Selected Object</em>}' reference. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getSelectedObject() + * @generated + * @ordered + */ + protected EObject selectedObject; + + /** + * The default value of the '{@link #getLineNumber() <em>Line Number</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getLineNumber() + * @generated + * @ordered + */ + protected static final int LINE_NUMBER_EDEFAULT = 0; + + /** + * The cached value of the '{@link #getLineNumber() <em>Line Number</em>}' attribute. + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @see #getLineNumber() + * @generated + * @ordered + */ + protected int lineNumber = LINE_NUMBER_EDEFAULT; + + /** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated @@ -194,6 +226,65 @@ public class TextEditorModelImpl extends EModelElementImpl implements TextEditor * <!-- end-user-doc --> * @generated */ + public EObject getSelectedObject() { + if (selectedObject != null && selectedObject.eIsProxy()) { + InternalEObject oldSelectedObject = (InternalEObject)selectedObject; + selectedObject = eResolveProxy(oldSelectedObject); + if (selectedObject != oldSelectedObject) { + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.RESOLVE, TextEditorModelPackage.TEXT_EDITOR_MODEL__SELECTED_OBJECT, oldSelectedObject, selectedObject)); + } + } + return selectedObject; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EObject basicGetSelectedObject() { + return selectedObject; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setSelectedObject(EObject newSelectedObject) { + EObject oldSelectedObject = selectedObject; + selectedObject = newSelectedObject; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, TextEditorModelPackage.TEXT_EDITOR_MODEL__SELECTED_OBJECT, oldSelectedObject, selectedObject)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public int getLineNumber() { + return lineNumber; + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public void setLineNumber(int newLineNumber) { + int oldLineNumber = lineNumber; + lineNumber = newLineNumber; + if (eNotificationRequired()) + eNotify(new ENotificationImpl(this, Notification.SET, TextEditorModelPackage.TEXT_EDITOR_MODEL__LINE_NUMBER, oldLineNumber, lineNumber)); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ @Override public Object eGet(int featureID, boolean resolve, boolean coreType) { switch (featureID) { @@ -204,6 +295,11 @@ public class TextEditorModelImpl extends EModelElementImpl implements TextEditor return getType(); case TextEditorModelPackage.TEXT_EDITOR_MODEL__NAME: return getName(); + case TextEditorModelPackage.TEXT_EDITOR_MODEL__SELECTED_OBJECT: + if (resolve) return getSelectedObject(); + return basicGetSelectedObject(); + case TextEditorModelPackage.TEXT_EDITOR_MODEL__LINE_NUMBER: + return getLineNumber(); } return super.eGet(featureID, resolve, coreType); } @@ -225,6 +321,12 @@ public class TextEditorModelImpl extends EModelElementImpl implements TextEditor case TextEditorModelPackage.TEXT_EDITOR_MODEL__NAME: setName((String)newValue); return; + case TextEditorModelPackage.TEXT_EDITOR_MODEL__SELECTED_OBJECT: + setSelectedObject((EObject)newValue); + return; + case TextEditorModelPackage.TEXT_EDITOR_MODEL__LINE_NUMBER: + setLineNumber((Integer)newValue); + return; } super.eSet(featureID, newValue); } @@ -246,6 +348,12 @@ public class TextEditorModelImpl extends EModelElementImpl implements TextEditor case TextEditorModelPackage.TEXT_EDITOR_MODEL__NAME: setName(NAME_EDEFAULT); return; + case TextEditorModelPackage.TEXT_EDITOR_MODEL__SELECTED_OBJECT: + setSelectedObject((EObject)null); + return; + case TextEditorModelPackage.TEXT_EDITOR_MODEL__LINE_NUMBER: + setLineNumber(LINE_NUMBER_EDEFAULT); + return; } super.eUnset(featureID); } @@ -264,6 +372,10 @@ public class TextEditorModelImpl extends EModelElementImpl implements TextEditor return TYPE_EDEFAULT == null ? type != null : !TYPE_EDEFAULT.equals(type); case TextEditorModelPackage.TEXT_EDITOR_MODEL__NAME: return NAME_EDEFAULT == null ? name != null : !NAME_EDEFAULT.equals(name); + case TextEditorModelPackage.TEXT_EDITOR_MODEL__SELECTED_OBJECT: + return selectedObject != null; + case TextEditorModelPackage.TEXT_EDITOR_MODEL__LINE_NUMBER: + return lineNumber != LINE_NUMBER_EDEFAULT; } return super.eIsSet(featureID); } @@ -282,6 +394,8 @@ public class TextEditorModelImpl extends EModelElementImpl implements TextEditor result.append(type); result.append(", name: "); result.append(name); + result.append(", lineNumber: "); + result.append(lineNumber); result.append(')'); return result.toString(); } diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/impl/TextEditorModelPackageImpl.java b/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/impl/TextEditorModelPackageImpl.java index c1677284644..01fa90fdcb9 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/impl/TextEditorModelPackageImpl.java +++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.model/src/org/eclipse/papyrus/texteditor/model/texteditormodel/impl/TextEditorModelPackageImpl.java @@ -143,6 +143,24 @@ public class TextEditorModelPackageImpl extends EPackageImpl implements TextEdit * <!-- end-user-doc --> * @generated */ + public EReference getTextEditorModel_SelectedObject() { + return (EReference)textEditorModelEClass.getEStructuralFeatures().get(3); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ + public EAttribute getTextEditorModel_LineNumber() { + return (EAttribute)textEditorModelEClass.getEStructuralFeatures().get(4); + } + + /** + * <!-- begin-user-doc --> + * <!-- end-user-doc --> + * @generated + */ public TextEditorModelFactory getTextEditorModelFactory() { return (TextEditorModelFactory)getEFactoryInstance(); } @@ -170,6 +188,8 @@ public class TextEditorModelPackageImpl extends EPackageImpl implements TextEdit createEReference(textEditorModelEClass, TEXT_EDITOR_MODEL__EDITED_OBJECT); createEAttribute(textEditorModelEClass, TEXT_EDITOR_MODEL__TYPE); createEAttribute(textEditorModelEClass, TEXT_EDITOR_MODEL__NAME); + createEReference(textEditorModelEClass, TEXT_EDITOR_MODEL__SELECTED_OBJECT); + createEAttribute(textEditorModelEClass, TEXT_EDITOR_MODEL__LINE_NUMBER); } /** @@ -210,6 +230,8 @@ public class TextEditorModelPackageImpl extends EPackageImpl implements TextEdit initEReference(getTextEditorModel_EditedObject(), theEcorePackage.getEObject(), null, "editedObject", null, 0, 1, TextEditorModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getTextEditorModel_Type(), ecorePackage.getEString(), "type", null, 0, 1, TextEditorModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); initEAttribute(getTextEditorModel_Name(), ecorePackage.getEString(), "name", null, 0, 1, TextEditorModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEReference(getTextEditorModel_SelectedObject(), theEcorePackage.getEObject(), null, "selectedObject", null, 0, 1, TextEditorModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_COMPOSITE, IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); + initEAttribute(getTextEditorModel_LineNumber(), ecorePackage.getEInt(), "lineNumber", null, 0, 1, TextEditorModel.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED); // Create resource createResource(eNS_URI); |