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 243306 Details for
Bug 362072
[JUnit] Offer 'Copy' or 'Copy Qualified Name' on selected test
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed patch
patch-362072.diff (text/plain), 6.99 KB, created by
Eric Le Ponner
on 2014-05-20 13:10:44 EDT
(
hide
)
Description:
Proposed patch
Filename:
MIME Type:
Creator:
Eric Le Ponner
Created:
2014-05-20 13:10:44 EDT
Size:
6.99 KB
patch
obsolete
>diff --git a/org.eclipse.jdt.junit/META-INF/MANIFEST.MF b/org.eclipse.jdt.junit/META-INF/MANIFEST.MF >index f09e0ef..b7b7384 100644 >--- a/org.eclipse.jdt.junit/META-INF/MANIFEST.MF >+++ b/org.eclipse.jdt.junit/META-INF/MANIFEST.MF >@@ -7,7 +7,8 @@ Bundle-Activator: org.eclipse.jdt.internal.junit.ui.JUnitPlugin > Bundle-ActivationPolicy: lazy > Bundle-Vendor: %providerName > Bundle-Localization: plugin >-Export-Package: org.eclipse.jdt.internal.junit.buildpath;x-internal:=true, >+Export-Package: org.eclipse.jdt.internal.junit;x-internal:=true, >+ org.eclipse.jdt.internal.junit.buildpath;x-internal:=true, > org.eclipse.jdt.internal.junit.launcher;x-internal:=true, > org.eclipse.jdt.internal.junit.refactoring;x-internal:=true, > org.eclipse.jdt.internal.junit.ui;x-internal:=true, >diff --git a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/JUnitCopyQualifiedNameAction.java b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/JUnitCopyQualifiedNameAction.java >new file mode 100644 >index 0000000..3562f83 >--- /dev/null >+++ b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/JUnitCopyQualifiedNameAction.java >@@ -0,0 +1,85 @@ >+/******************************************************************************* >+ * Copyright (c) 2014 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 >+ * >+ * Contributors: >+ * IBM Corporation - initial API and implementation >+ *******************************************************************************/ >+package org.eclipse.jdt.internal.junit.ui; >+ >+import org.eclipse.swt.SWTError; >+import org.eclipse.swt.dnd.Clipboard; >+import org.eclipse.swt.dnd.DND; >+import org.eclipse.swt.dnd.TextTransfer; >+import org.eclipse.swt.dnd.Transfer; >+ >+import org.eclipse.jface.dialogs.MessageDialog; >+ >+import org.eclipse.ui.IWorkbenchPartSite; >+import org.eclipse.ui.actions.SelectionListenerAction; >+ >+import org.eclipse.jdt.internal.junit.model.TestCaseElement; >+import org.eclipse.jdt.internal.junit.model.TestElement; >+import org.eclipse.jdt.internal.junit.model.TestSuiteElement; >+ >+import org.eclipse.jdt.internal.ui.actions.ActionMessages; >+import org.eclipse.jdt.internal.ui.actions.CopyQualifiedNameAction; >+ >+public class JUnitCopyQualifiedNameAction extends SelectionListenerAction { >+ >+ private IWorkbenchPartSite fSite; >+ private Clipboard fClipboard; >+ private TestElement fTestElement; >+ >+ >+ public JUnitCopyQualifiedNameAction(IWorkbenchPartSite site, Clipboard clipboard) { >+ super(ActionMessages.CopyQualifiedNameAction_ActionName); >+ setActionDefinitionId(CopyQualifiedNameAction.ACTION_DEFINITION_ID); >+ setToolTipText(ActionMessages.CopyQualifiedNameAction_ToolTipText); >+ fSite= site; >+ fClipboard= clipboard; >+ } >+ >+ public void handleTestSelected(TestElement test) { >+ fTestElement= test; >+ setEnabled(fTestElement != null); >+ } >+ >+ /* >+ * SelectionListener >+ */ >+ >+ @Override >+ public void run() { >+ >+ String qualifiedName; >+ if (fTestElement instanceof TestSuiteElement) { >+ qualifiedName= ((TestSuiteElement)fTestElement).getClassName(); >+ } else if (fTestElement instanceof TestCaseElement) { >+ qualifiedName= ((TestCaseElement)fTestElement).getClassName() >+ + "." //$NON-NLS-1$ >+ + ((TestCaseElement)fTestElement).getTestMethodName() >+ +"()"; //$NON-NLS-1$ >+ } else { >+ qualifiedName= null; >+ } >+ >+ if (qualifiedName != null) { >+ TextTransfer plainTextTransfer= TextTransfer.getInstance(); >+ try{ >+ fClipboard.setContents( >+ new String[]{ qualifiedName }, >+ new Transfer[]{ plainTextTransfer }); >+ } catch (SWTError e){ >+ if (e.code != DND.ERROR_CANNOT_SET_CLIPBOARD) >+ throw e; >+ if (MessageDialog.openQuestion(fSite.getShell(), JUnitMessages.CopyTraceAction_problem, JUnitMessages.CopyTraceAction_clipboard_busy)) >+ run(); >+ } >+ } >+ } >+ >+} >diff --git a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestRunnerViewPart.java b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestRunnerViewPart.java >index ccf104e..52f5a9e 100644 >--- a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestRunnerViewPart.java >+++ b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestRunnerViewPart.java >@@ -149,6 +149,7 @@ import org.eclipse.jdt.internal.junit.model.TestRunSession; > > import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; > >+import org.eclipse.jdt.internal.ui.actions.CopyQualifiedNameAction; > import org.eclipse.jdt.internal.ui.viewsupport.ViewHistory; > > /** >@@ -211,6 +212,7 @@ public class TestRunnerViewPart extends ViewPart { > > private StopAction fStopAction; > private JUnitCopyAction fCopyAction; >+ private JUnitCopyQualifiedNameAction fCopyQualifiedNameAction; > private Action fPasteAction; > > private Action fRerunLastTestAction; >@@ -1755,6 +1757,10 @@ action enablement > fCopyAction.setActionDefinitionId(ActionFactory.COPY.getCommandId()); > actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), fCopyAction); > >+ fCopyQualifiedNameAction= new JUnitCopyQualifiedNameAction(getSite(), fClipboard); >+ fCopyQualifiedNameAction.setActionDefinitionId(CopyQualifiedNameAction.ACTION_HANDLER_ID); >+ actionBars.setGlobalActionHandler(CopyQualifiedNameAction.ACTION_HANDLER_ID, fCopyQualifiedNameAction); >+ > fPasteAction= new JUnitPasteAction(parent.getShell(), fClipboard); > fPasteAction.setActionDefinitionId(ActionFactory.PASTE.getCommandId()); > actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), fPasteAction); >@@ -2007,6 +2013,7 @@ action enablement > public void handleTestSelected(TestElement test) { > showFailure(test); > fCopyAction.handleTestSelected(test); >+ fCopyQualifiedNameAction.handleTestSelected(test); > } > > private void showFailure(final TestElement test) { >diff --git a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestViewer.java b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestViewer.java >index 3ab858c..fe0fb1e 100644 >--- a/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestViewer.java >+++ b/org.eclipse.jdt.junit/src/org/eclipse/jdt/internal/junit/ui/TestViewer.java >@@ -241,12 +241,14 @@ public class TestViewer { > if (fLayoutMode == TestRunnerViewPart.LAYOUT_HIERARCHICAL) { > manager.add(new Separator()); > manager.add(new ExpandAllAction()); >+ manager.add(new Separator()); > } > >+ JUnitCopyQualifiedNameAction copyQualifiedAction= new JUnitCopyQualifiedNameAction(fTestRunnerPart.getSite(), fClipboard); >+ copyQualifiedAction.handleTestSelected(testElement); >+ manager.add(copyQualifiedAction); > } > if (fTestRunSession != null && fTestRunSession.getFailureCount() + fTestRunSession.getErrorCount() > 0) { >- if (fLayoutMode != TestRunnerViewPart.LAYOUT_HIERARCHICAL) >- manager.add(new Separator()); > manager.add(new CopyFailureListAction(fTestRunnerPart, fClipboard)); > } > manager.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
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 362072
: 243306