Author: akazakov
Date: 2009-05-18 16:13:30 -0400 (Mon, 18 May 2009)
New Revision: 15336
Added:
trunk/common/plugins/org.jboss.tools.common.el.core/plugin.xml
trunk/common/plugins/org.jboss.tools.common.el.core/schema/
trunk/common/plugins/org.jboss.tools.common.el.core/schema/elResolver.exsd
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactory.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.el.core/build.properties
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
Log:
https://jira.jboss.org/jira/browse/JBIDE-2808
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2009-05-18
18:52:25 UTC (rev 15335)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2009-05-18
20:13:30 UTC (rev 15336)
@@ -3,7 +3,7 @@
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-Name: %Bundle-Name.0
-Bundle-SymbolicName: org.jboss.tools.common.el.core
+Bundle-SymbolicName: org.jboss.tools.common.el.core;singleton=true
Bundle-Version: 2.0.0
Provide-Package: org.jboss.tools.common.el.core,
org.jboss.tools.common.el.core.model,
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/build.properties
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/build.properties 2009-05-18
18:52:25 UTC (rev 15335)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/build.properties 2009-05-18
20:13:30 UTC (rev 15336)
@@ -2,4 +2,6 @@
output.. = bin/
bin.includes = META-INF/,\
.,\
- plugin.properties
+ plugin.properties,\
+ plugin.xml,\
+ schema/
Added: trunk/common/plugins/org.jboss.tools.common.el.core/plugin.xml
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/plugin.xml
(rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/plugin.xml 2009-05-18 20:13:30 UTC
(rev 15336)
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension-point id="elResolver" name="EL Resolver"
schema="schema/elResolver.exsd"/>
+
+</plugin>
Property changes on: trunk/common/plugins/org.jboss.tools.common.el.core/plugin.xml
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/common/plugins/org.jboss.tools.common.el.core/schema/elResolver.exsd
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/schema/elResolver.exsd
(rev 0)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/schema/elResolver.exsd 2009-05-18
20:13:30 UTC (rev 15336)
@@ -0,0 +1,163 @@
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.jboss.tools.common.el.core"
xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.jboss.tools.common.el.core"
id="elResolver" name="EL Resolver"/>
+ </appinfo>
+ <documentation>
+ This extenion point is used to enable EL Resolver for a project which has
particular nature.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="el-resolver" 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="el-resolver">
+ <annotation>
+ <documentation>
+ EL Resolver
+ </documentation>
+ </annotation>
+ <complexType>
+ <sequence>
+ <element ref="factory" minOccurs="0"
maxOccurs="unbounded"/>
+ <element ref="project-nature" minOccurs="0"
maxOccurs="unbounded"/>
+ </sequence>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="project-nature">
+ <complexType>
+ <attribute name="id" type="string"
use="required">
+ <annotation>
+ <documentation>
+ ID of project nature which supports this EL
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier"
basedOn="org.eclipse.core.resources.natures/@point"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="resolver-class" type="string">
+ <annotation>
+ <documentation>
+ Implementation of org.jboss.tools.common.el.core.resolver.ELResolver
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java"
basedOn=":org.jboss.tools.common.el.core.resolver.ELResolver"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="factory">
+ <complexType>
+ <attribute name="class" type="string">
+ <annotation>
+ <documentation>
+ Implementetion of
org.jboss.tools.common.el.core.resolver.ELResolverFactory
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java"
basedOn=":org.jboss.tools.common.el.core.resolver.ELResolverFactory"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ JBoss Tools 3.1
+ </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>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2009 Red Hat, Inc.
+Distributed under license by Red Hat, Inc. All rights reserved.
+This program is made available under the terms of the
+Eclipse Public License v1.0 which accompanies this distribution,
+and is available at
http://www.eclipse.org/legal/epl-v10.html
+
+Contributors:
+Red Hat, Inc. - initial API and implementation
+ </documentation>
+ </annotation>
+
+</schema>
Property changes on:
trunk/common/plugins/org.jboss.tools.common.el.core/schema/elResolver.exsd
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java 2009-05-18
18:52:25 UTC (rev 15335)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContextImpl.java 2009-05-18
20:13:30 UTC (rev 15336)
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.common.el.core.resolver;
import java.util.HashMap;
Added:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactory.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactory.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactory.java 2009-05-18
20:13:30 UTC (rev 15336)
@@ -0,0 +1,26 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.el.core.resolver;
+
+import org.eclipse.core.resources.IResource;
+
+/**
+ * @author Alexey Kazakov
+ */
+public interface ELResolverFactory {
+
+ /**
+ * Create EL Resolver for resource. The method may return null.
+ * @param rersource
+ * @return
+ */
+ ELResolver createResolver(IResource resource);
+}
\ No newline at end of file
Property changes on:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactory.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java 2009-05-18
20:13:30 UTC (rev 15336)
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.el.core.resolver;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+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.IExtensionRegistry;
+import org.eclipse.core.runtime.InvalidRegistryObjectException;
+import org.eclipse.core.runtime.Platform;
+import org.jboss.tools.common.el.core.Activator;
+
+/**
+ * This factory is used to get EL Resources for particular resource
+ * which are plug in via org.jboss.tools.common.el.core.elResolver extension point.
+ * @author Alexey Kazakov
+ */
+public class ELResolverFactoryManager {
+
+ private static final ELResolverFactoryManager INSTANCE = new
ELResolverFactoryManager();
+
+ private Map<String, ELResolver[]> resolvers = new HashMap<String,
ELResolver[]>();
+
+ private ELResolverFactoryManager() {
+ }
+
+ /**
+ * Returns an instance of factory manager
+ * @return
+ */
+ public static ELResolverFactoryManager getInstance() {
+ return INSTANCE;
+ }
+
+ /**
+ * Returns all EL resolvers for the resource
+ * @param resource
+ * @return
+ */
+ public ELResolver[] getResolvers(IResource resource) {
+ IProject project = resource.getProject();
+ if(project==null) {
+ return new ELResolver[0];
+ }
+ ELResolver[] result = resolvers.get(project.getName());
+ if(result!=null) {
+ return result;
+ }
+ Set<ELResolver> resolverSet = new HashSet<ELResolver>();
+ IExtensionRegistry registry = Platform.getExtensionRegistry();
+ IExtensionPoint extensionPoint =
registry.getExtensionPoint("org.jboss.tools.common.el.core.elResolver");
//$NON-NLS-N$1
+ IExtension[] extensions = extensionPoint.getExtensions();
+ for (int i=0; i<extensions.length; i++) {
+ IExtension extension = extensions[i];
+ IConfigurationElement[] elements = extension.getConfigurationElements();
+ for(int j=0; j<elements.length; j++) {
+ IConfigurationElement[] natures =
elements[i].getChildren("project-nature"); //$NON-NLS-N$1
+ for (int k = 0; k < natures.length; k++) {
+ String natureId = natures[k].getAttribute("id"); //$NON-NLS-N$1
+ try {
+ if(project.hasNature(natureId)) {
+ Object resolver =
natures[k].createExecutableExtension("resolver-class"); //$NON-NLS-N$1
+ if(resolver instanceof ELResolver) {
+ resolverSet.add((ELResolver)resolver);
+ } else {
+ Activator.getPluginLog().logError(resolver.getClass().getName() + " must be
instance of org.jboss.tools.common.el.core.resolver.ELResolver");
+ }
+ }
+ } catch (InvalidRegistryObjectException e) {
+ Activator.getPluginLog().logError(e);
+ } catch (CoreException e) {
+ Activator.getPluginLog().logError(e);
+ }
+ }
+ IConfigurationElement[] factories = elements[i].getChildren("factory");
//$NON-NLS-N$1
+ for (int k = 0; k < factories.length; k++) {
+ try {
+ Object factory = factories[k].createExecutableExtension("class");
//$NON-NLS-N$1
+ if(factory instanceof ELResolverFactory) {
+ ELResolver resolver = ((ELResolverFactory)factory).createResolver(resource);
+ if(resolver!=null) {
+ resolverSet.add(resolver);
+ }
+ } else {
+ Activator.getPluginLog().logError(factory.getClass().getName() + " must be
instance of org.jboss.tools.common.el.core.resolver.ELResolverFactory");
+ }
+ } catch (CoreException e) {
+ Activator.getPluginLog().logError(e);
+ }
+ }
+ }
+ }
+ result = resolverSet.toArray(new ELResolver[resolverSet.size()]);
+ resolvers.put(project.getName(), result);
+ return result;
+ }
+}
\ No newline at end of file
Property changes on:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2009-05-18 18:52:25 UTC (rev
15335)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/plugin.xml 2009-05-18 20:13:30 UTC (rev
15336)
@@ -491,5 +491,12 @@
<variableresolver
class="org.jboss.tools.seam.internal.core.el.VariableResolver"
id="org.jboss.tools.seam.el.variableresolver"/>
+ </extension>
+
+ <extension
+ point="org.jboss.tools.common.el.core.elResolver">
+ <el-resolver id="seamELResolver">
+ <project-nature id="org.jboss.tools.seam.core.seamnature"/>
+ </el-resolver>
</extension>
</plugin>