JBoss Tools SVN: r32221 - trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-06-20 12:12:47 -0400 (Mon, 20 Jun 2011)
New Revision: 32221
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorConfigurationBlock.java
Log:
JBIDE-9185
https://issues.jboss.org/browse/JBIDE-9185
JBIDE-9195
https://issues.jboss.org/browse/JBIDE-9195
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorConfigurationBlock.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorConfigurationBlock.java 2011-06-20 16:09:37 UTC (rev 32220)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/ELValidatorConfigurationBlock.java 2011-06-20 16:12:47 UTC (rev 32221)
@@ -14,7 +14,9 @@
import java.util.ArrayList;
import org.eclipse.core.resources.IProject;
+import org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock;
import org.eclipse.jdt.internal.ui.preferences.ScrolledPageContent;
+import org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock.Key;
import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.swt.SWT;
@@ -30,6 +32,8 @@
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.OptionDescription;
+import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock.SectionDescription;
import org.jboss.tools.jst.web.kb.WebKbPlugin;
import org.jboss.tools.jst.web.kb.preferences.ELSeverityPreferences;
@@ -64,10 +68,8 @@
private static Key[] getKeys() {
ArrayList<Key> keys = new ArrayList<Key>();
- for (int i = 0; i < ALL_SECTIONS.length; i++) {
- for (int j = 0; j < ALL_SECTIONS[i].options.length; j++) {
- keys.add(ALL_SECTIONS[i].options[j].key);
- }
+ for (SectionDescription s: ALL_SECTIONS) {
+ s.collectKeys(keys);
}
keys.add(getKey(WebKbPlugin.PLUGIN_ID, ELSeverityPreferences.CHECK_VARS));
keys.add(getKey(WebKbPlugin.PLUGIN_ID, ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL));
@@ -97,79 +99,62 @@
@Override
protected Composite createStyleTabContent(Composite folder) {
- int nColumns = 3;
+ Composite result = super.createStyleTabContent(folder);
+ updateELCombox();
+ return result;
+ }
- final ScrolledPageContent sc1 = new ScrolledPageContent(folder);
+ @Override
+ protected void createSection(PreferenceTreeNode parent, SectionDescription section, Composite composite, int nColumns, int defaultIndent) {
+ String label = section.getLabel();
- Composite composite = sc1.getBody();
+ Key twistieKey = OptionsConfigurationBlock.getLocalKey(label.replace(' ', '_'));
+ PreferenceTreeNode treeSection = fFilteredPrefTree.addExpandableComposite(composite, label, nColumns, twistieKey, parent, false);
+ ExpandableComposite excomposite = getExpandableComposite(twistieKey);
+ Composite inner = createInnerComposite(excomposite, nColumns, composite.getFont());
+
+ for (SectionDescription s: section.getSections()) {
+ createSection(treeSection, s, inner, nColumns, defaultIndent);
+ }
- addMaxNumberOfMarkersField(composite);
-
- addWrongBuilderOrderField(composite);
-
- GridLayout layout= new GridLayout(nColumns, false);
- layout.marginHeight= 0;
- layout.marginWidth= 0;
- composite.setLayout(layout);
-
- Label description= new Label(composite, SWT.LEFT | SWT.WRAP);
- description.setFont(description.getFont());
- description.setText(getCommonDescription());
- description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false, nColumns - 1, 1));
-
- int defaultIndent = 0;
-
- for (int i = 0; i < ALL_SECTIONS.length; i++) {
- SectionDescription section = ALL_SECTIONS[i];
- String label = section.label;
- ExpandableComposite excomposite = createStyleSection(composite, label, nColumns);
-
- Composite inner = new Composite(excomposite, SWT.NONE);
- inner.setFont(composite.getFont());
- inner.setLayout(new GridLayout(nColumns, false));
- excomposite.setClient(inner);
-
- for (int j = 0; j < section.options.length; j++) {
- OptionDescription option = section.options[j];
- label = option.label;
- Combo combo = addComboBox(inner, label, option.key, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent);
- if(option.label == ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_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 == ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_unknownElVariablePropertyName_label) {
- elPropertiesCombo = combo;
- combo.addSelectionListener(new SelectionListener(){
- public void widgetDefaultSelected(SelectionEvent e) {
- updateELCombox();
- }
- public void widgetSelected(SelectionEvent e) {
- updateELCombox();
- }
- });
- }
+ for (OptionDescription option: section.getOptions()) {
+ label = option.label;
+ fFilteredPrefTree.addComboBox(inner, label, option.key, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent, treeSection);
+ Combo combo = getComboBox(option.key);
+ if(option.label == ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_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 == ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_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 = ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_checkVars_label;
- recognizeVarsCheckBox = addCheckBox(inner, label, getKey(WebKbPlugin.PLUGIN_ID, ELSeverityPreferences.CHECK_VARS), enableDisableValues, defaultIndent);
-
- label = ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_revalidateUnresolvedEl_label;
- revalidateUnresolvedElCheckBox = addCheckBox(inner, label, getKey(WebKbPlugin.PLUGIN_ID, ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL), enableDisableValues, defaultIndent);
- }
}
- restoreSectionExpansionStates(getDialogSettings());
+ if(section == SECTION_EL) {
+ label = ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_checkVars_label;
+ Key key = getKey(WebKbPlugin.PLUGIN_ID, ELSeverityPreferences.CHECK_VARS);
+ PreferenceTreeNode node = fFilteredPrefTree.addCheckBox(inner, label, key, enableDisableValues, defaultIndent, treeSection);
+ recognizeVarsCheckBox = getCheckBox(key);
- updateELCombox();
-
- return sc1;
+ label = ELSeverityPreferencesMessages.JSFValidatorConfigurationBlock_pb_revalidateUnresolvedEl_label;
+ key = getKey(WebKbPlugin.PLUGIN_ID, ELSeverityPreferences.RE_VALIDATE_UNRESOLVED_EL);
+ node = fFilteredPrefTree.addCheckBox(inner, label, key, enableDisableValues, defaultIndent, treeSection);
+ revalidateUnresolvedElCheckBox = getCheckBox(key);
+ }
}
@Override
14 years, 9 months
JBoss Tools SVN: r32220 - in trunk/cdi/plugins/org.jboss.tools.cdi.ui: schema and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-06-20 12:09:37 -0400 (Mon, 20 Jun 2011)
New Revision: 32220
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/schema/
trunk/cdi/plugins/org.jboss.tools.cdi.ui/schema/configBlockDescriptionProvider.exsd
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlockDescriptionProvider.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/IConfigurationBlockDescriptionProvider.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties
Log:
JBIDE-9185
https://issues.jboss.org/browse/JBIDE-9185
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml 2011-06-20 16:07:10 UTC (rev 32219)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/plugin.xml 2011-06-20 16:09:37 UTC (rev 32220)
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.2"?>
<plugin>
+ <extension-point id="configBlockDescriptionProvider" name="Config Block Description Provider" schema="schema/configBlockDescriptionProvider.exsd"/>
<extension
point="org.eclipse.ui.propertyPages">
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/schema/configBlockDescriptionProvider.exsd
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/schema/configBlockDescriptionProvider.exsd (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/schema/configBlockDescriptionProvider.exsd 2011-06-20 16:09:37 UTC (rev 32220)
@@ -0,0 +1,102 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.cdi.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appInfo>
+ <meta.schema plugin="org.jboss.tools.cdi.ui" id="configBlockDescriptionProvider" name="Config Block Description Provider"/>
+ </appInfo>
+ <documentation>
+ [Enter description of this extension point.]
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appInfo>
+ <meta.element />
+ </appInfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="provider" minOccurs="1" maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute translatable="true"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="provider">
+ <complexType>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appInfo>
+ <meta.attribute kind="java"/>
+ </appInfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="since"/>
+ </appInfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="examples"/>
+ </appInfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="apiinfo"/>
+ </appInfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appInfo>
+ <meta.section type="implementation"/>
+ </appInfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/schema/configBlockDescriptionProvider.exsd
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2011-06-20 16:07:10 UTC (rev 32219)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlock.java 2011-06-20 16:09:37 UTC (rev 32220)
@@ -28,154 +28,10 @@
private static final String SETTINGS_SECTION_NAME = "CDIValidatorConfigurationBlock";
- private static SectionDescription SECTION_NAME = new SectionDescription(
- CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_name,
- new String[][]{
- {CDIPreferences.STEREOTYPE_DECLARES_NON_EMPTY_NAME, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_stereotypeDeclaresNonEmptyName_label},
- {CDIPreferences.RESOURCE_PRODUCER_FIELD_SETS_EL_NAME, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_resourceProducerFieldSetsElName_label},
- {CDIPreferences.PARAM_INJECTION_DECLARES_EMPTY_NAME, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_paramInjectionDeclaresEmptyName_label},
- {CDIPreferences.INTERCEPTOR_HAS_NAME, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_interceptorHasName_label},
- {CDIPreferences.DECORATOR_HAS_NAME, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_decoratorHasName_label},
- {CDIPreferences.AMBIGUOUS_EL_NAMES, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_ambiguousElNames_label},
- },
- CDICorePlugin.PLUGIN_ID
- );
-
- private static SectionDescription SECTION_TYPE = new SectionDescription(
- CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_type,
- new String[][]{
- {CDIPreferences.UNSATISFIED_INJECTION_POINTS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_unsatisfiedInjectionPoints_label},
- {CDIPreferences.AMBIGUOUS_INJECTION_POINTS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_ambiguousInjectionPoints_label},
- {CDIPreferences.UNPROXYABLE_BEAN_TYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_unproxyableBeanType_label},
- {CDIPreferences.ILLEGAL_TYPE_IN_TYPED_DECLARATION, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalTypeInTypedDeclaration_label},
- {CDIPreferences.PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeHasWildcard_label},
- {CDIPreferences.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeIsVariable_label},
-// {CDIPreferences.PRODUCER_FIELD_TYPE_DOES_NOT_MATCH_JAVA_EE_OBJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerFieldTypeDoesNotMatchJavaEeObject_label},
- {CDIPreferences.INJECT_RESOLVES_TO_NULLABLE_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_injectResolvesToNullableBean_label},
- {CDIPreferences.INJECTION_TYPE_IS_VARIABLE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_injectionTypeIsVariable_label},
- {CDIPreferences.STEREOTYPE_IS_ANNOTATED_TYPED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_stereotypeIsAnnotatedTyped_label},
- {CDIPreferences.MISSING_NONBINDING_IN_QUALIFIER_TYPE_MEMBER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingNonbindingInQualifierTypeMember_label},
- {CDIPreferences.MISSING_NONBINDING_IN_INTERCEPTOR_BINDING_TYPE_MEMBER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingNonbindingInInterceptorBindingTypeMember_label},
- {CDIPreferences.MISSING_OR_INCORRECT_TARGET_OR_RETENTION_IN_ANNOTATION_TYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingOrIncorrectTargetOrRetentionInAnnotationType_label},
- {CDIPreferences.NOT_PASSIVATION_CAPABLE_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_notPassivationCapableBean_label},
- },
- CDICorePlugin.PLUGIN_ID
- );
-
- private static SectionDescription SECTION_SCOPE = new SectionDescription(
- CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_scope,
- new String[][]{
- {CDIPreferences.MULTIPLE_SCOPE_TYPE_ANNOTATIONS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleScopeTypeAnnotations_label},
- {CDIPreferences.MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingScopeWhenThereIsNoDefaultScope_label},
- {CDIPreferences.STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_stereotypeDeclaresMoreThanOneScope_label},
- {CDIPreferences.ILLEGAL_SCOPE_FOR_MANAGED_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForManagedBean_label},
- {CDIPreferences.ILLEGAL_SCOPE_FOR_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForSessionBean_label},
- {CDIPreferences.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForProducerMethod_label},
- {CDIPreferences.ILLEGAL_SCOPE_WHEN_TYPE_INJECTIONPOINT_IS_INJECTED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeWhenTypeInjectionPointIsInjected_label},
- {CDIPreferences.ILLEGAL_SCOPE_FOR_INTERCEPTOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForInterceptor_label},
- {CDIPreferences.ILLEGAL_SCOPE_FOR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForDecorator_label},
- },
- CDICorePlugin.PLUGIN_ID
- );
-
- private static SectionDescription SECTION_MEMBER = new SectionDescription(
- CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_member,
- new String[][]{
- {CDIPreferences.PRODUCER_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerAnnotatedInject_label},
- {CDIPreferences.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerParameterIllegallyAnnotated_label},
- {CDIPreferences.OBSERVER_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_observerAnnotatedInject_label},
- {CDIPreferences.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_observerParameterIllegallyAnnotated_label},
- {CDIPreferences.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalProducerMethodInSessionBean_label},
- {CDIPreferences.MULTIPLE_DISPOSING_PARAMETERS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDisposingParameters_label},
- {CDIPreferences.DISPOSER_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_disposerAnnotatedInject_label},
- {CDIPreferences.ILLEGAL_DISPOSER_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalDisposerInSessionBean_label},
- {CDIPreferences.NO_PRODUCER_MATCHING_DISPOSER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_noProducerMatchingDisposer_label},
- {CDIPreferences.MULTIPLE_DISPOSERS_FOR_PRODUCER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDisposersForProducer_label},
- {CDIPreferences.MULTIPLE_INJECTION_CONSTRUCTORS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleInjectionConstructors_label},
- {CDIPreferences.CONSTRUCTOR_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_constructorParameterIllegallyAnnotated_label},
- {CDIPreferences.GENERIC_METHOD_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_genericMethodAnnotatedInject_label},
- {CDIPreferences.MULTIPLE_OBSERVING_PARAMETERS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleObservingParameters_label},
- {CDIPreferences.ILLEGAL_OBSERVER_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalObserverInSessionBean_label},
- {CDIPreferences.ILLEGAL_CONDITIONAL_OBSERVER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalConditionalObserver_label},
- },
- CDICorePlugin.PLUGIN_ID
- );
-
- private static SectionDescription SECTION_INTERCEPTOR = new SectionDescription(
- CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_interceptor_and_decorator,
- new String[][]{
- {CDIPreferences.BOTH_INTERCEPTOR_AND_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_bothInterceptorAndDecorator_label},
- {CDIPreferences.SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_sessionBeanAnnotatedInterceptorOrDecorator_label},
- {CDIPreferences.PRODUCER_IN_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerInInterceptorOrDecorator_label},
- {CDIPreferences.DISPOSER_IN_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_disposerInInterceptorOrDecorator_label},
- {CDIPreferences.MULTIPLE_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDelegate_label},
- {CDIPreferences.MISSING_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingDelegate_label},
- {CDIPreferences.ILLEGAL_INJECTION_POINT_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalInjectionPointDelegate_label},
- {CDIPreferences.ILLEGAL_BEAN_DECLARING_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalBeanDeclaringDelegate_label},
- {CDIPreferences.DELEGATE_HAS_ILLEGAL_TYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_delegateHasIllegalType_label},
- {CDIPreferences.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalLifecycleCallbackInterceptorBinding_label},
- {CDIPreferences.ILLEGAL_INTERCEPTOR_BINDING_METHOD, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalInterceptorBindingMethod_label},
- {CDIPreferences.CONFLICTING_INTERCEPTOR_BINDINGS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_conflictingInterceptorBindings_label},
- {CDIPreferences.OBSERVER_IN_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_observerInInterceptorOrDecorator_label},
- {CDIPreferences.INTERCEPTOR_OR_DECORATOR_IS_ALTERNATIVE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_interceptorOrDecoratorIsAlternative_label},
- {CDIPreferences.MISSING_INTERCEPTOR_BINDING, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingInterceptorBinding_label},
- {CDIPreferences.INJECTED_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_injectedDecorator_label},
- {CDIPreferences.INJECTED_INTERCEPTOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_injectedInterceptor_label},
- {CDIPreferences.INJECTED_INTERCEPTOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_decoratorResolvesToFinalBean_label},
- },
- CDICorePlugin.PLUGIN_ID
- );
-
- private static SectionDescription SECTION_SPECIALIZATION = new SectionDescription(
- CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_specializing,
- new String[][]{
- {CDIPreferences.ILLEGAL_SPECIALIZING_MANAGED_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalSpecializingManagedBean_label},
- {CDIPreferences.ILLEGAL_SPECIALIZING_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalSpecializingSessionBean_label},
- {CDIPreferences.ILLEGAL_SPECIALIZING_PRODUCER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalSpecializingProducer_label},
- {CDIPreferences.MISSING_TYPE_IN_SPECIALIZING_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingTypeInSpecializingBean_label},
- {CDIPreferences.CONFLICTING_NAME_IN_SPECIALIZING_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_conflictingNameInSpecializingBean_label},
- {CDIPreferences.INTERCEPTOR_ANNOTATED_SPECIALIZES, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_interceptorAnnotatedSpecializes_label},
- {CDIPreferences.INCONSISTENT_SPECIALIZATION, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_inconsistentSpecialization_label},
- },
- CDICorePlugin.PLUGIN_ID
- );
-
- private static SectionDescription SECTION_MISCELLANEOUS = new SectionDescription(
- CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_miscellaneous,
- new String[][]{
-// {CDIPreferences.ILLEGAL_INJECTING_USERTRANSACTION_TYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalInjectingUserTransactionType_label},
-// {CDIPreferences.ILLEGAL_INJECTING_INJECTIONPOINT_TYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalInjectingInjectionPointType_label},
- {CDIPreferences.ILLEGAL_QUALIFIER_IN_STEREOTYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalQualifierInStereotype_label},
- },
- CDICorePlugin.PLUGIN_ID
- );
-
- private static SectionDescription SECTION_BEANSXML = new SectionDescription(
- CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_beansxml,
- new String[][]{
- {CDIPreferences.ILLEGAL_TYPE_NAME_IN_BEANS_XML, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalTypeInBeansXml_label},
- {CDIPreferences.DUPLICATE_TYPE_IN_BEANS_XML, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_duplicateTypeInBeansXml_label},
- },
- CDICorePlugin.PLUGIN_ID
- );
-
- private static SectionDescription[] ALL_SECTIONS = new SectionDescription[]{
- SECTION_NAME,
- SECTION_TYPE,
- SECTION_SCOPE,
- SECTION_MEMBER,
- SECTION_INTERCEPTOR,
- SECTION_SPECIALIZATION,
- SECTION_MISCELLANEOUS,
- SECTION_BEANSXML
- };
-
private static Key[] getKeys() {
ArrayList<Key> keys = new ArrayList<Key>();
- for (int i = 0; i < ALL_SECTIONS.length; i++) {
- for (int j = 0; j < ALL_SECTIONS[i].options.length; j++) {
- keys.add(ALL_SECTIONS[i].options[j].key);
- }
+ for (SectionDescription s: CDIConfigurationBlockDescriptionProvider.getInstance().getSections()) {
+ s.collectKeys(keys);
}
keys.add(MAX_NUMBER_OF_PROBLEMS_KEY);
keys.add(WRONG_BUILDER_ORDER_KEY);
@@ -202,7 +58,7 @@
@Override
protected SectionDescription[] getAllSections() {
- return ALL_SECTIONS;
+ return CDIConfigurationBlockDescriptionProvider.getInstance().getSections();
}
@Override
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlockDescriptionProvider.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlockDescriptionProvider.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlockDescriptionProvider.java 2011-06-20 16:09:37 UTC (rev 32220)
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * 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.cdi.ui.preferences;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.core.runtime.IExtension;
+import org.eclipse.core.runtime.IExtensionPoint;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.cdi.core.CDICorePlugin;
+import org.jboss.tools.cdi.core.preferences.CDIPreferences;
+import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock.SectionDescription;
+
+/**
+ *
+ * @author Alexey Kazakov & Viacheslav Kabanovich
+ *
+ */
+public class CDIConfigurationBlockDescriptionProvider {
+ private static final String POINT_ID = "org.jboss.tools.cdi.ui.configBlockDescriptionProvider";
+
+ private static CDIConfigurationBlockDescriptionProvider INSTANCE = null;
+
+ private CDIConfigurationBlockDescriptionProvider() {
+ init();
+ }
+
+ public static CDIConfigurationBlockDescriptionProvider getInstance() {
+ if(INSTANCE == null) {
+ CDIConfigurationBlockDescriptionProvider q = new CDIConfigurationBlockDescriptionProvider();
+ INSTANCE = q;
+ }
+ return INSTANCE;
+ }
+
+ private SectionDescription SECTION_NAME = new SectionDescription(
+ CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_name,
+ new String[][]{
+ {CDIPreferences.STEREOTYPE_DECLARES_NON_EMPTY_NAME, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_stereotypeDeclaresNonEmptyName_label},
+ {CDIPreferences.RESOURCE_PRODUCER_FIELD_SETS_EL_NAME, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_resourceProducerFieldSetsElName_label},
+ {CDIPreferences.PARAM_INJECTION_DECLARES_EMPTY_NAME, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_paramInjectionDeclaresEmptyName_label},
+ {CDIPreferences.INTERCEPTOR_HAS_NAME, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_interceptorHasName_label},
+ {CDIPreferences.DECORATOR_HAS_NAME, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_decoratorHasName_label},
+ {CDIPreferences.AMBIGUOUS_EL_NAMES, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_ambiguousElNames_label},
+ },
+ CDICorePlugin.PLUGIN_ID
+ );
+
+ private SectionDescription SECTION_TYPE = new SectionDescription(
+ CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_type,
+ new String[][]{
+ {CDIPreferences.UNSATISFIED_INJECTION_POINTS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_unsatisfiedInjectionPoints_label},
+ {CDIPreferences.AMBIGUOUS_INJECTION_POINTS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_ambiguousInjectionPoints_label},
+ {CDIPreferences.UNPROXYABLE_BEAN_TYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_unproxyableBeanType_label},
+ {CDIPreferences.ILLEGAL_TYPE_IN_TYPED_DECLARATION, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalTypeInTypedDeclaration_label},
+ {CDIPreferences.PRODUCER_METHOD_RETURN_TYPE_HAS_WILDCARD, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeHasWildcard_label},
+ {CDIPreferences.PRODUCER_METHOD_RETURN_TYPE_IS_VARIABLE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerMethodReturnTypeIsVariable_label},
+// {CDIPreferences.PRODUCER_FIELD_TYPE_DOES_NOT_MATCH_JAVA_EE_OBJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerFieldTypeDoesNotMatchJavaEeObject_label},
+ {CDIPreferences.INJECT_RESOLVES_TO_NULLABLE_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_injectResolvesToNullableBean_label},
+ {CDIPreferences.INJECTION_TYPE_IS_VARIABLE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_injectionTypeIsVariable_label},
+ {CDIPreferences.STEREOTYPE_IS_ANNOTATED_TYPED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_stereotypeIsAnnotatedTyped_label},
+ {CDIPreferences.MISSING_NONBINDING_IN_QUALIFIER_TYPE_MEMBER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingNonbindingInQualifierTypeMember_label},
+ {CDIPreferences.MISSING_NONBINDING_IN_INTERCEPTOR_BINDING_TYPE_MEMBER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingNonbindingInInterceptorBindingTypeMember_label},
+ {CDIPreferences.MISSING_OR_INCORRECT_TARGET_OR_RETENTION_IN_ANNOTATION_TYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingOrIncorrectTargetOrRetentionInAnnotationType_label},
+ {CDIPreferences.NOT_PASSIVATION_CAPABLE_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_notPassivationCapableBean_label},
+ },
+ CDICorePlugin.PLUGIN_ID
+ );
+
+ private SectionDescription SECTION_SCOPE = new SectionDescription(
+ CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_scope,
+ new String[][]{
+ {CDIPreferences.MULTIPLE_SCOPE_TYPE_ANNOTATIONS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleScopeTypeAnnotations_label},
+ {CDIPreferences.MISSING_SCOPE_WHEN_THERE_IS_NO_DEFAULT_SCOPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingScopeWhenThereIsNoDefaultScope_label},
+ {CDIPreferences.STEREOTYPE_DECLARES_MORE_THAN_ONE_SCOPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_stereotypeDeclaresMoreThanOneScope_label},
+ {CDIPreferences.ILLEGAL_SCOPE_FOR_MANAGED_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForManagedBean_label},
+ {CDIPreferences.ILLEGAL_SCOPE_FOR_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForSessionBean_label},
+ {CDIPreferences.ILLEGAL_SCOPE_FOR_PRODUCER_METHOD, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForProducerMethod_label},
+ {CDIPreferences.ILLEGAL_SCOPE_WHEN_TYPE_INJECTIONPOINT_IS_INJECTED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeWhenTypeInjectionPointIsInjected_label},
+ {CDIPreferences.ILLEGAL_SCOPE_FOR_INTERCEPTOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForInterceptor_label},
+ {CDIPreferences.ILLEGAL_SCOPE_FOR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalScopeForDecorator_label},
+ },
+ CDICorePlugin.PLUGIN_ID
+ );
+
+ private SectionDescription SECTION_MEMBER = new SectionDescription(
+ CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_member,
+ new String[][]{
+ {CDIPreferences.PRODUCER_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerAnnotatedInject_label},
+ {CDIPreferences.PRODUCER_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerParameterIllegallyAnnotated_label},
+ {CDIPreferences.OBSERVER_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_observerAnnotatedInject_label},
+ {CDIPreferences.OBSERVER_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_observerParameterIllegallyAnnotated_label},
+ {CDIPreferences.ILLEGAL_PRODUCER_METHOD_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalProducerMethodInSessionBean_label},
+ {CDIPreferences.MULTIPLE_DISPOSING_PARAMETERS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDisposingParameters_label},
+ {CDIPreferences.DISPOSER_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_disposerAnnotatedInject_label},
+ {CDIPreferences.ILLEGAL_DISPOSER_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalDisposerInSessionBean_label},
+ {CDIPreferences.NO_PRODUCER_MATCHING_DISPOSER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_noProducerMatchingDisposer_label},
+ {CDIPreferences.MULTIPLE_DISPOSERS_FOR_PRODUCER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDisposersForProducer_label},
+ {CDIPreferences.MULTIPLE_INJECTION_CONSTRUCTORS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleInjectionConstructors_label},
+ {CDIPreferences.CONSTRUCTOR_PARAMETER_ILLEGALLY_ANNOTATED, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_constructorParameterIllegallyAnnotated_label},
+ {CDIPreferences.GENERIC_METHOD_ANNOTATED_INJECT, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_genericMethodAnnotatedInject_label},
+ {CDIPreferences.MULTIPLE_OBSERVING_PARAMETERS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleObservingParameters_label},
+ {CDIPreferences.ILLEGAL_OBSERVER_IN_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalObserverInSessionBean_label},
+ {CDIPreferences.ILLEGAL_CONDITIONAL_OBSERVER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalConditionalObserver_label},
+ },
+ CDICorePlugin.PLUGIN_ID
+ );
+
+ private SectionDescription SECTION_INTERCEPTOR = new SectionDescription(
+ CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_interceptor_and_decorator,
+ new String[][]{
+ {CDIPreferences.BOTH_INTERCEPTOR_AND_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_bothInterceptorAndDecorator_label},
+ {CDIPreferences.SESSION_BEAN_ANNOTATED_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_sessionBeanAnnotatedInterceptorOrDecorator_label},
+ {CDIPreferences.PRODUCER_IN_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_producerInInterceptorOrDecorator_label},
+ {CDIPreferences.DISPOSER_IN_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_disposerInInterceptorOrDecorator_label},
+ {CDIPreferences.MULTIPLE_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_multipleDelegate_label},
+ {CDIPreferences.MISSING_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingDelegate_label},
+ {CDIPreferences.ILLEGAL_INJECTION_POINT_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalInjectionPointDelegate_label},
+ {CDIPreferences.ILLEGAL_BEAN_DECLARING_DELEGATE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalBeanDeclaringDelegate_label},
+ {CDIPreferences.DELEGATE_HAS_ILLEGAL_TYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_delegateHasIllegalType_label},
+ {CDIPreferences.ILLEGAL_LIFECYCLE_CALLBACK_INTERCEPTOR_BINDING, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalLifecycleCallbackInterceptorBinding_label},
+ {CDIPreferences.ILLEGAL_INTERCEPTOR_BINDING_METHOD, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalInterceptorBindingMethod_label},
+ {CDIPreferences.CONFLICTING_INTERCEPTOR_BINDINGS, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_conflictingInterceptorBindings_label},
+ {CDIPreferences.OBSERVER_IN_INTERCEPTOR_OR_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_observerInInterceptorOrDecorator_label},
+ {CDIPreferences.INTERCEPTOR_OR_DECORATOR_IS_ALTERNATIVE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_interceptorOrDecoratorIsAlternative_label},
+ {CDIPreferences.MISSING_INTERCEPTOR_BINDING, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingInterceptorBinding_label},
+ {CDIPreferences.INJECTED_DECORATOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_injectedDecorator_label},
+ {CDIPreferences.INJECTED_INTERCEPTOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_injectedInterceptor_label},
+ {CDIPreferences.INJECTED_INTERCEPTOR, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_decoratorResolvesToFinalBean_label},
+ },
+ CDICorePlugin.PLUGIN_ID
+ );
+
+ private SectionDescription SECTION_SPECIALIZATION = new SectionDescription(
+ CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_specializing,
+ new String[][]{
+ {CDIPreferences.ILLEGAL_SPECIALIZING_MANAGED_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalSpecializingManagedBean_label},
+ {CDIPreferences.ILLEGAL_SPECIALIZING_SESSION_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalSpecializingSessionBean_label},
+ {CDIPreferences.ILLEGAL_SPECIALIZING_PRODUCER, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalSpecializingProducer_label},
+ {CDIPreferences.MISSING_TYPE_IN_SPECIALIZING_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_missingTypeInSpecializingBean_label},
+ {CDIPreferences.CONFLICTING_NAME_IN_SPECIALIZING_BEAN, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_conflictingNameInSpecializingBean_label},
+ {CDIPreferences.INTERCEPTOR_ANNOTATED_SPECIALIZES, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_interceptorAnnotatedSpecializes_label},
+ {CDIPreferences.INCONSISTENT_SPECIALIZATION, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_inconsistentSpecialization_label},
+ },
+ CDICorePlugin.PLUGIN_ID
+ );
+
+ private SectionDescription SECTION_MISCELLANEOUS = new SectionDescription(
+ CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_miscellaneous,
+ new String[][]{
+// {CDIPreferences.ILLEGAL_INJECTING_USERTRANSACTION_TYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalInjectingUserTransactionType_label},
+// {CDIPreferences.ILLEGAL_INJECTING_INJECTIONPOINT_TYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalInjectingInjectionPointType_label},
+ {CDIPreferences.ILLEGAL_QUALIFIER_IN_STEREOTYPE, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalQualifierInStereotype_label},
+ },
+ CDICorePlugin.PLUGIN_ID
+ );
+
+ private SectionDescription SECTION_BEANSXML = new SectionDescription(
+ CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_beansxml,
+ new String[][]{
+ {CDIPreferences.ILLEGAL_TYPE_NAME_IN_BEANS_XML, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_illegalTypeInBeansXml_label},
+ {CDIPreferences.DUPLICATE_TYPE_IN_BEANS_XML, CDIPreferencesMessages.CDIValidatorConfigurationBlock_pb_duplicateTypeInBeansXml_label},
+ },
+ CDICorePlugin.PLUGIN_ID
+ );
+
+ private SectionDescription SECTION_JSR_299 = new SectionDescription(CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_jsr299,
+ new SectionDescription[]{
+ SECTION_NAME,
+ SECTION_TYPE,
+ SECTION_SCOPE,
+ SECTION_MEMBER,
+ SECTION_INTERCEPTOR,
+ SECTION_SPECIALIZATION,
+ SECTION_MISCELLANEOUS,
+ SECTION_BEANSXML
+ }, new String[0][], CDICorePlugin.PLUGIN_ID);
+
+ private SectionDescription[] ALL_SECTIONS = new SectionDescription[]{
+ SECTION_JSR_299
+ };
+
+ void init() {
+ List<SectionDescription> exs = new ArrayList<SectionDescription>();
+ IExtensionPoint point = Platform.getExtensionRegistry().getExtensionPoint(POINT_ID);
+ for (IExtension e: point.getExtensions()) {
+ IConfigurationElement[] es = e.getConfigurationElements();
+ for (IConfigurationElement element: es) {
+ try {
+ IConfigurationBlockDescriptionProvider provider = (IConfigurationBlockDescriptionProvider)element.createExecutableExtension("class");
+ SectionDescription[] ds = provider.getSections();
+ for (SectionDescription d: ds) {
+ exs.add(d);
+ }
+ } catch (CoreException exc) {
+ CDICorePlugin.getDefault().logError(exc);
+ }
+ }
+ }
+
+ SectionDescription extensions = new SectionDescription(CDIPreferencesMessages.CDIValidatorConfigurationBlock_section_extensions, exs.toArray(new SectionDescription[0]), new String[0][], CDICorePlugin.PLUGIN_ID);
+
+ ALL_SECTIONS = new SectionDescription[]{
+ SECTION_JSR_299,
+ extensions
+ };
+ }
+
+ public SectionDescription[] getSections() {
+ return ALL_SECTIONS;
+ }
+
+
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIConfigurationBlockDescriptionProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java 2011-06-20 16:07:10 UTC (rev 32219)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.java 2011-06-20 16:09:37 UTC (rev 32220)
@@ -28,6 +28,12 @@
public static String CDIValidatorConfigurationBlock_needsfullbuild_message;
public static String CDIValidatorConfigurationBlock_needsprojectbuild_message;
+ // Root section JSR-299
+ public static String CDIValidatorConfigurationBlock_section_jsr299;
+
+ // Root Section Extensions
+ public static String CDIValidatorConfigurationBlock_section_extensions;
+
// Section Test
public static String CDIValidatorConfigurationBlock_section_test;
public static String CDIValidatorConfigurationBlock_pb_test_label;
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties 2011-06-20 16:07:10 UTC (rev 32219)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/CDIPreferencesMessages.properties 2011-06-20 16:09:37 UTC (rev 32220)
@@ -17,6 +17,11 @@
CDIValidatorConfigurationBlock_needsfullbuild_message=The CDI Validator settings have changed. A full rebuild is required for changes to take effect. Do the full build now?
CDIValidatorConfigurationBlock_needsprojectbuild_message=The CDI Validator settings have changed. A rebuild of the project is required for changes to take effect. Build the project now?
+## Root section JSR-299
+CDIValidatorConfigurationBlock_section_jsr299=JSR-299
+##Root Section Extensions
+CDIValidatorConfigurationBlock_section_extensions=Extensions
+
##Section Test
CDIValidatorConfigurationBlock_section_test=Test
CDIValidatorConfigurationBlock_pb_test_label=Test:
Added: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/IConfigurationBlockDescriptionProvider.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/IConfigurationBlockDescriptionProvider.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/IConfigurationBlockDescriptionProvider.java 2011-06-20 16:09:37 UTC (rev 32220)
@@ -0,0 +1,22 @@
+/*******************************************************************************
+ * 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.cdi.ui.preferences;
+
+import org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock.SectionDescription;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public interface IConfigurationBlockDescriptionProvider {
+ public SectionDescription[] getSections();
+}
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/preferences/IConfigurationBlockDescriptionProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
14 years, 9 months
JBoss Tools SVN: r32219 - in trunk/common/plugins/org.jboss.tools.common.ui: src/org/jboss/tools/common/ui/preferences and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-06-20 12:07:10 -0400 (Mon, 20 Jun 2011)
New Revision: 32219
Modified:
trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java
Log:
JBIDE-9185
https://issues.jboss.org/browse/JBIDE-9185
JBIDE-9195
https://issues.jboss.org/browse/JBIDE-9195
Modified: trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF 2011-06-20 16:00:55 UTC (rev 32218)
+++ trunk/common/plugins/org.jboss.tools.common.ui/META-INF/MANIFEST.MF 2011-06-20 16:07:10 UTC (rev 32219)
@@ -12,7 +12,7 @@
org.eclipse.core.resources;bundle-version="3.7.100",
org.eclipse.ui.ide;bundle-version="3.7.0",
org.eclipse.jst.j2ee.ui;bundle-version="1.1.500",
- org.eclipse.ui.forms;bundle-version="3.5.100",
+ org.eclipse.ui.forms;bundle-version="3.5.100";visibility:=reexport,
org.eclipse.ui.workbench.texteditor;bundle-version="3.7.0",
org.eclipse.jface.text;bundle-version="3.7.0"
Export-Package: org.jboss.tools.common.ui,
Modified: trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java 2011-06-20 16:00:55 UTC (rev 32218)
+++ trunk/common/plugins/org.jboss.tools.common.ui/src/org/jboss/tools/common/ui/preferences/SeverityConfigurationBlock.java 2011-06-20 16:07:10 UTC (rev 32219)
@@ -11,6 +11,8 @@
package org.jboss.tools.common.ui.preferences;
+import java.util.ArrayList;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.jdt.core.JavaCore;
@@ -19,6 +21,7 @@
import org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock;
import org.eclipse.jdt.internal.ui.preferences.PreferencesMessages;
import org.eclipse.jdt.internal.ui.preferences.ScrolledPageContent;
+import org.eclipse.jdt.internal.ui.preferences.OptionsConfigurationBlock.Key;
import org.eclipse.jdt.internal.ui.wizards.IStatusChangeListener;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogSettings;
@@ -54,6 +57,8 @@
* );
* create required constant and property in SeverityPreferencesMessages,
* and add SECTION_A to array ALL_SECTIONS.
+ *
+ * Also, see ProblemSeveritiesConfigurationBlock
*
* @author Viacheslav Kabanovich
*/
@@ -77,6 +82,8 @@
protected PixelConverter fPixelConverter;
+ protected FilteredPreferenceTree fFilteredPrefTree;
+
public SeverityConfigurationBlock(IStatusChangeListener context,
IProject project, Key[] allKeys,
IWorkbenchPreferenceContainer container) {
@@ -91,56 +98,65 @@
protected Composite createStyleTabContent(Composite folder) {
int nColumns = 3;
+ GridLayout layout= new GridLayout(nColumns, false);
+ layout.marginHeight= 0;
+ layout.marginWidth= 0;
+ Composite c = new Composite(folder, 0);
+ c.setLayout(layout);
+ c.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- final ScrolledPageContent sc1 = new ScrolledPageContent(folder);
+ addMaxNumberOfMarkersField(c);
+ addWrongBuilderOrderField(c);
+ fFilteredPrefTree = new FilteredPreferenceTree(this, folder, getCommonDescription());
+ final ScrolledPageContent sc1 = fFilteredPrefTree.getScrolledPageContent();
+
Composite composite = sc1.getBody();
- addMaxNumberOfMarkersField(composite);
-
- addWrongBuilderOrderField(composite);
-
- GridLayout layout= new GridLayout(nColumns, false);
- layout.marginHeight= 0;
- layout.marginWidth= 0;
composite.setLayout(layout);
- Label description= new Label(composite, SWT.LEFT | SWT.WRAP);
- description.setFont(description.getFont());
- description.setText(getCommonDescription());
- description.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false, nColumns - 1, 1));
-
int defaultIndent = 0;
- SectionDescription[] sections = getAllSections();
- for (int i = 0; i < sections.length; i++) {
- SectionDescription section = sections[i];
- String label = section.label;
- ExpandableComposite excomposite = createStyleSection(composite, label, nColumns);
-
- Composite inner = new Composite(excomposite, SWT.NONE);
- inner.setFont(composite.getFont());
- inner.setLayout(new GridLayout(nColumns, false));
- excomposite.setClient(inner);
-
- 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);
- }
+ for (SectionDescription section: getAllSections()) {
+ createSection(null, section, composite, nColumns, defaultIndent);
}
- IDialogSettings section = getDialogSettings();
- restoreSectionExpansionStates(section);
+ restoreSectionExpansionStates(getDialogSettings());
return sc1;
}
+ protected Composite createInnerComposite(ExpandableComposite excomposite, int nColumns, Font font) {
+ Composite inner= new Composite(excomposite, SWT.NONE);
+ inner.setFont(font);
+ inner.setLayout(new GridLayout(nColumns, false));
+ excomposite.setClient(inner);
+ return inner;
+ }
+ protected void createSection(PreferenceTreeNode parent, SectionDescription section, Composite composite, int nColumns, int defaultIndent) {
+ String label = section.getLabel();
+
+ Key twistieKey = OptionsConfigurationBlock.getLocalKey(label.replace(' ', '_'));
+ PreferenceTreeNode treeSection = fFilteredPrefTree.addExpandableComposite(composite, label, nColumns, twistieKey, parent, false);
+ ExpandableComposite excomposite = getExpandableComposite(twistieKey);
+ Composite inner = createInnerComposite(excomposite, nColumns, composite.getFont());
+
+ for (SectionDescription s: section.getSections()) {
+ createSection(treeSection, s, inner, nColumns, defaultIndent);
+ }
+
+ for (OptionDescription option: section.getOptions()) {
+ label = option.label;
+ fFilteredPrefTree.addComboBox(inner, label, option.key, errorWarningIgnore, errorWarningIgnoreLabels, defaultIndent, treeSection);
+ }
+ }
+
protected void addMaxNumberOfMarkersField(Composite composite) {
Text text = addTextField(composite, SeverityPreferencesMessages.MAX_NUMBER_OF_MARKERS, getMaxNumberOfProblemsKey(), 0, 0);
GridData gd = (GridData) text.getLayoutData();
gd.widthHint = fPixelConverter.convertWidthInCharsToPixels(8);
gd.horizontalAlignment = GridData.BEGINNING;
+ text.setLayoutData(gd);
text.setTextLimit(6);
}
@@ -229,28 +245,44 @@
return;
}
- if (changedKey != null) {
- if (getMaxNumberOfProblemsKey().equals(changedKey)) {
- fContext.statusChanged(validateMaxNumberProblems());
- return;
- } else {
- return;
- }
+ if (changedKey == null || getMaxNumberOfProblemsKey().equals(changedKey)) {
+ fContext.statusChanged(validateMaxNumberProblems());
}
- fContext.statusChanged(validateMaxNumberProblems());
}
public static class SectionDescription {
- public String label;
- public OptionDescription[] options;
+ private String label;
+ private SectionDescription[] sections;
+ private OptionDescription[] options;
public SectionDescription(String label, String[][] optionLabelsAndKeys, String pluginId) {
+ this(label, new SectionDescription[0], optionLabelsAndKeys, pluginId);
+ }
+ public SectionDescription(String label, SectionDescription[] sections, String[][] optionLabelsAndKeys, String pluginId) {
this.label = label;
+ this.sections = sections;
options = new OptionDescription[optionLabelsAndKeys.length];
for (int i = 0; i < options.length; i++) {
options[i] = new OptionDescription(optionLabelsAndKeys[i][0], optionLabelsAndKeys[i][1], pluginId);
}
}
+ public String getLabel() {
+ return label;
+ }
+ public SectionDescription[] getSections() {
+ return sections;
+ }
+ public OptionDescription[] getOptions() {
+ return options;
+ }
+ public void collectKeys(ArrayList<Key> keys) {
+ for (SectionDescription s: sections) {
+ s.collectKeys(keys);
+ }
+ for (OptionDescription o: options) {
+ keys.add(o.key);
+ }
+ }
}
public static class OptionDescription {
14 years, 9 months
JBoss Tools SVN: r32218 - in trunk: common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: dazarov
Date: 2011-06-20 12:00:55 -0400 (Mon, 20 Jun 2011)
New Revision: 32218
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/MarkerAnnotationInfo.java
trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/MarkerProblemAnnotationHoverProcessor.java
trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/JSF2ComponentModelManager.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ComponentResolutionGenerator.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeAttrsProposal.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeComponentProposal.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2QuickFixProcessor.java
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ResourcesFolderProposal.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JSF2ValidatorTest.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/JSF2ResourcesScanner.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/SeamProblemMarkerResolutionGenerator.java
Log:
https://issues.jboss.org/browse/JBIDE-9138
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.ui/src/org/jboss/tools/cdi/ui/marker/CDIProblemMarkerResolutionGenerator.java 2011-06-20 16:00:55 UTC (rev 32218)
@@ -57,19 +57,30 @@
}
return new IMarkerResolution[] {};
}
+
+ /**
+ * return message id or -1 if impossible to find
+ * @param marker
+ * @return
+ */
+ private int getMessageID(IMarker marker)throws CoreException{
+ Integer attribute = ((Integer) marker.getAttribute(CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME));
+ if (attribute != null)
+ return attribute.intValue();
+ return -1;
+ }
+
private IMarkerResolution[] findResolutions(IMarker marker)
throws CoreException {
- Integer attribute = ((Integer) marker
- .getAttribute(CDIValidationErrorManager.MESSAGE_ID_ATTRIBUTE_NAME));
- if (attribute == null)
+
+ int messageId = getMessageID(marker);
+ if (messageId == -1)
return new IMarkerResolution[] {};
- int messageId = attribute.intValue();
-
final IFile file = (IFile) marker.getResource();
- attribute = ((Integer) marker.getAttribute(IMarker.CHAR_START));
+ Integer attribute = ((Integer) marker.getAttribute(IMarker.CHAR_START));
if (attribute == null)
return new IMarkerResolution[] {};
final int start = attribute.intValue();
@@ -352,8 +363,7 @@
public boolean hasResolutions(IMarker marker) {
try {
- if (findResolutions(marker).length != 0)
- return true;
+ return getMessageID(marker) >= 0;
} catch (CoreException ex) {
CDIUIPlugin.getDefault().logError(ex);
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/MarkerAnnotationInfo.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/MarkerAnnotationInfo.java 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/MarkerAnnotationInfo.java 2011-06-20 16:00:55 UTC (rev 32218)
@@ -11,34 +11,119 @@
package org.jboss.tools.common.text.xml;
import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.jface.text.quickassist.IQuickAssistInvocationContext;
+import org.eclipse.jface.text.quickassist.IQuickAssistProcessor;
+import org.eclipse.jface.text.quickassist.IQuickFixableAnnotation;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.SourceViewer;
import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
+import org.eclipse.wst.sse.ui.StructuredTextInvocationContext;
+import org.eclipse.wst.sse.ui.internal.correction.QuickFixRegistry;
+import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
public class MarkerAnnotationInfo {
- public final SimpleMarkerAnnotation annotation;
- public final Position position;
- public final ITextViewer viewer;
+ public final List<AnnotationInfo> infos;
+ public final SourceViewer viewer;
- public MarkerAnnotationInfo(SimpleMarkerAnnotation annotation, Position position, ITextViewer textViewer) {
- this.annotation= annotation;
- this.position= position;
- this.viewer= textViewer;
+ public MarkerAnnotationInfo(List<AnnotationInfo> infos, SourceViewer textViewer) {
+ this.infos = infos;
+ this.viewer = textViewer;
}
+
+ public List<ICompletionProposal> getCompletionProposals(AnnotationInfo info) {
- public QuickFixProposal[] getCompletionProposals() {
- ArrayList<QuickFixProposal> proposals = new ArrayList<QuickFixProposal>();
+ if(info.isTop())
+ return getMarkerProposals(info);
+ else
+ return getProposals(info);
+ }
+
+ public List<ICompletionProposal> getMarkerProposals(AnnotationInfo info) {
+ SimpleMarkerAnnotation annotation = (SimpleMarkerAnnotation)info.annotation;
+
+ ArrayList<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
+
IMarker marker = annotation.getMarker();
IMarkerResolution[] resolutions = IDE.getMarkerHelpRegistry().getResolutions(marker);
for (IMarkerResolution resolution : resolutions) {
proposals.add(new QuickFixProposal(resolution, marker));
}
- return proposals.toArray(new QuickFixProposal[proposals.size()]);
+ return proposals;
}
+
+ public List<ICompletionProposal> getProposals(AnnotationInfo info) {
+ TemporaryAnnotation annotation = (TemporaryAnnotation)info.annotation;
+
+ List<ICompletionProposal> allProposals = new ArrayList<ICompletionProposal>();
+ List<IQuickAssistProcessor> processors = new ArrayList<IQuickAssistProcessor>();
+ if (canFix(annotation)) {
+ Object o = annotation.getAdditionalFixInfo();
+ if (o instanceof IQuickAssistProcessor) {
+ processors.add((IQuickAssistProcessor)o);
+ }
+
+ // get all relevant quick fixes for this annotation
+ QuickFixRegistry registry = QuickFixRegistry.getInstance();
+ processors.addAll(Arrays.asList(registry.getQuickFixProcessors(annotation)));
+
+ // set up context
+ Map attributes = null;
+ attributes = annotation.getAttributes();
+ StructuredTextInvocationContext sseContext = new StructuredTextInvocationContext(viewer, info.position.getOffset(), info.position.getLength(), attributes);
+
+ // call each processor
+ for (int i = 0; i < processors.size(); ++i) {
+ List<ICompletionProposal> proposals = new ArrayList<ICompletionProposal>();
+ collectProposals((IQuickAssistProcessor) processors.get(i), annotation, sseContext, proposals);
+
+ if (proposals.size() > 0) {
+ allProposals.addAll(proposals);
+ }
+ }
+
+ }
+
+ return allProposals;
+ }
+
+ private void collectProposals(IQuickAssistProcessor processor, Annotation annotation, IQuickAssistInvocationContext invocationContext, List<ICompletionProposal> proposalsList) {
+ ICompletionProposal[] proposals = processor.computeQuickAssistProposals(invocationContext);
+ if (proposals != null && proposals.length > 0) {
+ proposalsList.addAll(Arrays.asList(proposals));
+ }
+ }
+
+ public boolean canFix(Annotation annotation) {
+ if (annotation instanceof IQuickFixableAnnotation) {
+ if (((IQuickFixableAnnotation) annotation).isQuickFixableStateSet()) {
+ return ((IQuickFixableAnnotation) annotation).isQuickFixable();
+ }
+ }
+ return false;
+ }
+
+ public static class AnnotationInfo {
+ public Annotation annotation;
+ public Position position;
+
+ public AnnotationInfo(Annotation annotation, Position position){
+ this.annotation = annotation;
+ this.position = position;
+ }
+
+ public boolean isTop(){
+ return annotation instanceof SimpleMarkerAnnotation;
+ }
+ }
}
Modified: trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/MarkerProblemAnnotationHoverProcessor.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/MarkerProblemAnnotationHoverProcessor.java 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/common/plugins/org.jboss.tools.common.text.xml/src/org/jboss/tools/common/text/xml/xpl/MarkerProblemAnnotationHoverProcessor.java 2011-06-20 16:00:55 UTC (rev 32218)
@@ -32,6 +32,7 @@
import org.eclipse.jface.text.ITextViewer;
import org.eclipse.jface.text.ITextViewerExtension;
import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jface.text.source.IAnnotationModel;
import org.eclipse.jface.text.source.SourceViewer;
@@ -59,9 +60,10 @@
import org.eclipse.ui.editors.text.EditorsUI;
import org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess;
import org.eclipse.ui.texteditor.SimpleMarkerAnnotation;
+import org.eclipse.wst.sse.ui.internal.reconcile.TemporaryAnnotation;
import org.eclipse.wst.sse.ui.internal.taginfo.ProblemAnnotationHoverProcessor;
import org.jboss.tools.common.text.xml.MarkerAnnotationInfo;
-import org.jboss.tools.common.text.xml.QuickFixProposal;
+import org.jboss.tools.common.text.xml.MarkerAnnotationInfo.AnnotationInfo;
import org.jboss.tools.common.text.xml.TextXMLMessages;
public class MarkerProblemAnnotationHoverProcessor extends ProblemAnnotationHoverProcessor implements ITextHoverExtension, ITextHoverExtension2{
@@ -74,6 +76,10 @@
}
public Object getHoverInfo2(ITextViewer viewer, IRegion hoverRegion) {
+ List<AnnotationInfo> all = new ArrayList<AnnotationInfo>();
+ List<AnnotationInfo> high = new ArrayList<AnnotationInfo>();
+ List<AnnotationInfo> low = new ArrayList<AnnotationInfo>();
+
IAnnotationModel model = ((SourceViewer) viewer).getAnnotationModel();
if (model != null) {
Iterator<Annotation> iterator = model.getAnnotationIterator();
@@ -85,10 +91,19 @@
Position position = model.getPosition(annotation);
if (position.overlapsWith(hoverRegion.getOffset(), hoverRegion.getLength())) {
- return new MarkerAnnotationInfo((SimpleMarkerAnnotation)annotation, position, viewer);
+ AnnotationInfo info = new AnnotationInfo(annotation, position);
+ if(info.isTop())
+ high.add(info);
+ else
+ low.add(info);
}
}
+ all.addAll(high);
+ all.addAll(low);
+
}
+ if(all.size() > 0)
+ return new MarkerAnnotationInfo(all, (SourceViewer) viewer);
return null;
}
@@ -99,7 +114,7 @@
}
protected boolean isAnnotationValid(Annotation annotation) {
- if(annotation instanceof SimpleMarkerAnnotation)
+ if(annotation instanceof SimpleMarkerAnnotation || annotation instanceof TemporaryAnnotation)
return true;
return false;
}
@@ -175,64 +190,32 @@
}
protected void createContent() {
- createInfo(parent, getAnnotationInfo().annotation);
- setDecoration(parent, parent.getForeground(), parent.getBackground(), JFaceResources.getDialogFont());
+ boolean first = true;
- QuickFixProposal[] proposals = getAnnotationInfo().getCompletionProposals();
- if (proposals.length > 0)
- createControl(parent, proposals);
-
- parent.layout(true);
- }
-
- private void createControl(Composite parent, QuickFixProposal[] proposals) {
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- GridLayout layout2 = new GridLayout(1, false);
- layout2.marginHeight = 0;
- layout2.marginWidth = 0;
- layout2.verticalSpacing = 2;
- composite.setLayout(layout2);
-
- Label separator= new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
- GridData gridData= new GridData(SWT.FILL, SWT.CENTER, true, false);
- separator.setLayoutData(gridData);
-
- Label quickFixLabel= new Label(composite, SWT.NONE);
- GridData layoutData= new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
- layoutData.horizontalIndent = 4;
- quickFixLabel.setLayoutData(layoutData);
- String text;
- if (proposals.length == 1) {
- text= TextXMLMessages.SINGLE_QUICK_FIX;
- } else {
- text= NLS.bind(TextXMLMessages.MULTIPLE_QUICK_FIX, proposals.length);
- }
- quickFixLabel.setText(text);
-
- setDecoration(composite, parent.getForeground(), parent.getBackground(), JFaceResources.getDialogFont());
- createList(composite, proposals);
- }
-
- private void createList(Composite parent, QuickFixProposal[] proposals) {
final ScrolledComposite scrolledComposite= new ScrolledComposite(parent, SWT.V_SCROLL | SWT.H_SCROLL);
GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
scrolledComposite.setLayoutData(gridData);
scrolledComposite.setExpandVertical(false);
scrolledComposite.setExpandHorizontal(false);
-
+
Composite composite = new Composite(scrolledComposite, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
- GridLayout layout = new GridLayout(2, false);
+ GridLayout layout = new GridLayout(1, false);
layout.marginLeft = 5;
layout.verticalSpacing = 2;
composite.setLayout(layout);
+
- List<Link> list = new ArrayList<Link>();
- for (QuickFixProposal proposal : proposals) {
- list.add(createLink(composite, proposal));
+ for(AnnotationInfo info : getAnnotationInfo().infos){
+ createInfo(composite, info.annotation, first);
+ if(first)
+ first = false;
+
+ List<ICompletionProposal> proposals = getAnnotationInfo().getCompletionProposals(info);
+ if (proposals.size() > 0)
+ createControl(composite, proposals);
}
-
+
scrolledComposite.setContent(composite);
setDecoration(scrolledComposite, parent.getForeground(), parent.getBackground(), JFaceResources.getDialogFont());
@@ -252,9 +235,45 @@
}
gridData.heightHint = contentSize.y - scrollBarHeight;
}
+
+ parent.layout(true);
}
+
+ private void createControl(Composite parent, List<ICompletionProposal> proposals) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ GridLayout layout2 = new GridLayout(1, false);
+ layout2.verticalSpacing = 2;
+ layout2.marginLeft = 5;
+ composite.setLayout(layout2);
- private Link createLink(Composite parent, final QuickFixProposal proposal) {
+ Label separator= new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridData gridData= new GridData(SWT.FILL, SWT.CENTER, true, false);
+ separator.setLayoutData(gridData);
+
+ Label quickFixLabel= new Label(composite, SWT.NONE);
+ GridData layoutData= new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
+ layoutData.horizontalIndent = 4;
+ quickFixLabel.setLayoutData(layoutData);
+ String text;
+ if (proposals.size() == 1) {
+ text= TextXMLMessages.SINGLE_QUICK_FIX;
+ } else {
+ text= NLS.bind(TextXMLMessages.MULTIPLE_QUICK_FIX, proposals.size());
+ }
+ quickFixLabel.setText(text);
+
+ createList(composite, proposals);
+ }
+
+ private void createList(Composite parent, List<ICompletionProposal> proposals) {
+ List<Link> list = new ArrayList<Link>();
+ for (ICompletionProposal proposal : proposals) {
+ list.add(createLink(parent, proposal));
+ }
+ }
+
+ private Link createLink(Composite parent, final ICompletionProposal proposal) {
Link proposalLink = new Link(parent, SWT.WRAP);
GridData layoutData = new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
String linkText = proposal.getDisplayString();
@@ -265,7 +284,7 @@
}
public void mouseDown(MouseEvent e) {
- fix(proposal, info.viewer, info.position.offset);
+ fix(proposal, info.viewer, info.infos.get(0).position.getOffset());
}
public void mouseUp(MouseEvent e) {
@@ -274,7 +293,7 @@
return proposalLink;
}
- private void fix(QuickFixProposal p, ITextViewer viewer, int offset) {
+ private void fix(ICompletionProposal p, ITextViewer viewer, int offset) {
dispose();
IRewriteTarget target = null;
@@ -302,7 +321,13 @@
}
}
- private void createInfo(Composite parent, final Annotation annotation) {
+ private void createInfo(Composite parent, final Annotation annotation, boolean firstElement) {
+ if(!firstElement){
+ Label separator= new Label(parent, SWT.SEPARATOR | SWT.HORIZONTAL);
+ GridData gridData= new GridData(SWT.FILL, SWT.CENTER, true, false);
+ separator.setLayoutData(gridData);
+ }
+
Composite composite = new Composite(parent, SWT.NONE);
composite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false));
GridLayout layout = new GridLayout(2, false);
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2011-06-20 16:00:55 UTC (rev 32218)
@@ -731,13 +731,13 @@
</validator>
</extension>
-->
- <extension
+ <!--extension
point="org.eclipse.wst.sse.ui.quickFixProcessor">
<quickFixProcessor
class="org.jboss.tools.jsf.web.validation.jsf2.action.JSF2QuickFixProcessor"
problemType="org.jboss.tools.jsf.jsf2problemmarker">
</quickFixProcessor>
- </extension>
+ </extension-->
<extension
point="org.eclipse.ui.editors.annotationTypes">
<type
@@ -903,5 +903,10 @@
name="%CreateJSF2Composite"
defaultHandler="org.jboss.tools.jsf.web.commands.CreateJSF2CompositeCommandHandler"/>
</extension>
+ <extension point="org.eclipse.ui.ide.markerResolution">
+ <markerResolutionGenerator
+ markerType="org.jboss.tools.jsf.compositeproblem"
+ class="org.jboss.tools.jsf.web.validation.jsf2.action.JSF2ComponentResolutionGenerator"/>
+ </extension>
</plugin>
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/JSF2ComponentModelManager.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/JSF2ComponentModelManager.java 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/jsf2/model/JSF2ComponentModelManager.java 2011-06-20 16:00:55 UTC (rev 32218)
@@ -11,16 +11,20 @@
package org.jboss.tools.jsf.jsf2.model;
-import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
+
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.jdt.internal.core.JarEntryFile;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.DocumentProviderRegistry;
+import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.wst.html.core.internal.encoding.HTMLModelLoader;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
@@ -35,6 +39,7 @@
import org.eclipse.wst.xml.core.internal.provisional.format.DocumentNodeFormatter;
import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
+import org.jboss.tools.jst.jsp.jspeditor.dnd.PaletteTaglibInserter;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.Node;
@@ -71,13 +76,26 @@
@Override
protected void edit(IDOMModel model) throws CoreException,
IOException {
- IDOMDocument document = model.getDocument();
- updateJSF2CompositeComponent(document, attrNames);
- IStructuredDocument structuredDocument = document
- .getStructuredDocument();
- String text = structuredDocument.getText();
- model.reload(new ByteArrayInputStream(text.getBytes()));
- model.save();
+ FileEditorInput input = new FileEditorInput(getFile());
+ IDocumentProvider provider = DocumentProviderRegistry.getDefault().getDocumentProvider(input);
+
+ provider.connect(input);
+
+ IDocument document = provider.getDocument(input);
+
+ updateJSF2CompositeComponent(model.getDocument(), attrNames);
+
+ provider.aboutToChange(input);
+ provider.saveDocument(new NullProgressMonitor(), input, document, true);
+ provider.disconnect(input);
+ //IDOMDocument document = model.getDocument();
+ //updateJSF2CompositeComponent(document, attrNames);
+ //IStructuredDocument structuredDocument = document
+ // .getStructuredDocument();
+ //String text = structuredDocument.getText();
+ // //getFile().setContents(new ByteArrayInputStream(text.getBytes()),true,false,null);
+ //model.reload(new ByteArrayInputStream(text.getBytes()));
+ //model.save();
}
});
return file;
@@ -167,13 +185,13 @@
if (element == null) {
return null;
}
- if (!"html".equals(element.getNodeName())) { //$NON-NLS-1$
- return null;
- }
- ElementImpl elementImpl = (ElementImpl) element;
- if (!"http://www.w3.org/1999/xhtml".equals(elementImpl.getNamespaceURI())) { //$NON-NLS-1$
- return null;
- }
+ //if (!"html".equals(element.getNodeName())) { //$NON-NLS-1$
+ //return null;
+ //}
+ //ElementImpl elementImpl = (ElementImpl) element;
+ //if (!"http://www.w3.org/1999/xhtml".equals(elementImpl.getNamespaceURI())) { //$NON-NLS-1$
+ // return null;
+ //}
IDOMElement[] interfaceElement = new IDOMElement[1];
findInterfaceComponent(element, interfaceElement);
return interfaceElement[0];
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/composite/CompositeComponentValidator.java 2011-06-20 16:00:55 UTC (rev 32218)
@@ -16,6 +16,7 @@
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
@@ -73,6 +74,11 @@
public static final String SHORT_ID = "jboss.jsf.core"; //$NON-NLS-1$
private static final String COMPOSITE_COMPONENT_URI_PREFIX = "http://java.sun.com/jsf/composite/"; //$NON-NLS-1$
+
+ public static final String MESSAGE_ID_ATTRIBUTE_NAME = "JSF2_message_id"; //$NON-NLS-1$
+
+ public static final int UNKNOWN_COMPOSITE_COMPONENT_NAME_ID = 1;
+ public static final int UNKNOWN_COMPOSITE_COMPONENT_ATTRIBUTE_ID = 2;
private IProject currentProject;
private IContainer webRootFolder;
@@ -225,13 +231,14 @@
if(tagName==null) {
return;
}
- ITagLibrary[] libs = KbProjectFactory.getKbProject(file.getProject(), true).getTagLibraries(xmlComponent.getNamespaceURI());
+ String tagLibUri = xmlComponent.getNamespaceURI();
+ // Save the link between the composition component URI and the validating page
+ getValidationContext().addLinkedCoreResource(SHORT_ID, tagLibUri + ":" + tagName, file.getFullPath(), false);
+
+ ITagLibrary[] libs = KbProjectFactory.getKbProject(file.getProject(), true).getTagLibraries(tagLibUri);
if(libs.length>0) {
IComponent kbComponent = libs[0].getComponent(tagName);
if(kbComponent!=null) {
- // Save the link between the composition component URI and the validating page
- getValidationContext().addLinkedCoreResource(SHORT_ID, libs[0].getURI() + ":" + kbComponent.getName(), file.getFullPath(), false);
-
NamedNodeMap map = xmlComponent.getAttributes();
for (int i = 0; i < map.getLength(); i++) {
Node xmlAttribute = map.item(i);
@@ -241,7 +248,7 @@
IndexedRegion region = (IndexedRegion)xmlAttribute;
int offset = region.getStartOffset();
int length = attributeName.length();
- addError(JSFValidationMessage.UNKNOWN_COMPOSITE_COMPONENT_ATTRIBUTE, JSFSeverityPreferences.UNKNOWN_COMPOSITE_COMPONENT_ATTRIBUTE, new String[]{attributeName, tagName}, length, offset, file);
+ addError(JSFValidationMessage.UNKNOWN_COMPOSITE_COMPONENT_ATTRIBUTE, JSFSeverityPreferences.UNKNOWN_COMPOSITE_COMPONENT_ATTRIBUTE, new String[]{attributeName, tagName}, length, offset, file, UNKNOWN_COMPOSITE_COMPONENT_ATTRIBUTE_ID);
}
}
} else {
@@ -263,7 +270,7 @@
IndexedRegion region = (IndexedRegion)xmlComponent;
int offset = region.getStartOffset();
int length = xmlComponent.getNodeName().length() + 1;
- addError(JSFValidationMessage.UNKNOWN_COMPOSITE_COMPONENT_NAME, JSFSeverityPreferences.UNKNOWN_COMPOSITE_COMPONENT_NAME, new String[]{tagName}, length, offset, file);
+ addError(JSFValidationMessage.UNKNOWN_COMPOSITE_COMPONENT_NAME, JSFSeverityPreferences.UNKNOWN_COMPOSITE_COMPONENT_NAME, new String[]{tagName}, length, offset, file, UNKNOWN_COMPOSITE_COMPONENT_NAME_ID);
}
}
@@ -386,4 +393,17 @@
public String getMarkerType() {
return PROBLEM_TYPE;
}
+
+ public IMarker addError(String message, String preferenceKey,
+ String[] messageArguments, int length, int offset, IResource target, int messageId) {
+ IMarker marker = addError(message, preferenceKey, messageArguments, length, offset, target);
+ try {
+ if(marker!=null) {
+ marker.setAttribute(MESSAGE_ID_ATTRIBUTE_NAME, new Integer(messageId));
+ }
+ } catch(CoreException e) {
+ JSFModelPlugin.getDefault().logError(e);
+ }
+ return marker;
+ }
}
\ No newline at end of file
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ComponentResolutionGenerator.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ComponentResolutionGenerator.java 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ComponentResolutionGenerator.java 2011-06-20 16:00:55 UTC (rev 32218)
@@ -11,13 +11,23 @@
package org.jboss.tools.jsf.web.validation.jsf2.action;
+import java.io.IOException;
+
+import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.ui.IMarkerResolution;
-import org.eclipse.ui.IMarkerResolutionGenerator;
+import org.eclipse.ui.IMarkerResolutionGenerator2;
+import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jsf.JSFModelPlugin;
-import org.jboss.tools.jsf.web.validation.jsf2.JSF2XMLValidator;
-import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
+import org.jboss.tools.jsf.web.validation.composite.CompositeComponentValidator;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
/**
*
@@ -26,30 +36,103 @@
*/
public class JSF2ComponentResolutionGenerator implements
- IMarkerResolutionGenerator {
+ IMarkerResolutionGenerator2 {
+
+ public static final String JSF2_URI_PREFIX = "http://java.sun.com/jsf/composite"; //$NON-NLS-1$
public IMarkerResolution[] getResolutions(IMarker marker) {
try {
- String markerType = marker.getType();
- if (markerType == null
- || !JSF2XMLValidator.JSF2_PROBLEM_ID.equals(markerType)) {
- return new IMarkerResolution[0];
- }
- String fixType = (String) marker
- .getAttribute(JSF2ValidatorConstants.JSF2_TYPE_KEY);
- if (JSF2ValidatorConstants.JSF2_COMPOSITE_COMPONENT_TYPE.equals(fixType)) {
- return new IMarkerResolution[] { new JSF2CompositeComponentProposal(marker) };
+ int messageId = getMessageID(marker);
+ if (messageId == -1)
+ return new IMarkerResolution[] {};
+
+ final IFile file = (IFile) marker.getResource();
+
+ Integer attribute = ((Integer) marker.getAttribute(IMarker.CHAR_START));
+ if (attribute == null)
+ return new IMarkerResolution[] {};
+ final int start = attribute.intValue();
+
+ IModelManager manager = StructuredModelManager.getModelManager();
+ if(manager != null){
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForRead(file);
+ if (model instanceof IDOMModel) {
+ Node node = Utils.findNodeForOffset(((IDOMModel) model).getDocument(), start);
+
+ String tagName = node.getLocalName();
+ String attrName = "";
+ if(node instanceof IDOMAttr){
+ attrName = node.getLocalName();
+ node = ((IDOMAttr)node).getOwnerElement();
+ tagName = node.getLocalName();
+ }
+
+ if (messageId == CompositeComponentValidator.UNKNOWN_COMPOSITE_COMPONENT_NAME_ID) {
+ return new IMarkerResolution[] { new JSF2CompositeComponentProposal(marker.getResource(), getComponentPath(node), tagName, getAttributes(node)) };
+ }else if(messageId == CompositeComponentValidator.UNKNOWN_COMPOSITE_COMPONENT_ATTRIBUTE_ID){
+
+ return new IMarkerResolution[] { new JSF2CompositeAttrsProposal(marker.getResource(), getComponentPath(node), tagName, getAttributes(node), attrName) };
+ }
+ }
+ } catch (CoreException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ } catch (IOException e) {
+ JSFModelPlugin.getPluginLog().logError(e);
+ } finally {
+ if (model != null) {
+ model.releaseFromRead();
+ }
}
- if (JSF2ValidatorConstants.JSF2_FIXABLE_ATTR_TYPE.equals(fixType)) {
- return new IMarkerResolution[] { new JSF2CompositeAttrsProposal(marker) };
- }
- if (JSF2ValidatorConstants.JSF2_URI_TYPE.equals(fixType)) {
- return new IMarkerResolution[] { new JSF2ResourcesFolderProposal(marker) };
- }
+ }
} catch (CoreException e) {
JSFModelPlugin.getPluginLog().logError(e);
}
return new IMarkerResolution[0];
}
+
+ private String getComponentPath(Node node){
+ String path;
+ String uriString = node.getNamespaceURI();
+ String relativeLocation = uriString.replaceFirst(
+ JSF2_URI_PREFIX, ""); //$NON-NLS-1$
+ String nodeName = node.getLocalName();
+ path = relativeLocation + "/" + nodeName + ".xhtml"; //$NON-NLS-1$ //$NON-NLS-2$
+ return path;
+ }
+
+ private String[] getAttributes(Node node){
+ NamedNodeMap nm = node.getAttributes();
+ String[] attributes = new String[nm.getLength()];
+ for(int i = 0; i < nm.getLength(); i++){
+ attributes[i] = nm.item(i).getLocalName();
+ }
+ return attributes;
+ }
+
+ /**
+ * return message id or -1 if impossible to find
+ * @param marker
+ * @return
+ */
+ private int getMessageID(IMarker marker)throws CoreException{
+ Integer attribute = ((Integer) marker.getAttribute(CompositeComponentValidator.MESSAGE_ID_ATTRIBUTE_NAME));
+ if (attribute != null)
+ return attribute.intValue();
+ return -1;
+ }
+
+
+ public boolean hasResolutions(IMarker marker) {
+ try {
+ return getMessageID(marker) >= 0;
+ } catch (CoreException ex) {
+ JSFModelPlugin.getDefault().logError(ex);
+ }
+ return false;
+ }
+
+
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeAttrsProposal.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeAttrsProposal.java 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeAttrsProposal.java 2011-06-20 16:00:55 UTC (rev 32218)
@@ -17,8 +17,11 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.jsf.JSFModelPlugin;
@@ -33,57 +36,40 @@
*
*/
-public class JSF2CompositeAttrsProposal extends JSF2AbstractProposal {
-
+public class JSF2CompositeAttrsProposal implements IMarkerResolution {
+ private IResource resource;
private String componentPath = null;
private String[] attrs = null;
private String elementName = null;
private String attrName="";
- public JSF2CompositeAttrsProposal(IMarker marker) {
- super(marker.getResource());
- try {
- this.elementName=(String) marker.getAttribute(JSF2ResourceUtil.JSF2_COMPONENT_NAME);
- this.componentPath=(String) marker.getAttribute(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY);
- this.attrName=(String)marker.getAttribute(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY);
- } catch (CoreException e) {
- JSFModelPlugin.getPluginLog().logError(e);
- }
- }
- public JSF2CompositeAttrsProposal(IResource validateResource,
- String compPath, String[] attrs,String attrName,String elementName) {
- super(validateResource);
+ public JSF2CompositeAttrsProposal(IResource resource, String compPath, String elementName, String[] attrs, String attrName) {
+ this.resource = resource;
this.componentPath = compPath;
this.attrs = attrs;
this.attrName = attrName;
this.elementName=elementName;
}
- public String getDisplayString() {
- return MessageFormat.format(JSFUIMessages.Create_JSF_2_Interface_Attr,attrName,elementName,JSF2ResourceUtil.calculateProjectRelativeJSF2ResourceProposal(validateResource.getProject())+componentPath);
+ @Override
+ public String getLabel() {
+ return MessageFormat.format(JSFUIMessages.Create_JSF_2_Interface_Attr, attrName, elementName, componentPath);
}
@Override
- protected void runWithMarker(IMarker marker) throws CoreException {
- if (marker != null) {
- validateResource = marker.getResource();
- Map<?, ?> attrsMap = marker.getAttributes();
- Object object = attrsMap
- .get(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY);
- componentPath = (String) object;
- attrs = new String[] { (String) marker
- .getAttribute(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY) };
+ public void run(IMarker marker) {
+ try{
+ final IFile createdFile = JSF2ResourceUtil
+ .createCompositeComponentFile(resource.getProject(),
+ new Path(componentPath), attrs);
+ if (createdFile != null) {
+ IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage(), createdFile);
+ }
+ }catch(Exception ex){
+ JSFModelPlugin.getPluginLog().logError(ex);
}
- final IFile createdFile = JSF2ResourceUtil
- .createCompositeComponentFile(validateResource.getProject(),
- new Path(componentPath), attrs);
- validateResource.getProject().deleteMarkers(
- JSF2XMLValidator.JSF2_PROBLEM_ID, false, 1);
- if (createdFile != null) {
- IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getActivePage(), createdFile);
- }
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeComponentProposal.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeComponentProposal.java 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2CompositeComponentProposal.java 2011-06-20 16:00:55 UTC (rev 32218)
@@ -12,23 +12,20 @@
package org.jboss.tools.jsf.web.validation.jsf2.action;
import java.text.MessageFormat;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.ui.IMarkerResolution;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
import org.jboss.tools.jsf.messages.JSFUIMessages;
-import org.jboss.tools.jsf.web.validation.jsf2.JSF2XMLValidator;
-import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
/**
*
@@ -36,75 +33,38 @@
*
*/
-public class JSF2CompositeComponentProposal extends JSF2AbstractProposal {
-
+public class JSF2CompositeComponentProposal implements IMarkerResolution {
+ private IResource resource;
private String componentPath = null;
private String[] attrs = null;
private String elementName;
- public JSF2CompositeComponentProposal(IMarker marker) {
- super(marker.getResource());
- try {
- this.elementName=(String) marker.getAttribute(JSF2ResourceUtil.JSF2_COMPONENT_NAME);
- this.componentPath=(String) marker.getAttribute(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY);
- } catch (CoreException e) {
- JSFModelPlugin.getPluginLog().logError(e);
- }
- }
-
- public JSF2CompositeComponentProposal(IResource validateResource,
- String compPath, String[] attrs, String elementName) {
- super(validateResource);
+ public JSF2CompositeComponentProposal(IResource resource, String compPath, String elementName, String[] attrs) {
+ this.resource = resource;
this.componentPath = compPath;
this.attrs = attrs;
this.elementName=elementName;
}
- @SuppressWarnings("unchecked")
- private String[] getAttributes(IMarker marker) throws CoreException {
- Map attrsMap = marker.getAttributes();
- if (attrsMap != null) {
- Set<String> set = new HashSet<String>(0);
- Set<Entry> entries = attrsMap.entrySet();
- for (Entry entry : entries) {
- String key = (String) entry.getKey();
- if (key.startsWith(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY)) {
- set.add((String) entry.getValue());
- }
- }
- return set.toArray(new String[0]);
- }
- return null;
- }
-
- public String getDisplayString() {
- String projectResourceRelativePath = JSF2ResourceUtil.calculateProjectRelativeJSF2ResourceProposal(validateResource.getProject())
- +componentPath;
+ @Override
+ public String getLabel() {
return MessageFormat.format(JSFUIMessages.Create_JSF_2_Composite_Component,elementName,
- projectResourceRelativePath);
+ componentPath);
}
- @SuppressWarnings("unchecked")
@Override
- protected void runWithMarker(IMarker marker) throws CoreException {
- if (marker != null) {
- validateResource = marker.getResource();
- Map attrsMap = marker.getAttributes();
- Object object = attrsMap
- .get(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY);
- componentPath = (String) object;
- attrs = getAttributes(marker);
+ public void run(IMarker marker) {
+ try{
+ final IFile createdFile = JSF2ResourceUtil
+ .createCompositeComponentFile(resource.getProject(),
+ new Path(componentPath), attrs);
+ if (createdFile != null) {
+ IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
+ .getActivePage(), createdFile);
+ }
+ }catch(CoreException ex){
+ JSFModelPlugin.getPluginLog().logError(ex);
}
- final IFile createdFile = JSF2ResourceUtil
- .createCompositeComponentFile(validateResource.getProject(),
- new Path(componentPath), attrs);
- validateResource.getProject().deleteMarkers(
- JSF2XMLValidator.JSF2_PROBLEM_ID, false, 1);
- if (createdFile != null) {
- IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow()
- .getActivePage(), createdFile);
- }
-
}
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2QuickFixProcessor.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2QuickFixProcessor.java 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2QuickFixProcessor.java 2011-06-20 16:00:55 UTC (rev 32218)
@@ -42,37 +42,37 @@
public ICompletionProposal[] computeQuickAssistProposals(
IQuickAssistInvocationContext invocationContext) {
- if (invocationContext instanceof StructuredTextInvocationContext) {
- StructuredTextInvocationContext context = (StructuredTextInvocationContext) invocationContext;
- String type = (String) context
- .getAttribute(JSF2ValidatorConstants.JSF2_TYPE_KEY);
- IResource resource = ResourcesPlugin.getWorkspace().getRoot()
- .findMember(
- (String) context
- .getAttribute("validateResourcePath")); //$NON-NLS-1$
- String compPath = (String) context
- .getAttribute(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY);
-
- if (type.equals(JSF2ValidatorConstants.JSF2_FIXABLE_ATTR_TYPE)) {
- String[] attrs = new String[] { (String) context
- .getAttribute(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY) };
- ICompletionProposal proposal = new JSF2CompositeAttrsProposal(
- resource, compPath, attrs,(String)context.getAttribute(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY),
- (String)context.getAttribute(JSF2ResourceUtil.JSF2_COMPONENT_NAME));
- return new ICompletionProposal[] { proposal };
- } else if (type
- .equals(JSF2ValidatorConstants.JSF2_COMPOSITE_COMPONENT_TYPE)) {
- ICompletionProposal proposal = new JSF2CompositeComponentProposal(
- resource, compPath, retriveAttrsFromContext(context),(String)context.getAttribute(JSF2ResourceUtil.JSF2_COMPONENT_NAME));
- return new ICompletionProposal[] { proposal };
- } else if (type.equals(JSF2ValidatorConstants.JSF2_URI_TYPE)) {
- String uriPath = (String) context
- .getAttribute(JSF2ValidatorConstants.JSF2_URI_NAME_KEY);
- ICompletionProposal proposal = new JSF2ResourcesFolderProposal(
- resource, uriPath,(String)context.getAttribute(JSF2ValidatorConstants.JSF2_URI_NAME_KEY));
- return new ICompletionProposal[] { proposal };
- }
- }
+// if (invocationContext instanceof StructuredTextInvocationContext) {
+// StructuredTextInvocationContext context = (StructuredTextInvocationContext) invocationContext;
+// String type = (String) context
+// .getAttribute(JSF2ValidatorConstants.JSF2_TYPE_KEY);
+// IResource resource = ResourcesPlugin.getWorkspace().getRoot()
+// .findMember(
+// (String) context
+// .getAttribute("validateResourcePath")); //$NON-NLS-1$
+// String compPath = (String) context
+// .getAttribute(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY);
+//
+// if (type.equals(JSF2ValidatorConstants.JSF2_FIXABLE_ATTR_TYPE)) {
+// String[] attrs = new String[] { (String) context
+// .getAttribute(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY) };
+// ICompletionProposal proposal = new JSF2CompositeAttrsProposal(
+// resource, compPath, attrs,(String)context.getAttribute(JSF2ValidatorConstants.JSF2_ATTR_NAME_KEY),
+// (String)context.getAttribute(JSF2ResourceUtil.JSF2_COMPONENT_NAME));
+// return new ICompletionProposal[] { proposal };
+// } else if (type
+// .equals(JSF2ValidatorConstants.JSF2_COMPOSITE_COMPONENT_TYPE)) {
+// ICompletionProposal proposal = new JSF2CompositeComponentProposal(
+// resource, compPath, retriveAttrsFromContext(context),(String)context.getAttribute(JSF2ResourceUtil.JSF2_COMPONENT_NAME));
+// return new ICompletionProposal[] { proposal };
+// } else if (type.equals(JSF2ValidatorConstants.JSF2_URI_TYPE)) {
+// String uriPath = (String) context
+// .getAttribute(JSF2ValidatorConstants.JSF2_URI_NAME_KEY);
+// ICompletionProposal proposal = new JSF2ResourcesFolderProposal(
+// resource, uriPath,(String)context.getAttribute(JSF2ValidatorConstants.JSF2_URI_NAME_KEY));
+// return new ICompletionProposal[] { proposal };
+// }
+// }
return null;
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ResourcesFolderProposal.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ResourcesFolderProposal.java 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/web/validation/jsf2/action/JSF2ResourcesFolderProposal.java 2011-06-20 16:00:55 UTC (rev 32218)
@@ -15,12 +15,13 @@
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.ui.IMarkerResolution;
import org.jboss.tools.jsf.JSFModelPlugin;
import org.jboss.tools.jsf.jsf2.util.JSF2ResourceUtil;
import org.jboss.tools.jsf.messages.JSFUIMessages;
-import org.jboss.tools.jsf.web.validation.jsf2.JSF2XMLValidator;
-import org.jboss.tools.jsf.web.validation.jsf2.util.JSF2ValidatorConstants;
/**
*
@@ -28,47 +29,34 @@
*
*/
-public class JSF2ResourcesFolderProposal extends JSF2AbstractProposal {
-
+public class JSF2ResourcesFolderProposal implements IMarkerResolution {
+ private IResource resource;
private String componentPath = null;
private String URL=null;
- public JSF2ResourcesFolderProposal(IMarker marker) {
- super(marker.getResource());
- try {
- this.componentPath=(String) marker.getAttribute(JSF2ResourceUtil.COMPONENT_RESOURCE_PATH_KEY);
- this.URL = (String) marker.getAttribute(JSF2ValidatorConstants.JSF2_URI_NAME_KEY);
- } catch (CoreException e) {
- JSFModelPlugin.getPluginLog().logError(e);
- }
- }
-
- public JSF2ResourcesFolderProposal(IResource validateResource, String compPath,String URL) {
- super(validateResource);
+ public JSF2ResourcesFolderProposal(IResource validateResource, String compPath, String URL) {
+ this.resource = validateResource;
this.componentPath = compPath;
this.URL = URL;
}
- public String getDisplayString() {
+ @Override
+ public String getLabel() {
String folderName="";
if(componentPath!=null){
folderName=componentPath.replaceFirst(JSF2ResourceUtil.JSF2_URI_PREFIX, "").trim();
}
return MessageFormat.format(JSFUIMessages.Create_JSF_2_Resources_Folder,
- JSF2ResourceUtil.calculateProjectRelativeJSF2ResourceProposal(validateResource.getProject())+folderName,URL);
+ JSF2ResourceUtil.calculateProjectRelativeJSF2ResourceProposal(resource.getProject())+folderName,URL);
}
@Override
- protected void runWithMarker(IMarker marker) throws CoreException {
- if (marker != null) {
- componentPath = (String) marker
- .getAttribute(JSF2ValidatorConstants.JSF2_URI_NAME_KEY);
- validateResource = marker.getResource();
+ public void run(IMarker marker) {
+ try{
+ JSF2ResourceUtil.createResourcesFolderByNameSpace(resource.getProject(), componentPath);
+ }catch(CoreException ex){
+ JSFModelPlugin.getPluginLog().logError(ex);
}
- JSF2ResourceUtil.createResourcesFolderByNameSpace(validateResource
- .getProject(), componentPath);
- validateResource.getProject().deleteMarkers(
- JSF2XMLValidator.JSF2_PROBLEM_ID, false, 1);
}
}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JSF2ValidatorTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JSF2ValidatorTest.java 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JSF2ValidatorTest.java 2011-06-20 16:00:55 UTC (rev 32218)
@@ -6,6 +6,8 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IncrementalProjectBuilder;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.swt.custom.StyledText;
import org.eclipse.ui.IEditorInput;
import org.eclipse.ui.part.FileEditorInput;
@@ -21,38 +23,52 @@
*
*/
public class JSF2ValidatorTest extends VpeTest{
-
+
private static final String MARKER_TYPE="org.jboss.tools.jsf.jsf2problemmarker"; //$NON-NLS-1$
public JSF2ValidatorTest(String name) {
super(name);
}
public void testCAforIncludeTaglibInInenerNodes() throws Throwable {
- // TODO Fix this test. See JBIDE-9088
-// IFile file = (IFile) TestUtil.getComponentPath("JBIDE/6922/jbide6922.xhtml", //$NON-NLS-1$
-// JsfAllTests.IMPORT_JSF_20_PROJECT_NAME);
-// IEditorInput input = new FileEditorInput(file);
-// JSPMultiPageEditor multiPageEditor = openEditor(input);
-// IMarker[] problemMarkers = file.findMarkers(MARKER_TYPE, true, IResource.DEPTH_INFINITE);
-// assertEquals("There shouldn't be any problems on page", 0,problemMarkers.length); //$NON-NLS-1$
-// StyledText styledText = multiPageEditor.getSourceEditor().getTextViewer()
-// .getTextWidget();
-// int caretOffcet = TestUtil.getLinePositionOffcet(multiPageEditor.getSourceEditor().getTextViewer(), 4, 5);
-// styledText.setCaretOffset(caretOffcet);
-// styledText.insert("xmlns:test=\"http://java.sun.com/jsf/composite/test\""); //$NON-NLS-1$
-// TestUtil.delay(1200);
-// TestUtil.waitForJobs();
-// problemMarkers = file.findMarkers(MARKER_TYPE, true, IResource.DEPTH_INFINITE);
-// assertEquals("res folder marker is expected", 1, problemMarkers.length); //$NON-NLS-1$
-// String message = (String) problemMarkers[0].getAttribute(IMarker.MESSAGE);
-// assertEquals("Error messages should be","JSF 2 Resources folder \"/resources/test\" is missing in a project web directory",message); //$NON-NLS-1$ //$NON-NLS-2$
-// caretOffcet = TestUtil.getLinePositionOffcet(multiPageEditor.getSourceEditor().getTextViewer(), 6, 1);
-// styledText.setCaretOffset(caretOffcet);
-// styledText.insert("<test:testElement />"); //$NON-NLS-1$
-// TestUtil.delay(1200);
-// TestUtil.waitForJobs();
-// problemMarkers = file.findMarkers(MARKER_TYPE, true, IResource.DEPTH_INFINITE);
-// assertEquals("Number of markers should be",2, problemMarkers.length); //$NON-NLS-1$
+ IFile file = (IFile) TestUtil.getComponentPath("JBIDE/6922/jbide6922.xhtml", //$NON-NLS-1$
+ JsfAllTests.IMPORT_JSF_20_PROJECT_NAME);
+
+ file.getProject().build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ TestUtil.delay(3000);
+ TestUtil.waitForJobs();
+
+ IEditorInput input = new FileEditorInput(file);
+ JSPMultiPageEditor multiPageEditor = openEditor(input);
+ IMarker[] problemMarkers = file.findMarkers(MARKER_TYPE, true, IResource.DEPTH_INFINITE);
+ assertEquals("There shouldn't be any problems on page", 0, problemMarkers.length); //$NON-NLS-1$
+
+ StyledText styledText = multiPageEditor.getSourceEditor().getTextViewer().getTextWidget();
+ int caretOffset = TestUtil.getLinePositionOffcet(multiPageEditor.getSourceEditor().getTextViewer(), 4, 5);
+ styledText.setCaretOffset(caretOffset);
+ styledText.insert("xmlns:test=\"http://java.sun.com/jsf/composite/test\""); //$NON-NLS-1$
+
+ multiPageEditor.doSave(new NullProgressMonitor());
+ file.getProject().build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ TestUtil.delay(3000);
+ TestUtil.waitForJobs();
+
+ problemMarkers = file.findMarkers(MARKER_TYPE, true, IResource.DEPTH_INFINITE);
+
+ assertEquals("res folder marker is expected", 1, problemMarkers.length); //$NON-NLS-1$
+ String message = (String) problemMarkers[0].getAttribute(IMarker.MESSAGE);
+ assertEquals("Error message","JSF 2 Resources folder \"/resources/test\" is missing in a project web directory",message); //$NON-NLS-1$ //$NON-NLS-2$
+
+ caretOffset = TestUtil.getLinePositionOffcet(multiPageEditor.getSourceEditor().getTextViewer(), 6, 1);
+ styledText.setCaretOffset(caretOffset);
+ styledText.insert("<test:testElement />"); //$NON-NLS-1$
+
+ multiPageEditor.doSave(new NullProgressMonitor());
+ file.getProject().build(IncrementalProjectBuilder.FULL_BUILD, new NullProgressMonitor());
+ TestUtil.delay(3000);
+ TestUtil.waitForJobs();
+
+ problemMarkers = file.findMarkers(MARKER_TYPE, true, IResource.DEPTH_INFINITE);
+ assertEquals("Number of markers",2, problemMarkers.length); //$NON-NLS-1$
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/JSF2ResourcesScanner.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/JSF2ResourcesScanner.java 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/scanner/JSF2ResourcesScanner.java 2011-06-20 16:00:55 UTC (rev 32218)
@@ -9,8 +9,11 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelException;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.XModelObjectConstants;
+import org.jboss.tools.common.model.filesystems.impl.FolderImpl;
+import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.project.ext.IValueInfo;
import org.jboss.tools.common.model.project.ext.impl.ValueInfo;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
@@ -100,6 +103,13 @@
IResource r = (IResource)c.getAdapter(IResource.class);
if(r instanceof IFile) {
component.setSourcePath(r.getFullPath());
+ //
+ try {
+ ((FolderImpl)c.getParent()).updateChildFile(c, r.getLocation().toFile());
+ } catch (XModelException e) {
+ ModelPlugin.getPluginLog().logError(e);
+ }
+ //
}
component.setName(createValueInfo(c.getAttributeValue(XModelObjectConstants.ATTR_NAME)));
library.addComponent(component);
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/JSPProblemMarkerResolutionGenerator.java 2011-06-20 16:00:55 UTC (rev 32218)
@@ -42,6 +42,8 @@
private static final String HTML_VALIDATOR_MARKER="org.eclipse.wst.html.core.validationMarker"; //$NON-NLS-1$
private static final String JSP_VALIDATOR_MARKER="org.eclipse.jst.jsp.core.validationMarker"; //$NON-NLS-1$
+ private static final String UNKNOWN_TAG = "Unknown tag"; //$NON-NLS-1$
+
public static HashMap<String, String> libs = new HashMap<String, String>();
static{
libs.put("s", "http://jboss.com/products/seam/taglib"); //$NON-NLS-1$//$NON-NLS-2$
@@ -84,7 +86,7 @@
return false;
final int end = attribute.intValue();
- if(!message.startsWith("Unknown tag")) //$NON-NLS-1$
+ if(!message.startsWith(UNKNOWN_TAG)) //$NON-NLS-1$
return false;
String prefix = getPrifix(message);
@@ -163,8 +165,8 @@
public boolean hasResolutions(IMarker marker) {
try{
- if(isOurCase(marker))
- return true;
+ String message = (String)marker.getAttribute(IMarker.MESSAGE);
+ return message.startsWith(UNKNOWN_TAG);
}catch(CoreException ex){
WebUiPlugin.getPluginLog().logError(ex);
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/SeamProblemMarkerResolutionGenerator.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/SeamProblemMarkerResolutionGenerator.java 2011-06-20 15:53:34 UTC (rev 32217)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/marker/SeamProblemMarkerResolutionGenerator.java 2011-06-20 16:00:55 UTC (rev 32218)
@@ -48,19 +48,30 @@
}
return new IMarkerResolution[] {};
}
+
+ /**
+ * return message id or -1 if impossible to find
+ * @param marker
+ * @return
+ */
+ private int getMessageID(IMarker marker)throws CoreException{
+ Integer attribute = ((Integer) marker.getAttribute(SeamCoreValidator.MESSAGE_ID_ATTRIBUTE_NAME));
+ if (attribute != null)
+ return attribute.intValue();
+ return -1;
+ }
+
private IMarkerResolution[] findResolutions(IMarker marker)
throws CoreException {
- Integer attribute = ((Integer) marker
- .getAttribute(SeamCoreValidator.MESSAGE_ID_ATTRIBUTE_NAME));
- if (attribute == null)
+
+ int messageId = getMessageID(marker);
+ if (messageId == -1)
return new IMarkerResolution[] {};
- int messageId = attribute.intValue();
-
IFile file = (IFile) marker.getResource();
- attribute = ((Integer) marker.getAttribute(IMarker.CHAR_START));
+ Integer attribute = ((Integer) marker.getAttribute(IMarker.CHAR_START));
if (attribute == null)
return new IMarkerResolution[] {};
int start = attribute.intValue();
@@ -240,8 +251,7 @@
public boolean hasResolutions(IMarker marker) {
try {
- if (findResolutions(marker).length != 0)
- return true;
+ return getMessageID(marker) >= 0;
} catch (CoreException ex) {
SeamGuiPlugin.getPluginLog().logError(ex);
}
14 years, 9 months
JBoss Tools SVN: r32217 - in trunk/smooks/plugins: org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: tfennelly
Date: 2011-06-20 11:53:34 -0400 (Mon, 20 Jun 2011)
New Revision: 32217
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksSAXXMLHandler.java
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
Log:
JBIDE-8917: NPE when validating transform_XML2XML_date_manipulation project example
https://issues.jboss.org/browse/JBIDE-8917
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksSAXXMLHandler.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksSAXXMLHandler.java 2011-06-20 15:15:30 UTC (rev 32216)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.core/src/org/jboss/tools/smooks/core/SmooksSAXXMLHandler.java 2011-06-20 15:53:34 UTC (rev 32217)
@@ -129,7 +129,7 @@
@Override
public void comment(char[] ch, int start, int length) {
String comment = new String(ch, start, length);
- Object obj = objects.get(objects.size() - 1);
+ Object obj = getObject(objects.size() - 1);
if (mixedTargets.peek() != null) {
if (text != null) {
@@ -158,6 +158,24 @@
}
+ /**
+ * @return
+ */
+ private Object getObject(int index) {
+ if(index < 0 || index >= objects.size()) {
+ return null;
+ }
+
+ // Need to perform the following check on the underlying objects.data[], before calling objects.get(),
+ // otherwise BasicEList throws a wobbler...
+ Object[] data = objects.data();
+ if(data == null || data[index] == null) {
+ return null;
+ }
+
+ return objects.get(index);
+ }
+
/*
* (non-Javadoc)
*
Modified: trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java
===================================================================
--- trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2011-06-20 15:15:30 UTC (rev 32216)
+++ trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/editor/AbstractSmooksFormEditor.java 2011-06-20 15:53:34 UTC (rev 32217)
@@ -671,7 +671,7 @@
try {
smooksResource.load(Collections.emptyMap());
smooksModel = smooksResource.getContents().get(0);
- } catch (IOException e) {
+ } catch (Exception e) {
initSmooksModelException = e;
}
} else {
14 years, 9 months
JBoss Tools SVN: r32216 - in trunk/as/plugins: org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-06-20 11:15:30 -0400 (Mon, 20 Jun 2011)
New Revision: 32216
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/RuntimeUtils.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java
trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEUtils.java
Log:
[JBIDE-9200] moved method from ServerUtils to RuntimeUtils (deprecated old method)
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/RuntimeUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/RuntimeUtils.java 2011-06-20 14:23:07 UTC (rev 32215)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/RuntimeUtils.java 2011-06-20 15:15:30 UTC (rev 32216)
@@ -11,7 +11,7 @@
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IRuntimeType;
import org.eclipse.wst.server.core.IRuntimeWorkingCopy;
-import org.eclipse.wst.server.core.IServer;
+import org.eclipse.wst.server.core.IServerAttributes;
import org.eclipse.wst.server.core.ServerUtil;
import org.eclipse.wst.server.core.internal.RuntimeWorkingCopy;
import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
@@ -20,11 +20,16 @@
public class RuntimeUtils {
- public static IJBossServerRuntime getJBossServerRuntime(IServer server) throws CoreException {
+ public static IJBossServerRuntime checkedGetJBossServerRuntime(IServerAttributes server) {
IRuntime rt = server.getRuntime();
IJBossServerRuntime jbrt = null;
if (rt != null)
jbrt = (IJBossServerRuntime) rt.loadAdapter(IJBossServerRuntime.class, new NullProgressMonitor());
+ return jbrt;
+ }
+
+ public static IJBossServerRuntime getJBossServerRuntime(IServerAttributes server) throws CoreException {
+ IJBossServerRuntime jbrt = checkedGetJBossServerRuntime(server);
if (jbrt == null)
throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
NLS.bind(Messages.ServerRuntimeNotFound, server.getName())));
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java 2011-06-20 14:23:07 UTC (rev 32215)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerConverter.java 2011-06-20 15:15:30 UTC (rev 32216)
@@ -14,7 +14,6 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerAttributes;
import org.eclipse.wst.server.core.IServerWorkingCopy;
@@ -131,13 +130,14 @@
servers.toArray(ret);
return ret;
}
- public static IJBossServerRuntime getJBossRuntime(IServer server) {
- return getJBossRuntime((IServerAttributes)server);
+
+ @Deprecated
+ public static IJBossServerRuntime getJBossRuntime(IServer server) throws CoreException {
+ return RuntimeUtils.getJBossServerRuntime(server);
}
-
+
+ @Deprecated
public static IJBossServerRuntime getJBossRuntime(IServerAttributes server) {
- if( server == null ) return null;
- IRuntime rt = server.getRuntime();
- return (IJBossServerRuntime)rt.loadAdapter(IJBossServerRuntime.class, null);
+ return RuntimeUtils.checkedGetJBossServerRuntime(server);
}
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEUtils.java 2011-06-20 14:23:07 UTC (rev 32215)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.rse.core/src/org/jboss/ide/eclipse/as/rse/core/RSEUtils.java 2011-06-20 15:15:30 UTC (rev 32216)
@@ -27,7 +27,7 @@
import org.jboss.ide.eclipse.as.core.util.IConstants;
import org.jboss.ide.eclipse.as.core.util.IJBossRuntimeResourceConstants;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
-import org.jboss.ide.eclipse.as.core.util.ServerConverter;
+import org.jboss.ide.eclipse.as.core.util.RuntimeUtils;
/*
@@ -50,7 +50,7 @@
}
public static String getRSEConfigName(IServerAttributes server) {
- IJBossServerRuntime runtime = ServerConverter.getJBossRuntime(server);
+ IJBossServerRuntime runtime = RuntimeUtils.checkedGetJBossServerRuntime(server);
return server.getAttribute(RSEUtils.RSE_SERVER_CONFIG, runtime.getJBossConfiguration());
}
14 years, 9 months
JBoss Tools SVN: r32215 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-06-20 10:23:07 -0400 (Mon, 20 Jun 2011)
New Revision: 32215
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java
Log:
[JBIDE-9200] split large methods into smaller ones
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java 2011-06-20 14:22:39 UTC (rev 32214)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerUtil.java 2011-06-20 14:23:07 UTC (rev 32215)
@@ -12,9 +12,12 @@
import java.io.File;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
import org.eclipse.osgi.util.NLS;
import org.eclipse.wst.server.core.IRuntime;
import org.eclipse.wst.server.core.IServer;
@@ -160,11 +163,15 @@
return NLS.bind(Messages.serverCountName, base, i);
}
- public static String getServerHome(JBossServer jbs) {
- return jbs.getServer().getRuntime().getLocation().toOSString();
+ public static String getServerHome(JBossServer jbs) throws CoreException {
+ String serverHome = jbs.getServer().getRuntime().getLocation().toOSString();
+ if (serverHome == null)
+ throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
+ NLS.bind(Messages.CannotLocateServerHome, jbs.getServer().getName())));
+ return serverHome;
}
-
- public static IPath getServerHomePath(JBossServer jbs) {
+
+ public static IPath getServerHomePath(JBossServer jbs) throws CoreException {
return new Path(getServerHome(jbs));
}
14 years, 9 months
JBoss Tools SVN: r32214 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-06-20 10:22:39 -0400 (Mon, 20 Jun 2011)
New Revision: 32214
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java
Log:
[JBIDE-9200] split large methods into smaller ones
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java 2011-06-20 13:50:58 UTC (rev 32213)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/AbstractJBossLaunchConfigType.java 2011-06-20 14:22:39 UTC (rev 32214)
@@ -149,7 +149,7 @@
}
@Deprecated
- public static void addCPEntry(ArrayList<IRuntimeClasspathEntry> list, JBossServer jbs, String relative) {
+ public static void addCPEntry(ArrayList<IRuntimeClasspathEntry> list, JBossServer jbs, String relative) throws CoreException {
String serverHome = org.jboss.ide.eclipse.as.core.util.ServerUtil.getServerHome(jbs);
LaunchConfigUtils.addCPEntry(serverHome, relative, list);
}
@@ -181,7 +181,7 @@
}
@Deprecated
- public static String getServerHome(JBossServer jbs) {
+ public static String getServerHome(JBossServer jbs) throws CoreException {
return ServerUtil.getServerHome(jbs);
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java 2011-06-20 13:50:58 UTC (rev 32213)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java 2011-06-20 14:22:39 UTC (rev 32214)
@@ -103,15 +103,8 @@
protected void updateMandatedFields(ILaunchConfigurationWorkingCopy wc, JBossServer jbs)
throws CoreException {
String serverHome = ServerUtil.getServerHome(jbs);
- if (serverHome == null)
- throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
- NLS.bind(Messages.CannotLocateServerHome, jbs.getServer().getName())));
- ensureJBossRuntimeIsSet(jbs);
-
- /* Args and vm args */
- IJBossServerRuntime runtime = (IJBossServerRuntime)
- jbs.getServer().getRuntime().loadAdapter(IJBossServerRuntime.class, null);
-
+ IJBossServerRuntime runtime = RuntimeUtils.getJBossServerRuntime(jbs.getServer());
+
updateVMPath(runtime, wc);
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
serverHome + Path.SEPARATOR + IJBossRuntimeResourceConstants.BIN);
@@ -156,17 +149,6 @@
IJBossRuntimeResourceConstants.ENDORSED).toOSString(), true);
}
- private void ensureJBossRuntimeIsSet(JBossServer jbs) throws CoreException {
- IRuntime rt = jbs.getServer().getRuntime();
- IJBossServerRuntime jbrt = null;
- if (rt != null)
- jbrt = (IJBossServerRuntime) rt.getAdapter(IJBossServerRuntime.class);
-
- if (jbrt == null)
- throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
- NLS.bind(Messages.ServerRuntimeNotFound, jbs.getServer().getName())));
- }
-
private String updateRuntimeArgument(String args, IJBossServerRuntime runtime) {
String config = runtime.getJBossConfiguration();
args = ArgsUtil.setArg(args,
14 years, 9 months
JBoss Tools SVN: r32213 - trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-06-20 09:50:58 -0400 (Mon, 20 Jun 2011)
New Revision: 32213
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java
Log:
[JBIDE-9200] split large methods into smaller ones
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java 2011-06-20 12:25:52 UTC (rev 32212)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/launch/LocalJBossServerStartupLaunchUtil.java 2011-06-20 13:50:58 UTC (rev 32213)
@@ -56,6 +56,10 @@
import org.jboss.ide.eclipse.as.core.util.ServerConverter;
import org.jboss.ide.eclipse.as.core.util.ServerUtil;
+/**
+ * @author Rob Stryker
+ * @author André Dietisheim
+ */
public class LocalJBossServerStartupLaunchUtil implements StartLaunchDelegate, IStartLaunchSetupParticipant {
public static final String DEFAULTS_SET = "jboss.defaults.been.set"; //$NON-NLS-1$
@@ -65,40 +69,94 @@
public void setupLaunchConfiguration(
ILaunchConfigurationWorkingCopy workingCopy, IServer server) throws CoreException {
- if (!workingCopy.getAttributes().containsKey(DEFAULTS_SET)) {
- forceDefaultsSet(workingCopy, server);
- }
-
- // Upgrade old launch configs
JBossServer jbs = ServerConverter.findJBossServer(server.getId());
if (jbs == null) {
throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
NLS.bind(Messages.CannotSetUpImproperServer, server.getName())));
}
- String cpProvider = workingCopy.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER,
- (String) null);
+
+ if (!workingCopy.getAttributes().containsKey(DEFAULTS_SET)) {
+ forceDefaultsSet(workingCopy, jbs);
+ }
+
+ upgradeOldLaunchConfig(workingCopy, jbs);
+
+ // Force the launch to get certain fields from the runtime
+ updateMandatedFields(workingCopy, jbs);
+ }
+
+ private void upgradeOldLaunchConfig(ILaunchConfigurationWorkingCopy workingCopy, JBossServer jbs)
+ throws CoreException {
+ String cpProvider = workingCopy.getAttribute(
+ IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, (String) null);
if (!DEFAULT_CP_PROVIDER_ID.equals(cpProvider)) {
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH_PROVIDER, DEFAULT_CP_PROVIDER_ID);
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, getClasspath(jbs));
workingCopy.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
}
-
- // Force the launch to get certain fields from the runtime
- updateMandatedFields(workingCopy, jbs);
}
/*
* Ensures that the working directory and classpath are 100% accurate.
* Merges proper required params into args and vm args
*/
-
protected void updateMandatedFields(ILaunchConfigurationWorkingCopy wc, JBossServer jbs)
throws CoreException {
String serverHome = ServerUtil.getServerHome(jbs);
if (serverHome == null)
throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
NLS.bind(Messages.CannotLocateServerHome, jbs.getServer().getName())));
+ ensureJBossRuntimeIsSet(jbs);
+ /* Args and vm args */
+ IJBossServerRuntime runtime = (IJBossServerRuntime)
+ jbs.getServer().getRuntime().loadAdapter(IJBossServerRuntime.class, null);
+
+ updateVMPath(runtime, wc);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY,
+ serverHome + Path.SEPARATOR + IJBossRuntimeResourceConstants.BIN);
+ updateArguments(wc, jbs, runtime);
+ updateVMArgs(wc, runtime);
+ updateClassPath(wc, jbs);
+ wc.setAttribute(AbstractJBossLaunchConfigType.SERVER_ID, jbs.getServer().getId());
+ }
+
+ private void updateVMPath(IJBossServerRuntime runtime, ILaunchConfigurationWorkingCopy wc) {
+ IVMInstall vmInstall = runtime.getVM();
+ if (vmInstall != null)
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH,
+ JavaRuntime.newJREContainerPath(vmInstall).toPortableString());
+ }
+
+ private void updateClassPath(ILaunchConfigurationWorkingCopy wc, JBossServer jbs) throws CoreException {
+ List<String> newCP = updateRunJarEntry(wc, jbs);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, newCP);
+ }
+
+ private void updateVMArgs(ILaunchConfigurationWorkingCopy wc, IJBossServerRuntime runtime) throws CoreException {
+ String vmArgs = wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, ""); //$NON-NLS-1$
+ updateEndorsedDir(vmArgs, runtime);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs.trim());
+ }
+
+ private void updateArguments(ILaunchConfigurationWorkingCopy wc, JBossServer jbs, IJBossServerRuntime runtime)
+ throws CoreException {
+ String args = wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$
+ String host = jbs.getServer().getHost();
+ args = updateHostArgument(host, args);
+ args = updateRuntimeArgument(args, runtime);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, args.trim());
+ }
+
+ private void updateEndorsedDir(String vmArgs, IJBossServerRuntime runtime) {
+ vmArgs = ArgsUtil.setArg(vmArgs, null,
+ IJBossRuntimeConstants.SYSPROP + IJBossRuntimeConstants.ENDORSED_DIRS,
+ runtime.getRuntime().getLocation().append(
+ IJBossRuntimeResourceConstants.LIB).append(
+ IJBossRuntimeResourceConstants.ENDORSED).toOSString(), true);
+ }
+
+ private void ensureJBossRuntimeIsSet(JBossServer jbs) throws CoreException {
IRuntime rt = jbs.getServer().getRuntime();
IJBossServerRuntime jbrt = null;
if (rt != null)
@@ -107,22 +165,9 @@
if (jbrt == null)
throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
NLS.bind(Messages.ServerRuntimeNotFound, jbs.getServer().getName())));
+ }
- /* Args and vm args */
-
- String args = wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, ""); //$NON-NLS-1$
- String vmArgs = wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, ""); //$NON-NLS-1$
- String host = jbs.getServer().getHost();
- String host2 = ArgsUtil.getValue(args,
- IJBossRuntimeConstants.STARTUP_ARG_HOST_SHORT,
- IJBossRuntimeConstants.STARTUP_ARG_HOST_LONG);
- if (!host.equals(host2))
- args = ArgsUtil.setArg(args,
- IJBossRuntimeConstants.STARTUP_ARG_HOST_SHORT,
- IJBossRuntimeConstants.STARTUP_ARG_HOST_LONG, host);
-
- IJBossServerRuntime runtime = (IJBossServerRuntime)
- jbs.getServer().getRuntime().loadAdapter(IJBossServerRuntime.class, null);
+ private String updateRuntimeArgument(String args, IJBossServerRuntime runtime) {
String config = runtime.getJBossConfiguration();
args = ArgsUtil.setArg(args,
IJBossRuntimeConstants.STARTUP_ARG_CONFIG_SHORT,
@@ -136,75 +181,55 @@
}
} catch (MalformedURLException murle) {
}
+ return args;
+ }
- vmArgs = ArgsUtil.setArg(vmArgs, null,
- IJBossRuntimeConstants.SYSPROP + IJBossRuntimeConstants.ENDORSED_DIRS,
- runtime.getRuntime().getLocation().append(
- IJBossRuntimeResourceConstants.LIB).append(
- IJBossRuntimeResourceConstants.ENDORSED).toOSString(), true);
- /* Claspath */
- List<String> cp = wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, new ArrayList<String>());
- List<String> newCP = fixCP(cp, jbs);
+ private String updateHostArgument(String host, String args) {
+ String argsHost = ArgsUtil.getValue(args,
+ IJBossRuntimeConstants.STARTUP_ARG_HOST_SHORT,
+ IJBossRuntimeConstants.STARTUP_ARG_HOST_LONG);
- IVMInstall vmInstall = runtime.getVM();
- if (vmInstall != null)
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH,
- JavaRuntime.newJREContainerPath(vmInstall).toPortableString());
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, serverHome + Path.SEPARATOR
- + IJBossRuntimeResourceConstants.BIN);
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, args.trim());
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, vmArgs.trim());
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, newCP);
- wc.setAttribute(AbstractJBossLaunchConfigType.SERVER_ID, jbs.getServer().getId());
-
+ if (!host.equals(host))
+ args = ArgsUtil.setArg(args,
+ IJBossRuntimeConstants.STARTUP_ARG_HOST_SHORT,
+ IJBossRuntimeConstants.STARTUP_ARG_HOST_LONG, host);
+ return args;
}
- protected List<String> fixCP(List<String> list, JBossServer jbs) {
+ protected List<String> updateRunJarEntry(ILaunchConfigurationWorkingCopy wc, JBossServer jbs) throws CoreException {
+ List<String> cp = wc.getAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, new ArrayList<String>());
try {
boolean found = false;
- String[] asString = (String[]) list.toArray(new String[list.size()]);
+ String[] asString = (String[]) cp.toArray(new String[cp.size()]);
for (int i = 0; i < asString.length; i++) {
if (asString[i].contains(RunJarContainerWrapper.ID)) {
found = true;
asString[i] = LaunchConfigUtils.getRunJarRuntimeCPEntry(jbs.getServer()).getMemento();
}
}
- ArrayList<String> result = new ArrayList<String>();
+ List<String> result = new ArrayList<String>();
result.addAll(Arrays.asList(asString));
if (!found)
result.add(LaunchConfigUtils.getRunJarRuntimeCPEntry(jbs.getServer()).getMemento());
return result;
} catch (CoreException ce) {
- return list;
+ return cp;
}
}
- protected void forceDefaultsSet(ILaunchConfigurationWorkingCopy wc, IServer server) throws CoreException {
- JBossServer jbs = ServerConverter.findJBossServer(server.getId());
- if (jbs == null) {
- throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
- NLS.bind(Messages.CannotSetUpImproperServer, server.getName())));
- }
-
+ protected void forceDefaultsSet(ILaunchConfigurationWorkingCopy wc, JBossServer jbs) throws CoreException {
String serverHome = ServerUtil.getServerHome(jbs);
if (serverHome == null)
throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
- NLS.bind(Messages.CannotLocateServerHome, server.getName())));
+ NLS.bind(Messages.CannotLocateServerHome, jbs.getServer().getName())));
- IRuntime rt = jbs.getServer().getRuntime();
- IJBossServerRuntime jbrt = null;
- if (rt != null) {
- jbrt = (IJBossServerRuntime) rt.getAdapter(IJBossServerRuntime.class);
- }
-
+ IJBossServerRuntime jbrt = getJBossServerRuntime(jbs);
if (jbrt == null)
throw new CoreException(new Status(IStatus.ERROR, JBossServerCorePlugin.PLUGIN_ID,
NLS.bind(Messages.ServerRuntimeNotFound, jbs.getServer().getName())));
- IVMInstall vmInstall = jbrt.getVM();
- if (vmInstall != null)
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH,
- JavaRuntime.newJREContainerPath(vmInstall).toPortableString());
+
+ updateVMPath(jbrt, wc);
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, getDefaultArgs(jbs));
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_VM_ARGUMENTS, jbrt.getDefaultRunVMArgs());
wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, START_MAIN_TYPE);
@@ -217,6 +242,16 @@
wc.setAttribute(DEFAULTS_SET, true);
}
+
+ private IJBossServerRuntime getJBossServerRuntime(JBossServer jbs) throws CoreException {
+ IRuntime rt = jbs.getServer().getRuntime();
+ IJBossServerRuntime jbrt = null;
+ if (rt != null) {
+ jbrt = (IJBossServerRuntime) rt.getAdapter(IJBossServerRuntime.class);
+ }
+
+ return jbrt;
+ }
private List<String> getClasspath(JBossServer jbs) throws CoreException {
IJBossServerRuntime jbrt = RuntimeUtils.getJBossServerRuntime(jbs.getServer());
14 years, 9 months
JBoss Tools SVN: r32212 - trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke.
by jbosstools-commits@lists.jboss.org
Author: vpakan(a)redhat.com
Date: 2011-06-20 08:25:52 -0400 (Mon, 20 Jun 2011)
New Revision: 32212
Modified:
trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/OpenOnTest.java
Log:
Fixed wrong selection position.
Modified: trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/OpenOnTest.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/OpenOnTest.java 2011-06-20 11:58:20 UTC (rev 32211)
+++ trunk/jsf/tests/org.jboss.tools.jsf.ui.bot.test/src/org/jboss/tools/jsf/ui/bot/test/smoke/OpenOnTest.java 2011-06-20 12:25:52 UTC (rev 32212)
@@ -65,7 +65,7 @@
// Check open on for #{Message.prompt_message} EL
String expectedTableRowLabel = "prompt_message";
openedEditor = OpenOnHelper.checkOpenOnFileIsOpened(
- SWTTestExt.bot, TEST_PAGE, "value=\"#{Message." + expectedTableRowLabel + "}\"", 10,
+ SWTTestExt.bot, TEST_PAGE, "value=\"#{Message." + expectedTableRowLabel + "}\"", 18,
0, 0, expectedOpenedFileName);
selectedTableRowLabel = openedEditor.bot().table().selection().get(0, 0);
assertTrue("Selected table row has to have value " + expectedTableRowLabel + " but has " + selectedTableRowLabel,
14 years, 9 months