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 108192 Details for
Bug 241804
Open Source Code context menu enabled for non-JUnit test types.
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]
Patch.
Defect_241804_Patch.txt (text/plain), 15.59 KB, created by
Paul Slauenwhite
on 2008-07-23 09:28:58 EDT
(
hide
)
Description:
Patch.
Filename:
MIME Type:
Creator:
Paul Slauenwhite
Created:
2008-07-23 09:28:58 EDT
Size:
15.59 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.hyades.test.tools.ui >Index: src/org/eclipse/hyades/test/tools/ui/java/internal/junit/navigator/JUnitTestSuiteProxyFactory.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.tools.ui/src/org/eclipse/hyades/test/tools/ui/java/internal/junit/navigator/JUnitTestSuiteProxyFactory.java,v >retrieving revision 1.1 >diff -u -r1.1 JUnitTestSuiteProxyFactory.java >--- src/org/eclipse/hyades/test/tools/ui/java/internal/junit/navigator/JUnitTestSuiteProxyFactory.java 25 Mar 2005 18:23:38 -0000 1.1 >+++ src/org/eclipse/hyades/test/tools/ui/java/internal/junit/navigator/JUnitTestSuiteProxyFactory.java 23 Jul 2008 13:27:42 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2005 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 IBM 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 > * which accompanies this distribution, and is available at >@@ -12,6 +12,7 @@ > package org.eclipse.hyades.test.tools.ui.java.internal.junit.navigator; > > import org.eclipse.hyades.models.common.testprofile.TPFTest; >+import org.eclipse.hyades.models.common.testprofile.TPFTestCase; > import org.eclipse.hyades.models.common.testprofile.TPFTestSuite; > import org.eclipse.hyades.test.ui.TestUIConstants; > import org.eclipse.hyades.test.ui.navigator.DefaultTypedElementProxyFactory; >@@ -19,11 +20,18 @@ > import org.eclipse.ui.IMemento; > > /** >- * This factory is responsible to create special proxy node for JUnit test suite. >+ * This factory is responsible to create special proxy nodes for JUnit test cases and suites. >+ * <p/> >+ * Those test cases should have the type org.eclipse.hyades.test.java.junit.testCase. >+ * <p/> > * Those test suites should have the type org.eclipse.hyades.test.java.junit.testSuite. >+ * <p/> >+ * > * >- * @author jgout >- * @since 4.0 >+ * @author Jerome Gout >+ * @author Paul E. Slauenwhite >+ * @version July 23, 2008 >+ * @since March 25, 2005 > */ > public class JUnitTestSuiteProxyFactory extends DefaultTypedElementProxyFactory { > >@@ -35,6 +43,11 @@ > TPFTestSuite ts = (TPFTestSuite) test; > return new JUnitTestSuiteProxyNode(ts, parent); > } >+ else if (test instanceof TPFTestCase) { >+ TPFTestCase tc = (TPFTestCase) test; >+ return new JUnitTestCaseProxyNode(tc, parent); >+ } >+ > return super.create(test, parent); > } > >@@ -45,8 +58,12 @@ > String nodeKind = memento.getString(TestUIConstants.TAG_NODE_KIND); > if(nodeKind.equals(TestUIConstants.TESTSUITE_NODE)) { > return new JUnitTestSuiteProxyNode(memento, parent); >- } else { >- //- since this is not a saved test suite, let's default factory handle this memento >+ } >+ else if(nodeKind.equals(TestUIConstants.TESTCASE_NODE)) { >+ return (new JUnitTestCaseProxyNode(memento, parent)); >+ } >+ else { >+ //- since this is not a saved test case or suite, let's default factory handle this memento > return super.recreate(memento, parent); > } > } >Index: plugin.xml >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.tools.ui/plugin.xml,v >retrieving revision 1.57 >diff -u -r1.57 plugin.xml >--- plugin.xml 11 Mar 2008 18:13:05 -0000 1.57 >+++ plugin.xml 23 Jul 2008 13:27:42 -0000 >@@ -275,9 +275,27 @@ > <typedElement > type="org.eclipse.hyades.test.java.junit.testSuite" > factoryID="org.eclipse.hyades.test.tools.ui.JUnitTestSuiteFactory"/> >+ <typedElement >+ type="org.eclipse.hyades.test.java.junit.testCase" >+ factoryID="org.eclipse.hyades.test.tools.ui.JUnitTestSuiteFactory"/> > </extension> > <extension > point="org.eclipse.ui.popupMenus"> >+ >+ <!-- Open JUnit test method from TPTP JUnit test case: --> >+ <objectContribution >+ adaptable="false" >+ objectClass="org.eclipse.hyades.test.tools.ui.java.internal.junit.navigator.JUnitTestCaseProxyNode" >+ id="org.eclipse.hyades.test.tools.ui.JUnitTestCaseContribution"> >+ <action >+ enablesFor="1" >+ label="%OPEN_JUNIT_TEST_SUITE_CODE" >+ class="org.eclipse.hyades.test.tools.ui.java.internal.junit.actions.OpenJUnitTestCaseCodeAction" >+ menubarPath="org.eclipse.ui.OpenWithSubMenu" >+ id="org.eclipse.hyades.test.tools.ui.JUnitTestCaseOpenCode"/> >+ </objectContribution> >+ >+ <!-- Open JUnit test class from TPTP JUnit test suite: --> > <objectContribution > adaptable="false" > objectClass="org.eclipse.hyades.test.tools.ui.java.internal.junit.navigator.JUnitTestSuiteProxyNode" >@@ -289,6 +307,8 @@ > menubarPath="org.eclipse.ui.OpenWithSubMenu" > id="org.eclipse.hyades.test.tools.ui.JUnitTestSuiteOpenCode"/> > </objectContribution> >+ >+ <!-- Import a JUnit test class to a TPTP JUnit test suite: --> > <objectContribution > adaptable="false" > id="org.eclipse.hyades.test.tools.ui.RegularJUnitTestSuiteContribution" >@@ -301,21 +321,6 @@ > menubarPath="group.import"/> > </objectContribution> > </extension> >- <extension >- point="org.eclipse.ui.popupMenus"> >- <objectContribution >- adaptable="false" >- objectClass="org.eclipse.hyades.test.ui.internal.navigator.proxy.DefaultTestCaseProxyNode" >- id="org.eclipse.hyades.test.tools.ui.JUnitTestCaseContribution"> >- <action >- enablesFor="1" >- label="%OPEN_JUNIT_TEST_SUITE_CODE" >- class="org.eclipse.hyades.test.tools.ui.java.internal.junit.actions.OpenJUnitTestSuiteCodeAction" >- menubarPath="org.eclipse.ui.OpenWithSubMenu" >- id="org.eclipse.hyades.test.tools.ui.JUnitTestCaseOpenCode"/> >- </objectContribution> >- </extension> >- > > <extension > point="org.eclipse.hyades.ui.typeDescriptions"> >Index: src/org/eclipse/hyades/test/tools/ui/java/internal/junit/actions/OpenJUnitTestSuiteCodeAction.java >=================================================================== >RCS file: /cvsroot/tptp/test/org.eclipse.hyades.test.tools.ui/src/org/eclipse/hyades/test/tools/ui/java/internal/junit/actions/OpenJUnitTestSuiteCodeAction.java,v >retrieving revision 1.1 >diff -u -r1.1 OpenJUnitTestSuiteCodeAction.java >--- src/org/eclipse/hyades/test/tools/ui/java/internal/junit/actions/OpenJUnitTestSuiteCodeAction.java 1 Sep 2006 14:14:37 -0000 1.1 >+++ src/org/eclipse/hyades/test/tools/ui/java/internal/junit/actions/OpenJUnitTestSuiteCodeAction.java 23 Jul 2008 13:27:42 -0000 >@@ -1,5 +1,5 @@ > /********************************************************************** >- * Copyright (c) 2005, 2006 IBM Corporation and others. >+ * Copyright (c) 2005, 2008 IBM 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 > * which accompanies this distribution, and is available at >@@ -12,60 +12,60 @@ > package org.eclipse.hyades.test.tools.ui.java.internal.junit.actions; > > import org.eclipse.core.resources.IFile; >-import org.eclipse.hyades.models.common.testprofile.TPFTestCase; > import org.eclipse.hyades.models.common.testprofile.TPFTestSuite; > import org.eclipse.hyades.test.tools.core.java.JUnitTestSuiteFacade; > import org.eclipse.hyades.test.tools.ui.java.internal.junit.navigator.JUnitTestSuiteProxyNode; >-import org.eclipse.hyades.test.ui.internal.navigator.proxy.DefaultTestCaseProxyNode; > import org.eclipse.hyades.test.ui.navigator.IProxyNode; > import org.eclipse.hyades.ui.internal.util.UIUtil; > import org.eclipse.jface.action.IAction; > import org.eclipse.jface.viewers.ISelection; > import org.eclipse.jface.viewers.IStructuredSelection; >-import org.eclipse.jface.viewers.StructuredSelection; > import org.eclipse.ui.IActionDelegate; > > /** > * Action to open the source code of a JUnit test suite. >- * @author jgout, jcanches >- * @since 4.0 >+ * </p> >+ * >+ * >+ * @author Jerome Gout >+ * @author Julien Canches >+ * @author Paul E. Slauenwhite >+ * @version July 23, 2008 >+ * @since September 1, 2006 > */ > public class OpenJUnitTestSuiteCodeAction implements IActionDelegate { > >- private IStructuredSelection selection; >+ private IStructuredSelection selection = null; > > /* (non-Javadoc) > * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) > */ > public void run(IAction action) { >+ > IProxyNode proxy = (IProxyNode) selection.getFirstElement(); >+ > if (proxy instanceof JUnitTestSuiteProxyNode) { >+ > TPFTestSuite ts = ((JUnitTestSuiteProxyNode)proxy).getTestSuite(); > IFile javaFile = JUnitTestSuiteFacade.getJUnitSourceFile(ts); >- if(javaFile != null) { >+ >+ if(javaFile != null) { > UIUtil.openEditor(javaFile, null, false); > } >+ > if(ts.eResource() != null) { > ts.eResource().unload(); > } >- } else if (proxy instanceof DefaultTestCaseProxyNode) { >- DefaultTestCaseProxyNode tcpn = (DefaultTestCaseProxyNode)proxy; >- if (tcpn.getParent() instanceof JUnitTestSuiteProxyNode) { >- TPFTestCase tc = tcpn.getTestCase(); >- OpenTestMethodAction tcAction = new OpenTestMethodAction(null); >- tcAction.selectionChanged(new StructuredSelection(tc)); >- tcAction.run(); >- } >- } >+ } > } > > /* (non-Javadoc) > * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) > */ > public void selectionChanged(IAction action, ISelection selection) { >- if (selection instanceof IStructuredSelection) { >+ >+ if (selection instanceof IStructuredSelection) { > this.selection = (IStructuredSelection) selection; > } > } >- > } >Index: src/org/eclipse/hyades/test/tools/ui/java/internal/junit/navigator/JUnitTestCaseProxyNode.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/tools/ui/java/internal/junit/navigator/JUnitTestCaseProxyNode.java >diff -N src/org/eclipse/hyades/test/tools/ui/java/internal/junit/navigator/JUnitTestCaseProxyNode.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/tools/ui/java/internal/junit/navigator/JUnitTestCaseProxyNode.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,45 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM 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 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * $Id$ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.test.tools.ui.java.internal.junit.navigator; >+ >+import org.eclipse.hyades.models.common.testprofile.TPFTestCase; >+import org.eclipse.hyades.test.ui.internal.navigator.proxy.DefaultTestCaseProxyNode; >+import org.eclipse.hyades.test.ui.navigator.ITestCaseProxyNode; >+import org.eclipse.ui.IMemento; >+ >+/** >+ * JUnit test case proxy node to specialize the actions in the context menu >+ * of the Test Navigator. >+ * <p/> >+ * >+ * >+ * @author Paul E. Slauenwhite >+ * @version July 23, 2008 >+ * @since July 23, 2008 >+ */ >+public class JUnitTestCaseProxyNode extends DefaultTestCaseProxyNode implements ITestCaseProxyNode { >+ >+ public JUnitTestCaseProxyNode(TPFTestCase ts, Object parent) { >+ super(ts, parent); >+ } >+ >+ public JUnitTestCaseProxyNode(IMemento memento, Object parent) { >+ super(memento, parent); >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.hyades.test.ui.internal.navigator.proxy.DefaultTestCaseProxyNode#getFactoryID() >+ */ >+ public String getFactoryID() { >+ return "org.eclipse.hyades.test.tools.ui.JUnitTestSuiteFactory"; //$NON-NLS-1$ >+ } >+} >Index: src/org/eclipse/hyades/test/tools/ui/java/internal/junit/actions/OpenJUnitTestCaseCodeAction.java >=================================================================== >RCS file: src/org/eclipse/hyades/test/tools/ui/java/internal/junit/actions/OpenJUnitTestCaseCodeAction.java >diff -N src/org/eclipse/hyades/test/tools/ui/java/internal/junit/actions/OpenJUnitTestCaseCodeAction.java >--- /dev/null 1 Jan 1970 00:00:00 -0000 >+++ src/org/eclipse/hyades/test/tools/ui/java/internal/junit/actions/OpenJUnitTestCaseCodeAction.java 1 Jan 1970 00:00:00 -0000 >@@ -0,0 +1,68 @@ >+/********************************************************************** >+ * Copyright (c) 2008 IBM 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 >+ * which accompanies this distribution, and is available at >+ * http://www.eclipse.org/legal/epl-v10.html >+ * $Id$ >+ * >+ * Contributors: >+ * IBM - Initial API and implementation >+ **********************************************************************/ >+package org.eclipse.hyades.test.tools.ui.java.internal.junit.actions; >+ >+import org.eclipse.hyades.models.common.testprofile.TPFTestCase; >+import org.eclipse.hyades.test.tools.ui.java.internal.junit.navigator.JUnitTestCaseProxyNode; >+import org.eclipse.hyades.test.tools.ui.java.internal.junit.navigator.JUnitTestSuiteProxyNode; >+import org.eclipse.hyades.test.ui.navigator.IProxyNode; >+import org.eclipse.jface.action.IAction; >+import org.eclipse.jface.viewers.ISelection; >+import org.eclipse.jface.viewers.IStructuredSelection; >+import org.eclipse.jface.viewers.StructuredSelection; >+import org.eclipse.ui.IActionDelegate; >+ >+/** >+ * Action to open the source code of a JUnit test case. >+ * </p> >+ * >+ * >+ * @author Paul E. Slauenwhite >+ * @version July 23, 2008 >+ * @since July 23, 2008 >+ */ >+public class OpenJUnitTestCaseCodeAction implements IActionDelegate { >+ >+ private IStructuredSelection selection = null; >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) >+ */ >+ public void run(IAction action) { >+ >+ IProxyNode proxy = ((IProxyNode)(selection.getFirstElement())); >+ >+ if (proxy instanceof JUnitTestCaseProxyNode) { >+ >+ JUnitTestCaseProxyNode tcpn = ((JUnitTestCaseProxyNode)(proxy)); >+ >+ if (tcpn.getParent() instanceof JUnitTestSuiteProxyNode) { >+ >+ TPFTestCase tc = tcpn.getTestCase(); >+ >+ OpenTestMethodAction tcAction = new OpenTestMethodAction(null); >+ tcAction.selectionChanged(new StructuredSelection(tc)); >+ tcAction.run(); >+ } >+ } >+ } >+ >+ /* (non-Javadoc) >+ * @see org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection) >+ */ >+ public void selectionChanged(IAction action, ISelection selection) { >+ >+ if (selection instanceof IStructuredSelection) { >+ this.selection = ((IStructuredSelection)(selection)); >+ } >+ } >+}
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 241804
: 108192