Author: scabanovich
Date: 2011-11-29 19:39:29 -0500 (Tue, 29 Nov 2011)
New Revision: 36755
Added:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigConfigurationBlock.java
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigPreferencesMessages.java
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigPreferencesMessages.properties
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigValidatorPreferencePage.java
Modified:
trunk/struts/plugins/org.jboss.tools.struts.ui/META-INF/MANIFEST.MF
trunk/struts/plugins/org.jboss.tools.struts.ui/plugin.properties
trunk/struts/plugins/org.jboss.tools.struts.ui/plugin.xml
Log:
JBIDE-10190
https://issues.jboss.org/browse/JBIDE-10190
Migrated validation for struts-config.xml.
Modified: trunk/struts/plugins/org.jboss.tools.struts.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.ui/META-INF/MANIFEST.MF 2011-11-30
00:39:08 UTC (rev 36754)
+++ trunk/struts/plugins/org.jboss.tools.struts.ui/META-INF/MANIFEST.MF 2011-11-30
00:39:29 UTC (rev 36755)
@@ -37,6 +37,7 @@
org.jboss.tools.struts.ui.editor
Require-Bundle: org.jboss.tools.common,
org.jboss.tools.common.gef,
+ org.jboss.tools.common.ui,
org.eclipse.ui.ide;bundle-version="3.7.0",
org.eclipse.jface.text;bundle-version="3.7.0",
org.eclipse.ui.workbench.texteditor;bundle-version="3.7.0",
Modified: trunk/struts/plugins/org.jboss.tools.struts.ui/plugin.properties
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.ui/plugin.properties 2011-11-30 00:39:08
UTC (rev 36754)
+++ trunk/struts/plugins/org.jboss.tools.struts.ui/plugin.properties 2011-11-30 00:39:29
UTC (rev 36755)
@@ -43,4 +43,5 @@
PreferencePage_Customization=Customization
PreferencePage_WebFlow=Struts Flow Diagram
PreferencePage_PluginInsets=Plug-in Insets
+PreferencePage_StrutsCore_Validator=Validator
Modified: trunk/struts/plugins/org.jboss.tools.struts.ui/plugin.xml
===================================================================
--- trunk/struts/plugins/org.jboss.tools.struts.ui/plugin.xml 2011-11-30 00:39:08 UTC (rev
36754)
+++ trunk/struts/plugins/org.jboss.tools.struts.ui/plugin.xml 2011-11-30 00:39:29 UTC (rev
36755)
@@ -150,6 +150,12 @@
<page category="org.jboss.tools.common.xstudio.editors"
class="org.jboss.tools.struts.ui.preferences.WebFlowTabbedPreferencesPage"
id="org.jboss.tools.common.xstudio.editors.webflowdiagram"
name="%PreferencePage_WebFlow">
</page>
+ <page
+ category="org.jboss.tools.common.xstudio"
+
class="org.jboss.tools.struts.ui.preferences.StrutsConfigValidatorPreferencePage"
+ id="org.jboss.tools.struts.ui.StrutsValidatorPreferencePage"
+ name="%PreferencePage_StrutsCore_Validator">
+ </page>
</extension>
<!--extension point="org.eclipse.ui.perspectives">
<perspective
class="org.jboss.tools.struts.ui.XStudioPerspectiveFactory"
icon="$nl$/images/xstudio/perspective.gif"
id="org.jboss.tools.common.model.ui.XStudioPerspective"
name="%perspective.name">
Added:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigConfigurationBlock.java
===================================================================
---
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigConfigurationBlock.java
(rev 0)
+++
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigConfigurationBlock.java 2011-11-30
00:39:29 UTC (rev 36755)
@@ -0,0 +1,104 @@
+/*******************************************************************************
+ * 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.struts.ui.preferences;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.jboss.tools.common.preferences.SeverityPreferences;
+import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock;
+import
org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock.SectionDescription;
+import org.jboss.tools.jst.web.ui.WebUiPlugin;
+import org.jboss.tools.jst.web.validation.WebXMLPreferences;
+import org.jboss.tools.struts.StrutsModelPlugin;
+import org.jboss.tools.struts.validation.StrutsPreferences;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class StrutsConfigConfigurationBlock extends SeverityConfigurationBlock {
+
+ private static final String SETTINGS_SECTION_NAME =
"StrutsConfigConfigurationBlock"; //$NON-NLS-1$
+
+ private static SectionDescription SECTION_STRUTS_CONFIG = new SectionDescription(
+ StrutsConfigPreferencesMessages.StrutsConfigConfigurationBlock_section_struts_config,
+ new String[][]{
+ {StrutsPreferences.INVALID_ACTION_NAME,
StrutsConfigPreferencesMessages.StrutsConfigConfigurationBlock_pb_invalidActionName_label},
+ {StrutsPreferences.INVALID_ACTION_REFERENCE_ATTRIBUTE,
StrutsConfigPreferencesMessages.StrutsConfigConfigurationBlock_pb_invalidActionReferenceAttribute_label},
+ {StrutsPreferences.INVALID_ACTION_TYPE,
StrutsConfigPreferencesMessages.StrutsConfigConfigurationBlock_pb_invalidActionType_label},
+ {StrutsPreferences.INVALID_ACTION_FORWARD,
StrutsConfigPreferencesMessages.StrutsConfigConfigurationBlock_pb_invalidActionForward_label},
+
+ {StrutsPreferences.INVALID_GLOBAL_FORWARD,
StrutsConfigPreferencesMessages.StrutsConfigConfigurationBlock_pb_invalidGlobalForward_label},
+ {StrutsPreferences.INVALID_GLOBAL_EXCEPTION,
StrutsConfigPreferencesMessages.StrutsConfigConfigurationBlock_pb_invalidGlobalException_label},
+
+ {StrutsPreferences.INVALID_CONTROLLER,
StrutsConfigPreferencesMessages.StrutsConfigConfigurationBlock_pb_invalidController_label},
+ {StrutsPreferences.INVALID_MESSAGE_RESOURCES,
StrutsConfigPreferencesMessages.StrutsConfigConfigurationBlock_pb_invalidMessageResources_label},
+ },
+ StrutsModelPlugin.PLUGIN_ID
+ );
+
+ private static SectionDescription SECTION_WEB_XML = new SectionDescription(
+ StrutsConfigPreferencesMessages.StrutsConfigConfigurationBlock_section_web_xml,
+ new String[][]{
+ {StrutsPreferences.INVALID_INIT_PARAM,
StrutsConfigPreferencesMessages.StrutsConfigConfigurationBlock_pb_invalidInitParam_label},
+ },
+ StrutsModelPlugin.PLUGIN_ID
+ );
+
+ private static SectionDescription[] ALL_SECTIONS = new SectionDescription[]{
+ SECTION_STRUTS_CONFIG,
+ SECTION_WEB_XML,
+ };
+
+ private static Key[] getKeys() {
+ ArrayList<Key> keys = new ArrayList<Key>();
+ for (SectionDescription s: ALL_SECTIONS) {
+ s.collectKeys(keys);
+ }
+ keys.add(MAX_NUMBER_OF_PROBLEMS_KEY);
+ return keys.toArray(new Key[0]);
+ }
+
+ private static final Key MAX_NUMBER_OF_PROBLEMS_KEY =
getKey(StrutsModelPlugin.PLUGIN_ID,
SeverityPreferences.MAX_NUMBER_OF_MARKERS_PREFERENCE_NAME);
+
+ @Override
+ protected Key getMaxNumberOfProblemsKey() {
+ return MAX_NUMBER_OF_PROBLEMS_KEY;
+ }
+
+ public StrutsConfigConfigurationBlock(IStatusChangeListener context,
+ IProject project, IWorkbenchPreferenceContainer container) {
+ super(context, project, getKeys(), container);
+ }
+
+ @Override
+ protected SectionDescription[] getAllSections() {
+ return ALL_SECTIONS;
+ }
+
+ @Override
+ protected String getCommonDescription() {
+ return
StrutsConfigPreferencesMessages.StrutsConfigConfigurationBlock_common_description;
+ }
+
+ @Override
+ protected IDialogSettings getDialogSettings() {
+ return WebUiPlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME);
+ }
+
+ @Override
+ protected String getQualifier() {
+ return StrutsModelPlugin.PLUGIN_ID;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigConfigurationBlock.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigPreferencesMessages.java
===================================================================
---
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigPreferencesMessages.java
(rev 0)
+++
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigPreferencesMessages.java 2011-11-30
00:39:29 UTC (rev 36755)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * 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.struts.ui.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class StrutsConfigPreferencesMessages extends NLS {
+ private static final String BUNDLE_NAME =
StrutsConfigPreferencesMessages.class.getName();
+
+ // Validator Preference page
+ public static String StrutsConfigConfigurationBlock_common_description;
+
+ // Section Struts Config
+ public static String StrutsConfigConfigurationBlock_section_struts_config;
+ public static String StrutsConfigConfigurationBlock_pb_invalidActionName_label;
+ public static String
StrutsConfigConfigurationBlock_pb_invalidActionReferenceAttribute_label;
+ public static String StrutsConfigConfigurationBlock_pb_invalidActionType_label;
+ public static String StrutsConfigConfigurationBlock_pb_invalidActionForward_label;
+ public static String StrutsConfigConfigurationBlock_pb_invalidGlobalForward_label;
+ public static String StrutsConfigConfigurationBlock_pb_invalidGlobalException_label;
+ public static String StrutsConfigConfigurationBlock_pb_invalidController_label;
+ public static String StrutsConfigConfigurationBlock_pb_invalidMessageResources_label;
+
+ public static String StrutsConfigConfigurationBlock_section_web_xml;
+ public static String StrutsConfigConfigurationBlock_pb_invalidInitParam_label;
+
+
+ public static String PREFERENCE_PAGE_STRUTS_CORE_VALIDATOR;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, StrutsConfigPreferencesMessages.class);
+ }
+}
\ No newline at end of file
Property changes on:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigPreferencesMessages.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigPreferencesMessages.properties
===================================================================
---
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigPreferencesMessages.properties
(rev 0)
+++
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigPreferencesMessages.properties 2011-11-30
00:39:29 UTC (rev 36755)
@@ -0,0 +1,29 @@
+##################################################################################
+### 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
+##################################################################################
+
+StrutsConfigConfigurationBlock_common_description=Select the severity level for the
following optional struts-config.xml Validator problems:
+
+##Section Action
+StrutsConfigConfigurationBlock_section_struts_config=Struts Config
+StrutsConfigConfigurationBlock_pb_invalidActionName_label=Invalid action name:
+StrutsConfigConfigurationBlock_pb_invalidActionReferenceAttribute_label=Invalid action
reference attribute:
+StrutsConfigConfigurationBlock_pb_invalidActionType_label=Invalid action type:
+StrutsConfigConfigurationBlock_pb_invalidActionForward_label=Invalid action forward:
+StrutsConfigConfigurationBlock_pb_invalidGlobalForward_label=Invalid global forward:
+StrutsConfigConfigurationBlock_pb_invalidGlobalException_label=Invalid global exception:
+StrutsConfigConfigurationBlock_pb_invalidController_label=Invalid controller:
+StrutsConfigConfigurationBlock_pb_invalidMessageResources_label=Invalid message
resources:
+
+##Section Web XML
+StrutsConfigConfigurationBlock_section_web_xml=Web XML
+StrutsConfigConfigurationBlock_pb_invalidInitParam_label=Invalid init param:
+
+PREFERENCE_PAGE_STRUTS_CORE_VALIDATOR=Struts Core Validator
Property changes on:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigPreferencesMessages.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigValidatorPreferencePage.java
===================================================================
---
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigValidatorPreferencePage.java
(rev 0)
+++
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigValidatorPreferencePage.java 2011-11-30
00:39:29 UTC (rev 36755)
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * 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.struts.ui.preferences;
+
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
+import org.jboss.tools.common.ui.preferences.SeverityPreferencePage;
+import org.jboss.tools.struts.StrutsModelPlugin;
+import org.jboss.tools.struts.validation.StrutsCoreValidator;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class StrutsConfigValidatorPreferencePage extends SeverityPreferencePage {
+
+ public static final String PREF_ID = StrutsCoreValidator.PREFERENCE_PAGE_ID;
+ public static final String PROP_ID =
"org.jboss.tools.struts.ui.propertyPages.StrutsValidatorPreferencePage";
//$NON-NLS-1$
+
+ public StrutsConfigValidatorPreferencePage() {
+ setPreferenceStore(StrutsModelPlugin.getDefault().getPreferenceStore());
+ setTitle(StrutsConfigPreferencesMessages.PREFERENCE_PAGE_STRUTS_CORE_VALIDATOR);
+ }
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPreferencePageID()
+ */
+ @Override
+ protected String getPreferencePageID() {
+ return PREF_ID;
+ }
+
+ /* (non-Javadoc)
+ * @see
org.eclipse.jdt.internal.ui.preferences.PropertyAndPreferencePage#getPropertyPageID()
+ */
+ @Override
+ protected String getPropertyPageID() {
+ return PROP_ID;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ IWorkbenchPreferenceContainer container = (IWorkbenchPreferenceContainer)
getContainer();
+ fConfigurationBlock = new StrutsConfigConfigurationBlock(getNewStatusChangedListener(),
getProject(), container);
+
+ super.createControl(parent);
+ }
+}
\ No newline at end of file
Property changes on:
trunk/struts/plugins/org.jboss.tools.struts.ui/src/org/jboss/tools/struts/ui/preferences/StrutsConfigValidatorPreferencePage.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain