1
19 package com.qasystems.qstudio.java.integration.eclipse.actions;
20
21 import com.qasystems.debug.DebugWriter;
22 import com.qasystems.qstudio.java.gui.Project;
23 import com.qasystems.qstudio.java.integration.eclipse.EclipseAnalyzer;
24 import com.qasystems.qstudio.java.integration.eclipse.EclipseEnvironment;
25
26 import java.util.Vector;
27
28 import org.eclipse.jdt.core.IJavaElement;
29 import org.eclipse.jdt.core.IJavaProject;
30 import org.eclipse.jdt.core.JavaModelException;
31 import org.eclipse.jface.action.IAction;
32 import org.eclipse.ui.IEditorActionDelegate;
33 import org.eclipse.ui.IEditorInput;
34 import org.eclipse.ui.IEditorPart;
35 import org.eclipse.ui.actions.ActionDelegate;
36
37
41 public class InspectProjectAction extends ActionDelegate
42 implements IEditorActionDelegate {
43
44 private IEditorPart editor;
45
46
49 public void setActiveEditor(IAction action, IEditorPart targetEditor) {
50 editor = targetEditor;
51 }
52
53
56 public void run(IAction action) {
57 final IJavaProject ideProject = getJavaElement().getJavaProject();
58 final Vector files = new Vector();
59 final Project qstudioProject =
60 EclipseEnvironment.toQSJavaProject(ideProject);
61
62 try {
63 EclipseEnvironment.getJavaFilesFromProject(ideProject, files);
64 } catch (JavaModelException e) {
65 new DebugWriter().writeException(e, this);
66 }
67
68 new EclipseAnalyzer(qstudioProject, files);
74
75 }
77
78 private IJavaElement getJavaElement() {
79 final IEditorInput input = editor.getEditorInput();
80 final IJavaElement je = (IJavaElement) input.getAdapter(IJavaElement.class);
81
82 return (je);
83 }
84 }
85