Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoratikhomirov2010-04-07 08:59:38 -0400
committeratikhomirov2010-04-07 08:59:38 -0400
commitfb00cca00d0c511cb3901c68dbd6982fd8c8870c (patch)
tree70f8d550f0055df1d47d8ccb83cc9d0041abddd1
parent2e960c358ce4f702fc4a1ed48bc1f8cb1c469501 (diff)
downloadorg.eclipse.gmf-tooling-fb00cca00d0c511cb3901c68dbd6982fd8c8870c.tar.gz
org.eclipse.gmf-tooling-fb00cca00d0c511cb3901c68dbd6982fd8c8870c.tar.xz
org.eclipse.gmf-tooling-fb00cca00d0c511cb3901c68dbd6982fd8c8870c.zip
viewer configuration moved out from GeneratorConfiguration andv20100407-2359
not exposed in the session setup (needed in few tests only, not for the setup itself); Abstraction of generated diagram editor used throughout code separated from SessionSetup
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramEditorMatchingStrategyTest.java15
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramEditorOutlineTest.java14
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramElementDeleteTest.java7
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramElementTest.java7
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramLinksTest.java5
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramNodeCloneMoveTest.java5
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramNodeTest.java5
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/ExternalNodeLabelsTest.java19
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/NotationRefreshTest.java5
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gen/LiteGeneratorConfiguration.java40
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/multi/ShortcutCreationTest.java5
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/rt/ElementInitializerTest.java6
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/rt/LinkCreationConstraintsTest.java24
-rw-r--r--tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/setup/LiteLinksSessionSetup.java4
14 files changed, 109 insertions, 52 deletions
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramEditorMatchingStrategyTest.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramEditorMatchingStrategyTest.java
index e35b1e694..0be1cfc06 100644
--- a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramEditorMatchingStrategyTest.java
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramEditorMatchingStrategyTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2007 Borland Software Corporation
+/*
+ * Copyright (c) 2007, 2010 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
@@ -14,15 +14,19 @@ package org.eclipse.gmf.tests.lite.gef;
import org.eclipse.core.resources.IFile;
import org.eclipse.emf.common.ui.URIEditorInput;
import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.gmf.runtime.lite.parts.DiagramEditor;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.tests.gef.AbstractDiagramEditorTest;
+import org.eclipse.gmf.tests.lite.gen.LiteGeneratorConfiguration;
+import org.eclipse.gmf.tests.setup.GeneratedDiagramPlugin;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchPage;
public class DiagramEditorMatchingStrategyTest extends AbstractDiagramEditorTest {
public DiagramEditorMatchingStrategyTest(String name) {
- super(name);
+ super(name, new LiteGeneratorConfiguration());
}
public void testReusingEditor() throws Exception {
@@ -47,4 +51,9 @@ public class DiagramEditorMatchingStrategyTest extends AbstractDiagramEditorTest
assertNotSame(editor, newEditor);
assertSame(editor.getEditingDomain(), newEditor.getEditingDomain());
}
+
+ @Override
+ protected Diagram createDiagramView(EObject domainElement, GeneratedDiagramPlugin genPlugin) {
+ return LiteGeneratorConfiguration.createDiagram(domainElement, genPlugin);
+ }
}
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramEditorOutlineTest.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramEditorOutlineTest.java
index aa88b7618..52946d2c7 100644
--- a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramEditorOutlineTest.java
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramEditorOutlineTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008 Borland Software Corporation
+ * Copyright (c) 2007, 2010 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
@@ -18,9 +18,12 @@ import org.eclipse.gef.NodeEditPart;
import org.eclipse.gef.RequestConstants;
import org.eclipse.gef.requests.GroupRequest;
import org.eclipse.gmf.codegen.gmfgen.GenNode;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.tests.gef.AbstractDiagramEditorTest;
+import org.eclipse.gmf.tests.lite.gen.LiteGeneratorConfiguration;
import org.eclipse.gmf.tests.lite.setup.LibraryConstrainedSetup;
+import org.eclipse.gmf.tests.setup.GeneratedDiagramPlugin;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IViewPart;
import org.eclipse.ui.IWorkbenchPage;
@@ -31,7 +34,7 @@ import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
public class DiagramEditorOutlineTest extends AbstractDiagramEditorTest {
public DiagramEditorOutlineTest(String name) {
- super(name);
+ super(name, new LiteGeneratorConfiguration());
myDefaultSetup = LibraryConstrainedSetup.getInstance();
}
@@ -73,4 +76,9 @@ public class DiagramEditorOutlineTest extends AbstractDiagramEditorTest {
execute(command);
assertNull("Command obtained via outline has not executed correctly", book1.eResource());
}
-}
+
+ @Override
+ protected Diagram createDiagramView(EObject domainElement, GeneratedDiagramPlugin genPlugin) {
+ return LiteGeneratorConfiguration.createDiagram(domainElement, genPlugin);
+ }
+} \ No newline at end of file
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramElementDeleteTest.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramElementDeleteTest.java
index d2c85f7fa..02ed784be 100644
--- a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramElementDeleteTest.java
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramElementDeleteTest.java
@@ -1,5 +1,5 @@
-/**
- * Copyright (c) 2007 Borland Software Corporation
+/*
+ * Copyright (c) 2007, 2010 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
@@ -29,12 +29,13 @@ import org.eclipse.gmf.codegen.gmfgen.GenLink;
import org.eclipse.gmf.codegen.gmfgen.GenNode;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.tests.lite.gen.LiteGeneratorConfiguration;
import org.eclipse.gmf.tests.rt.GeneratedCanvasTest;
public class DiagramElementDeleteTest extends GeneratedCanvasTest {
public DiagramElementDeleteTest(String name) {
- super(name);
+ super(name, new LiteGeneratorConfiguration());
}
public void testReferencesToDeletedElement() throws Exception {
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramElementTest.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramElementTest.java
index 9b3f8d0f0..56ce0f859 100644
--- a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramElementTest.java
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramElementTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2008 Borland Software Corporation
+ * Copyright (c) 2006, 2010 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
@@ -31,6 +31,7 @@ import org.eclipse.gmf.runtime.lite.services.DefaultDiagramLayouter;
import org.eclipse.gmf.runtime.lite.services.IDiagramLayouter;
import org.eclipse.gmf.runtime.notation.Bounds;
import org.eclipse.gmf.runtime.notation.Node;
+import org.eclipse.gmf.tests.lite.gen.LiteGeneratorConfiguration;
import org.eclipse.gmf.tests.rt.GeneratedCanvasTest;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
@@ -42,7 +43,7 @@ import org.eclipse.ui.part.ViewPart;
public class DiagramElementTest extends GeneratedCanvasTest {
public DiagramElementTest(String name) {
- super(name);
+ super(name, new LiteGeneratorConfiguration());
}
private static final Rectangle NODE_1_BOUNDS = new Rectangle(10, 10, 100, 100);
@@ -104,7 +105,7 @@ public class DiagramElementTest extends GeneratedCanvasTest {
private void align(List<EditPart> nodes, int alignment) {
layout(((GraphicalEditPart)nodes.get(0)).getFigure().getParent()); //since the action operates with figure bounds, we must invoke layout explicitly to update them from layout constraints.
AlignmentAction action = new AlignmentAction(new ViewPart() {
- @SuppressWarnings("unchecked")
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (CommandStack.class == adapter) {
return getCommandStack();
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramLinksTest.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramLinksTest.java
index baf4f5349..c4ed72661 100644
--- a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramLinksTest.java
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramLinksTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2008 Borland Software Corporation
+ * Copyright (c) 2006, 2010 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
@@ -28,11 +28,12 @@ import org.eclipse.gmf.runtime.notation.Bendpoints;
import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.RelativeBendpoints;
+import org.eclipse.gmf.tests.lite.gen.LiteGeneratorConfiguration;
import org.eclipse.gmf.tests.rt.GeneratedCanvasTest;
public class DiagramLinksTest extends GeneratedCanvasTest {
public DiagramLinksTest(String name) {
- super(name);
+ super(name, new LiteGeneratorConfiguration());
}
public void testBendpoints() throws Exception {
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramNodeCloneMoveTest.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramNodeCloneMoveTest.java
index a137e8933..f4fb2388e 100644
--- a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramNodeCloneMoveTest.java
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramNodeCloneMoveTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2008 Borland Software Corporation
+ * Copyright (c) 2006, 2010 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
@@ -45,12 +45,13 @@ import org.eclipse.gmf.runtime.notation.Edge;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tests.lite.gen.LiteGeneratorConfiguration;
import org.eclipse.gmf.tests.lite.setup.LibraryConstrainedSetup;
import org.eclipse.gmf.tests.rt.GeneratedCanvasTest;
public class DiagramNodeCloneMoveTest extends GeneratedCanvasTest {
public DiagramNodeCloneMoveTest(String name) {
- super(name);
+ super(name, new LiteGeneratorConfiguration());
myDefaultSetup = LibraryConstrainedSetup.getInstance();
}
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramNodeTest.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramNodeTest.java
index 5b70e0a73..10aee590a 100644
--- a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramNodeTest.java
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/DiagramNodeTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008 Borland Software Corporation
+ * Copyright (c) 2007, 2010 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
@@ -23,6 +23,7 @@ import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.Style;
+import org.eclipse.gmf.tests.lite.gen.LiteGeneratorConfiguration;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;
@@ -31,7 +32,7 @@ import org.eclipse.swt.graphics.FontData;
public class DiagramNodeTest extends org.eclipse.gmf.tests.gef.DiagramNodeTest {
public DiagramNodeTest(String name) {
- super(name);
+ super(name, new LiteGeneratorConfiguration());
}
public void testPreferences() throws Exception {
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/ExternalNodeLabelsTest.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/ExternalNodeLabelsTest.java
index 55a2c7b70..b00920a15 100644
--- a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/ExternalNodeLabelsTest.java
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/ExternalNodeLabelsTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2008 Borland Software Corporation
+ * Copyright (c) 2006, 2010 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
@@ -11,12 +11,11 @@
*/
package org.eclipse.gmf.tests.lite.gef;
-import java.util.Iterator;
-
import org.eclipse.draw2d.PositionConstants;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.transaction.util.TransactionUtil;
@@ -30,13 +29,16 @@ import org.eclipse.gmf.codegen.gmfgen.GenNode;
import org.eclipse.gmf.codegen.gmfgen.GenNodeLabel;
import org.eclipse.gmf.runtime.lite.commands.WrappingCommand;
import org.eclipse.gmf.runtime.lite.preferences.IPreferenceConstants;
+import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.FontStyle;
import org.eclipse.gmf.runtime.notation.Location;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.tests.gef.AbstractDiagramEditorTest;
+import org.eclipse.gmf.tests.lite.gen.LiteGeneratorConfiguration;
import org.eclipse.gmf.tests.lite.setup.LibraryConstrainedSetup;
+import org.eclipse.gmf.tests.setup.GeneratedDiagramPlugin;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.graphics.FontData;
@@ -46,7 +48,7 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
public class ExternalNodeLabelsTest extends AbstractDiagramEditorTest {
public ExternalNodeLabelsTest(String name) {
- super(name);
+ super(name, new LiteGeneratorConfiguration());
PlatformUI.getWorkbench().getEditorRegistry();
myDefaultSetup = LibraryConstrainedSetup.getInstance();
}
@@ -101,10 +103,8 @@ public class ExternalNodeLabelsTest extends AbstractDiagramEditorTest {
assertEquals("Unexpected position of external node label", nodeBottom.y + location.getY(), labelTop.y, tolerance.height);
}
- @SuppressWarnings("unchecked")
private GenExternalNodeLabel getFirstExternalNodeLabel(GenNode genNode) {
- for(Iterator it = genNode.getLabels().iterator(); it.hasNext(); ) {
- GenNodeLabel next = (GenNodeLabel) it.next();
+ for (GenNodeLabel next : genNode.getLabels()) {
if (next instanceof GenExternalNodeLabel) {
return (GenExternalNodeLabel) next;
}
@@ -161,4 +161,9 @@ public class ExternalNodeLabelsTest extends AbstractDiagramEditorTest {
//Check that the font of the label has changed in response.
assertEquals(fonts[index].getName(), extLabelEP.getFigure().getFont().getFontData()[0].getName());
}
+
+ @Override
+ protected Diagram createDiagramView(EObject domainElement, GeneratedDiagramPlugin genPlugin) {
+ return LiteGeneratorConfiguration.createDiagram(domainElement, genPlugin);
+ }
}
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/NotationRefreshTest.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/NotationRefreshTest.java
index 9854064cf..5c29b83ca 100644
--- a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/NotationRefreshTest.java
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gef/NotationRefreshTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2008 Borland Software Corporation
+ * Copyright (c) 2006, 2010 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
@@ -36,12 +36,13 @@ import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tests.lite.gen.LiteGeneratorConfiguration;
import org.eclipse.gmf.tests.lite.setup.LibraryConstrainedSetup;
import org.eclipse.gmf.tests.rt.GeneratedCanvasTest;
public class NotationRefreshTest extends GeneratedCanvasTest {
public NotationRefreshTest(String name) {
- super(name);
+ super(name, new LiteGeneratorConfiguration());
myDefaultSetup = LibraryConstrainedSetup.getInstance();
}
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gen/LiteGeneratorConfiguration.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gen/LiteGeneratorConfiguration.java
index cf88d6b69..f55fed1b4 100644
--- a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gen/LiteGeneratorConfiguration.java
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/gen/LiteGeneratorConfiguration.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2008 Borland Software Corporation
+ * Copyright (c) 2006, 2010 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
@@ -48,7 +48,8 @@ import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationFactory;
import org.eclipse.gmf.runtime.notation.View;
import org.eclipse.gmf.tests.setup.AbstractGeneratorConfiguration;
-import org.eclipse.gmf.tests.setup.SessionSetup;
+import org.eclipse.gmf.tests.setup.GeneratedDiagramPlugin;
+import org.eclipse.gmf.tests.setup.ViewerConfiguration;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferenceConverter;
import org.eclipse.swt.events.DisposeEvent;
@@ -57,7 +58,6 @@ import org.eclipse.swt.graphics.RGB;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.Bundle;
public class LiteGeneratorConfiguration extends AbstractGeneratorConfiguration {
@@ -66,28 +66,33 @@ public class LiteGeneratorConfiguration extends AbstractGeneratorConfiguration {
return new Generator(diagram.getEditorGen());
}
- public ViewerConfiguration createViewerConfiguration(EditPartViewer viewer, GenDiagram model, Bundle genProject) throws Exception {
- return new LiteViewerConfiguration(viewer, model, genProject);
+ public ViewerConfiguration createViewerConfiguration(EditPartViewer viewer, GeneratedDiagramPlugin genPlugin){
+ return new LiteViewerConfiguration(viewer, genPlugin);
}
protected EditPartViewer createViewerInstance() {
return new FakeLiteViewer();
}
- public Diagram createDiagram(EObject domainElement, SessionSetup sessionSetup) throws Exception {
- Diagram result = NotationFactory.eINSTANCE.createDiagram();
- result.setElement(domainElement);
- String diagramDecoratorClass = sessionSetup.getGenModel().getGenDiagram().getNotationViewFactoryQualifiedClassName();
- Class<?> pluginClass = sessionSetup.loadGeneratedClass(diagramDecoratorClass);
- Field field = pluginClass.getField("INSTANCE");
- IViewDecorator decorator = (IViewDecorator) field.get(null);
- decorator.decorateView(result);
- return result;
+ public static Diagram createDiagram(EObject domainElement, GeneratedDiagramPlugin genPlugin) {
+ try {
+ Diagram result = NotationFactory.eINSTANCE.createDiagram();
+ result.setElement(domainElement);
+ String diagramDecoratorClass = genPlugin.getGenDiagram().getNotationViewFactoryQualifiedClassName();
+ Class<?> pluginClass = genPlugin.loadGeneratedClass(diagramDecoratorClass);
+ Field field = pluginClass.getField("INSTANCE");
+ IViewDecorator decorator = (IViewDecorator) field.get(null);
+ decorator.decorateView(result);
+ return result;
+ } catch (Exception ex) {
+ Assert.fail(ex.toString());
+ }
+ return null;
}
private static class LiteViewerConfiguration extends AbstractViewerConfiguration {
- public LiteViewerConfiguration(EditPartViewer viewer, GenDiagram model, Bundle genPlugin) {
- super(viewer, model, genPlugin);
+ public LiteViewerConfiguration(EditPartViewer viewer, GeneratedDiagramPlugin genPlugin) {
+ super(viewer, genPlugin);
}
public Command getCreateNodeCommand(View parentView, GenCommonBase nodeType) {
@@ -208,9 +213,6 @@ public class LiteGeneratorConfiguration extends AbstractGeneratorConfiguration {
return myPreferenceStore;
}
- protected TransactionalEditingDomain getEditDomain(EditPart editPart) {
- return TransactionUtil.getEditingDomain(editPart.getModel());
- }
protected TransactionalEditingDomain getEditDomain(EObject object) {
return TransactionUtil.getEditingDomain(object);
}
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/multi/ShortcutCreationTest.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/multi/ShortcutCreationTest.java
index c381e1a45..8b07f3e7a 100644
--- a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/multi/ShortcutCreationTest.java
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/multi/ShortcutCreationTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2008 Borland Software Corporation
+ * Copyright (c) 2007, 2010 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
@@ -41,6 +41,7 @@ import org.eclipse.gmf.runtime.notation.Diagram;
import org.eclipse.gmf.runtime.notation.Node;
import org.eclipse.gmf.runtime.notation.NotationPackage;
import org.eclipse.gmf.runtime.notation.View;
+import org.eclipse.gmf.tests.lite.gen.LiteGeneratorConfiguration;
import org.eclipse.gmf.tests.rt.AbstractMultiSetupTest;
import org.eclipse.gmf.tests.setup.RTSetup;
import org.eclipse.gmf.tests.setup.SessionSetup;
@@ -48,7 +49,7 @@ import org.eclipse.gmf.tests.setup.SessionSetup;
public class ShortcutCreationTest extends AbstractMultiSetupTest {
public ShortcutCreationTest(String name) {
- super(name);
+ super(name, new LiteGeneratorConfiguration());
}
@Override
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/rt/ElementInitializerTest.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/rt/ElementInitializerTest.java
index ca152f92b..c3a25d426 100644
--- a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/rt/ElementInitializerTest.java
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/rt/ElementInitializerTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2008 Borland Software Corporation
+ * Copyright (c) 2006, 2010 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
@@ -11,10 +11,12 @@
*/
package org.eclipse.gmf.tests.lite.rt;
+import org.eclipse.gmf.tests.lite.gen.LiteGeneratorConfiguration;
+
public class ElementInitializerTest extends org.eclipse.gmf.tests.rt.ElementInitializerTest {
public ElementInitializerTest(String name) {
- super(name);
+ super(name, new LiteGeneratorConfiguration());
}
@Override
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/rt/LinkCreationConstraintsTest.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/rt/LinkCreationConstraintsTest.java
new file mode 100644
index 000000000..6154ab84f
--- /dev/null
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/rt/LinkCreationConstraintsTest.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright (c) 2010 Artem Tikhomirov and others
+ *
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Artem Tikhomirov (independent) - initial API and implementation
+ */
+package org.eclipse.gmf.tests.lite.rt;
+
+import org.eclipse.gmf.tests.lite.gen.LiteGeneratorConfiguration;
+
+/**
+ * @author artem
+ */
+public class LinkCreationConstraintsTest extends org.eclipse.gmf.tests.rt.LinkCreationConstraintsTest {
+
+ public LinkCreationConstraintsTest(String name) {
+ super(name, new LiteGeneratorConfiguration());
+ }
+}
diff --git a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/setup/LiteLinksSessionSetup.java b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/setup/LiteLinksSessionSetup.java
index 765b84ec6..8df339b9c 100644
--- a/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/setup/LiteLinksSessionSetup.java
+++ b/tests/org.eclipse.gmf.tests.lite/src/org/eclipse/gmf/tests/lite/setup/LiteLinksSessionSetup.java
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2008 Borland Software Corporation
+ * Copyright (c) 2006, 2010 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
@@ -34,7 +34,7 @@ public class LiteLinksSessionSetup extends LinksSessionSetup {
protected DiaGenSource createGenModel() {
DiaGenSource result = super.createGenModel();
result.getGenDiagram().getContainsShortcutsTo().add("Library"); //$NON-NLS-1$
- result.getGenDiagram().getContainsShortcutsTo().add(result.getGenDiagram().getEditorGen().getModelID()); //$NON-NLS-1$
+ result.getGenDiagram().getContainsShortcutsTo().add(result.getGenDiagram().getEditorGen().getModelID());
return result;
}
}

Back to the top