Author: akazakov
Date: 2008-02-19 14:36:36 -0500 (Tue, 19 Feb 2008)
New Revision: 6442
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java
Log:
http://jira.jboss.com/jira/browse/JBIDE-999 Done
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java 2008-02-19
18:55:07 UTC (rev 6441)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/core/SeamPreferences.java 2008-02-19
19:36:36 UTC (rev 6442)
@@ -17,6 +17,7 @@
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.InstanceScope;
+import org.eclipse.jdt.core.JavaCore;
/**
* Constants for names of seam preferences.
@@ -44,6 +45,9 @@
public static final String WARNING = "warning"; //$NON-NLS-1$
public static final String IGNORE = "ignore"; //$NON-NLS-1$
+ public static final String ENABLE = JavaCore.ENABLED; //$NON-NLS-1$
+ public static final String DISABLE = JavaCore.DISABLED; //$NON-NLS-1$
+
public static final Set<String> severityOptionNames = new
HashSet<String>();
//Components
@@ -108,6 +112,8 @@
// Mark EL Variable name which we can't resolve.
public static final String UNKNOWN_EL_VARIABLE_NAME =
createSeverityOption("unknownElVariableName"); //$NON-NLS-1$
+ // Check "var" attributes.
+ public static final String CHECK_VARS = createSeverityOption("checkVars");
//$NON-NLS-1$
// Mark EL Variable property name which we can't resolve.
public static final String UNKNOWN_EL_VARIABLE_PROPERTY_NAME =
createSeverityOption("unknownElVariablePropertyName"); //$NON-NLS-1$
// If Expression use property of component and this property has only setter(getter)
without getter(setter) then mark it.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java 2008-02-19
18:55:07 UTC (rev 6441)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/SeamPreferenceInitializer.java 2008-02-19
19:36:36 UTC (rev 6442)
@@ -35,5 +35,6 @@
defaultPreferences.put(SeamPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME,
SeamPreferences.WARNING);
defaultPreferences.put(SeamPreferences.UNKNOWN_VARIABLE_NAME,
SeamPreferences.WARNING);
defaultPreferences.put(SeamPreferences.UNPAIRED_GETTER_OR_SETTER,
SeamPreferences.IGNORE);
+ defaultPreferences.put(SeamPreferences.CHECK_VARS, SeamPreferences.ENABLE);
}
}
\ No newline at end of file
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2008-02-19
18:55:07 UTC (rev 6441)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamELValidator.java 2008-02-19
19:36:36 UTC (rev 6442)
@@ -35,6 +35,7 @@
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegionList;
import org.eclipse.wst.validation.internal.core.ValidationException;
+import org.eclipse.wst.validation.internal.provisional.core.IMessage;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
@@ -205,7 +206,11 @@
}
private void validateChildNodes(IFile file, Node parent) {
- Var var = ElVarSearcher.findVar(parent);
+ String preferenceValue = SeamPreferences.getProjectPreference(project,
SeamPreferences.CHECK_VARS);
+ Var var = null;
+ if (SeamPreferences.ENABLE.equals(preferenceValue)) {
+ var = ElVarSearcher.findVar(parent);
+ }
if(var!=null) {
varListForCurentValidatedNode.add(var);
}
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java 2008-02-19
18:55:07 UTC (rev 6441)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.java 2008-02-19
19:36:36 UTC (rev 6442)
@@ -89,6 +89,7 @@
//Seam Expression language
public static String SeamValidatorConfigurationBlock_section_el;
public static String SeamValidatorConfigurationBlock_pb_unknownElVariableName_label;
+ public static String SeamValidatorConfigurationBlock_pb_checkVars_label;
public static String
SeamValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label;
public static String SeamValidatorConfigurationBlock_pb_unpairedGetterOrSetter_label;
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties 2008-02-19
18:55:07 UTC (rev 6441)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamPreferencesMessages.properties 2008-02-19
19:36:36 UTC (rev 6442)
@@ -57,6 +57,7 @@
##Seam Expression language
SeamValidatorConfigurationBlock_section_el=Expression language
SeamValidatorConfigurationBlock_pb_unknownElVariableName_label=Context variable cannot be
resolved:
+SeamValidatorConfigurationBlock_pb_checkVars_label=Recognize "var" attributes
SeamValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label=Property cannot be
resolved:
SeamValidatorConfigurationBlock_pb_unpairedGetterOrSetter_label=Unpaired Getter/Setter:
SEAM_VALIDATOR_CONFIGURATION_BLOCK_SEAM_VALIDATOR_CONFIGURATION_BLOCK=SeamValidatorConfigurationBlock
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java 2008-02-19
18:55:07 UTC (rev 6441)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/preferences/SeamValidatorConfigurationBlock.java 2008-02-19
19:36:36 UTC (rev 6442)
@@ -14,6 +14,7 @@
import java.util.ArrayList;
import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.internal.ui.dialogs.StatusInfo;
import org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock;
import org.eclipse.jdt.internal.ui.preferences.ScrolledPageContent;
@@ -21,8 +22,12 @@
import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Combo;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
@@ -30,6 +35,7 @@
import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer;
import org.jboss.tools.seam.core.SeamCorePlugin;
import org.jboss.tools.seam.core.SeamPreferences;
+import org.jboss.tools.seam.internal.core.el.ElVarSearcher.Var;
/**
* Find in SeamPreferences the instruction to Framework for Severity preferences
@@ -54,6 +60,10 @@
public class SeamValidatorConfigurationBlock extends OptionsConfigurationBlock {
private static final String SETTINGS_SECTION_NAME =
SeamPreferencesMessages.SEAM_VALIDATOR_CONFIGURATION_BLOCK_SEAM_VALIDATOR_CONFIGURATION_BLOCK;
+ private Button recognizeVarsCheckBox;
+ private Combo elVariablesCombo;
+ private Combo elPropertiesCombo;
+
private static SectionDescription SECTION_COMPONENT = new SectionDescription(
SeamPreferencesMessages.SeamValidatorConfigurationBlock_section_component,
new String[][]{
@@ -129,12 +139,13 @@
SECTION_EL
};
- private static Key PREF_NON_UNIQUE_COMPONENT_NAME =
getSeamKey(SeamPreferences.NONUNIQUE_COMPONENT_NAME);
-
private static final String ERROR = SeamPreferences.ERROR;
private static final String WARNING = SeamPreferences.WARNING;
private static final String IGNORE = SeamPreferences.IGNORE;
+ private static final String ENABLED= JavaCore.ENABLED;
+ private static final String DISABLED= JavaCore.DISABLED;
+
private PixelConverter fPixelConverter;
private static Key[] getKeys() {
@@ -144,6 +155,7 @@
keys.add(ALL_SECTIONS[i].options[j].key);
}
}
+ keys.add(getSeamKey(SeamPreferences.CHECK_VARS));
return keys.toArray(new Key[0]);
}
@@ -177,6 +189,7 @@
private Composite createStyleTabContent(Composite folder) {
String[] errorWarningIgnore = new String[] {ERROR, WARNING, IGNORE};
+ String[] enableDisableValues= new String[] {ENABLED, DISABLED};
String[] errorWarningIgnoreLabels = new String[] {
SeamPreferencesMessages.SEAM_VALIDATOR_CONFIGURATION_BLOCK_ERROR,
@@ -214,17 +227,59 @@
for (int j = 0; j < section.options.length; j++) {
OptionDescription option = section.options[j];
label = option.label;
- addComboBox(inner, label, option.key, errorWarningIgnore, errorWarningIgnoreLabels,
defaultIndent);
+ Combo combo = addComboBox(inner, label, option.key, errorWarningIgnore,
errorWarningIgnoreLabels, defaultIndent);
+ if(option.label ==
SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_unknownElVariableName_label) {
+ elVariablesCombo = combo;
+ combo.addSelectionListener(new SelectionListener(){
+ public void widgetDefaultSelected(SelectionEvent e) {
+ updateELCombox();
+ }
+ public void widgetSelected(SelectionEvent e) {
+ updateELCombox();
+ }
+ });
+ } else if(option.label ==
SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label)
{
+ elPropertiesCombo = combo;
+ combo.addSelectionListener(new SelectionListener(){
+ public void widgetDefaultSelected(SelectionEvent e) {
+ updateELCombox();
+ }
+ public void widgetSelected(SelectionEvent e) {
+ updateELCombox();
+ }
+ });
+ }
}
+
+ if(section==SECTION_EL) {
+ label = SeamPreferencesMessages.SeamValidatorConfigurationBlock_pb_checkVars_label;
+ recognizeVarsCheckBox = addCheckBox(inner, label,
getSeamKey(SeamPreferences.CHECK_VARS), enableDisableValues, defaultIndent);
+ }
}
IDialogSettings section =
SeamCorePlugin.getDefault().getDialogSettings().getSection(SETTINGS_SECTION_NAME);
restoreSectionExpansionStates(section);
+ updateELCombox();
+
return sc1;
}
@Override
+ public void performDefaults() {
+ super.performDefaults();
+ updateELCombox();
+ }
+
+ private void updateELCombox() {
+ if(elPropertiesCombo.getSelectionIndex()==2 &&
elVariablesCombo.getSelectionIndex()==2) {
+ recognizeVarsCheckBox.setEnabled(false);
+ } else {
+ recognizeVarsCheckBox.setEnabled(true);
+ }
+ }
+
+ @Override
protected String[] getFullBuildDialogStrings(boolean workspaceSettings) {
String title= SeamPreferencesMessages.SeamValidatorConfigurationBlock_needsbuild_title;
String message;