Skip to content

Commit 86944f0

Browse files
committed
Got selected element. WIP
1 parent becb47c commit 86944f0

File tree

4 files changed

+39
-3
lines changed

4 files changed

+39
-3
lines changed

src/ServiceStackEclipse/.classpath

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,23 @@
33
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
44
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
55
<classpathentry kind="src" path="src"/>
6+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt_3.11.0.v20150430-1445.jar"/>
7+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.annotation_1.1.100.v20140704-0625.jar"/>
8+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.annotation_2.0.100.v20150311-1658.jar"/>
9+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.apt.core_3.4.0.v20150423-0947.jar"/>
10+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.apt.pluggable.core_1.1.0.v20150423-0947.jar"/>
11+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.apt.ui_3.4.0.v20150423-0947.jar"/>
12+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.compiler.apt_1.2.0.v20150424-1830.jar"/>
13+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.compiler.tool_1.1.0.v20150423-0947.jar"/>
14+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.core_3.11.0.v20150429-0810.jar"/>
15+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.core.manipulation_1.5.100.v20141002-1241.jar"/>
16+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.debug.ui_3.7.0.v20150414-0909.jar"/>
17+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.doc.user_3.11.0.v20150429-1030.jar"/>
18+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.junit_3.8.0.v20150428-1340.jar"/>
19+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.junit.core_3.7.400.v20150423-0747.jar"/>
20+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.junit.runtime_3.4.500.v20140527-1138.jar"/>
21+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.junit4.runtime_1.1.500.v20150423-0747.jar"/>
22+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.launching_3.8.0.v20150416-1425.jar"/>
23+
<classpathentry kind="var" path="ECLIPSE_HOME/plugins/org.eclipse.jdt.ui_3.11.0.v20150428-1805.jar"/>
624
<classpathentry kind="output" path="bin"/>
725
</classpath>

src/ServiceStackEclipse/META-INF/MANIFEST.MF

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,3 +7,4 @@ Bundle-Vendor: ServiceStack
77
Require-Bundle: org.eclipse.ui,
88
org.eclipse.core.resources
99
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
10+
Import-Package: org.eclipse.core.runtime

src/ServiceStackEclipse/plugin.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
point="org.eclipse.ui.popupMenus">
77
<objectContribution
88
adaptable="true"
9-
objectClass="org.eclipse.core.resources.IFile"
9+
objectClass="org.eclipse.core.resources.IFolder"
1010
id="net.servicestack.eclipse.contribution1">
1111
<action
1212
label="Add ServiceStack Reference..."

src/ServiceStackEclipse/src/net/servicestack/eclipse/popup/actions/AddReferenceAction.java

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,51 @@
11
package net.servicestack.eclipse.popup.actions;
22

33
import org.eclipse.jface.action.IAction;
4-
import org.eclipse.jface.dialogs.MessageDialog;
54
import org.eclipse.jface.viewers.ISelection;
5+
import org.eclipse.jface.viewers.IStructuredSelection;
66
import org.eclipse.swt.widgets.Shell;
77
import org.eclipse.ui.IObjectActionDelegate;
8+
import org.eclipse.ui.ISelectionService;
89
import org.eclipse.ui.IWorkbenchPart;
10+
import org.eclipse.jdt.internal.core.PackageFragment;
911

1012
public class AddReferenceAction implements IObjectActionDelegate {
1113

1214
private Shell shell;
15+
private ISelectionService selectionService;
1316

1417
/**
1518
* Constructor for Action1.
1619
*/
1720
public AddReferenceAction() {
1821
super();
1922
}
20-
23+
2124
/**
2225
* @see IObjectActionDelegate
2326
*/
2427
public void setActivePart(IAction action, IWorkbenchPart targetPart) {
2528
shell = targetPart.getSite().getShell();
29+
selectionService = targetPart.getSite().getWorkbenchWindow().getSelectionService();
2630
}
2731

2832
/**
2933
* @see IActionDelegate#run(IAction)
3034
*/
3135
public void run(IAction action) {
36+
IStructuredSelection structured = (IStructuredSelection) selectionService
37+
.getSelection("org.eclipse.jdt.ui.PackageExplorer");
38+
Object firstElement = structured.getFirstElement();
39+
if(firstElement instanceof PackageFragment) { //NoClassDefFoundError...
40+
PackageFragment packFrag = (PackageFragment)firstElement;
41+
}
42+
// IFolder folder = (IFolder) structured.getFirstElement();
43+
// if(folder == null) {
44+
// return;
45+
// }
46+
// IPath path = folder.getLocation();
47+
//
48+
// ObjectPluginAction pluginAction = (ObjectPluginAction)action;
3249
AddRefDialog dialog = new AddRefDialog();
3350
dialog.pack();
3451
dialog.setLocationRelativeTo(null);

0 commit comments

Comments
 (0)