Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorghillairet2012-05-16 08:38:44 -0400
committermgolubev2012-05-16 08:38:44 -0400
commite6160349c0ff23db9fee594b58a1de84d278921e (patch)
tree707a1b87abc2871e4734987d48d3925c380e9323
parent7113a8ba56842ea6b18cfcf1c5e5c12620d9236b (diff)
parent829aec7afe629fa07980ad894d16ce75f57fafcb (diff)
downloadorg.eclipse.gmf-tooling-e6160349c0ff23db9fee594b58a1de84d278921e.tar.gz
org.eclipse.gmf-tooling-e6160349c0ff23db9fee594b58a1de84d278921e.tar.xz
org.eclipse.gmf-tooling-e6160349c0ff23db9fee594b58a1de84d278921e.zip
Merge branch 'master' into 3.0.M7-qvto
-rw-r--r--examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/helpers/TOEBaseEditHelper.java81
-rw-r--r--examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/parts/TOEEditPartFactory.java100
-rw-r--r--examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/policies/TOEBaseItemSemanticEditPolicy.java10
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/BaseEditHelper.xpt89
-rw-r--r--plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/EditPartFactory.xpt99
-rw-r--r--plugins/org.eclipse.gmf.tooling.runtime/META-INF/MANIFEST.MF2
-rw-r--r--plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/directedit/locator/CellEditorLocatorAccess.java20
-rw-r--r--plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/directedit/locator/LabelCellEditorLocator.java34
-rw-r--r--plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/directedit/locator/TextCellEditorLocator.java38
-rw-r--r--plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/edit/helpers/GeneratedEditHelperBase.java65
-rw-r--r--tests/org.eclipse.gmf.tests/pom.xml2
11 files changed, 218 insertions, 322 deletions
diff --git a/examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/helpers/TOEBaseEditHelper.java b/examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/helpers/TOEBaseEditHelper.java
index 5efa4c149..02051ff44 100644
--- a/examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/helpers/TOEBaseEditHelper.java
+++ b/examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/helpers/TOEBaseEditHelper.java
@@ -1,86 +1,9 @@
package org.eclipse.gmf.examples.ocldriven.toe.diagram.edit.helpers;
-import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
-import org.eclipse.gmf.runtime.common.core.command.ICommand;
-import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
-import org.eclipse.gmf.runtime.emf.type.core.IElementType;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper;
-import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
-import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+import org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase;
/**
* @generated
*/
-public class TOEBaseEditHelper extends AbstractEditHelper {
-
- /**
- * @generated
- */
- public static final String EDIT_POLICY_COMMAND = "edit policy command"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- public static final String CONTEXT_ELEMENT_TYPE = "context element type"; //$NON-NLS-1$
-
- /**
- * @generated
- */
- protected IEditHelperAdvice[] getEditHelperAdvice(IEditCommandRequest req) {
- if (req.getParameter(CONTEXT_ELEMENT_TYPE) instanceof IElementType) {
- return ElementTypeRegistry.getInstance().getEditHelperAdvice((IElementType) req.getParameter(CONTEXT_ELEMENT_TYPE));
- }
- return super.getEditHelperAdvice(req);
- }
-
- /**
- * @generated
- */
- protected ICommand getInsteadCommand(IEditCommandRequest req) {
- ICommand epCommand = (ICommand) req.getParameter(EDIT_POLICY_COMMAND);
- req.setParameter(EDIT_POLICY_COMMAND, null);
- ICommand ehCommand = super.getInsteadCommand(req);
- if (epCommand == null) {
- return ehCommand;
- }
- if (ehCommand == null) {
- return epCommand;
- }
- CompositeCommand command = new CompositeCommand(null);
- command.add(epCommand);
- command.add(ehCommand);
- return command;
- }
-
- /**
- * @generated
- */
- protected ICommand getCreateCommand(CreateElementRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected ICommand getCreateRelationshipCommand(CreateRelationshipRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected ICommand getDestroyElementCommand(DestroyElementRequest req) {
- return null;
- }
-
- /**
- * @generated
- */
- protected ICommand getDestroyReferenceCommand(DestroyReferenceRequest req) {
- return null;
- }
+public class TOEBaseEditHelper extends GeneratedEditHelperBase {
}
diff --git a/examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/parts/TOEEditPartFactory.java b/examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/parts/TOEEditPartFactory.java
index b58e43af3..96e214dd9 100644
--- a/examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/parts/TOEEditPartFactory.java
+++ b/examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/parts/TOEEditPartFactory.java
@@ -1,19 +1,12 @@
package org.eclipse.gmf.examples.ocldriven.toe.diagram.edit.parts;
-import org.eclipse.draw2d.FigureUtilities;
-import org.eclipse.draw2d.Label;
-import org.eclipse.draw2d.geometry.Dimension;
-import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;
import org.eclipse.gef.tools.CellEditorLocator;
import org.eclipse.gmf.examples.ocldriven.toe.diagram.part.TOEVisualIDRegistry;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
-import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
import org.eclipse.gmf.runtime.notation.View;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Control;
+import org.eclipse.gmf.tooling.runtime.directedit.locator.CellEditorLocatorAccess;
/**
* @generated
@@ -117,96 +110,7 @@ public class TOEEditPartFactory implements EditPartFactory {
* @generated
*/
public static CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) {
- if (source.getFigure() instanceof WrappingLabel)
- return new TextCellEditorLocator((WrappingLabel) source.getFigure());
- else {
- return new LabelCellEditorLocator((Label) source.getFigure());
- }
- }
-
- /**
- * @generated
- */
- static private class TextCellEditorLocator implements CellEditorLocator {
-
- /**
- * @generated
- */
- private WrappingLabel wrapLabel;
-
- /**
- * @generated
- */
- public TextCellEditorLocator(WrappingLabel wrapLabel) {
- this.wrapLabel = wrapLabel;
- }
-
- /**
- * @generated
- */
- public WrappingLabel getWrapLabel() {
- return wrapLabel;
- }
-
- /**
- * @generated
- */
- public void relocate(CellEditor celleditor) {
- Control control = (Control) celleditor.getControl();
- Rectangle rect = getWrapLabel().getTextBounds().getCopy();
- getWrapLabel().translateToAbsolute(rect);
- if (!control.getFont().isDisposed()) {
- if (getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
- rect.setSize(new Dimension(control.computeSize(rect.width, SWT.DEFAULT)));
- } else {
- int avr = FigureUtilities.getFontMetrics(control.getFont()).getAverageCharWidth();
- rect.setSize(new Dimension(control.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
- }
- }
- if (!rect.equals(new Rectangle(control.getBounds()))) {
- control.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
+ return CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source);
}
- /**
- * @generated
- */
- private static class LabelCellEditorLocator implements CellEditorLocator {
-
- /**
- * @generated
- */
- private Label label;
-
- /**
- * @generated
- */
- public LabelCellEditorLocator(Label label) {
- this.label = label;
- }
-
- /**
- * @generated
- */
- public Label getLabel() {
- return label;
- }
-
- /**
- * @generated
- */
- public void relocate(CellEditor celleditor) {
- Control control = (Control) celleditor.getControl();
- Rectangle rect = getLabel().getTextBounds().getCopy();
- getLabel().translateToAbsolute(rect);
- if (!control.getFont().isDisposed()) {
- int avr = FigureUtilities.getFontMetrics(control.getFont()).getAverageCharWidth();
- rect.setSize(new Dimension(control.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
- }
- if (!rect.equals(new Rectangle(control.getBounds()))) {
- control.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- }
}
diff --git a/examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/policies/TOEBaseItemSemanticEditPolicy.java b/examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/policies/TOEBaseItemSemanticEditPolicy.java
index 32e46b6fa..23041fa06 100644
--- a/examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/policies/TOEBaseItemSemanticEditPolicy.java
+++ b/examples/org.eclipse.gmf.examples.ocldriven.diagram/src/org/eclipse/gmf/examples/ocldriven/toe/diagram/edit/policies/TOEBaseItemSemanticEditPolicy.java
@@ -13,7 +13,6 @@ import org.eclipse.gmf.examples.ocldriven.toe.Department;
import org.eclipse.gmf.examples.ocldriven.toe.Employee;
import org.eclipse.gmf.examples.ocldriven.toe.Manager;
import org.eclipse.gmf.examples.ocldriven.toe.Project;
-import org.eclipse.gmf.examples.ocldriven.toe.diagram.edit.helpers.TOEBaseEditHelper;
import org.eclipse.gmf.examples.ocldriven.toe.diagram.part.TOEDiagramEditorPlugin;
import org.eclipse.gmf.examples.ocldriven.toe.diagram.part.TOEVisualIDRegistry;
import org.eclipse.gmf.examples.ocldriven.toe.diagram.providers.TOEElementTypes;
@@ -40,6 +39,7 @@ import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientReferenceRelations
import org.eclipse.gmf.runtime.emf.type.core.requests.ReorientRelationshipRequest;
import org.eclipse.gmf.runtime.emf.type.core.requests.SetRequest;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase;
/**
* @generated
@@ -121,13 +121,13 @@ public class TOEBaseItemSemanticEditPolicy extends SemanticEditPolicy {
private Command getEditHelperCommand(IEditCommandRequest request, Command editPolicyCommand) {
if (editPolicyCommand != null) {
ICommand command = editPolicyCommand instanceof ICommandProxy ? ((ICommandProxy) editPolicyCommand).getICommand() : new CommandProxy(editPolicyCommand);
- request.setParameter(TOEBaseEditHelper.EDIT_POLICY_COMMAND, command);
+ request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, command);
}
IElementType requestContextElementType = getContextElementType(request);
- request.setParameter(TOEBaseEditHelper.CONTEXT_ELEMENT_TYPE, requestContextElementType);
+ request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, requestContextElementType);
ICommand command = requestContextElementType.getEditCommand(request);
- request.setParameter(TOEBaseEditHelper.EDIT_POLICY_COMMAND, null);
- request.setParameter(TOEBaseEditHelper.CONTEXT_ELEMENT_TYPE, null);
+ request.setParameter(GeneratedEditHelperBase.EDIT_POLICY_COMMAND, null);
+ request.setParameter(GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE, null);
if (command != null) {
if (!(command instanceof CompositeTransactionalCommand)) {
command = new CompositeTransactionalCommand(getEditingDomain(), command.getLabel()).compose(command);
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/BaseEditHelper.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/BaseEditHelper.xpt
index d12ff14ec..e5cffa9a1 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/BaseEditHelper.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/edithelpers/BaseEditHelper.xpt
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2009 Borland Software Corporation
+ * Copyright (c) 2006, 2009, 2012 Borland Software Corporation and others
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
@@ -8,92 +8,55 @@
*
* Contributors:
* Dmitry Stadnik (Borland) - initial API and implementation
+ * Michael Golubev (Montages) - #368169 - extract common code to GMFT-specific runtime
*/
«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
+«DEFINE extendsClause FOR gmfgen::GenDiagram»extends «EXPAND superClass»«ENDDEFINE»
+«DEFINE superClass FOR gmfgen::GenDiagram»org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase«ENDDEFINE»
+
«DEFINE BaseEditHelper FOR gmfgen::GenDiagram-»
«EXPAND xpt::Common::copyright FOR editorGen-»
package «editHelpersPackageName»;
«EXPAND xpt::Common::generatedClassComment»
-public class «baseEditHelperClassName» extends org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper {
+public class «baseEditHelperClassName» «EXPAND extendsClause» {
«EXPAND attributes-»
«EXPAND getEditHelperAdvice-»
+
+ «EXPAND getInsteadCommand-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getInsteadCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest req) {
- org.eclipse.gmf.runtime.common.core.command.ICommand epCommand =
- (org.eclipse.gmf.runtime.common.core.command.ICommand) req.getParameter(«EXPAND editPolicyCommand»);
- req.setParameter(«EXPAND editPolicyCommand», null);
- org.eclipse.gmf.runtime.common.core.command.ICommand ehCommand = super.getInsteadCommand(req);
- if (epCommand == null) {
- return ehCommand;
- }
- if (ehCommand == null) {
- return epCommand;
- }
- org.eclipse.gmf.runtime.common.core.command.CompositeCommand command =
- new org.eclipse.gmf.runtime.common.core.command.CompositeCommand(null);
- command.add(epCommand);
- command.add(ehCommand);
- return command;
- }
+ «EXPAND getCreateCommand-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getCreateCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest req) {
- return null;
- }
+ «EXPAND getCreateRelationshipCommand-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getCreateRelationshipCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest req) {
- return null;
- }
+ «EXPAND getDestroyElementCommand-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getDestroyElementCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest req) {
- return null;
- }
+ «EXPAND getDestroyReferenceCommand-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.common.core.command.ICommand getDestroyReferenceCommand(
- org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest req) {
- return null;
- }
«EXPAND additions-»
}
«ENDDEFINE»
-«DEFINE attributes FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- public static final String «EXPAND editPolicyCommand» = "edit policy command"; //$NON-NLS-1$
-
- «EXPAND xpt::Common::generatedMemberComment»
- public static final String «EXPAND contextElementType» = "context element type"; //$NON-NLS-1$
-«ENDDEFINE»
-
-«DEFINE editPolicyCommand FOR gmfgen::GenDiagram»EDIT_POLICY_COMMAND«ENDDEFINE»
-
-«DEFINE contextElementType FOR gmfgen::GenDiagram»CONTEXT_ELEMENT_TYPE«ENDDEFINE»
-
-«DEFINE editPolicyCommandConstant FOR gmfgen::GenDiagram»«getBaseEditHelperQualifiedClassName()».«EXPAND editPolicyCommand»«ENDDEFINE»
+«DEFINE editPolicyCommandConstant FOR gmfgen::GenDiagram»org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase.EDIT_POLICY_COMMAND«ENDDEFINE»
-«DEFINE contextElementTypeConstant FOR gmfgen::GenDiagram»«getBaseEditHelperQualifiedClassName()».«EXPAND contextElementType»«ENDDEFINE»
+«DEFINE contextElementTypeConstant FOR gmfgen::GenDiagram»org.eclipse.gmf.tooling.runtime.edit.helpers.GeneratedEditHelperBase.CONTEXT_ELEMENT_TYPE«ENDDEFINE»
-«DEFINE getEditHelperAdvice FOR gmfgen::GenDiagram-»
- «EXPAND xpt::Common::generatedMemberComment»
- protected org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice[] getEditHelperAdvice(org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest req) {
- if (req.getParameter(«EXPAND contextElementType») instanceof org.eclipse.gmf.runtime.emf.type.core.IElementType) {
- return org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry.getInstance().getEditHelperAdvice((org.eclipse.gmf.runtime.emf.type.core.IElementType) req.getParameter(«EXPAND contextElementType»));
- }
- return super.getEditHelperAdvice(req);
- }
+«DEFINE attributes FOR gmfgen::GenDiagram-»
«ENDDEFINE»
+«REM»
+All empty DEFINE's below are still here for backward compatibilty of AROUND's.
+However we don't have anything to generate here since common code had extracted to GMFT-runtime as part of #368169
+«ENDREM»
+«DEFINE getEditHelperAdvice FOR gmfgen::GenDiagram»«ENDDEFINE»
+«DEFINE getInsteadCommand FOR gmfgen::GenDiagram»«ENDDEFINE»
+«DEFINE getCreateCommand FOR gmfgen::GenDiagram»«ENDDEFINE»
+«DEFINE getCreateRelationshipCommand FOR gmfgen::GenDiagram»«ENDDEFINE»
+«DEFINE getDestroyElementCommand FOR gmfgen::GenDiagram»«ENDDEFINE»
+«DEFINE getDestroyReferenceCommand FOR gmfgen::GenDiagram»«ENDDEFINE»
+
«DEFINE additions FOR gmfgen::GenDiagram»«ENDDEFINE»
diff --git a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/EditPartFactory.xpt b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/EditPartFactory.xpt
index 6b63143f8..fa9a31dda 100644
--- a/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/EditPartFactory.xpt
+++ b/plugins/org.eclipse.gmf.codegen/templates/xpt/diagram/editparts/EditPartFactory.xpt
@@ -19,6 +19,17 @@ package «editPartsPackageName»;
«EXPAND xpt::Common::generatedClassComment»
public class «editPartFactoryClassName» implements org.eclipse.gef.EditPartFactory {
+ «EXPAND createEditPartMethod-»
+
+ «EXPAND createUnrecognizedEditPart-»
+
+ «EXPAND getTextCellEditorLocator-»
+
+ «EXPAND additions-»
+}
+«ENDDEFINE»
+
+«DEFINE createEditPartMethod FOR gmfgen::GenDiagram-»
«EXPAND xpt::Common::generatedMemberComment»
public org.eclipse.gef.EditPart createEditPart(org.eclipse.gef.EditPart context, Object model) {
if (model instanceof org.eclipse.gmf.runtime.notation.View) {
@@ -38,92 +49,28 @@ public class «editPartFactoryClassName» implements org.eclipse.gef.EditPartFac
}
return createUnrecognizedEditPart(context, model);
}
+«ENDDEFINE»
+
+«DEFINE createEditPart FOR gmfgen::GenCommonBase»
+ «EXPAND xpt::Common::caseVisualID»
+ return new «getEditPartQualifiedClassName()»(view);
+«ENDDEFINE»
+«DEFINE createUnrecognizedEditPart FOR gmfgen::GenDiagram-»
«EXPAND xpt::Common::generatedMemberComment»
private org.eclipse.gef.EditPart createUnrecognizedEditPart(org.eclipse.gef.EditPart context, Object model) {
// Handle creation of unrecognized child node EditParts here
return null;
}
+«ENDDEFINE»
+«DEFINE getTextCellEditorLocator FOR gmfgen::GenDiagram-»
«EXPAND xpt::Common::generatedMemberComment»
public static org.eclipse.gef.tools.CellEditorLocator getTextCellEditorLocator(
org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart source) {
- if (source.getFigure() instanceof org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel)
- return new TextCellEditorLocator((org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel) source.getFigure());
- else {
- return new LabelCellEditorLocator((org.eclipse.draw2d.Label) source.getFigure());
- }
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- static private class TextCellEditorLocator implements org.eclipse.gef.tools.CellEditorLocator {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel wrapLabel;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public TextCellEditorLocator(org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel wrapLabel) {
- this.wrapLabel = wrapLabel;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel getWrapLabel() {
- return wrapLabel;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void relocate(org.eclipse.jface.viewers.CellEditor celleditor) {
- org.eclipse.swt.widgets.Control control = (org.eclipse.swt.widgets.Control) celleditor.getControl();
- org.eclipse.draw2d.geometry.Rectangle rect = getWrapLabel().getTextBounds().getCopy();
- getWrapLabel().translateToAbsolute(rect);
- if (!control.getFont().isDisposed()) {
- if (getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
- rect.setSize(new org.eclipse.draw2d.geometry.Dimension(control.computeSize(rect.width, org.eclipse.swt.SWT.DEFAULT)));
- } else {
- int avr = org.eclipse.draw2d.FigureUtilities.getFontMetrics(control.getFont()).getAverageCharWidth();
- rect.setSize(new org.eclipse.draw2d.geometry.Dimension(control.computeSize(org.eclipse.swt.SWT.DEFAULT, org.eclipse.swt.SWT.DEFAULT)).expand(avr * 2, 0));
- }
- }
- if (!rect.equals(new org.eclipse.draw2d.geometry.Rectangle(control.getBounds()))) {
- control.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
- }
-
- «EXPAND xpt::Common::generatedClassComment»
- private static class LabelCellEditorLocator implements org.eclipse.gef.tools.CellEditorLocator {
-
- «EXPAND xpt::Common::generatedMemberComment»
- private org.eclipse.draw2d.Label label;
-
- «EXPAND xpt::Common::generatedMemberComment»
- public LabelCellEditorLocator(org.eclipse.draw2d.Label label) {
- this.label = label;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public org.eclipse.draw2d.Label getLabel() {
- return label;
- }
-
- «EXPAND xpt::Common::generatedMemberComment»
- public void relocate(org.eclipse.jface.viewers.CellEditor celleditor) {
- org.eclipse.swt.widgets.Control control = (org.eclipse.swt.widgets.Control) celleditor.getControl();
- org.eclipse.draw2d.geometry.Rectangle rect = getLabel().getTextBounds().getCopy();
- getLabel().translateToAbsolute(rect);
- if (!control.getFont().isDisposed()) {
- int avr = org.eclipse.draw2d.FigureUtilities.getFontMetrics(control.getFont()).getAverageCharWidth();
- rect.setSize(new org.eclipse.draw2d.geometry.Dimension(control.computeSize(org.eclipse.swt.SWT.DEFAULT, org.eclipse.swt.SWT.DEFAULT)).expand(avr * 2, 0));
- }
- if (!rect.equals(new org.eclipse.draw2d.geometry.Rectangle(control.getBounds()))) {
- control.setBounds(rect.x, rect.y, rect.width, rect.height);
- }
- }
+ return org.eclipse.gmf.tooling.runtime.directedit.locator.CellEditorLocatorAccess.INSTANCE.getTextCellEditorLocator(source);
}
-}
«ENDDEFINE»
-«DEFINE createEditPart FOR gmfgen::GenCommonBase»
- «EXPAND xpt::Common::caseVisualID»
- return new «getEditPartQualifiedClassName()»(view);
-«ENDDEFINE»
+«DEFINE additions FOR gmfgen::GenDiagram-»
+«ENDDEFINE» \ No newline at end of file
diff --git a/plugins/org.eclipse.gmf.tooling.runtime/META-INF/MANIFEST.MF b/plugins/org.eclipse.gmf.tooling.runtime/META-INF/MANIFEST.MF
index 4d4a3f46f..412582b35 100644
--- a/plugins/org.eclipse.gmf.tooling.runtime/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.gmf.tooling.runtime/META-INF/MANIFEST.MF
@@ -23,6 +23,8 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Activator: org.eclipse.gmf.tooling.runtime.GMFToolingRuntimePlugin
Export-Package: org.eclipse.gmf.tooling.runtime,
org.eclipse.gmf.tooling.runtime.directedit,
+ org.eclipse.gmf.tooling.runtime.directedit.locator,
+ org.eclipse.gmf.tooling.runtime.edit.helpers,
org.eclipse.gmf.tooling.runtime.edit.policies.effect,
org.eclipse.gmf.tooling.runtime.edit.policies.reparent,
org.eclipse.gmf.tooling.runtime.ocl.tracker,
diff --git a/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/directedit/locator/CellEditorLocatorAccess.java b/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/directedit/locator/CellEditorLocatorAccess.java
new file mode 100644
index 000000000..98cdd1de2
--- /dev/null
+++ b/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/directedit/locator/CellEditorLocatorAccess.java
@@ -0,0 +1,20 @@
+package org.eclipse.gmf.tooling.runtime.directedit.locator;
+
+import org.eclipse.draw2d.Label;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+
+public class CellEditorLocatorAccess {
+
+ public static final CellEditorLocatorAccess INSTANCE = new CellEditorLocatorAccess();
+
+ public CellEditorLocator getTextCellEditorLocator(ITextAwareEditPart source) {
+ if (source.getFigure() instanceof WrappingLabel)
+ return new TextCellEditorLocator((WrappingLabel) source.getFigure());
+ else {
+ return new LabelCellEditorLocator((Label) source.getFigure());
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/directedit/locator/LabelCellEditorLocator.java b/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/directedit/locator/LabelCellEditorLocator.java
new file mode 100644
index 000000000..44e8a85b7
--- /dev/null
+++ b/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/directedit/locator/LabelCellEditorLocator.java
@@ -0,0 +1,34 @@
+package org.eclipse.gmf.tooling.runtime.directedit.locator;
+
+import org.eclipse.draw2d.FigureUtilities;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Text;
+
+public class LabelCellEditorLocator implements CellEditorLocator {
+
+ private Label myLabel;
+
+ public LabelCellEditorLocator(Label label) {
+ myLabel = label;
+ }
+
+ public Label getLabel() {
+ return myLabel;
+ }
+
+ public void relocate(CellEditor celleditor) {
+ Text text = (Text) celleditor.getControl();
+ Rectangle rect = getLabel().getTextBounds().getCopy();
+ getLabel().translateToAbsolute(rect);
+ int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
+ rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
+ if (!rect.equals(new Rectangle(text.getBounds()))) {
+ text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/directedit/locator/TextCellEditorLocator.java b/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/directedit/locator/TextCellEditorLocator.java
new file mode 100644
index 000000000..6828282eb
--- /dev/null
+++ b/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/directedit/locator/TextCellEditorLocator.java
@@ -0,0 +1,38 @@
+package org.eclipse.gmf.tooling.runtime.directedit.locator;
+
+import org.eclipse.draw2d.FigureUtilities;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gmf.runtime.draw2d.ui.figures.WrappingLabel;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Text;
+
+public class TextCellEditorLocator implements CellEditorLocator {
+
+ private WrappingLabel myWrapLabel;
+
+ public TextCellEditorLocator(WrappingLabel wrapLabel) {
+ myWrapLabel = wrapLabel;
+ }
+
+ public WrappingLabel getWrapLabel() {
+ return myWrapLabel;
+ }
+
+ public void relocate(CellEditor celleditor) {
+ Text text = (Text) celleditor.getControl();
+ Rectangle rect = getWrapLabel().getTextBounds().getCopy();
+ getWrapLabel().translateToAbsolute(rect);
+ if (getWrapLabel().isTextWrapOn() && getWrapLabel().getText().length() > 0) {
+ rect.setSize(new Dimension(text.computeSize(rect.width, SWT.DEFAULT)));
+ } else {
+ int avr = FigureUtilities.getFontMetrics(text.getFont()).getAverageCharWidth();
+ rect.setSize(new Dimension(text.computeSize(SWT.DEFAULT, SWT.DEFAULT)).expand(avr * 2, 0));
+ }
+ if (!rect.equals(new Rectangle(text.getBounds()))) {
+ text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/edit/helpers/GeneratedEditHelperBase.java b/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/edit/helpers/GeneratedEditHelperBase.java
new file mode 100644
index 000000000..dce57f092
--- /dev/null
+++ b/plugins/org.eclipse.gmf.tooling.runtime/src/org/eclipse/gmf/tooling/runtime/edit/helpers/GeneratedEditHelperBase.java
@@ -0,0 +1,65 @@
+package org.eclipse.gmf.tooling.runtime.edit.helpers;
+
+import org.eclipse.gmf.runtime.common.core.command.CompositeCommand;
+import org.eclipse.gmf.runtime.common.core.command.ICommand;
+import org.eclipse.gmf.runtime.emf.type.core.ElementTypeRegistry;
+import org.eclipse.gmf.runtime.emf.type.core.IElementType;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.AbstractEditHelper;
+import org.eclipse.gmf.runtime.emf.type.core.edithelper.IEditHelperAdvice;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.CreateRelationshipRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyElementRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.DestroyReferenceRequest;
+import org.eclipse.gmf.runtime.emf.type.core.requests.IEditCommandRequest;
+
+public class GeneratedEditHelperBase extends AbstractEditHelper {
+
+ public static final String EDIT_POLICY_COMMAND = "edit policy command"; //$NON-NLS-1$
+
+ public static final String CONTEXT_ELEMENT_TYPE = "context element type"; //$NON-NLS-1$
+
+ @Override
+ protected IEditHelperAdvice[] getEditHelperAdvice(IEditCommandRequest req) {
+ if (req.getParameter(CONTEXT_ELEMENT_TYPE) instanceof IElementType) {
+ return ElementTypeRegistry.getInstance().getEditHelperAdvice((IElementType) req.getParameter(CONTEXT_ELEMENT_TYPE));
+ }
+ return super.getEditHelperAdvice(req);
+ }
+
+ @Override
+ protected ICommand getInsteadCommand(IEditCommandRequest req) {
+ ICommand epCommand = (ICommand) req.getParameter(EDIT_POLICY_COMMAND);
+ req.setParameter(EDIT_POLICY_COMMAND, null);
+ ICommand ehCommand = super.getInsteadCommand(req);
+ if (epCommand == null) {
+ return ehCommand;
+ }
+ if (ehCommand == null) {
+ return epCommand;
+ }
+ CompositeCommand command = new CompositeCommand(null);
+ command.add(epCommand);
+ command.add(ehCommand);
+ return command;
+ }
+
+ @Override
+ protected ICommand getCreateCommand(CreateElementRequest req) {
+ return null;
+ }
+
+ @Override
+ protected ICommand getCreateRelationshipCommand(CreateRelationshipRequest req) {
+ return null;
+ }
+
+ @Override
+ protected ICommand getDestroyElementCommand(DestroyElementRequest req) {
+ return null;
+ }
+
+ @Override
+ protected ICommand getDestroyReferenceCommand(DestroyReferenceRequest req) {
+ return null;
+ }
+}
diff --git a/tests/org.eclipse.gmf.tests/pom.xml b/tests/org.eclipse.gmf.tests/pom.xml
index 90d8c1d4d..ec3e10da2 100644
--- a/tests/org.eclipse.gmf.tests/pom.xml
+++ b/tests/org.eclipse.gmf.tests/pom.xml
@@ -55,7 +55,7 @@
<configuration>
<useUIHarness>true</useUIHarness>
<testSuite>org.eclipse.gmf.tests</testSuite>
- <argLine>${tycho.testArgLine} -Xmx512m -XX:MaxPermSize=128m -DbuildingWithTycho=true</argLine>
+ <argLine>${tycho.testArgLine} -Xmx512m -XX:MaxPermSize=128m -DbuildingWithTycho=true -XstartOnFirstThread</argLine>
<bundleStartLevel>
<bundle>
<id>org.eclipse.equinox.ds</id>

Back to the top