Author: akazakov
Date: 2009-11-27 11:48:34 -0500 (Fri, 27 Nov 2009)
New Revision: 18890
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/RemoveSeamSupportAction.java
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.properties
trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/AddSeamSupportAction.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5275
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.properties
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.properties 2009-11-27 16:31:01 UTC
(rev 18889)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.properties 2009-11-27 16:48:34 UTC
(rev 18890)
@@ -7,6 +7,7 @@
ViewCategory_Seam=Seam
ViewName_SeamComponents=Seam Components
ConfigureMenu_AddSeamSupport=Add Seam support...
+ConfigureMenu_RemoveSeamSupport=Remove Seam support...
perspective.name=Seam
Bundle-Vendor.0 = JBoss by Red Hat
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2009-11-27 16:31:01 UTC (rev
18889)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/plugin.xml 2009-11-27 16:48:34 UTC (rev
18890)
@@ -410,24 +410,6 @@
name="org.jboss.tools.seam.ui.contentAssistProcessor">
</extension>
- <extension
- point="org.eclipse.ui.popupMenus">
- <!-- TODO: We should either remove this or move it to a not so prominient place
in the final release -->
- <objectContribution
- adaptable="true"
- id="org.jboss.tools.seam.ui.enableSeamAction"
- nameFilter="*"
- objectClass="org.eclipse.core.resources.IProject">
- <!--action
- class="org.jboss.tools.seam.ui.builder.ToggleSeamNatureAction"
- enablesFor="+"
- id="org.jboss.tools.seam.ui.addRemoveSeamNatureAction"
- label="Add/Remove Seam support"
- menubarPath="additions">
- </action-->
- </objectContribution>
- </extension>
-
<extension point="org.eclipse.ui.preferencePages">
<page
category="org.jboss.tools.common.model.ui.seam"
@@ -682,7 +664,7 @@
point="org.eclipse.ui.popupMenus">
<objectContribution
- id="org.jboss.tools.seam.ui.project.configure"
+ id="org.jboss.tools.seam.ui.project.configure.enable"
objectClass="org.eclipse.core.resources.IProject"
adaptable="true">
<visibility>
@@ -706,6 +688,25 @@
menubarPath="org.eclipse.ui.projectConfigure/additions"/>
</objectContribution>
+
+ <objectContribution
+ id="org.jboss.tools.seam.ui.project.configure.disable"
+ objectClass="org.eclipse.core.resources.IProject"
+ adaptable="true">
+ <visibility>
+ <objectState
+ name="projectNature"
+ value="org.jboss.tools.seam.core.seamnature"/>
+ </visibility>
+
+ <action
+ id="org.jboss.tools.seam.ui.RemoveSeamSupport"
+ label="%ConfigureMenu_RemoveSeamSupport"
+ class="org.jboss.tools.seam.ui.preferences.RemoveSeamSupportAction"
+ enablesFor="1"
+ menubarPath="org.eclipse.ui.projectConfigure/additions"/>
+
+ </objectContribution>
</extension>
</plugin>
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/AddSeamSupportAction.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/AddSeamSupportAction.java 2009-11-27
16:31:01 UTC (rev 18889)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/AddSeamSupportAction.java 2009-11-27
16:48:34 UTC (rev 18890)
@@ -39,9 +39,15 @@
public void run(IAction action) {
IProject project = (IProject) ((IStructuredSelection)
currentSelection).getFirstElement();
PreferenceDialog dialog =
PreferencesUtil.createPropertyDialogOn(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
project, SeamSettingsPreferencePage.ID, new String[] {SeamSettingsPreferencePage.ID},
null);
+ SeamSettingsPreferencePage page =
(SeamSettingsPreferencePage)dialog.getSelectedPage();
+ page.setEnabledSeamSuport(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)
*/
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/RemoveSeamSupportAction.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/RemoveSeamSupportAction.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/RemoveSeamSupportAction.java 2009-11-27
16:48:34 UTC (rev 18890)
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2009 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.seam.ui.preferences;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class RemoveSeamSupportAction extends AddSeamSupportAction {
+
+ /* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.preferences.AddSeamSupportAction#shouldEnable()
+ */
+ @Override
+ protected boolean shouldEnable() {
+ return false;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/RemoveSeamSupportAction.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2009-11-27
16:31:01 UTC (rev 18889)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamSettingsPreferencePage.java 2009-11-27
16:48:34 UTC (rev 18890)
@@ -714,7 +714,11 @@
private String getSeamRuntimeName() {
if(preferences!=null) {
- return preferences.get(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
"");
+ SeamRuntime defaultRuntime =
SeamRuntimeManager.getDefaultRuntimeForProject(warProject!=null?warProject:project);
+ if(defaultRuntime==null) {
+ defaultRuntime = SeamRuntimeManager.getInstance().getDefaultRuntime();
+ }
+ return preferences.get(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME,
defaultRuntime==null?"":defaultRuntime.getName());
}
return "";
}
@@ -841,9 +845,10 @@
return suportSeam;
}
- private void setEnabledSeamSuport(boolean enabled) {
- // just for enabling/disabling groups
+ public void setEnabledSeamSuport(boolean enabled) {
suportSeam = enabled;
+ editorRegistry.get(SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_SEAM_SUPPORT).setValue(enabled);
+ // just for enabling/disabling groups
if(!enabled) {
setEnabledGroups(enabled);
// disable all below
@@ -851,7 +856,7 @@
if(key!=SeamPreferencesMessages.SEAM_SETTINGS_PREFERENCE_PAGE_SEAM_SUPPORT) {
editorRegistry.get(key).setEnabled(enabled);
}
- }
+ }
} else {
editorRegistry.get(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME).setEnabled(enabled);
if(runtimeIsSelected) {