Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew M. Finkbeiner2016-07-07 19:33:40 -0400
committerAndrew M. Finkbeiner2016-10-06 21:12:11 -0400
commitf399127050449f0f186182258fbd4689d7e8b643 (patch)
treea0c89367ca872490bde58b7ca444edd8054541e4
parentd54c057311291955bca2871848f8d429f1c9d869 (diff)
downloadorg.eclipse.osee-f399127050449f0f186182258fbd4689d7e8b643.tar.gz
org.eclipse.osee-f399127050449f0f186182258fbd4689d7e8b643.tar.xz
org.eclipse.osee-f399127050449f0f186182258fbd4689d7e8b643.zip
feature[ats_ATS280993]: Drag-n-drop from eclipse file search to script run list
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/plugin.xml18
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerPopupAction.java13
-rw-r--r--plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTableViewer.java28
-rw-r--r--plugins/org.eclipse.osee.ote.ui/plugin.xml5
4 files changed, 56 insertions, 8 deletions
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/plugin.xml b/plugins/org.eclipse.osee.ote.ui.test.manager/plugin.xml
index 8931ac39fe..cbfdc76662 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/plugin.xml
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/plugin.xml
@@ -33,9 +33,21 @@
</extension>
<extension
point="org.eclipse.ui.popupMenus">
- <objectContribution
- objectClass="org.eclipse.jdt.core.ICompilationUnit"
- nameFilter="*"
+ <objectContribution adaptable="true"
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.java" id="org.eclipse.osee.ote.ui.menucontribution">
+ <menu
+ label="OTE"
+ path="additions"
+ id="org.eclipse.osee.ote.ui">
+ <separator
+ name="placeholder">
+ </separator>
+ </menu>
+ </objectContribution>
+ <objectContribution adaptable="true"
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.java"
id="org.eclipse.osee.ote.ui.test.manager.contribution1">
<action
enablesFor="+"
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerPopupAction.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerPopupAction.java
index b13ac1a920..8deb8eb5f5 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerPopupAction.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/actions/AddToTestManagerPopupAction.java
@@ -15,6 +15,7 @@ import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IResource;
import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IMember;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
@@ -23,13 +24,15 @@ import org.eclipse.osee.framework.ui.ws.AWorkspace;
import org.eclipse.osee.ote.ui.test.manager.operations.AddIFileToTestManager;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWindowActionDelegate;
+import org.eclipse.ui.PlatformUI;
public class AddToTestManagerPopupAction implements IWorkbenchWindowActionDelegate {
public static String[] getSelection() {
- StructuredSelection sel = AWorkspace.getSelection();
- Iterator<?> i = sel.iterator();
List<String> selection = new ArrayList<>();
+ ISelection sel1 = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection();
+ if(sel1 instanceof StructuredSelection){
+ Iterator<?> i = ((StructuredSelection)sel1).iterator();
while (i.hasNext()) {
Object obj = i.next();
@@ -43,8 +46,14 @@ public class AddToTestManagerPopupAction implements IWorkbenchWindowActionDelega
if (resource != null) {
selection.add(resource.getResource().getLocation().toOSString());
}
+ } else if (obj instanceof IMember){
+ ICompilationUnit resource = ((IMember) obj).getCompilationUnit();
+ if (resource != null) {
+ selection.add(resource.getResource().getLocation().toOSString());
+ }
}
}
+ }
return selection.toArray(new String[0]);
}
diff --git a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTableViewer.java b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTableViewer.java
index c59fc7a040..59ab45060d 100644
--- a/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTableViewer.java
+++ b/plugins/org.eclipse.osee.ote.ui.test.manager/src/org/eclipse/osee/ote/ui/test/manager/pages/scriptTable/ScriptTableViewer.java
@@ -16,6 +16,7 @@ import java.util.List;
import java.util.Vector;
import java.util.logging.Level;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IMenuListener;
import org.eclipse.jface.action.IMenuManager;
@@ -50,11 +51,13 @@ import org.eclipse.swt.dnd.DropTargetAdapter;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.swt.dnd.DropTargetListener;
import org.eclipse.swt.dnd.FileTransfer;
+import org.eclipse.swt.dnd.TextTransfer;
import org.eclipse.swt.dnd.Transfer;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.events.KeyListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.part.ResourceTransfer;
public class ScriptTableViewer {
@@ -275,15 +278,38 @@ public class ScriptTableViewer {
private void attachDragDropListener() {
final FileTransfer fileTransfer = FileTransfer.getInstance();
- final Transfer types[] = new Transfer[] {fileTransfer};
+ final TextTransfer textTransfer = TextTransfer.getInstance();
+ final ResourceTransfer resourceTransfer = ResourceTransfer.getInstance();
+
+ final Transfer types[] = new Transfer[] {fileTransfer, textTransfer, resourceTransfer};
// Add Drag/Drop to Table
DropTargetListener scriptDropTargetListener = new DropTargetAdapter() {
@Override
public void drop(DropTargetEvent event) {
if (fileTransfer.isSupportedType(event.currentDataType)) {
processDroppedFiles((String[]) event.data);
+ } else if(textTransfer.isSupportedType(event.currentDataType)) {
+ processDroppedFiles((String[]) event.data);
+ } else if(resourceTransfer.isSupportedType(event.currentDataType)){
+ IResource[] resources = (IResource[])event.data;
+ String[] asStrings = new String[resources.length];
+ for(int i = 0; i < resources.length; i++) {
+ asStrings[i] = resources[i].getLocation().toOSString();
+ }
+ processDroppedFiles(asStrings);
}
}
+ @Override
+ public void dropAccept( DropTargetEvent event )
+ {
+ event.detail = DND.DROP_COPY;
+ }
+
+ @Override
+ public void dragEnter( DropTargetEvent event )
+ {
+ event.detail = DND.DROP_COPY;
+ }
};
// Setup drag/drop of files
int operations = DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_DEFAULT;
diff --git a/plugins/org.eclipse.osee.ote.ui/plugin.xml b/plugins/org.eclipse.osee.ote.ui/plugin.xml
index b6b4d23d30..1dee02323a 100644
--- a/plugins/org.eclipse.osee.ote.ui/plugin.xml
+++ b/plugins/org.eclipse.osee.ote.ui/plugin.xml
@@ -36,8 +36,9 @@
name="OSEE Test"/>
</extension>
<extension point="org.eclipse.ui.popupMenus">
- <objectContribution objectClass="org.eclipse.jdt.core.ICompilationUnit"
- nameFilter="*" id="org.eclipse.osee.ote.ui.menucontribution">
+ <objectContribution adaptable="true"
+ objectClass="org.eclipse.core.resources.IFile"
+ nameFilter="*.java" id="org.eclipse.osee.ote.ui.menucontribution">
<menu
label="OTE"
path="additions"

Back to the top