1
19 package com.qasystems.qstudio.java.integration.eclipse.actions;
20
21 import com.qasystems.qstudio.java.integration.eclipse.EclipsePropertiesPanel;
22
23 import org.eclipse.jdt.core.IJavaProject;
24 import org.eclipse.jface.action.IAction;
25 import org.eclipse.jface.viewers.ISelectionProvider;
26 import org.eclipse.jface.viewers.StructuredSelection;
27 import org.eclipse.ui.IObjectActionDelegate;
28 import org.eclipse.ui.IWorkbenchPage;
29 import org.eclipse.ui.IWorkbenchPart;
30 import org.eclipse.ui.IWorkbenchPartSite;
31 import org.eclipse.ui.actions.ActionDelegate;
32
33
36 public class ProjectPropertiesAction extends ActionDelegate
37 implements IObjectActionDelegate {
38
39 private IWorkbenchPage page;
40
41
42 private IWorkbenchPart part;
43
44
50 public void setActivePart(IAction iAction, IWorkbenchPart iWorkbenchPart) {
51 part = iWorkbenchPart;
52 page = part.getSite().getPage();
53 }
54
55
58 public void run(final IAction action) {
59 final IWorkbenchPartSite site = part.getSite();
60 final ISelectionProvider provider = site.getSelectionProvider();
61 final StructuredSelection selection =
62 (StructuredSelection) provider.getSelection();
63 final Object project = selection.getFirstElement();
64
65 if (project instanceof IJavaProject) {
66 new EclipsePropertiesPanel().run((IJavaProject) project);
67 }
68 }
69 }
70