Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvlorenzo2012-02-22 08:50:53 +0000
committervlorenzo2012-02-22 08:50:53 +0000
commitf4b4a60ba86f049eef4ce191ba6cc002c6f7100e (patch)
treefd552b60f50164c2efa321ccb45c8021f5a0f1de /incoming
parent263423f7a01ce1e8c475c09bee6f3b905ae21b7f (diff)
downloadorg.eclipse.papyrus-f4b4a60ba86f049eef4ce191ba6cc002c6f7100e.tar.gz
org.eclipse.papyrus-f4b4a60ba86f049eef4ce191ba6cc002c6f7100e.tar.xz
org.eclipse.papyrus-f4b4a60ba86f049eef4ce191ba6cc002c6f7100e.zip
372031: [Documentation][Developper] The creation of nested Editor should be documented
https://bugs.eclipse.org/bugs/show_bug.cgi?id=372031
Diffstat (limited to 'incoming')
-rw-r--r--incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java13
-rw-r--r--incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/handler/CommentEditorHandler.java6
-rw-r--r--incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/modelresource/TextEditorModelCommentResource.java35
-rw-r--r--incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/factory/CommentEditorFactory.java15
-rw-r--r--incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/handler/CommentEditorHandler.java6
-rw-r--r--incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/modelresource/TextEditorModelSharedResource.java7
6 files changed, 33 insertions, 49 deletions
diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java b/incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java
index 4d8554938f9..0cb524d35c7 100644
--- a/incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java
+++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/factory/CommentEditorFactory.java
@@ -19,7 +19,6 @@ import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
import org.eclipse.papyrus.example.uml.comment.editor.newresource.Activator;
import org.eclipse.papyrus.example.uml.comment.editor.newresource.editor.PapyrusCommentEditor;
-import org.eclipse.papyrus.example.uml.comment.editor.newresource.handler.CommentEditorHandler;
import org.eclipse.papyrus.infra.core.editor.BackboneException;
import org.eclipse.papyrus.infra.core.extension.diagrameditor.AbstractEditorFactory;
import org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
@@ -45,7 +44,7 @@ public class CommentEditorFactory extends AbstractEditorFactory {
* the type of editor
*/
public CommentEditorFactory() {
- super(PapyrusCommentEditor.class,PapyrusCommentEditor.EDITOR_TYPE);
+ super(PapyrusCommentEditor.class, PapyrusCommentEditor.EDITOR_TYPE);
}
/**
@@ -117,8 +116,12 @@ public class CommentEditorFactory extends AbstractEditorFactory {
*/
public IEditorPart createIEditorPart() throws PartInitException {
try {
- Constructor<?> c = getDiagramClass().getConstructor(ServicesRegistry.class, PapyrusTextInstance.class);
- editor = (IEditorPart)c.newInstance(servicesRegistry, rawModel);
+ //we use this way when there is one factory for several editor types
+ // Constructor<?> c = getDiagramClass().getConstructor(ServicesRegistry.class, PapyrusTextInstance.class);
+ // editor = (IEditorPart)c.newInstance(servicesRegistry, rawModel);
+
+ //we use this way when there is only one editor type
+ editor = new PapyrusCommentEditor(servicesRegistry, rawModel);
return editor;
} catch (Exception e) {
@@ -186,7 +189,7 @@ public class CommentEditorFactory extends AbstractEditorFactory {
*/
public Image getTabIcon() {
ImageDescriptor imageDescriptor = getEditorDescriptor().getIcon();
- if(imageDescriptor == null){
+ if(imageDescriptor == null) {
return null;
}
return imageDescriptor.createImage();
diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/handler/CommentEditorHandler.java b/incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/handler/CommentEditorHandler.java
index b1e9bd4fee3..52857fd9f45 100644
--- a/incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/handler/CommentEditorHandler.java
+++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/handler/CommentEditorHandler.java
@@ -62,7 +62,11 @@ public class CommentEditorHandler extends AbstractHandler {
return getSelection().size() == 1;
}
- //TODO essayer de merger cet handler avec un autre fournissant une commande et la sélection!
+ /**
+ *
+ * @return
+ * the current selection
+ */
protected List<EObject> getSelection() {
ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
List<EObject> currentSelection = new ArrayList<EObject>();
diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/modelresource/TextEditorModelCommentResource.java b/incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/modelresource/TextEditorModelCommentResource.java
index 74d4be96bed..4a20d8eb412 100644
--- a/incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/modelresource/TextEditorModelCommentResource.java
+++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.newresource/src/org/eclipse/papyrus/example/uml/comment/editor/newresource/modelresource/TextEditorModelCommentResource.java
@@ -12,26 +12,18 @@
*
*****************************************************************************/
package org.eclipse.papyrus.example.uml.comment.editor.newresource.modelresource;
+
import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
-import org.eclipse.papyrus.infra.core.resource.AbstractBaseModel;
import org.eclipse.papyrus.infra.core.resource.AbstractDynamicModel;
import org.eclipse.papyrus.infra.core.resource.IModel;
public class TextEditorModelCommentResource extends AbstractDynamicModel<PapyrusTextInstance> implements IModel {
- /*
- * To save in a new file :
- * the class should extends AbstractBaseModel and NOTATION_FILE_EXTENSION = "nattable" for example
- */
-
-
/**
- * File extension used for notation.
+ * File extension used for comment.
*/
- public static final String COMMENT_FILE_EXTENSION = "comment"; //$NON-NLS-1$
-
-// public static final String NOTATION_FILE_EXTENSION = "notation"; //$NON-NLS-1$
+ public static final String COMMENT_FILE_EXTENSION = "comment"; //$NON-NLS-1$
/**
* Model ID.
@@ -40,9 +32,9 @@ public class TextEditorModelCommentResource extends AbstractDynamicModel<Papyrus
/**
- *
+ *
* Constructor.
- *
+ *
*/
public TextEditorModelCommentResource() {
@@ -51,9 +43,9 @@ public class TextEditorModelCommentResource extends AbstractDynamicModel<Papyrus
/**
* Get the file extension used for this model.
- *
+ *
* @see org.eclipse.papyrus.infra.core.resource.AbstractBaseModel#getModelFileExtension()
- *
+ *
* @return
*/
@Override
@@ -81,7 +73,6 @@ public class TextEditorModelCommentResource extends AbstractDynamicModel<Papyrus
* The compareInstance to add.
*/
public void addPapyrusTextInstance(PapyrusTextInstance compareInstance) {
-// getResource().getContents().add(compareInstance);
addModelRoot(compareInstance);
}
@@ -95,16 +86,4 @@ public class TextEditorModelCommentResource extends AbstractDynamicModel<Papyrus
getResource().getContents().remove(compareInstance);
}
-// /**
-// *
-// * @see org.eclipse.papyrus.infra.core.resource.AbstractModelWithSharedResource#isModelRoot(org.eclipse.emf.ecore.EObject)
-// *
-// * @param object
-// * @return
-// */
-// @Override
-// protected boolean isModelRoot(EObject object) {
-// return false;
-// }
-
}
diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/factory/CommentEditorFactory.java b/incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/factory/CommentEditorFactory.java
index f59f0d3a085..94c266fd4d3 100644
--- a/incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/factory/CommentEditorFactory.java
+++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/factory/CommentEditorFactory.java
@@ -13,13 +13,10 @@
*****************************************************************************/
package org.eclipse.papyrus.example.uml.comment.editor.sharedresource.factory;
-import java.lang.reflect.Constructor;
-
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.papyrus.example.text.instance.papyrustextinstance.PapyrusTextInstance;
import org.eclipse.papyrus.example.uml.comment.editor.sharedresource.Activator;
import org.eclipse.papyrus.example.uml.comment.editor.sharedresource.editor.PapyrusCommentEditor;
-import org.eclipse.papyrus.example.uml.comment.editor.sharedresource.handler.CommentEditorHandler;
import org.eclipse.papyrus.infra.core.editor.BackboneException;
import org.eclipse.papyrus.infra.core.extension.diagrameditor.AbstractEditorFactory;
import org.eclipse.papyrus.infra.core.multidiagram.actionbarcontributor.ActionBarContributorRegistry;
@@ -45,7 +42,7 @@ public class CommentEditorFactory extends AbstractEditorFactory {
* the type of editor
*/
public CommentEditorFactory() {
- super(PapyrusCommentEditor.class,PapyrusCommentEditor.EDITOR_TYPE);
+ super(PapyrusCommentEditor.class, PapyrusCommentEditor.EDITOR_TYPE);
}
/**
@@ -117,8 +114,12 @@ public class CommentEditorFactory extends AbstractEditorFactory {
*/
public IEditorPart createIEditorPart() throws PartInitException {
try {
- Constructor<?> c = getDiagramClass().getConstructor(ServicesRegistry.class, PapyrusTextInstance.class);
- editor = (IEditorPart)c.newInstance(servicesRegistry, rawModel);
+ //we use this way when there is one factory for several editor types
+ // Constructor<?> c = getDiagramClass().getConstructor(ServicesRegistry.class, PapyrusTextInstance.class);
+ // editor = (IEditorPart)c.newInstance(servicesRegistry, rawModel);
+
+ //we use this way when there is only one editor type
+ editor = new PapyrusCommentEditor(servicesRegistry, rawModel);
return editor;
} catch (Exception e) {
@@ -186,7 +187,7 @@ public class CommentEditorFactory extends AbstractEditorFactory {
*/
public Image getTabIcon() {
ImageDescriptor imageDescriptor = getEditorDescriptor().getIcon();
- if(imageDescriptor == null){
+ if(imageDescriptor == null) {
return null;
}
return imageDescriptor.createImage();
diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/handler/CommentEditorHandler.java b/incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/handler/CommentEditorHandler.java
index ce1f0ca7eda..c557a58933c 100644
--- a/incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/handler/CommentEditorHandler.java
+++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/handler/CommentEditorHandler.java
@@ -62,7 +62,11 @@ public class CommentEditorHandler extends AbstractHandler {
return getSelection().size() == 1;
}
- //TODO essayer de merger cet handler avec un autre fournissant une commande et la sélection!
+ /**
+ *
+ * @return
+ * the current selection
+ */
protected List<EObject> getSelection() {
ISelection selection = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
List<EObject> currentSelection = new ArrayList<EObject>();
diff --git a/incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/modelresource/TextEditorModelSharedResource.java b/incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/modelresource/TextEditorModelSharedResource.java
index 541a3a18bfa..608e4b0e868 100644
--- a/incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/modelresource/TextEditorModelSharedResource.java
+++ b/incoming/org.eclipse.papyrus.example.uml.comment.editor.sharedresource/src/org/eclipse/papyrus/example/uml/comment/editor/sharedresource/modelresource/TextEditorModelSharedResource.java
@@ -20,17 +20,10 @@ import org.eclipse.papyrus.infra.core.resource.IModel;
public class TextEditorModelSharedResource extends AbstractModelWithSharedResource<PapyrusTextInstance> implements IModel {
- /*
- * To save in a new file :
- * the class should extends AbstractBaseModel and NOTATION_FILE_EXTENSION = "nattable" for example
- */
-
/**
* File extension used for notation.
*/
- // public static final String NOTATION_FILE_EXTENSION = "nattable"; //$NON-NLS-1$
-
public static final String NOTATION_FILE_EXTENSION = "notation"; //$NON-NLS-1$
/**

Back to the top