Author: scabanovich
Date: 2011-07-28 16:58:42 -0400 (Thu, 28 Jul 2011)
New Revision: 33324
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/AddKBSupportAction.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/RemoveKBSupportAction.java
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.properties
trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
Log:
JBIDE-9120
https://issues.jboss.org/browse/JBIDE-9120
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.properties
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.properties 2011-07-28 20:55:35 UTC
(rev 33323)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.properties 2011-07-28 20:58:42 UTC
(rev 33324)
@@ -8,4 +8,7 @@
BuilderOrderProblemName=Builders Order Problem
ELValidator=EL Validator
-PreferencePage_KBSettings=JBoss Tools Knowledge Base
\ No newline at end of file
+PreferencePage_KBSettings=JBoss Tools Knowledge Base
+
+ConfigureMenu_AddKBSupport=Add JBoss Tools Knowledge Base Support
+ConfigureMenu_RemoveKBSupport=Remove JBoss Tools Knowledge Base Support
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2011-07-28 20:55:35 UTC (rev
33323)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2011-07-28 20:58:42 UTC (rev
33324)
@@ -305,4 +305,54 @@
</page>
</extension>
+ <extension
+ point="org.eclipse.ui.popupMenus">
+
+ <objectContribution
+ id="org.jboss.tools.web.kb.project.configure.enable"
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true">
+ <visibility>
+ <and>
+ <objectState
+ name="projectNature"
+ value="org.eclipse.jdt.core.javanature"/>
+ <not>
+ <objectState
+ name="projectNature"
+ value="org.jboss.tools.jst.web.kb.kbnature"/>
+ </not>
+ </and>
+ </visibility>
+
+ <action
+ id="org.jboss.tools.web.kb.AddKBSupport"
+ label="%ConfigureMenu_AddKBSupport"
+ class="org.jboss.tools.jst.web.kb.preferences.AddKBSupportAction"
+ enablesFor="1"
+ menubarPath="org.eclipse.ui.projectConfigure/additions"/>
+
+ </objectContribution>
+
+ <objectContribution
+ id="org.jboss.tools.web.kb.project.configure.disable"
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true">
+ <visibility>
+ <objectState
+ name="projectNature"
+ value="org.jboss.tools.jst.web.kb.kbnature"/>
+ </visibility>
+
+ <action
+ id="org.jboss.tools.web.kb.RemoveKBSupport"
+ label="%ConfigureMenu_RemoveKBSupport"
+ class="org.jboss.tools.jst.web.kb.preferences.RemoveKBSupportAction"
+ enablesFor="1"
+ menubarPath="org.eclipse.ui.projectConfigure/additions"/>
+
+ </objectContribution>
+
+ </extension>
+
</plugin>
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/AddKBSupportAction.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/AddKBSupportAction.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/AddKBSupportAction.java 2011-07-28
20:58:42 UTC (rev 33324)
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.preferences;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.ui.IObjectActionDelegate;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.PreferencesUtil;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class AddKBSupportAction implements IObjectActionDelegate {
+
+ private ISelection currentSelection;
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction,
org.eclipse.ui.IWorkbenchPart)
+ */
+ public void setActivePart(IAction action, IWorkbenchPart targetPart) {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
+ */
+ public void run(IAction action) {
+ IProject project = (IProject) ((IStructuredSelection)
currentSelection).getFirstElement();
+ PreferenceDialog dialog =
PreferencesUtil.createPropertyDialogOn(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
project, KBSettingsPreferencePage.ID, new String[] {KBSettingsPreferencePage.ID}, null);
+ KBSettingsPreferencePage page = (KBSettingsPreferencePage)dialog.getSelectedPage();
+ page.setEnabledKBSuport(shouldEnable());
+ dialog.open();
+ }
+
+ protected boolean shouldEnable() {
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.ui.IActionDelegate#selectionChanged(org.eclipse.jface.action.IAction,
org.eclipse.jface.viewers.ISelection)
+ */
+ public void selectionChanged(IAction action, ISelection selection) {
+ this.currentSelection = selection;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/AddKBSupportAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/RemoveKBSupportAction.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/RemoveKBSupportAction.java
(rev 0)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/RemoveKBSupportAction.java 2011-07-28
20:58:42 UTC (rev 33324)
@@ -0,0 +1,18 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jst.web.kb.preferences;
+
+public class RemoveKBSupportAction extends AddKBSupportAction {
+
+ protected boolean shouldEnable() {
+ return false;
+ }
+}
Property changes on:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/preferences/RemoveKBSupportAction.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain