Bug 494895 - Add / Remove Shell Script Support always available
Change-Id: I16508adf05bdc17955ab82d1fe803f051ecbee7c
Signed-off-by: Dawid Pakuła <zulus@w3des.net>
diff --git a/plugins/org.eclipse.dltk.sh.doc/userguide/Getting-Started.html b/plugins/org.eclipse.dltk.sh.doc/userguide/Getting-Started.html
index e84bb97..793c0f8 100644
--- a/plugins/org.eclipse.dltk.sh.doc/userguide/Getting-Started.html
+++ b/plugins/org.eclipse.dltk.sh.doc/userguide/Getting-Started.html
@@ -70,8 +70,8 @@
</p>
<h2 id="ExistingProjects">Existing Projects</h2>
<p>You probably have shell scripts in other projects that you want to run and debug. In this case, you can add shell script support to existing, non-shell script projects by right-clicking them and choosing the
- <b>ShellEd</b> ->
- <b>Add Shell Script Support</b> menu item.
+ <b>Configure</b> ->
+ <b>Convert to Shell Script Project..</b> menu item.
</p>
<p>
<img border="0" src="Add-Support-Screenshot.png"/>
@@ -101,4 +101,4 @@
</tr>
</table>
</body>
-</html>
\ No newline at end of file
+</html>
diff --git a/plugins/org.eclipse.dltk.sh.ui/plugin.xml b/plugins/org.eclipse.dltk.sh.ui/plugin.xml
index 55e6f44..875e7c8 100644
--- a/plugins/org.eclipse.dltk.sh.ui/plugin.xml
+++ b/plugins/org.eclipse.dltk.sh.ui/plugin.xml
@@ -235,79 +235,58 @@
id="org.eclipse.dltk.ui.shellEditorScope">
</context>
</extension>
-<extension
+ <extension
point="org.eclipse.ui.menus">
<menuContribution
- locationURI="popup:org.eclipse.ui.popup.any?after=additions">
- <menu
- label="ShellEd">
- <command
- commandId="org.eclipse.dltk.sh.ui.addnature"
- style="push">
- <visibleWhen
- checkEnabled="false">
+ allPopups="true"
+ locationURI="popup:org.eclipse.ui.projectConfigure?after=additions">
+ <command
+ commandId="org.eclipse.dltk.sh.ui.addnature"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
<with
- variable="selection">
- <iterate
- ifEmpty="false"
- operator="or">
- <not>
- <test
- property="org.eclipse.dltk.sh.ui.naturetester.hasShellEdNature">
- </test>
- </not>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <command
- commandId="org.eclipse.dltk.sh.ui.removenature"
- style="push">
- <visibleWhen
- checkEnabled="false">
- <with
- variable="selection">
- <iterate
- ifEmpty="false"
- operator="or">
- <test
- property="org.eclipse.dltk.sh.ui.naturetester.hasShellEdNature">
- </test>
- </iterate>
- </with>
- </visibleWhen>
- </command>
- <visibleWhen
- checkEnabled="false">
- <with
- variable="selection">
- <iterate
- ifEmpty="false"
- operator="and">
- <or>
- <adapt
- type="org.eclipse.core.resources.IProject">
- </adapt>
- <adapt
- type="org.eclipse.dltk.core.IScriptProject">
- </adapt>
- </or>
- </iterate>
- </with>
- </visibleWhen>
- </menu>
+ variable="selection">
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <adapt
+ type="org.eclipse.core.resources.IProject">
+ <not>
+ <or>
+ <test property="org.eclipse.dltk.hasScriptNature" />
+ <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.dltk.sh.core.nature" />
+ </or>
+ </not>
+ </adapt>
+ </iterate>
+ </with>
+ </and>
+ </visibleWhen>
+ </command>
+ <command
+ commandId="org.eclipse.dltk.sh.ui.removenature"
+ style="push">
+ <visibleWhen
+ checkEnabled="false">
+ <and>
+ <with
+ variable="selection">
+ <iterate
+ ifEmpty="false"
+ operator="and">
+ <adapt
+ type="org.eclipse.core.resources.IProject">
+ <test property="org.eclipse.core.resources.projectNature" value="org.eclipse.dltk.sh.core.nature" />
+ </adapt>
+ </iterate>
+ </with>
+ </and>
+ </visibleWhen>
+ </command>
</menuContribution>
</extension>
-<extension
- point="org.eclipse.core.expressions.propertyTesters">
- <propertyTester
- class="org.eclipse.dltk.sh.internal.ui.commands.NaturePropertyTester"
- id="org.eclipse.dltk.sh.ui.naturetester"
- namespace="org.eclipse.dltk.sh.ui.naturetester"
- properties="hasShellEdNature"
- type="org.eclipse.core.runtime.IAdaptable">
- </propertyTester>
-</extension>
<extension point="org.eclipse.dltk.ui.folding">
<structureProvider
diff --git a/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/commands/NaturePropertyTester.java b/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/commands/NaturePropertyTester.java
deleted file mode 100644
index 542cc5b..0000000
--- a/plugins/org.eclipse.dltk.sh.ui/src/org/eclipse/dltk/sh/internal/ui/commands/NaturePropertyTester.java
+++ /dev/null
@@ -1,42 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010, 2016 Mat Booth and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *******************************************************************************/
-package org.eclipse.dltk.sh.internal.ui.commands;
-
-import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.dltk.sh.core.ShelledNature;
-
-/**
- * A property tester that returns true if the project containing any given
- * resource is a ShellEd-natured project.
- */
-public class NaturePropertyTester extends PropertyTester {
-
- // Properties made available for test by this tester
- private static final String HAS_SHELLED_NATURE = "hasShellEdNature"; //$NON-NLS-1$
-
- @Override
- public boolean test(Object receiver, String property, Object[] args, Object expectedValue) {
- IResource resource = ((IAdaptable) receiver).getAdapter(IResource.class);
- if (resource == null) {
- return false;
- }
- if (property.equals(HAS_SHELLED_NATURE)) {
- try {
- IProject proj = resource.getProject();
- return proj.isAccessible() && proj.hasNature(ShelledNature.SHELLED_NATURE);
- } catch (CoreException e) {
- return false;
- }
- }
- return false;
- }
-}