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 80668 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 of HEAD version to allow draw2d figures as verification hook targets
patch.txt (text/plain), 30.39 KB, created by
Alexander Nyßen
on 2007-10-18 11:14:54 EDT
(
hide
)
Description:
Patch of HEAD version to allow draw2d figures as verification hook targets
Filename:
MIME Type:
Creator:
Alexander Nyßen
Created:
2007-10-18 11:14:54 EDT
Size:
30.39 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 18 Oct 2007 15:12:44 -0000 >@@ -11,93 +11,113 @@ > *******************************************************************************/ > package org.eclipse.tptp.test.auto.gui.internal.core; > >+import org.eclipse.draw2d.FigureCanvas; >+import org.eclipse.draw2d.IFigure; >+import org.eclipse.draw2d.geometry.Point; > > /** >- * 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 >+ private FigureCanvas figureCanvas; >+ private Point figureCanvasLocalCursorPosition; >+ private IFigure figure; > >+ 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 IFigure getFigure() { >+ return figure; >+ } >+ > >+ public void setFigure(IFigure figure) { >+ this.figure = figure; >+ } >+ // 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 18 Oct 2007 15:12:44 -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 18 Oct 2007 15:12:44 -0000 >@@ -19,8 +19,13 @@ > import java.util.Vector; > > import org.eclipse.core.runtime.CoreException; >+import org.eclipse.core.runtime.IAdaptable; > 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.gef.EditPartViewer; > import org.eclipse.hyades.test.common.junit.HyadesTestSuite; > import org.eclipse.jdt.core.IJavaProject; > import org.eclipse.jface.dialogs.MessageDialog; >@@ -44,355 +49,388 @@ > 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 figureCanvasLocalCursorPosition; >+ 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); >- >+ > /* Construct the meta data here */ > VerificationMetaData metaData = getMetaData(); >- >+ > 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 >+ 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 > } >- >- >+ > /** >- * 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.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()}, false, false); >+ // BEGIN ADDED ANy >+ if (metaData.getFigureCanvasLocalCursorPosition() != null) { >+ int x = metaData.getFigureCanvasLocalCursorPosition().x; >+ int y = metaData.getFigureCanvasLocalCursorPosition().y; >+ MacroUtil.addAttribute(sb, new String[] {POSITION}, new String[] {"(" + x + "," + y + ")"}, true, true); >+ } >+ // END ADDED 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); >+ >+ 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) >- { >+ >+ if (metaData.getFocusType() == VerificationMetaData.VIEW) { > IViewPart view = MacroObjectLocator.locateView(display.getActiveShell(), contextId, getStartLine()); > args[0] = view; > } >- else if (metaData.getFocusType() == VerificationMetaData.EDITOR) >- { >+ 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 >+ if (metaData.getFigureCanvasLocalCursorPosition() != null) { >+ IEditorPart editor = (IEditorPart) args[0]; >+ if (editor instanceof IAdaptable) { >+ EditPartViewer viewer = (EditPartViewer) editor.getAdapter(EditPartViewer.class); >+ if (viewer != null) { >+ FigureCanvas figureCanvas = (FigureCanvas) viewer.getControl(); >+ IFigure figure = >+ figureCanvas.getLightweightSystem().getRootFigure().findFigureAt( >+ metaData.getFigureCanvasLocalCursorPosition()); >+ metaData.setFigureCanvas(figureCanvas); >+ metaData.setFigure(figure); >+ } >+ } >+ if (metaData.getFigure() != null) { >+ args = new Object[2]; >+ args[0] = editor; >+ args[1] = metaData.getFigure(); >+ } >+ } >+ // 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 (metaData.getFigure() != null) { >+ Class param1 = testMethodParams[0]; >+ testMethodParams = new Class[2]; >+ testMethodParams[0] = param1; >+ testMethodParams[1] = metaData.getFigure().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 >- { >+ if (MacroManager.getInstance().getGlobalState() == MacroManager.QUICK_RUN_MODE) { >+ try { > verificationHook.getClass().getMethod(testMethodName, testMethodParams); > } >- 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); >+ 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); > } > } > 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); > } >- catch (InstantiationException 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()}; >+ 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) >- { >+ catch (IllegalArgumentException e) { > AutoGUIUtil.throwCoreException(AutoGUIMessages.AUTO_GUI_ERROR_VER_ARG_EXCEPT, super.getStartLine()); > } >- catch (Exception 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: >- >+ >+ // BEGIN ADDED BY ANy >+ if (event.widget instanceof FigureCanvas && event.type == SWT.FocusIn) { >+ figureCanvas = (FigureCanvas) event.widget; >+ org.eclipse.swt.graphics.Point swtFigureCanvasLocalCursorPosition = >+ figureCanvas.getDisplay().map( >+ null, figureCanvas, >+ figureCanvas.getDisplay().getCursorLocation()); >+ figureCanvasLocalCursorPosition = new Point(swtFigureCanvasLocalCursorPosition.x, swtFigureCanvasLocalCursorPosition.y); >+ figure = figureCanvas.getLightweightSystem().getRootFigure().findFigureAt(figureCanvasLocalCursorPosition); >+ } >+ // END ADDED BY ANy >+ > WidgetIdentifier widgetID = MacroUtil.getVerificationContextIdentifier(event); > String path = (widgetID == null ? "" : widgetID.getFullyQualifiedPath().toString()); >- >- if (MacroUtil.findFocusType(path) == -1) >- { >+ >+ 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(); > String contextId = toBeAck.getContextId().toString(); > metaData.setContextId(contextId); > metaData.setFocusType(MacroUtil.findFocusType(contextId)); >- >+ >+ // BEGIN ADDED BY ANy >+ if (figureCanvas != null) { >+ metaData.setFigureCanvas(figureCanvas); >+ metaData.setFigureCanvasLocalCursorPosition(figureCanvasLocalCursorPosition); >+ metaData.setFigure(figure); >+ } >+ // END ADDED BY ANy >+ > /* Create the verification command instance */ >- instance = new VerificationCommand (parent, metaData); >+ instance = new VerificationCommand(parent, metaData); > break; >- >+ > default: > toBeAck = null; >+ figureCanvas = null; >+ figureCanvasLocalCursorPosition = null; >+ figure = 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/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 18 Oct 2007 15:12:44 -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,15 @@ > VerificationMetaData metaData = verificationCommand.getMetaData(); > metaData.setLocation(testSuite.getImplementor().getLocation()); > metaData.setResource(testSuite.getImplementor().getResource()); >- metaData.setHook(verHook + ":" + argument); >+ if(metaData.getFigure() != null){ >+ // remove the ";" >+ argument = argument + "Q"; >+ argument = argument + metaData.getFigure().getClass().getName(); >+ argument = argument + ";"; >+ } > >+ 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/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 18 Oct 2007 15:12:44 -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 18 Oct 2007 15:12:44 -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 Raw
Actions:
View
Attachments on
bug 133099
:
80668
|
80669
|
84044
|
88247
|
88970
|
89819
|
90299
|
95022
|
95024
|
96551
|
108487
|
108488
|
108613
|
127394
|
127395
|
138251
|
138252
|
138255
|
138256