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 84044 Details for
Bug 133099
Providing the ability to record user's interactions with GEF objects in a GEF editor
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Draw2d figures as verification hooks
enhanced_patch.txt (text/plain), 35.08 KB, created by
Alexander Nyßen
on 2007-11-29 04:47:23 EST
(
hide
)
Description:
Draw2d figures as verification hooks
Filename:
MIME Type:
Creator:
Alexander Nyßen
Created:
2007-11-29 04:47:23 EST
Size:
35.08 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.tptp.test.auto.gui >Index: src/org/eclipse/tptp/test/auto/gui/internal/core/VerificationMetaData.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.tptp.test.auto.gui/src/org/eclipse/tptp/test/auto/gui/internal/core/VerificationMetaData.java,v >retrieving revision 1.2 >diff -u -r1.2 VerificationMetaData.java >--- src/org/eclipse/tptp/test/auto/gui/internal/core/VerificationMetaData.java 27 Oct 2006 14:39:10 -0000 1.2 >+++ src/org/eclipse/tptp/test/auto/gui/internal/core/VerificationMetaData.java 29 Nov 2007 09:43:49 -0000 >@@ -11,93 +11,128 @@ > *******************************************************************************/ > package org.eclipse.tptp.test.auto.gui.internal.core; > >- > /** >- * A container class for the data that the verificaiton command will need >+ * A container class for the data that the verificaiton command will need > * > * @author Ali Mehregani > */ >-public class VerificationMetaData >-{ >+public class VerificationMetaData { >+ > /* The possible types */ >- public static final byte EDITOR = 0x01; >- public static final byte VIEW = 0x02; >- public static final byte SHELL = 0x03; >- >+ public static final byte EDITOR = 0x01; >+ public static final byte VIEW = 0x02; >+ public static final byte SHELL = 0x03; >+ >+ // BEGIN ADDED BY ANy >+ String objectId; >+ >+ public String getObjectId() { >+ return objectId; >+ } >+ >+ public void setObjectId(String objectId) { >+ this.objectId = objectId; >+ } >+ >+ // private FigureCanvas figureCanvas; >+ // private Point figureCanvasLocalCursorPosition; >+ private Object object; >+ private String resolverId; >+ >+ // >+ // public FigureCanvas getFigureCanvas() { >+ // return figureCanvas; >+ // } >+ // >+ // public void setFigureCanvas(FigureCanvas figureCanvas) { >+ // this.figureCanvas = figureCanvas; >+ // } >+ // >+ // public Point getFigureCanvasLocalCursorPosition() { >+ // return figureCanvasLocalCursorPosition; >+ // } >+ // >+ // public void setFigureCanvasLocalCursorPosition(Point figureCanvasLocalCursorPosition) { >+ // this.figureCanvasLocalCursorPosition = figureCanvasLocalCursorPosition; >+ // } >+ // >+ public Object getObject() { >+ return object; >+ } >+ >+ public void setObject(Object object) { >+ this.object = object; >+ } >+ >+ public String getResolverId(){ >+ return resolverId; >+ } > >+ public void setResolverId(String resolverId){ >+ this.resolverId = resolverId; >+ } >+ // END ADDED BY ANy >+ > /* The context id is the id of the editor, viewer, etc... that will be used to retrieve it */ > private String contextId; >- >+ > /* The location is the plugin that contains the hook source code */ > private String location; >- >+ > /* The resource is the class name containing the hook */ > private String resource; >- >+ > /* The hook is the method name representing the verification point */ > private String hook; >- >- /* The focus type indicates whether the type of context being retrieved */ >+ >+ /* The focus type indicates whether the type of context being retrieved */ > private byte focusType; > >- public VerificationMetaData() >- { >+ public VerificationMetaData() { > focusType = -1; > } >- >- public String getContextId() >- { >+ >+ public String getContextId() { > return contextId; > } > >- public void setContextId(String contextId) >- { >+ public void setContextId(String contextId) { > this.contextId = contextId; > } > >- public byte getFocusType() >- { >+ public byte getFocusType() { > return focusType; > } > >- public void setFocusType(byte focusType) >- { >+ public void setFocusType(byte focusType) { > this.focusType = focusType; > } > >- public String getHook() >- { >+ public String getHook() { > return hook; > } > >- public void setHook(String hook) >- { >+ public void setHook(String hook) { > this.hook = hook; > } > >- public String getLocation() >- { >+ public String getLocation() { > return location; > } > >- public void setLocation(String location) >- { >+ public void setLocation(String location) { > this.location = location; > } > >- public String getResource() >- { >+ public String getResource() { > return resource; > } > >- public void setResource(String resource) >- { >+ public void setResource(String resource) { > this.resource = resource; > } >- >- public boolean isComplete() >- { >- return contextId != null && location != null && resource != null && hook != null && focusType != -1; >+ >+ public boolean isComplete() { >+ return contextId != null && location != null && resource != null && hook != null && focusType != -1; > } >- > } >Index: src/org/eclipse/tptp/test/auto/gui/internal/codegen/AutoGUIGenerator.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.tptp.test.auto.gui/src/org/eclipse/tptp/test/auto/gui/internal/codegen/AutoGUIGenerator.java,v >retrieving revision 1.9 >diff -u -r1.9 AutoGUIGenerator.java >--- src/org/eclipse/tptp/test/auto/gui/internal/codegen/AutoGUIGenerator.java 19 Apr 2007 12:28:03 -0000 1.9 >+++ src/org/eclipse/tptp/test/auto/gui/internal/codegen/AutoGUIGenerator.java 29 Nov 2007 09:43:48 -0000 >@@ -117,7 +117,14 @@ > > > cu.becomeWorkingCopy(null, new NullProgressMonitor()); >+ > String[] args = {argument}; >+ >+ // BEGIN ADDED ANy >+ argument = argument.replace(";Q", ";-Q"); >+ args = argument.split("-"); >+ // END ADDED ANy >+ > IMethod method = mainClass.getMethod(methodName, args); > > try >Index: src/org/eclipse/tptp/test/auto/gui/internal/commands/VerificationCommand.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.tptp.test.auto.gui/src/org/eclipse/tptp/test/auto/gui/internal/commands/VerificationCommand.java,v >retrieving revision 1.1 >diff -u -r1.1 VerificationCommand.java >--- src/org/eclipse/tptp/test/auto/gui/internal/commands/VerificationCommand.java 10 Jul 2006 14:49:05 -0000 1.1 >+++ src/org/eclipse/tptp/test/auto/gui/internal/commands/VerificationCommand.java 29 Nov 2007 09:43:49 -0000 >@@ -18,9 +18,13 @@ > import java.util.StringTokenizer; > import java.util.Vector; > >+import org.eclipse.core.runtime.Assert; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IProgressMonitor; > import org.eclipse.core.runtime.Path; >+import org.eclipse.draw2d.FigureCanvas; >+import org.eclipse.draw2d.IFigure; >+import org.eclipse.draw2d.geometry.Point; > import org.eclipse.hyades.test.common.junit.HyadesTestSuite; > import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jface.dialogs.MessageDialog; >@@ -30,6 +34,7 @@ > import org.eclipse.swt.widgets.Display; > import org.eclipse.swt.widgets.Event; > import org.eclipse.swt.widgets.Shell; >+import org.eclipse.swt.widgets.Widget; > import org.eclipse.tptp.test.auto.gui.internal.AutoGUIMessages; > import org.eclipse.tptp.test.auto.gui.internal.AutoGUIUtil; > import org.eclipse.tptp.test.auto.gui.internal.core.VerifHookClassLoader; >@@ -44,355 +49,453 @@ > import org.eclipse.ui.IViewPart; > import org.w3c.dom.Node; > >- > /** >- * The following command is inserted for every verification hook that the >- * user inserts for a particular test case. An instance of this class can >- * only be created through constructInstance(Event). <br/> >- * In order for clients to be able to write or playback this command they must >- * meet the following pre-conditions. >+ * The following command is inserted for every verification hook that the user inserts for a particular test case. An instance of this class can only >+ * be created through constructInstance(Event). <br/> In order for clients to be able to write or playback this command they must meet the following >+ * pre-conditions. > * > * <ul> >- * <li> test suite must be set using setTestSuite </li> >- * <li> verification hook must be set using setVerificationHook </li> >+ * <li> test suite must be set using setTestSuite </li> >+ * <li> verification hook must be set using setVerificationHook </li> > * </ul> > * > * @author Ali Mehregani > */ >-public class VerificationCommand extends AbstractMacroCommand >-{ >+public class VerificationCommand extends AbstractMacroCommand { >+ > /* The type of this command */ > public static final String TYPE = "verification"; > >- /* This instance variable is updated if at any point there is an error >- * creating an instance of this class through constructInstance. This can >- * be null if no errors are to be reported */ >+ /* >+ * This instance variable is updated if at any point there is an error creating an instance of this class through constructInstance. This can be >+ * null if no errors are to be reported >+ */ > private static String error; >- >+ > /* The meta data required by this verification command */ > private VerificationMetaData metaData; >- >+ > /* To be acknowledged events */ > private static WidgetIdentifier toBeAck; >- >+ >+ // BEGIN ADDED BY ANy >+ // public static final String POSITION = "position"; >+ // private static FigureCanvas figureCanvas; >+ // private static Point figurePosition; >+ // private static IFigure figure; >+ >+ // END ADDED BY ANy >+ > /** >- * The constructor >+ * The constructor > * >- * @param metaData The meta data that this verification command uses to write >- * or play back itself. >+ * @param metaData >+ * The meta data that this verification command uses to write or play back itself. > */ >- public VerificationCommand (MacroCommandShell parent, VerificationMetaData metaData) >- { >- super(parent, WidgetIdentifier.NULL_IDENTIFIER); /* The widget id is irrelevant in the verification command. This is just a dummy command */ >+ public VerificationCommand(MacroCommandShell parent, VerificationMetaData metaData) { >+ super(parent, >+ WidgetIdentifier.NULL_IDENTIFIER); /* The widget id is irrelevant in the verification command. This is just a dummy command */ > this.metaData = metaData; > } > >- public String getType() >- { >+ public String getType() { > return TYPE; > } > >- public void processEvent(Event e) >- { >+ public void processEvent(Event e) { > } > > /** > * A chance to build the meta-data of this verification command > */ >- public void load(Node node, Hashtable lineTable) >- { >+ public void load(Node node, Hashtable lineTable) { > /* Bind the source location */ >- super.bindSourceLocation(node, lineTable); >- >+ super.bindSourceLocation(node, >+ lineTable); >+ > /* Construct the meta data here */ > VerificationMetaData metaData = getMetaData(); >- >- String contextId = MacroUtil.getAttribute(node, "contextId"); >+ >+ String contextId = MacroUtil.getAttribute(node, >+ "contextId"); > metaData.setContextId(contextId); > metaData.setFocusType(MacroUtil.findFocusType(contextId)); >- metaData.setLocation(MacroUtil.getAttribute(node, "location")); >- metaData.setResource(MacroUtil.getAttribute(node, "resource")); >- metaData.setHook(MacroUtil.getAttribute(node, "hook")); >+ // ADDED BY ANy >+ metaData.setObjectId(MacroUtil.getAttribute(node, >+ "objectId")); >+ metaData.setResolverId(MacroUtil.getAttribute(node, >+ "resolverId")); >+ // String locationString = MacroUtil.getAttribute(node, POSITION); >+ // if (locationString != null) { >+ // String xPos = locationString.substring(locationString.indexOf("(") + 1, locationString.indexOf(",")); >+ // String yPos = locationString.substring(locationString.indexOf(",") + 1, locationString.indexOf(")")); >+ // int x = new Integer(xPos).intValue(); >+ // int y = new Integer(yPos).intValue(); >+ // metaData.setFigureCanvasLocalCursorPosition(new Point(x, y)); >+ // } >+ // END ADDED BY ANy >+ metaData.setLocation(MacroUtil.getAttribute(node, >+ "location")); >+ metaData.setResource(MacroUtil.getAttribute(node, >+ "resource")); >+ metaData.setHook(MacroUtil.getAttribute(node, >+ "hook")); >+ >+ // BEGIN ADDED BY ANy >+ setWidgetId(new WidgetIdentifier(new Path(metaData.getContextId()), new Path(metaData.getObjectId()), metaData.getResolverId())); >+ // END ADDED BY ANy > } >- >- >+ > /** >- * Invoked when this writable object is ready to be written to >- * a print writer. >+ * Invoked when this writable object is ready to be written to a print writer. > */ >- public void write(int indent, StringBuffer sb) >- { >+ public void write(int indent, StringBuffer sb) { > if (!metaData.isComplete()) > return; >- >- /* If the default package is selected for a verification hook class, >- * it is often prefixed with a '.' This needs to be taken out before >- * written as part of the macro >+ >+ /* >+ * If the default package is selected for a verification hook class, it is often prefixed with a '.' This needs to be taken out before written >+ * as part of the macro > */ > String resource = metaData.getResource(); > if (resource != null && resource.length() > 0 && resource.charAt(0) == '.') > resource = resource.substring(1); >- >- MacroUtil.addElement(sb, indent, MacroConstants.COMMAND_ELEMENT, false, false); >- MacroUtil.addAttribute(sb, >- new String[] {MacroConstants.TYPE_ATTRIBUTE, >- MacroConstants.CONTEXT_ID_ATTRIBUTE, >- MacroConstants.LOCATION_ATTRIBUTE, >- MacroConstants.RESOURCE_ATTRIBUTE, >- MacroConstants.HOOK_ATTRIBUTE}, >- new String[] {getType(), >- metaData.getContextId(), >- metaData.getLocation(), >- resource, >- metaData.getHook()}, true, true); >+ >+ MacroUtil.addElement(sb, >+ indent, >+ MacroConstants.COMMAND_ELEMENT, >+ false, >+ false); >+ // BEGIN MODIFIED ANy >+ MacroUtil.addAttribute(sb, >+ new String[] { >+ MacroConstants.TYPE_ATTRIBUTE, >+ MacroConstants.CONTEXT_ID_ATTRIBUTE, >+ "objectId", >+ "resolverId", >+ MacroConstants.LOCATION_ATTRIBUTE, >+ MacroConstants.RESOURCE_ATTRIBUTE, >+ MacroConstants.HOOK_ATTRIBUTE}, >+ new String[] { >+ getType(), >+ metaData.getContextId(), >+ metaData.getObjectId(), >+ metaData.getResolverId(), >+ metaData.getLocation(), >+ resource, >+ metaData.getHook()}, >+ true, >+ true); >+ // END MODIFIED ANy > } > >- > /** >- * This doesn't involve any UI actions. Playing back the verification command will >- * simply run the verification hook. >- * @throws CoreException >+ * This doesn't involve any UI actions. Playing back the verification command will simply run the verification hook. >+ * >+ * @throws CoreException > */ >- public boolean playback(Display display, Composite parent, IProgressMonitor monitor) throws CoreException >- { >- /* Phases: >- * 1. Load the necessary class >- * 2. Do the method look up on the hook entry >- * 3. If valid: >- * 4. Load its context (i.e. View/Editor/etc...) >- * 5. Invoke the hook with the context >+ public boolean playback(Display display, Composite parent, IProgressMonitor monitor) throws CoreException { >+ /* >+ * Phases: 1. Load the necessary class 2. Do the method look up on the hook entry 3. If valid: 4. Load its context (i.e. View/Editor/etc...) >+ * 5. Invoke the hook with the context > */ >- >+ > String classPath = System.getProperty("java.class.path"); >- try >- { >+ try { > Vector reqPlugins = null; >- >- >- /* If we happen to run in the quick run mode, then we need to explicitly modify the >- * class path ourself. */ >- if (MacroManager.getInstance().getGlobalState() == MacroManager.QUICK_RUN_MODE) >- { >+ >+ /* >+ * If we happen to run in the quick run mode, then we need to explicitly modify the class path ourself. >+ */ >+ if (MacroManager.getInstance().getGlobalState() == MacroManager.QUICK_RUN_MODE) { > /* The project is expected to be a java project */ > IJavaProject javaProject = AutoGUIUtil.findJavaProject(metaData.getLocation()); > > /* We need to add the output folder of all the java projects in our workspace to the classpath */ > classPath += AutoGUIUtil.appendWSProjOutputFolder(classPath); >- >- if (javaProject != null && javaProject.exists()) >- { >- /* Add the classpath entries of the project */ >- reqPlugins = new Vector(5); >- classPath += AutoGUIUtil.findDependencies (javaProject, reqPlugins, true); >+ >+ if (javaProject != null && javaProject.exists()) { >+ /* Add the classpath entries of the project */ >+ reqPlugins = new Vector(5); >+ classPath += AutoGUIUtil.findDependencies(javaProject, >+ reqPlugins, >+ true); > } > } >- >- /* Otherwise we're running in execution mode. We'll still need to resolve the dependencies of the plugin >- * containing the test suite. If any exists, then it would have been registerd with the MacroManager. */ >- else >- { >+ >+ /* >+ * Otherwise we're running in execution mode. We'll still need to resolve the dependencies of the plugin containing the test suite. If any >+ * exists, then it would have been registerd with the MacroManager. >+ */ >+ else { > reqPlugins = MacroManager.getInstance().getDependecies(); > } >- >- StringTokenizer st = new StringTokenizer (classPath, File.pathSeparator); >+ >+ StringTokenizer st = new StringTokenizer(classPath, File.pathSeparator); > Vector urlsVec = new Vector(10); >- >+ > /* https://bugs.eclipse.org/bugs/show_bug.cgi?id=136157 */ > final String PREFIX = "file:"; >- >- while (st.hasMoreTokens()) >- { >+ >+ while (st.hasMoreTokens()) { > String curURL = st.nextToken(); >- >+ > /* The URL class loader will require all directories to end with a forward slash */ > if (!curURL.endsWith(".jar") && !curURL.endsWith("/")) >- curURL += "/"; >- >+ curURL += "/"; >+ > urlsVec.add(new URL(PREFIX + curURL)); > } >- >+ > /* Construct the urls */ > URL[] urls = new URL[urlsVec.size()]; >- for (int i = 0; i < urls.length; i++) >- { >+ for (int i = 0; i < urls.length; i++) { > urls[i] = (URL) urlsVec.get(i); > } >- >- >- ClassLoader customClassLoader = new VerifHookClassLoader (urls, this.getClass().getClassLoader(), reqPlugins); >- Class verifyHookClass = Class.forName(metaData.getResource(), true, customClassLoader); >+ >+ ClassLoader customClassLoader = new VerifHookClassLoader(urls, this.getClass().getClassLoader(), reqPlugins); >+ Class verifyHookClass = Class.forName(metaData.getResource(), >+ true, >+ customClassLoader); > > Object[] args = new Object[1]; > String contextId = new Path(metaData.getContextId()).segment(1); >- >- if (metaData.getFocusType() == VerificationMetaData.VIEW) >- { >- IViewPart view = MacroObjectLocator.locateView(display.getActiveShell(), contextId, getStartLine()); >+ >+ if (metaData.getFocusType() == VerificationMetaData.VIEW) { >+ IViewPart view = MacroObjectLocator.locateView(display.getActiveShell(), >+ contextId, >+ getStartLine()); > args[0] = view; > } >- else if (metaData.getFocusType() == VerificationMetaData.EDITOR) >- { >- IEditorPart editor = MacroObjectLocator.locateEditor(display.getActiveShell(), contextId, getStartLine(), null); >+ else if (metaData.getFocusType() == VerificationMetaData.EDITOR) { >+ IEditorPart editor = MacroObjectLocator.locateEditor(display.getActiveShell(), >+ contextId, >+ getStartLine(), >+ null); > args[0] = editor; > } >- else if (metaData.getFocusType() == VerificationMetaData.SHELL) >- { >+ else if (metaData.getFocusType() == VerificationMetaData.SHELL) { > Shell shell = getParent().getShell(); > args[0] = shell; > } >- >+ >+ // BEGIN ADDED ANy >+ String objectId = metaData.getObjectId(); >+ // check if we have to resolve beyond the context level (object) >+ if (objectId != null) { >+ Object arg0 = args[0]; >+ >+ // TODO: The widget resolving does not work with the position suffix, so removed it >+ getWidgetId().setObjectId(new Path(getWidgetId().getObjectId().toString().substring(0, >+ getWidgetId().getObjectId().toString().lastIndexOf("/")))); >+ >+ // Find the widget >+ CommandTarget[] targets = MacroObjectLocator.locateCommandTarget(parent, >+ getWidgetId(), >+ getStartLine()); >+ >+ // make sure we just have one widget >+ Assert.isLegal(targets.length == 1); >+ Widget widget = targets[0].getWidget(); >+ >+ Object object = null; >+ if (widget instanceof FigureCanvas) { >+ FigureCanvas figureCanvas = (FigureCanvas) widget; >+ >+ String xPos = objectId.substring(objectId.indexOf("/(") + 2, >+ objectId.indexOf(",")); >+ String yPos = objectId.substring(objectId.indexOf(", ") + 2, >+ objectId.indexOf(")")); >+ int x = new Integer(xPos).intValue(); >+ int y = new Integer(yPos).intValue(); >+ Point position = new Point(x, y); >+ object = figureCanvas.getLightweightSystem().getRootFigure().findFigureAt(position); >+ } >+ >+ if (object != null) { >+ // metaData.setObject(object); >+ args = new Object[2]; >+ args[0] = arg0; >+ args[1] = object; >+ } >+ } >+ // END ADDED ANy >+ > /* Construct the test case */ > HyadesTestSuite testSuite = new HyadesTestSuite(); > Constructor constructor = verifyHookClass.getConstructor(new Class[] {String.class, Class[].class, Object[].class}); >- >+ > String testMethodName = MacroUtil.findMethodName(metaData); > Class[] testMethodParams = MacroUtil.findParameterType(metaData); >- AutoGUIVerificationHook verificationHook = (AutoGUIVerificationHook) constructor.newInstance(new Object[] {testMethodName,testMethodParams , args}); >+ // BEGIN ADDED BY ANy >+ if (args.length == 2) { >+ Class param1 = testMethodParams[0]; >+ testMethodParams = new Class[2]; >+ testMethodParams[0] = param1; >+ testMethodParams[1] = args[1].getClass(); >+ } >+ // END ADDED BY ANy >+ >+ AutoGUIVerificationHook verificationHook = >+ (AutoGUIVerificationHook) constructor.newInstance(new Object[] {testMethodName, testMethodParams, args}); > verificationHook.setTestInvocationId("invocation-id-" + System.currentTimeMillis()); > testSuite.addTest(verificationHook); >- >+ > /* If we are running in quick mode, then report verification test methods that are missing */ >- if (MacroManager.getInstance().getGlobalState() == MacroManager.QUICK_RUN_MODE) >- { >- try >- { >- verificationHook.getClass().getMethod(testMethodName, testMethodParams); >+ if (MacroManager.getInstance().getGlobalState() == MacroManager.QUICK_RUN_MODE) { >+ try { >+ verificationHook.getClass().getMethod(testMethodName, >+ testMethodParams); > } >- catch (NoSuchMethodException e) >- { >+ catch (NoSuchMethodException e) { > AutoGUIUtil.showMessage(AutoGUIMessages.AUTO_GUI_ERROR_VER_METHOD_NF_T, >- NLS.bind(AutoGUIMessages.AUTO_GUI_ERROR_VER_METHOD_NF, new String[] {testMethodName, String.valueOf(getStartLine())}), >- MessageDialog.WARNING); >+ NLS.bind(AutoGUIMessages.AUTO_GUI_ERROR_VER_METHOD_NF, >+ new String[] {testMethodName, String.valueOf(getStartLine())}), >+ MessageDialog.WARNING); > } > } > MacroManager.getInstance().getRunner().runVerificaitonHook(testSuite); >- >+ > return true; >- >+ > } >- catch (ClassNotFoundException e) >- { >- /* The class was not found. The classpath should have been set by the deployment adapter >- * (JavaExecutionDeploymentAdapter) and the file should have been transferred to the >- * system's temporary directory. This is an internal error */ >+ catch (ClassNotFoundException e) { >+ /* >+ * The class was not found. The classpath should have been set by the deployment adapter (JavaExecutionDeploymentAdapter) and the file >+ * should have been transferred to the system's temporary directory. This is an internal error >+ */ > String[] args = {metaData.getResource(), metaData.getHook(), classPath}; >- AutoGUIUtil.throwCoreException(NLS.bind(AutoGUIMessages.AUTO_GUI_ERROR_VER_CLASS_NOT_F, args), super.getStartLine(), e); >+ AutoGUIUtil.throwCoreException(NLS.bind(AutoGUIMessages.AUTO_GUI_ERROR_VER_CLASS_NOT_F, >+ args), >+ super.getStartLine(), >+ e); > } >- catch (InstantiationException e) >- { >- AutoGUIUtil.throwCoreException(NLS.bind(AutoGUIMessages.AUTO_GUI_ERROR_VER_INSTANTIATE, metaData.getResource()), super.getStartLine(), e); >+ catch (InstantiationException e) { >+ AutoGUIUtil.throwCoreException(NLS.bind(AutoGUIMessages.AUTO_GUI_ERROR_VER_INSTANTIATE, >+ metaData.getResource()), >+ super.getStartLine(), >+ e); > } >- catch (CoreException e) >- { >- String[] args = {metaData.getContextId(), metaData.getHook()}; >- AutoGUIUtil.throwCoreException(NLS.bind(AutoGUIMessages.AUTO_GUI_ERROR_VER_CONTEXT, args), super.getStartLine()); >+ catch (CoreException e) { >+ String[] args = {metaData.getContextId(), metaData.getHook()}; >+ AutoGUIUtil.throwCoreException(NLS.bind(AutoGUIMessages.AUTO_GUI_ERROR_VER_CONTEXT, >+ args), >+ super.getStartLine()); > } >- catch (IllegalArgumentException e) >- { >- AutoGUIUtil.throwCoreException(AutoGUIMessages.AUTO_GUI_ERROR_VER_ARG_EXCEPT, super.getStartLine()); >+ catch (IllegalArgumentException e) { >+ AutoGUIUtil.throwCoreException(AutoGUIMessages.AUTO_GUI_ERROR_VER_ARG_EXCEPT, >+ super.getStartLine()); > } >- catch (Exception e) >- { >- AutoGUIUtil.throwCoreException(AutoGUIUtil.getOriginOfException(e), super.getStartLine(), e); >+ catch (Exception e) { >+ AutoGUIUtil.throwCoreException(AutoGUIUtil.getOriginOfException(e), >+ super.getStartLine(), >+ e); > } >- >+ > return false; > } > >- >- >- > /** >- * Returns an instance of this class based an event. The returned value is null >- * if an error occurs while constructing the instance. Check the value returned >- * by getError to determine the error that has occurred. >+ * Returns an instance of this class based an event. The returned value is null if an error occurs while constructing the instance. Check the >+ * value returned by getError to determine the error that has occurred. > * >- * @param event The event >+ * @param event >+ * The event > * @return An instance of this class > */ >- public synchronized static VerificationCommand constructInstance (MacroCommandShell parent, Event event) >- { >+ public synchronized static VerificationCommand constructInstance(MacroCommandShell parent, Event event) { > VerificationCommand instance = null; >- >- error = ""; >- if (MacroUtil.isIgnorableEvent(event)) >- { >- error = ""; /* We don't want to report anything */ >+ >+ error = ""; >+ if (MacroUtil.isIgnorableEvent(event)) { >+ error = ""; /* We don't want to report anything */ > return null; > } >- >- try >- { >+ >+ try { > /* Ignore all command except for a focus in command */ >- switch (event.type) >- { >+ switch (event.type) { > case SWT.Activate: > case SWT.Selection: > case SWT.FocusIn: >- >+ > WidgetIdentifier widgetID = MacroUtil.getVerificationContextIdentifier(event); >- String path = (widgetID == null ? "" : widgetID.getFullyQualifiedPath().toString()); >- >- if (MacroUtil.findFocusType(path) == -1) >- { >+ >+ String path = (widgetID == null >+ ? "" >+ : widgetID.getFullyQualifiedPath().toString()); >+ >+ if (MacroUtil.findFocusType(path) == -1) { > error = AutoGUIMessages.AUTO_GUI_ERROR_VER_NOT_SUPP_CON; > break; > } >- >+ > /* We only acknowledge after there is a mouse up event */ > toBeAck = widgetID; > break; >- >- case SWT.MouseUp: >+ >+ case SWT.MouseUp: > > if (toBeAck == null) > break; >- >+ > /* Build the verification meta data -- we only know the context id and the focus type at this point */ > VerificationMetaData metaData = new VerificationMetaData(); >+ >+ // ADDED BY ANy >+ // retrieve the widget identifier again to have a correct object id as well (before only the context id was acknowledged) >+ toBeAck = MacroUtil.getWidgetIdentifier(event.widget); >+ // END ADDED BY ANy >+ > String contextId = toBeAck.getContextId().toString(); > metaData.setContextId(contextId); > metaData.setFocusType(MacroUtil.findFocusType(contextId)); >- >+ >+ // BEGIN ADDED BY ANy >+ String objectId = toBeAck.getObjectId().toString(); >+ if (event.widget instanceof FigureCanvas) { >+ objectId = objectId + Path.SEPARATOR + "(" + event.x + ", " + event.y + ")"; >+ IFigure figure = >+ ((FigureCanvas) event.widget).getLightweightSystem().getRootFigure().findFigureAt(new Point(event.x, event.y)); >+ if (figure != null) { >+ metaData.setObject(figure); >+ } >+ } >+ metaData.setObjectId(objectId); >+ // END ADDED BY ANy >+ > /* Create the verification command instance */ >- instance = new VerificationCommand (parent, metaData); >+ instance = new VerificationCommand(parent, metaData); > break; >- >+ > default: > toBeAck = null; > error = AutoGUIMessages.AUTO_GUI_ERROR_VER_WRONG_EVENT; > } >- >+ > return instance; >- } >- catch (Exception e) >- { >+ } >+ catch (Exception e) { > error = e.getMessage(); > e.printStackTrace(); > return null; > } > } > >- >- public static String getError() >- { >+ public static String getError() { > return error; > } > >- public static void setError(String error) >- { >+ public static void setError(String error) { > VerificationCommand.error = error; > } > >- public VerificationMetaData getMetaData() >- { >+ public VerificationMetaData getMetaData() { > return metaData; > } > >- public void setMetaData(VerificationMetaData metaData) >- { >+ public void setMetaData(VerificationMetaData metaData) { > this.metaData = metaData; > } >- >-} > >+} >Index: src/org/eclipse/tptp/test/auto/gui/internal/commands/CommandTarget.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.tptp.test.auto.gui/src/org/eclipse/tptp/test/auto/gui/internal/commands/CommandTarget.java,v >retrieving revision 1.2 >diff -u -r1.2 CommandTarget.java >--- src/org/eclipse/tptp/test/auto/gui/internal/commands/CommandTarget.java 27 Oct 2006 14:39:12 -0000 1.2 >+++ src/org/eclipse/tptp/test/auto/gui/internal/commands/CommandTarget.java 29 Nov 2007 09:43:48 -0000 >@@ -28,9 +28,11 @@ > public Widget getWidget() { > return widget; > } >+ > public Object getContext() { > return context; > } >+ > public void setFocus() { > ensureVisible(); > Display display = widget.getDisplay(); >Index: src/org/eclipse/tptp/test/auto/gui/internal/actions/AutoGUIRecordAction.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.tptp.test.auto.gui/src/org/eclipse/tptp/test/auto/gui/internal/actions/AutoGUIRecordAction.java,v >retrieving revision 1.8 >diff -u -r1.8 AutoGUIRecordAction.java >--- src/org/eclipse/tptp/test/auto/gui/internal/actions/AutoGUIRecordAction.java 22 Mar 2007 14:41:46 -0000 1.8 >+++ src/org/eclipse/tptp/test/auto/gui/internal/actions/AutoGUIRecordAction.java 29 Nov 2007 09:43:48 -0000 >@@ -13,6 +13,7 @@ > > import java.io.PrintWriter; > import java.io.StringWriter; >+import java.lang.reflect.Method; > > import org.eclipse.core.runtime.NullProgressMonitor; > import org.eclipse.hyades.models.common.facades.behavioral.ITestCase; >@@ -446,7 +447,7 @@ > case VerificationMetaData.SHELL: > argument += Shell.class.getName(); > break; >- } >+ } > argument = argument + ";"; > > /* Insert a method in the source file corresponding to the name of the verification hook */ >@@ -461,8 +462,16 @@ > VerificationMetaData metaData = verificationCommand.getMetaData(); > metaData.setLocation(testSuite.getImplementor().getLocation()); > metaData.setResource(testSuite.getImplementor().getResource()); >+ // BEGIN ADDED by ANy >+ if(metaData.getObject() != null){ >+ // remove the ";" >+ argument = argument + "Q"; >+ argument = argument + metaData.getObject().getClass().getName(); >+ argument = argument + ";"; >+ } >+ // END ADDED BY ANy > metaData.setHook(verHook + ":" + argument); >- >+ > generator.setInput(userInput.getName(), userInput.getDescription()); > generator.createMethod (verHook, argument); > } catch (Exception e) >Index: src/org/eclipse/tptp/test/auto/gui/internal/macro/MacroUtil.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.tptp.test.auto.gui/src/org/eclipse/tptp/test/auto/gui/internal/macro/MacroUtil.java,v >retrieving revision 1.1 >diff -u -r1.1 MacroUtil.java >--- src/org/eclipse/tptp/test/auto/gui/internal/macro/MacroUtil.java 10 Jul 2006 14:49:06 -0000 1.1 >+++ src/org/eclipse/tptp/test/auto/gui/internal/macro/MacroUtil.java 29 Nov 2007 09:43:49 -0000 >@@ -22,6 +22,8 @@ > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; > import org.eclipse.core.runtime.Path; >+import org.eclipse.draw2d.FigureCanvas; >+import org.eclipse.draw2d.IFigure; > import org.eclipse.hyades.test.common.util.XMLUtil; > import org.eclipse.jface.action.ActionContributionItem; > import org.eclipse.jface.action.CoolBarManager; >@@ -266,7 +268,7 @@ > else if (part instanceof IEditorPart) > { > String inputName = ((IEditorPart) part).getEditorInput().getName(); >- path = new Path(MacroConstants.EDITOR_VALUE).append(site.getId()).append(inputName); >+ path = new Path(MacroConstants.EDITOR_VALUE).append(site.getId()).append(inputName); > } > else > { >Index: src/org/eclipse/tptp/test/auto/gui/internal/AutoGUIUtil.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.tptp.test.auto.gui/src/org/eclipse/tptp/test/auto/gui/internal/AutoGUIUtil.java,v >retrieving revision 1.10 >diff -u -r1.10 AutoGUIUtil.java >--- src/org/eclipse/tptp/test/auto/gui/internal/AutoGUIUtil.java 8 Aug 2006 17:56:06 -0000 1.10 >+++ src/org/eclipse/tptp/test/auto/gui/internal/AutoGUIUtil.java 29 Nov 2007 09:43:48 -0000 >@@ -178,8 +178,13 @@ > IProject[] workspaceProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects(); > for (int i = 0; i < workspaceProjects.length; i++) > { >- if (workspaceProjects[i].getNature(JavaCore.NATURE_ID) == null) >+ // patch for bug#206768 >+ if (!workspaceProjects[i].isOpen()) > continue; >+ >+ if( workspaceProjects[i].getNature(JavaCore.NATURE_ID) == null) >+ continue; >+ > IJavaProject javaProject = JavaCore.create(workspaceProjects[i]); > > if (javaProject == null || !javaProject.exists()) >Index: META-INF/MANIFEST.MF >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.tptp.test.auto.gui/META-INF/MANIFEST.MF,v >retrieving revision 1.9 >diff -u -r1.9 MANIFEST.MF >--- META-INF/MANIFEST.MF 16 Apr 2007 17:20:58 -0000 1.9 >+++ META-INF/MANIFEST.MF 29 Nov 2007 09:43:48 -0000 >@@ -34,6 +34,8 @@ > org.eclipse.debug.ui;bundle-version="[3.2.0,4.0.0)", > org.eclipse.ui.testing;bundle-version="[3.2.0,4.0.0)", > org.eclipse.hyades.trace.ui;bundle-version="[4.1.0,5.0.0)", >- org.eclipse.jdt.ui >+ org.eclipse.jdt.ui, >+ org.eclipse.draw2d, >+ org.eclipse.gef > Eclipse-LazyStart: true > Bundle-RequiredExecutionEnvironment: J2SE-1.4
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 133099
:
80668
|
80669
|
84044
|
88247
|
88970
|
89819
|
90299
|
95022
|
95024
|
96551
|
108487
|
108488
|
108613
|
127394
|
127395
|
138251
|
138252
|
138255
|
138256