Skip to content

Commit

Permalink
Fix for Java perspective set nature
Browse files Browse the repository at this point in the history
  • Loading branch information
emasliukovas committed Dec 2, 2020
1 parent b4e4f40 commit a90a55a
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 14 deletions.
21 changes: 20 additions & 1 deletion com.gocypher.cybench.plugin.tools/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,26 @@
<reference definitionId="com.gocypher.cybench.project.projectSelection"/>
<not>
<reference definitionId="com.gocypher.cybench.project.hasNature"/>
</not>
</not>
</iterate>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.jdt.ui.PackageExplorer?after=additions">
<separator name="com.gocypher.cybench.converterhelper.separator" visible="true" />
<command
id="com.gocypher.cybench.plugin.ProjectConfigureLaunchInner"
commandId="com.gocypher.cybench.plugin.handlers.AddNature"
label="Add CyBench Nature"
icon="icons/cybench_symbol_small.png"
tooltip="Add needed parts and configurations for CyBench"
style="push">
<visibleWhen>
<iterate>
<not>
<reference definitionId="com.gocypher.cybench.project.hasNature"/>
</not>
</iterate>
</visibleWhen>
</command>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,13 @@ public static IJavaProject resolveJavaProject (ISelection selection) {
IJavaProject javaProject = null ;
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
System.out.println(ss.getFirstElement());
for (Object elem : ss.toList()) {
if (elem instanceof IProject) {
// GuiUtils.logInfo("--->instanceof IProject: "+ elem);
javaProject = (IJavaProject)JavaCore.create((IProject)elem);
}else if (elem instanceof IJavaProject) {
javaProject = (IJavaProject) elem;
// GuiUtils.logInfo("--->instanceof IJavaProject: "+ elem);
}
}
}
Expand Down
19 changes: 19 additions & 0 deletions eclipse-mars/com.gocypher.cybench.plugin.tools/plugin.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,25 @@
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.jdt.ui.PackageExplorer?after=additions">
<separator name="com.gocypher.cybench.converterhelper.separator" visible="true" />
<command
id="com.gocypher.cybench.plugin.ProjectConfigureLaunchInner"
commandId="com.gocypher.cybench.plugin.handlers.AddNature"
label="Add CyBench Nature"
icon="icons/cybench_symbol_small.png"
tooltip="Add needed parts and configurations for CyBench"
style="push">
<visibleWhen>
<iterate>
<not>
<reference definitionId="com.gocypher.cybench.project.hasNature"/>
</not>
</iterate>
</visibleWhen>
</command>
</menuContribution>
<menuContribution
locationURI="popup:org.eclipse.ui.popup.any?after=additions">
<separator name="com.mycompany.converterhelper.separator" visible="true" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,18 +201,21 @@ public static void refreshProject (IJavaProject javaProject) {

}
public static IJavaProject resolveJavaProject (ISelection selection) {
IJavaProject javaProject = null ;
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
GuiUtils.logInfo(ss.getFirstElement().toString());
for (Object elem : ss.toList()) {
if (elem instanceof IProject) {
javaProject = (IJavaProject)JavaCore.create((IProject)elem);
}
}
}
return javaProject;
}
IJavaProject javaProject = null ;
if (selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
for (Object elem : ss.toList()) {
if (elem instanceof IProject) {
// GuiUtils.logInfo("--->instanceof IProject: "+ elem);
javaProject = (IJavaProject)JavaCore.create((IProject)elem);
}else if (elem instanceof IJavaProject) {
javaProject = (IJavaProject) elem;
// GuiUtils.logInfo("--->instanceof IJavaProject: "+ elem);
}
}
}
return javaProject;
}
public static void logInfo (String message) {
if (LOG != null) {
LOG.log(new Status(IStatus.INFO, Activator.PLUGIN_ID, message));
Expand Down

0 comments on commit a90a55a

Please sign in to comment.