Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 42150 Details for
Bug 140162
Implement tests for the lite generator fuctionality
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Additional refactoring
140162_2.patch (text/plain), 11.38 KB, created by
Boris Blajer
on 2006-05-22 10:04:51 EDT
(
hide
)
Description:
Additional refactoring
Filename:
MIME Type:
Creator:
Boris Blajer
Created:
2006-05-22 10:04:51 EDT
Size:
11.38 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.gmf.tests >Index: src/org/eclipse/gmf/tests/rt/RuntimeDiagramTestBase.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/rt/RuntimeDiagramTestBase.java,v >retrieving revision 1.13 >diff -u -r1.13 RuntimeDiagramTestBase.java >--- src/org/eclipse/gmf/tests/rt/RuntimeDiagramTestBase.java 17 May 2006 10:37:24 -0000 1.13 >+++ src/org/eclipse/gmf/tests/rt/RuntimeDiagramTestBase.java 22 May 2006 14:04:51 -0000 >@@ -128,6 +128,8 @@ > * if the given name does not refer existing feature > */ > protected void setBusinessElementStructuralFeature(View view, String featureName, Object value) { >- getViewerConfiguration().setBusinessElementStructuralFeature(view, featureName, value); >+ Command command = getViewerConfiguration().getSetBusinessElementStructuralFeatureCommand(view, featureName, value); >+ assertNotNull("Command is null", command); >+ command.execute(); > } > } >Index: src/org/eclipse/gmf/tests/gef/DiagramNodeTest.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/gef/DiagramNodeTest.java,v >retrieving revision 1.11 >diff -u -r1.11 DiagramNodeTest.java >--- src/org/eclipse/gmf/tests/gef/DiagramNodeTest.java 23 Feb 2006 21:14:41 -0000 1.11 >+++ src/org/eclipse/gmf/tests/gef/DiagramNodeTest.java 22 May 2006 14:04:51 -0000 >@@ -11,30 +11,21 @@ > */ > package org.eclipse.gmf.tests.gef; > >-import java.util.Collections; >- >-import org.eclipse.core.commands.ExecutionException; >-import org.eclipse.core.runtime.IAdaptable; >-import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.draw2d.PositionConstants; > import org.eclipse.draw2d.geometry.Dimension; > import org.eclipse.draw2d.geometry.Point; >-import org.eclipse.emf.transaction.TransactionalEditingDomain; > import org.eclipse.gef.EditPart; > import org.eclipse.gef.RequestConstants; > import org.eclipse.gef.commands.Command; > import org.eclipse.gef.requests.ChangeBoundsRequest; >-import org.eclipse.gmf.runtime.common.core.command.CommandResult; >-import org.eclipse.gmf.runtime.diagram.ui.commands.EtoolsProxyCommand; >-import org.eclipse.gmf.runtime.diagram.ui.editparts.IGraphicalEditPart; > import org.eclipse.gmf.runtime.draw2d.ui.figures.FigureUtilities; >-import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; > import org.eclipse.gmf.runtime.notation.FillStyle; > import org.eclipse.gmf.runtime.notation.LineStyle; > 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.Size; >+import org.eclipse.gmf.runtime.notation.View; > import org.eclipse.gmf.tests.rt.GeneratedCanvasTest; > import org.eclipse.swt.graphics.RGB; > >@@ -155,15 +146,7 @@ > } > > private Command createChangeColorCommand(final int newColor, final boolean isForeground) { >- TransactionalEditingDomain ed = ((IGraphicalEditPart) getNodeEditPart()).getEditingDomain(); >- assertNotNull("No TransactionalEditingDomain found", ed); >- return new EtoolsProxyCommand(new AbstractTransactionalCommand(ed, "ChangeColor", Collections.EMPTY_LIST) { >- protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { >- IGraphicalEditPart ep = ((IGraphicalEditPart) getNodeEditPart()); >- ep.setStructuralFeatureValue(isForeground ? NotationPackage.eINSTANCE.getLineStyle_LineColor() : NotationPackage.eINSTANCE.getFillStyle_FillColor(), new Integer(newColor)); >- return null; >- } >- }); >+ return getViewerConfiguration().getSetNotationalElementStructuralFeature((View)getNodeEditPart().getModel(), isForeground ? NotationPackage.eINSTANCE.getLineStyle_LineColor() : NotationPackage.eINSTANCE.getFillStyle_FillColor(), new Integer(newColor)); > } > > private void assertColorValues(int expectedForegroundColor, int expectedBackgroundColor, String assertTag) { >Index: src/org/eclipse/gmf/tests/setup/LinksSessionSetup.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/LinksSessionSetup.java,v >retrieving revision 1.13 >diff -u -r1.13 LinksSessionSetup.java >--- src/org/eclipse/gmf/tests/setup/LinksSessionSetup.java 11 May 2006 18:37:40 -0000 1.13 >+++ src/org/eclipse/gmf/tests/setup/LinksSessionSetup.java 22 May 2006 14:04:51 -0000 >@@ -41,7 +41,7 @@ > > private static String modelURI = "/models/links/links.ecore"; //$NON-NLS-1$ > >- private LinksSessionSetup() { >+ protected LinksSessionSetup() { > } > > public static SessionSetup newInstance() { >Index: src/org/eclipse/gmf/tests/setup/GeneratorConfiguration.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/GeneratorConfiguration.java,v >retrieving revision 1.2 >diff -u -r1.2 GeneratorConfiguration.java >--- src/org/eclipse/gmf/tests/setup/GeneratorConfiguration.java 18 May 2006 19:12:43 -0000 1.2 >+++ src/org/eclipse/gmf/tests/setup/GeneratorConfiguration.java 22 May 2006 14:04:51 -0000 >@@ -11,6 +11,7 @@ > */ > package org.eclipse.gmf.tests.setup; > >+import org.eclipse.emf.ecore.EStructuralFeature; > import org.eclipse.gef.EditPart; > import org.eclipse.gef.EditPartViewer; > import org.eclipse.gef.commands.Command; >@@ -34,7 +35,8 @@ > public Command getCreateNodeCommand(View parentView, GenCommonBase nodeType); > public Command getStartLinkCommand(View source, GenCommonBase linkType); > public Command getCreateLinkCommand(View source, View target, GenCommonBase linkType); >- public void setBusinessElementStructuralFeature(View view, String featureName, Object value); >+ public Command getSetBusinessElementStructuralFeatureCommand(View view, String featureName, Object value); >+ public Command getSetNotationalElementStructuralFeature(View view, EStructuralFeature feature, Object value); > public void dispose(); > } > >Index: src/org/eclipse/gmf/tests/setup/RuntimeBasedGeneratorConfiguration.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/setup/RuntimeBasedGeneratorConfiguration.java,v >retrieving revision 1.2 >diff -u -r1.2 RuntimeBasedGeneratorConfiguration.java >--- src/org/eclipse/gmf/tests/setup/RuntimeBasedGeneratorConfiguration.java 18 May 2006 19:12:43 -0000 1.2 >+++ src/org/eclipse/gmf/tests/setup/RuntimeBasedGeneratorConfiguration.java 22 May 2006 14:04:51 -0000 >@@ -17,6 +17,9 @@ > > import junit.framework.Assert; > >+import org.eclipse.core.commands.ExecutionException; >+import org.eclipse.core.runtime.IAdaptable; >+import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.draw2d.geometry.Point; > import org.eclipse.emf.ecore.EObject; > import org.eclipse.emf.ecore.EStructuralFeature; >@@ -30,6 +33,7 @@ > import org.eclipse.gmf.codegen.gmfgen.GenDiagram; > import org.eclipse.gmf.codegen.util.Generator; > import org.eclipse.gmf.internal.common.codegen.GeneratorBase; >+import org.eclipse.gmf.runtime.common.core.command.CommandResult; > import org.eclipse.gmf.runtime.diagram.core.edithelpers.CreateElementRequestAdapter; > import org.eclipse.gmf.runtime.diagram.core.listener.DiagramEventBroker; > import org.eclipse.gmf.runtime.diagram.core.preferences.PreferencesHint; >@@ -44,6 +48,7 @@ > import org.eclipse.gmf.runtime.diagram.ui.requests.CreateUnspecifiedTypeRequest; > import org.eclipse.gmf.runtime.diagram.ui.requests.EditCommandRequestWrapper; > import org.eclipse.gmf.runtime.diagram.ui.requests.CreateConnectionViewAndElementRequest.ConnectionViewAndElementDescriptor; >+import org.eclipse.gmf.runtime.emf.commands.core.command.AbstractTransactionalCommand; > import org.eclipse.gmf.runtime.emf.commands.core.command.CompositeTransactionalCommand; > import org.eclipse.gmf.runtime.emf.type.core.IElementType; > import org.eclipse.gmf.runtime.emf.type.core.IHintedType; >@@ -111,7 +116,7 @@ > return (EditPart) myViewer.getEditPartRegistry().get(notationElement); > } > >- public void setBusinessElementStructuralFeature(View view, String featureName, Object value) { >+ public Command getSetBusinessElementStructuralFeatureCommand(View view, String featureName, Object value) { > EObject instance = view.getElement(); > Assert.assertNotNull("No business element bound to notation element", instance); //$NON-NLS-1$ > EObject resultObj = EPath.findLocalFeature(instance.eClass(), featureName); >@@ -122,12 +127,31 @@ > EStructuralFeature feature = (EStructuralFeature) resultObj; > SetRequest setReq = new SetRequest(instance, feature, value); > EditPart editPart = findEditPart(view); >- Assert.assertTrue("IGraphicalEditPart expected", editPart instanceof IGraphicalEditPart); //$NON-NLS-1$ >- >- TransactionalEditingDomain txEditDomain = ((IGraphicalEditPart) editPart).getEditingDomain(); >+ TransactionalEditingDomain txEditDomain = getEditDomain(editPart); > CompositeTransactionalCommand modelCmd = new CompositeTransactionalCommand(txEditDomain, "Set feature"); //$NON-NLS-1$ > modelCmd.compose(new SetValueCommand(setReq)); >- new EtoolsProxyCommand(modelCmd).execute(); >+ return new EtoolsProxyCommand(modelCmd); >+ } >+ >+ public Command getSetNotationalElementStructuralFeature(View view, final EStructuralFeature feature, final Object value) { >+ Assert.assertNotNull("Null view", view); //$NON-NLS-1$ >+ Assert.assertNotNull("Null feature", feature); //$NON-NLS-1$ >+ final EditPart editPart = findEditPart(view); >+ Assert.assertNotNull("Cannot find edit part", editPart); //$NON-NLS-1$ >+ TransactionalEditingDomain ed = getEditDomain(editPart); >+ Assert.assertNotNull("No TransactionalEditingDomain found", ed); //$NON-NLS-1$ >+ return new EtoolsProxyCommand(new AbstractTransactionalCommand(ed, "ChangeColor", Collections.EMPTY_LIST) { >+ protected CommandResult doExecuteWithResult(IProgressMonitor progressMonitor, IAdaptable info) throws ExecutionException { >+ IGraphicalEditPart ep = (IGraphicalEditPart) editPart; >+ ep.setStructuralFeatureValue(feature, value); >+ return null; >+ } >+ }); >+ } >+ >+ protected TransactionalEditingDomain getEditDomain(EditPart editPart) { >+ Assert.assertTrue("IGraphicalEditPart expected", editPart instanceof IGraphicalEditPart); //$NON-NLS-1$ >+ return ((IGraphicalEditPart) editPart).getEditingDomain(); > } > > public void dispose() { >Index: src/org/eclipse/gmf/tests/AllTests.java >=================================================================== >RCS file: /cvsroot/technology/org.eclipse.gmf/tests/org.eclipse.gmf.tests/src/org/eclipse/gmf/tests/AllTests.java,v >retrieving revision 1.44 >diff -u -r1.44 AllTests.java >--- src/org/eclipse/gmf/tests/AllTests.java 14 May 2006 18:06:33 -0000 1.44 >+++ src/org/eclipse/gmf/tests/AllTests.java 22 May 2006 14:04:51 -0000 >@@ -117,7 +117,7 @@ > return suite; > } > >- private static Test feed(Class theClass, TestConfiguration config) { >+ protected static Test feed(Class theClass, TestConfiguration config) { > TestSuite suite = new TestSuite(theClass); > if (!NeedsSetup.class.isAssignableFrom(theClass)) { > return suite;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 140162
:
40355
| 42150 |
42153