Author: scabanovich
Date: 2012-05-23 19:53:30 -0400 (Wed, 23 May 2012)
New Revision: 41327
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/validation/DeltaspikeSuppressWarningsMap.java
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikeConfigBlockDescriptionProvider.java
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikePreferencesMessages.java
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikePreferencesMessages.properties
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/META-INF/MANIFEST.MF
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/plugin.xml
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSecurityDefinitionContext.java
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSecurityExtension.java
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSeverityPreferenceInitializer.java
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSeverityPreferences.java
Log:
JBIDE-11552
https://issues.jboss.org/browse/JBIDE-11552
Deltaspike preferences configuration block is added to validation preferences page , and
populated with preferences for security extension validation.
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/META-INF/MANIFEST.MF 2012-05-23
23:49:23 UTC (rev 41326)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/META-INF/MANIFEST.MF 2012-05-23
23:53:30 UTC (rev 41327)
@@ -12,6 +12,8 @@
org.jboss.tools.common.validation,
org.jboss.tools.jst.web.kb,
org.jboss.tools.cdi.core,
+ org.jboss.tools.common.ui,
+ org.jboss.tools.cdi.ui,
org.jboss.tools.cdi.seam.solder.core,
org.eclipse.jdt.core;bundle-version="3.7.0"
Bundle-ActivationPolicy: lazy
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/plugin.xml
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/plugin.xml 2012-05-23 23:49:23
UTC (rev 41326)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/plugin.xml 2012-05-23 23:53:30
UTC (rev 41327)
@@ -30,4 +30,21 @@
<initializer
class="org.jboss.tools.cdi.deltaspike.core.DeltaspikeSeverityPreferenceInitializer"/>
</extension>
+ <extension
+ id="DeltaspikeWarnings"
+ point="org.jboss.tools.common.validation.warnings">
+ <map
+
class="org.jboss.tools.cdi.deltaspike.core.validation.DeltaspikeSuppressWarningsMap"
+ warningGroupID="deltaspike"
+
preferenceGroupID="org.jboss.tools.cdi.deltaspike.core.validator.problem">
+ </map>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.cdi.ui.configBlockDescriptionProvider">
+ <provider
+
class="org.jboss.tools.cdi.deltaspike.ui.preferences.DeltaspikeConfigBlockDescriptionProvider">
+ </provider>
+</extension>
+
</plugin>
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSecurityDefinitionContext.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSecurityDefinitionContext.java 2012-05-23
23:49:23 UTC (rev 41326)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSecurityDefinitionContext.java 2012-05-23
23:53:30 UTC (rev 41327)
@@ -61,6 +61,8 @@
public void computeAnnotationKind(AnnotationDefinition annotation) {
if(SECURES_ANNOTATION_TYPE_NAME.equals(annotation.getType().getFullyQualifiedName()))
{
annotation.setExtendedKind(SECURES_ANNOTATION_KIND);
+ } else
if(SECURED_ANNOTATION_TYPE_NAME.equals(annotation.getType().getFullyQualifiedName())) {
+ annotation.setExtendedKind(SECURES_ANNOTATION_KIND);
} else if(annotation.isAnnotationPresent(SECURITY_BINDING_ANNOTATION_TYPE_NAME)) {
annotation.setExtendedKind(SECURITY_BINDING_ANNOTATION_KIND);
String qn = annotation.getType().getFullyQualifiedName();
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSecurityExtension.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSecurityExtension.java 2012-05-23
23:49:23 UTC (rev 41326)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSecurityExtension.java 2012-05-23
23:53:30 UTC (rev 41327)
@@ -84,8 +84,9 @@
MethodDefinition method = (MethodDefinition)memberDefinition;
method.setCDIAnnotated(true);
DeltaspikeAuthorityMethod authorizer = new DeltaspikeAuthorityMethod(method);
- ((DeltaspikeSecurityDefinitionContext)this.context.getWorkingCopy()).allAuthorizerMethods.getAuthorizerMembers().add(authorizer);
- List<IAnnotationDeclaration> ds =
findAnnotationAnnotatedWithSecurityBindingType(memberDefinition);
+ DeltaspikeSecurityDefinitionContext contextCopy =
((DeltaspikeSecurityDefinitionContext)this.context.getWorkingCopy());
+ contextCopy.allAuthorizerMethods.getAuthorizerMembers().add(authorizer);
+ List<IAnnotationDeclaration> ds =
findAnnotationAnnotatedWithSecurityBindingType(memberDefinition,
contextCopy.getRootContext());
for (IAnnotationDeclaration d: ds) {
DeltaspikeSecurityBindingConfiguration c =
((DeltaspikeSecurityDefinitionContext)this.context.getWorkingCopy()).getConfiguration(d.getTypeName());
authorizer.addBinding(d, c);
@@ -104,7 +105,7 @@
}
private void addSecurityMember(AbstractMemberDefinition def, IRootDefinitionContext
context) {
- List<IAnnotationDeclaration> ds =
findAnnotationAnnotatedWithSecurityBindingType(def);
+ List<IAnnotationDeclaration> ds =
findAnnotationAnnotatedWithSecurityBindingType(def, context);
for (IAnnotationDeclaration d: ds) {
addBoundMember(def, d, context);
}
@@ -138,12 +139,13 @@
static List<IAnnotationDeclaration> EMPTY =
Collections.<IAnnotationDeclaration>emptyList();
- private List<IAnnotationDeclaration>
findAnnotationAnnotatedWithSecurityBindingType(AbstractMemberDefinition m) {
+ private List<IAnnotationDeclaration>
findAnnotationAnnotatedWithSecurityBindingType(AbstractMemberDefinition m,
IRootDefinitionContext context) {
List<IAnnotationDeclaration> result = null;
List<IAnnotationDeclaration> ds = m.getAnnotations();
for (IAnnotationDeclaration d: ds) {
if(d.getTypeName() != null) {
- AnnotationDefinition a = context.getRootContext().getAnnotation(d.getTypeName());
+// context.getAnnotationKind(d.getType());
+ AnnotationDefinition a = context.getAnnotation(d.getTypeName());
if(a != null && a.isAnnotationPresent(SECURITY_BINDING_ANNOTATION_TYPE_NAME))
{
if(result == null) {
result = new ArrayList<IAnnotationDeclaration>();
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSeverityPreferenceInitializer.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSeverityPreferenceInitializer.java 2012-05-23
23:49:23 UTC (rev 41326)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSeverityPreferenceInitializer.java 2012-05-23
23:53:30 UTC (rev 41327)
@@ -13,7 +13,7 @@
import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
import org.eclipse.core.runtime.preferences.DefaultScope;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
-import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.jboss.tools.cdi.core.preferences.CDIPreferences;
import org.jboss.tools.common.preferences.SeverityPreferences;
/**
@@ -26,9 +26,10 @@
*/
@Override
public void initializeDefaultPreferences() {
- IEclipsePreferences defaultPreferences = ((IScopeContext) new
DefaultScope()).getNode(DeltaspikeCorePlugin.PLUGIN_ID);
+ IEclipsePreferences defaultPreferences =
DefaultScope.INSTANCE.getNode(DeltaspikeCorePlugin.PLUGIN_ID);
for (String name : DeltaspikeSeverityPreferences.SEVERITY_OPTION_NAMES) {
defaultPreferences.put(name, SeverityPreferences.WARNING);
}
+ defaultPreferences.put(DeltaspikeSeverityPreferences.INVALID_AUTHORIZER,
CDIPreferences.ERROR);
}
}
\ No newline at end of file
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSeverityPreferences.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSeverityPreferences.java 2012-05-23
23:49:23 UTC (rev 41326)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/DeltaspikeSeverityPreferences.java 2012-05-23
23:53:30 UTC (rev 41327)
@@ -13,6 +13,7 @@
import java.util.HashSet;
import java.util.Set;
+import org.jboss.tools.cdi.core.CDICorePlugin;
import org.jboss.tools.cdi.core.preferences.CDIPreferences;
import org.jboss.tools.common.validation.ValidationSeverityPreferences;
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/validation/DeltaspikeSuppressWarningsMap.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/validation/DeltaspikeSuppressWarningsMap.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/validation/DeltaspikeSuppressWarningsMap.java 2012-05-23
23:53:30 UTC (rev 41327)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.deltaspike.core.validation;
+
+import org.jboss.tools.cdi.deltaspike.core.DeltaspikeSeverityPreferences;
+import org.jboss.tools.common.validation.IWarningNameMap;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class DeltaspikeSuppressWarningsMap implements IWarningNameMap {
+
+ /*
+ * (non-Javadoc)
+ * @see
org.jboss.tools.common.validation.IWarningNameMap#getWarningNames(java.lang.String)
+ */
+ @Override
+ public String[] getWarningNames(String preferenceID) {
+ return DeltaspikeSeverityPreferences.getInstance().getWarningNames(preferenceID);
+ }
+}
\ No newline at end of file
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/core/validation/DeltaspikeSuppressWarningsMap.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikeConfigBlockDescriptionProvider.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikeConfigBlockDescriptionProvider.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikeConfigBlockDescriptionProvider.java 2012-05-23
23:53:30 UTC (rev 41327)
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.deltaspike.ui.preferences;
+
+import org.jboss.tools.cdi.deltaspike.core.DeltaspikeCorePlugin;
+import org.jboss.tools.cdi.deltaspike.core.DeltaspikeSeverityPreferences;
+import org.jboss.tools.cdi.ui.preferences.IConfigurationBlockDescriptionProvider;
+import
org.jboss.tools.common.ui.preferences.SeverityConfigurationBlock.SectionDescription;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class DeltaspikeConfigBlockDescriptionProvider implements
IConfigurationBlockDescriptionProvider {
+
+ private static SectionDescription SECTION_DELTASPIKE = new SectionDescription(
+ DeltaspikePreferencesMessages.CDIValidatorConfigurationBlock_section_deltaspike,
+ new String[][]{
+ {DeltaspikeSeverityPreferences.AMBIGUOUS_AUTHORIZER,
DeltaspikePreferencesMessages.CDIValidatorConfigurationBlock_pb_ambiguousAuthorizer_label},
+ {DeltaspikeSeverityPreferences.UNRESOLVED_AUTHORIZER,
DeltaspikePreferencesMessages.CDIValidatorConfigurationBlock_pb_unresolvedAuthorizer_label},
+ {DeltaspikeSeverityPreferences.INVALID_AUTHORIZER,
DeltaspikePreferencesMessages.CDIValidatorConfigurationBlock_pb_invalidAuthorizer_label},
+ },
+ DeltaspikeCorePlugin.PLUGIN_ID
+ );
+
+ private static SectionDescription[] ALL_SECTIONS = {
+ SECTION_DELTASPIKE
+ };
+
+ @Override
+ public SectionDescription[] getSections() {
+ return ALL_SECTIONS;
+ }
+
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikeConfigBlockDescriptionProvider.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikePreferencesMessages.java
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikePreferencesMessages.java
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikePreferencesMessages.java 2012-05-23
23:53:30 UTC (rev 41327)
@@ -0,0 +1,30 @@
+/*******************************************************************************
+ * Copyright (c) 2012 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.deltaspike.ui.preferences;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class DeltaspikePreferencesMessages extends NLS {
+ private static final String BUNDLE_NAME =
DeltaspikePreferencesMessages.class.getName();
+
+ //Section Deltaspike
+ public static String CDIValidatorConfigurationBlock_section_deltaspike;
+ public static String CDIValidatorConfigurationBlock_pb_ambiguousAuthorizer_label;
+ public static String CDIValidatorConfigurationBlock_pb_unresolvedAuthorizer_label;
+ public static String CDIValidatorConfigurationBlock_pb_invalidAuthorizer_label;
+
+ static {
+ NLS.initializeMessages(BUNDLE_NAME, DeltaspikePreferencesMessages.class);
+ }
+}
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikePreferencesMessages.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikePreferencesMessages.properties
===================================================================
---
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikePreferencesMessages.properties
(rev 0)
+++
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikePreferencesMessages.properties 2012-05-23
23:53:30 UTC (rev 41327)
@@ -0,0 +1,6 @@
+##Section Deltaspike
+
+CDIValidatorConfigurationBlock_section_deltaspike=Deltaspike
+CDIValidatorConfigurationBlock_pb_ambiguousAuthorizer_label=Umbiguous authorizer for a
secured method:
+CDIValidatorConfigurationBlock_pb_unresolvedAuthorizer_label=Unresolved authorizer for a
secured method:
+CDIValidatorConfigurationBlock_pb_invalidAuthorizer_label=Invalid authorizer:
\ No newline at end of file
Property changes on:
trunk/cdi/plugins/org.jboss.tools.cdi.deltaspike.core/src/org/jboss/tools/cdi/deltaspike/ui/preferences/DeltaspikePreferencesMessages.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain