JBoss Tools SVN: r18800 - in trunk/esb/plugins/org.jboss.tools.esb.core: src/org/jboss/tools/esb/core/model and 1 other directories.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-11-24 09:49:42 -0500 (Tue, 24 Nov 2009)
New Revision: 18800
Added:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/BasicListConverter.java
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/ConverterConstants.java
Removed:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/AliasConverter.java
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/NotificationConverter.java
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/ObjectPathConverter.java
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/RouteToConverter.java
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/SpecificActionLoader.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5199
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta 2009-11-24 14:38:47 UTC (rev 18799)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb-actions.meta 2009-11-24 14:49:42 UTC (rev 18800)
@@ -24,12 +24,18 @@
<PAIR name="org.jboss.soa.esb.actions.converters.SmooksTransformer" value="ESBPreActionSmooksTransformer"/>
<PAIR name="org.jboss.soa.esb.actions.converters.XStreamToObject" value="ESBPreActionXStreamToObject"/>
<PAIR name="org.jboss.soa.esb.actions.jbpm.CommandInterpreter" value="ESBPreActionCommandInterpreter"/>
+ <PAIR name="org.jboss.soa.esb.actions.routing.JMSRouter" value="ESBPreActionJMSRouter"/>
+ <PAIR name="org.jboss.soa.esb.actions.routing.email.EmailRouter" value="ESBPreActionEMailRouter"/>
+ <PAIR name="org.jboss.soa.esb.actions.routing.email.EmailWiretap" value="ESBPreActionEMailWiretap"/>
<PAIR
name="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor" value="ESBPreActionGroovyProcessor"/>
<PAIR name="org.jboss.soa.esb.actions.soap.SOAPClient" value="ESBPreActionSOAPClient"/>
<PAIR name="org.jboss.soa.esb.actions.soap.SOAPProcessor" value="ESBPreActionSOAPProcessor"/>
<PAIR name="org.jboss.soa.esb.actions.soap.proxy.SOAPProxy" value="ESBPreActionSOAPProxy"/>
<PAIR name="org.jboss.soa.esb.actions.transformation.xslt.XslAction" value="ESBPreActionXSLTAction"/>
+ <PAIR
+ name="org.jboss.soa.esb.actions.validation.SchemaValidationAction" value="ESBPreActionSchemaValidator"/>
+ <PAIR name="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor" value="ESBPreActionBpmProcessor"/>
<PAIR name="org.jboss.soa.esb.smooks.SmooksAction" value="ESBPreActionSmooksAction"/>
</MAPPING>
<MAPPING name="FileVersions">
@@ -116,6 +122,69 @@
</XModelEntity>
<XModelEntity ImplementingClass="%ESB%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;children=%EntityOrdered%"
+ XMLSUBPATH="action" name="ESBPreActionBpmProcessor120">
+ <XChildrenEntities>
+ <XChildEntity name="ESBProperty"/>
+ <XChildEntity name="ESBPreBPMVar"/>
+ </XChildrenEntities>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.esb.action" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="bpm processor action" loader="ElementType" name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;id=true;save=always"
+ name="name" xmlname="name"/>
+ <XModelAttribute PROPERTIES="category=general;save=always"
+ default="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor"
+ name="class" xmlname="class">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="pre=true;category=general;save=always"
+ name="command" xmlname="command"/>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ name="process definition name" xmlname="processdefinition"/>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ name="process definition id" xmlname="process-definition-id"/>
+ <XModelAttribute PROPERTIES="pre=true;category=general" name="actor" xmlname="actor"/>
+ <XModelAttribute PROPERTIES="pre=true;category=general" name="key" xmlname="key"/>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ name="transition name" xmlname="transition-name"/>
+ <XModelAttribute PROPERTIES="category=general" name="process" xmlname="process">
+ <Constraint loader="ListString">
+ <value name="process"/>
+ <value name="split"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ <XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem kind="list" name="CreateActions">
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Add BPM Var..." kind="action" name="AddBPMVar">
+ <EntityData EntityName="ESBPreBPMVar">
+ <AttributeData AttributeName="esb"/>
+ <AttributeData AttributeName="bpm" Mandatory="no"/>
+ <AttributeData AttributeName="default" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
+ </XActionItem>
+ <XActionItemReference entity="ESBProperty" name="CopyActions"/>
+ <XActionItemReference entity="ESBProperty" name="DeleteActions"/>
+ <XActionItemReference entity="ESBProperty" name="Properties"/>
+ <XActionItemReference entity="ESBProperty" name="MoveActions"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ESB%"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;children=%EntityOrdered%"
XMLSUBPATH="action" name="ESBPreActionBusinessRulesProcessor101">
<XChildrenEntities>
<XChildEntity name="ESBProperty"/>
@@ -357,6 +426,128 @@
<XDependencies/>
</XModelEntity>
<XModelEntity ImplementingClass="%ESB%"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;children=%EntityOrdered%"
+ XMLSUBPATH="action" name="ESBPreActionEMailRouter120">
+ <XChildrenEntities>
+ <XChildEntity name="ESBProperty"/>
+ </XChildrenEntities>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.esb.action" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="email router action" loader="ElementType" name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;id=true;save=always"
+ name="name" xmlname="name"/>
+ <XModelAttribute PROPERTIES="category=general;save=always"
+ default="org.jboss.soa.esb.actions.routing.email.EmailRouter"
+ name="class" xmlname="class">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="pre=true;category=general" name="from" xmlname="from"/>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ name="send to" xmlname="sendTo"/>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ name="subject" xmlname="subject"/>
+ <XModelAttribute PROPERTIES="pre=true;category=general" name="host" xmlname="host">
+ <Editor name="AccessibleJava"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="pre=true;category=general" name="port" xmlname="port"/>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ name="username" xmlname="username"/>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ name="password" xmlname="password"/>
+ <XModelAttribute PROPERTIES="category=general;pre=true"
+ default="default(false)" name="unwrap" xmlname="unwrap">
+ <Constraint loader="ListString">
+ <value name="default(false)"/>
+ <value name="true"/>
+ <value name="false"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;pre=true" name="auth" xmlname="auth">
+ <Constraint loader="ListString">
+ <value/>
+ <value name="true"/>
+ <value name="false"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="pre=true;category=advanced"
+ name="message attachment name" xmlname="messageAttachmentName"/>
+ <XModelAttribute PROPERTIES="pre=true;category=advanced"
+ name="message" xmlname="message"/>
+ <XModelAttribute PROPERTIES="pre=true;category=advanced" name="cc to" xmlname="ccTo"/>
+ <XModelAttribute PROPERTIES="category=general" name="process" xmlname="process">
+ <Constraint loader="ListString">
+ <value name="process"/>
+ <value name="split"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ <XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem kind="list" name="CreateActions"/>
+ <XActionItemReference entity="ESBProperty" name="CopyActions"/>
+ <XActionItemReference entity="ESBProperty" name="DeleteActions"/>
+ <XActionItemReference entity="ESBProperty" name="Properties"/>
+ <XActionItemReference entity="ESBProperty" name="MoveActions"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ESB%"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;children=%EntityOrdered%"
+ XMLSUBPATH="action" name="ESBPreActionEMailWiretap120">
+ <XChildrenEntities>
+ <XChildEntity name="ESBProperty"/>
+ </XChildrenEntities>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.esb.action" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="email wiretap action" loader="ElementType" name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;id=true;save=always"
+ name="name" xmlname="name"/>
+ <XModelAttribute PROPERTIES="category=general;save=always"
+ default="org.jboss.soa.esb.actions.routing.email.EmailWiretap"
+ name="class" xmlname="class">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttributeReference
+ attributes="from,send to,subject,host,port,username,password,auth,message attachment name,message,cc to"
+ entity="ESBPreActionEMailRouter120" name="router"/>
+ <XModelAttribute PROPERTIES="category=general" name="process" xmlname="process">
+ <Constraint loader="ListString">
+ <value name="process"/>
+ <value name="split"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ <XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem kind="list" name="CreateActions"/>
+ <XActionItemReference entity="ESBProperty" name="CopyActions"/>
+ <XActionItemReference entity="ESBProperty" name="DeleteActions"/>
+ <XActionItemReference entity="ESBProperty" name="Properties"/>
+ <XActionItemReference entity="ESBProperty" name="MoveActions"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ESB%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData"
XMLSUBPATH="action" name="ESBPreActionGroovyProcessor101">
<XChildrenEntities>
@@ -387,6 +578,24 @@
</Constraint>
<Editor name="TreeChooser"/>
</XModelAttribute>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ default="Default(false)" name="support message based scripting" xmlname="supportMessageBasedScripting">
+ <Constraint loader="ListString">
+ <value name="Default(false)"/>
+ <value name="true"/>
+ <value name="false"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ default="Default(true)" name="cache script" xmlname="cacheScript">
+ <Constraint loader="ListString">
+ <value name="Default(true)"/>
+ <value name="true"/>
+ <value name="false"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
<XModelAttribute PROPERTIES="category=general" name="process" xmlname="process">
<Editor name="Uneditable"/>
</XModelAttribute>
@@ -408,6 +617,89 @@
<XDependencies/>
</XModelEntity>
<XModelEntity ImplementingClass="%ESB%"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;children=%EntityOrdered%"
+ XMLSUBPATH="action" name="ESBPreActionJMSRouter120">
+ <XChildrenEntities>
+ <XChildEntity name="ESBProperty"/>
+ </XChildrenEntities>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.esb.action" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="jms router action" loader="ElementType" name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;id=true;save=always"
+ name="name" xmlname="name"/>
+ <XModelAttribute PROPERTIES="category=general;save=always"
+ default="org.jboss.soa.esb.actions.routing.JMSRouter" name="class" xmlname="class">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ name="jndi context factory" xmlname="jndi-context-factory">
+ <Editor name="AccessibleJava"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ name="jndi url" xmlname="jndi-URL"/>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ name="jndi pkg prefix" xmlname="jndi-pkg-prefix"/>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ name="connection factory" xmlname="connection-factory"/>
+ <XModelAttribute PROPERTIES="pre=true;category=general"
+ name="priority" xmlname="priority"/>
+ <XModelAttribute PROPERTIES="category=general;pre=true"
+ default="default(false)" name="unwrap" xmlname="unwrap">
+ <Constraint loader="ListString">
+ <value name="default(false)"/>
+ <value name="true"/>
+ <value name="false"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;pre=true"
+ default="default(true)" name="persistent" xmlname="persistent">
+ <Constraint loader="ListString">
+ <value name="default(true)"/>
+ <value name="true"/>
+ <value name="false"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="pre=true;category=advanced"
+ name="time to live" xmlname="time-to-live"/>
+ <XModelAttribute PROPERTIES="pre=true;category=advanced"
+ name="security principal" xmlname="security-principal"/>
+ <XModelAttribute PROPERTIES="pre=true;category=advanced"
+ name="security credentials" xmlname="security-credentials"/>
+ <XModelAttribute PROPERTIES="pre=true;category=advanced"
+ name="property strategy" xmlname="property-strategy"/>
+ <XModelAttribute PROPERTIES="pre=true;category=advanced"
+ name="message prop" xmlname="message-prop"/>
+ <XModelAttribute PROPERTIES="pre=true;category=advanced"
+ name="jndi prefixes" xmlname="jndi-prefixes"/>
+ <XModelAttribute PROPERTIES="category=general" name="process" xmlname="process">
+ <Constraint loader="ListString">
+ <value name="process"/>
+ <value name="split"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ <XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem kind="list" name="CreateActions"/>
+ <XActionItemReference entity="ESBProperty" name="CopyActions"/>
+ <XActionItemReference entity="ESBProperty" name="DeleteActions"/>
+ <XActionItemReference entity="ESBProperty" name="Properties"/>
+ <XActionItemReference entity="ESBProperty" name="MoveActions"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ESB%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData"
XMLSUBPATH="action" name="ESBPreActionLongToDateConverter101">
<XChildrenEntities>
@@ -490,6 +782,58 @@
<XDependencies/>
</XModelEntity>
<XModelEntity ImplementingClass="%ESB%"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData"
+ XMLSUBPATH="action" name="ESBPreActionMessagePersister120">
+ <XChildrenEntities>
+ <XChildEntity name="ESBProperty"/>
+ </XChildrenEntities>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.esb.action" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="persist action" loader="ElementType" name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;id=true;save=always"
+ name="name" xmlname="name"/>
+ <XModelAttribute PROPERTIES="category=general;save=always"
+ default="org.jboss.soa.esb.actions.MessagePersister" name="class" xmlname="class">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;save=always;pre=true"
+ name="message store class" xmlname="message-store-class">
+ <Editor name="AccessibleJava"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;pre=true"
+ name="classification" xmlname="classification"/>
+ <XModelAttribute PROPERTIES="category=general;pre=true"
+ default="default(true)" name="terminal" xmlname="terminal">
+ <Constraint loader="ListString">
+ <value name="default(true)"/>
+ <value name="true"/>
+ <value name="false"/>
+ </Constraint>
+ <Editor name="ListString"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general" name="process" xmlname="process">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem kind="list" name="CreateActions"/>
+ <XActionItemReference entity="ESBProperty" name="CopyActions"/>
+ <XActionItemReference entity="ESBProperty" name="DeleteActions"/>
+ <XActionItemReference entity="ESBProperty" name="Properties"/>
+ <XActionItemReference entity="ESBProperty" name="MoveActions"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ESB%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;children=%EntityOrdered%"
XMLSUBPATH="action" name="ESBPreActionNotifier101">
<XChildrenEntities>
@@ -823,6 +1167,60 @@
</XModelEntity>
<XModelEntity ImplementingClass="%ESB%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData"
+ XMLSUBPATH="action" name="ESBPreActionSchemaValidator120">
+ <XChildrenEntities>
+ <XChildEntity name="ESBProperty"/>
+ </XChildrenEntities>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.esb.action" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="schema validation action"
+ loader="ElementType" name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;id=true;save=always"
+ name="name" xmlname="name"/>
+ <XModelAttribute PROPERTIES="category=general;save=always"
+ default="org.jboss.soa.esb.actions.validation.SchemaValidationAction"
+ name="class" xmlname="class">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;save=always;pre=true"
+ name="schema" xmlname="schema">
+ <Constraint loader="Tree">
+ <value name="ESBResourceTree"/>
+ <value name="extensions=xsd"/>
+ <value name="linkAction=OpenSchema"/>
+ </Constraint>
+ <Editor name="TreeChooser"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;pre=true"
+ name="schema language" xmlname="schemaLanguage"/>
+ <XModelAttribute PROPERTIES="category=general" name="process" xmlname="process">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem
+ HandlerClassName="org.jboss.tools.esb.core.model.handlers.OpenESBResourceHandler"
+ ICON="action.empty" PROPERTIES="actionpath=Open;attribute=schema"
+ displayName="Open Schema" kind="action" name="OpenSchema"/>
+ <XActionItem kind="list" name="CreateActions"/>
+ <XActionItemReference entity="ESBProperty" name="CopyActions"/>
+ <XActionItemReference entity="ESBProperty" name="DeleteActions"/>
+ <XActionItemReference entity="ESBProperty" name="Properties"/>
+ <XActionItemReference entity="ESBProperty" name="MoveActions"/>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
+ <XModelEntity ImplementingClass="%ESB%"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData"
XMLSUBPATH="action" name="ESBPreActionSmooksAction101">
<XChildrenEntities>
<XChildEntity name="ESBProperty"/>
@@ -856,6 +1254,8 @@
<XModelAttribute PROPERTIES="category=advanced;pre=true"
name="set payload location" xmlname="set-payload-location"/>
<XModelAttribute PROPERTIES="category=advanced;pre=true"
+ name="mapped context objects" xmlname="mappedContextObjects"/>
+ <XModelAttribute PROPERTIES="category=advanced;pre=true"
name="exclude non-serializables" xmlname="excludeNonSerializables">
<Constraint loader="ListString">
<value/>
@@ -1299,6 +1699,52 @@
</XActionItem>
<XDependencies/>
</XModelEntity>
+ <XModelEntity
+ ImplementingClass="org.jboss.tools.esb.core.model.ESBRouteToImpl"
+ PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;converter=bpmVar"
+ XMLSUBPATH="mapping" name="ESBPreBPMVar">
+ <XChildrenEntities/>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.esb.property" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="bpm var" loader="ElementType" name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttribute PROPERTIES="category=general;id=true;save=always"
+ name="esb" xmlname="esb"/>
+ <XModelAttribute PROPERTIES="category=general" name="bpm" xmlname="bpm"/>
+ <XModelAttribute PROPERTIES="category=general" name="default" xmlname="default"/>
+ <XModelAttribute TRIM="no" name="comment" visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list">
+ <XActionItem kind="list" name="CreateActions"/>
+ <XActionItem ICON="action.empty" displayName="Create" kind="list" name="EditActions"/>
+ <XActionItem ICON="action.copy" displayName="Copy" kind="list" name="CopyActions">
+ <XActionItem BaseActionName="Copy" HandlerClassName="%Copy%"
+ ICON="action.copy" displayName="Copy" kind="action" name="Copy"/>
+ <XActionItem BaseActionName="Cut" HandlerClassName="%Cut%"
+ ICON="action.cut" displayName="Cut" kind="action" name="Cut"/>
+ </XActionItem>
+ <XActionItem ICON="action.delete" displayName="Delete" kind="list" name="DeleteActions">
+ <XActionItem BaseActionName="Delete" HandlerClassName="%Delete%"
+ ICON="action.delete" displayName="Delete" kind="action" name="Delete"/>
+ </XActionItem>
+ <XActionItem ICON="action.empty" kind="list" name="Properties">
+ <XActionItem HandlerClassName="%Properties%" ICON="action.empty"
+ displayName="Properties..." kind="action" name="Properties"/>
+ </XActionItem>
+ <XActionItem displayName="move" kind="list" name="MoveActions">
+ <XActionItem HIDE="always" HandlerClassName="%Move%"
+ ICON="action.move" displayName="Move" kind="action" name="Move"/>
+ </XActionItem>
+ </XActionItem>
+ <XDependencies/>
+ </XModelEntity>
<XModelEntity ImplementingClass="%ESB%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;converter=notification"
XMLSUBPATH="NotificationList" name="ESBPreNotificationList">
@@ -1757,14 +2203,18 @@
<XChildEntity name="ESBPreActionObjectToXStream101"/>
<XChildEntity name="ESBPreActionSmooksAction101"/>
<XChildEntity name="ESBPreActionSmooksTransformer101"/>
- <XChildEntity name="ESBPreActionMessagePersister101"/>
+ <XChildEntity name="ESBPreActionMessagePersister120"/>
<XChildEntity name="ESBPreActionXStreamToObject101"/>
<XChildEntity name="ESBPreActionCommandInterpreter101"/>
+ <XChildEntity name="ESBPreActionBpmProcessor120"/>
<XChildEntity name="ESBPreActionGroovyProcessor101"/>
<XChildEntity name="ESBPreActionAggregator101"/>
<XChildEntity name="ESBPreActionContentBasedRouter101"/>
<XChildEntity name="ESBPreActionStaticRouter101"/>
<XChildEntity name="ESBPreActionStaticWiretap101"/>
+ <XChildEntity name="ESBPreActionJMSRouter120"/>
+ <XChildEntity name="ESBPreActionEMailRouter120"/>
+ <XChildEntity name="ESBPreActionEMailWiretap120"/>
<XChildEntity name="ESBPreActionSOAPProcessor101"/>
<XChildEntity name="ESBPreActionSOAPClient101"/>
<XChildEntity name="ESBPreActionSOAPProxy120"/>
@@ -1772,6 +2222,7 @@
<XChildEntity name="ESBPreActionNotifier101"/>
<XChildEntity name="ESBPreActionBusinessRulesProcessor101"/>
<XChildEntity name="ESBPreActionXSLTAction120"/>
+ <XChildEntity name="ESBPreActionSchemaValidator120"/>
</XChildrenEntities>
<XActionItem kind="list">
<XActionItem ICON="action.empty" displayName="New" group="1"
@@ -1785,7 +2236,16 @@
<XActionItemReference entity="ESBActions101" name="AddObjectToXStream"/>
<XActionItemReference entity="ESBActions101" name="AddSmooksAction"/>
<XActionItemReference entity="ESBActions101" name="AddSmooksTransformer"/>
- <XActionItemReference entity="ESBActions101" name="AddMessagePersister"/>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Message Persister..." kind="action" name="AddMessagePersister">
+ <EntityData EntityName="ESBPreActionMessagePersister120">
+ <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="message store class"/>
+ <AttributeData AttributeName="classification" Mandatory="no"/>
+ <AttributeData AttributeName="terminal" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
<XActionItemReference entity="ESBActions101" name="AddXStreamToObject"/>
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
@@ -1800,8 +2260,87 @@
</XActionItem>
</XActionItem>
<XActionItemReference entity="ESBActions101" name="AddCommandInterpreter"/>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="BPM Processor..." kind="action" name="AddBPMProcessor">
+ <EntityData EntityName="ESBPreActionBpmProcessor120">
+ <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="command"/>
+ <AttributeData AttributeName="process definition name" Mandatory="no"/>
+ <AttributeData AttributeName="process definition id" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
<XActionItemReference entity="ESBActions101" name="AddGroovyProcessor"/>
- <XActionItemReference entity="ESBActions101" name="Routers"/>
+ <XActionItem displayName="Routers" group="1" kind="list" name="Routers">
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Aggregator..." kind="action" name="AddAggregator">
+ <EntityData EntityName="ESBPreActionAggregator101">
+ <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="timeout in millies" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Content Based Router..." kind="action" name="AddContentBasedRouter">
+ <EntityData EntityName="ESBPreActionContentBasedRouter101">
+ <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="process" Mandatory="no"/>
+ <AttributeData AttributeName="rule set"/>
+ <AttributeData AttributeName="rule language" Mandatory="no"/>
+ <AttributeData AttributeName="rule reload" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Static Router..." kind="action" name="AddStaticRouter">
+ <EntityData EntityName="ESBPreActionStaticRouter101">
+ <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="process" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Static Wiretap..." kind="action" name="AddStaticWiretap">
+ <EntityData EntityName="ESBPreActionStaticWiretap101">
+ <AttributeData AttributeName="name"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Notifier..." kind="action" name="AddNotifier">
+ <EntityData EntityName="ESBPreActionNotifier101">
+ <AttributeData AttributeName="name"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="JMS Router..." kind="action" name="AddJMSRouter">
+ <EntityData EntityName="ESBPreActionJMSRouter120">
+ <AttributeData AttributeName="name"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="EMail Router..." kind="action" name="AddEMailRouter">
+ <EntityData EntityName="ESBPreActionEMailRouter120">
+ <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="from" Mandatory="no"/>
+ <AttributeData AttributeName="send to" Mandatory="no"/>
+ <AttributeData AttributeName="subject" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="EMail Wiretap..." kind="action" name="AddEMailWiretap">
+ <EntityData EntityName="ESBPreActionEMailWiretap120">
+ <AttributeData AttributeName="name"/>
+ <AttributeData AttributeName="from" Mandatory="no"/>
+ <AttributeData AttributeName="send to" Mandatory="no"/>
+ <AttributeData AttributeName="subject" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
+ </XActionItem>
<XActionItem displayName="SOAP" kind="list" name="SOAP">
<XActionItem HandlerClassName="%Create%" ICON="action.empty"
PROPERTIES="validator.add=true" WizardClassName="%Default%"
@@ -1833,6 +2372,14 @@
</XActionItem>
<XActionItemReference entity="ESBActions101" name="AddSystemPrintln"/>
<XActionItemReference entity="ESBActions101" name="AddBusinessRulesProcessor"/>
+ <XActionItem HandlerClassName="%Create%" ICON="action.empty"
+ PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ displayName="Schema Validation..." kind="action" name="AddSchemaValidation">
+ <EntityData EntityName="ESBPreActionSchemaValidator120">
+ <AttributeData AttributeName="schema"/>
+ <AttributeData AttributeName="schema language" Mandatory="no"/>
+ </EntityData>
+ </XActionItem>
</XActionItem>
</XActionItem>
</XActionItem>
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/SpecificActionLoader.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/SpecificActionLoader.java 2009-11-24 14:38:47 UTC (rev 18799)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/SpecificActionLoader.java 2009-11-24 14:49:42 UTC (rev 18800)
@@ -23,10 +23,8 @@
import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
import org.jboss.tools.esb.core.ESBCorePlugin;
-import org.jboss.tools.esb.core.model.converters.AliasConverter;
-import org.jboss.tools.esb.core.model.converters.NotificationConverter;
-import org.jboss.tools.esb.core.model.converters.ObjectPathConverter;
-import org.jboss.tools.esb.core.model.converters.RouteToConverter;
+import org.jboss.tools.esb.core.model.converters.ConverterConstants;
+import org.jboss.tools.esb.core.model.converters.IPropertyConverter;
/**
* @author Viacheslav Kabanovich
@@ -134,15 +132,9 @@
if(ESBConstants.ENT_ESB_PROPERTY.equals(childEntityName)) continue;
XModelEntity childEntity = action.getModelEntity().getMetaModel().getEntity(childEntityName);
if(childEntity == null) continue;
- String converter = childEntity.getProperty("converter");
- if("alias".equals(converter)) {
- new AliasConverter().toSpecific(basic, action);
- } else if("route".equals(converter)) {
- new RouteToConverter().toSpecific(basic, action);
- } else if("path".equals(converter)) {
- new ObjectPathConverter().toSpecific(basic, action);
- } else if("notification".equals(converter)) {
- new NotificationConverter().toSpecific(basic, action);
+ IPropertyConverter converter = getPropertyConverter(childEntity);
+ if(converter != null) {
+ converter.toSpecific(basic, action);
}
}
@@ -193,15 +185,9 @@
if(ESBConstants.ENT_ESB_PROPERTY.equals(childEntityName)) continue;
XModelEntity childEntity = entity.getMetaModel().getEntity(childEntityName);
if(childEntity == null) continue;
- String converter = childEntity.getProperty("converter");
- if("alias".equals(converter)) {
- new AliasConverter().toBasic(result, action);
- } else if("route".equals(converter)) {
- new RouteToConverter().toBasic(result, action);
- } else if("path".equals(converter)) {
- new ObjectPathConverter().toBasic(result, action);
- } else if("notification".equals(converter)) {
- new NotificationConverter().toBasic(result, action);
+ IPropertyConverter converter = getPropertyConverter(childEntity);
+ if(converter != null) {
+ converter.toBasic(result, action);
}
}
@@ -211,4 +197,15 @@
}
return result;
}
+
+ IPropertyConverter getPropertyConverter(XModelEntity childEntity) {
+ String converter = childEntity.getProperty("converter");
+ if("alias".equals(converter)) return ConverterConstants.ALIAS_CONVERTER;
+ if("route".equals(converter)) return ConverterConstants.ROUTE_CONVERTER;
+ if("path".equals(converter)) return ConverterConstants.OBJECT_PATHS_CONVERTER;
+ if("notification".equals(converter)) return ConverterConstants.NOTIFICATION_CONVERTER;
+ if("bpmVar".equals(converter)) return ConverterConstants.BPM_VAR_CONVERTER;
+
+ return null;
+ }
}
Deleted: trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/AliasConverter.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/AliasConverter.java 2009-11-24 14:38:47 UTC (rev 18799)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/AliasConverter.java 2009-11-24 14:49:42 UTC (rev 18800)
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.esb.core.model.converters;
-
-/**
- * @author Viacheslav Kabanovich
- */
-public class AliasConverter extends ListConverter {
- static final String ALIAS_ENTITY = "ESBPreAlias";
- static final String ALIASES = "aliases";
-
- protected String getPropertyName() {
- return ALIASES;
- }
-
- protected String getItemEntityName() {
- return ALIAS_ENTITY;
- }
-
-}
Added: trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/BasicListConverter.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/BasicListConverter.java (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/BasicListConverter.java 2009-11-24 14:49:42 UTC (rev 18800)
@@ -0,0 +1,33 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.esb.core.model.converters;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class BasicListConverter extends ListConverter {
+ String propertyName;
+ String itemEntityName;
+
+ public BasicListConverter(String propertyName, String itemEntityName) {
+ this.propertyName = propertyName;
+ this.itemEntityName = itemEntityName;
+ }
+
+ protected String getPropertyName() {
+ return propertyName;
+ }
+
+ protected String getItemEntityName() {
+ return itemEntityName;
+ }
+
+}
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/BasicListConverter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/ConverterConstants.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/ConverterConstants.java (rev 0)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/ConverterConstants.java 2009-11-24 14:49:42 UTC (rev 18800)
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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.esb.core.model.converters;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public interface ConverterConstants {
+ String ALIAS_ENTITY = "ESBPreAlias";
+ String ALIASES = "aliases";
+ IPropertyConverter ALIAS_CONVERTER = new BasicListConverter(ALIASES, ALIAS_ENTITY);
+
+ String ROUTE_TO_ENTITY = "ESBPreRouteTo";
+ String DESTINATIONS = "destinations";
+ IPropertyConverter ROUTE_CONVERTER = new BasicListConverter(DESTINATIONS, ROUTE_TO_ENTITY);
+
+ String OBJECT_PATH_ENTITY = "ESBPreObjectPath";
+ String OBJECT_PATHS = "object-paths";
+ IPropertyConverter OBJECT_PATHS_CONVERTER = new BasicListConverter(OBJECT_PATHS, OBJECT_PATH_ENTITY);
+
+ String NOTIFICATION_ENTITY = "ESBPreNotificationList";
+ IPropertyConverter NOTIFICATION_CONVERTER = new BasicListConverter(DESTINATIONS, NOTIFICATION_ENTITY);
+
+ String BPM_VAR_ENTITY = "ESBPreBPMVar";
+ String BPM_VARS = "esbToBpmVars";
+ IPropertyConverter BPM_VAR_CONVERTER = new BasicListConverter(BPM_VARS, BPM_VAR_ENTITY);
+
+}
Property changes on: trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/ConverterConstants.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/NotificationConverter.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/NotificationConverter.java 2009-11-24 14:38:47 UTC (rev 18799)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/NotificationConverter.java 2009-11-24 14:49:42 UTC (rev 18800)
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.esb.core.model.converters;
-
-/**
- * @author Viacheslav Kabanovich
- */
-public class NotificationConverter extends ListConverter {
- static final String NOTIFICATION_ENTITY = "ESBPreNotificationList";
- static final String DESTINATIONS = "destinations";
-
- protected String getPropertyName() {
- return DESTINATIONS;
- }
-
- protected String getItemEntityName() {
- return NOTIFICATION_ENTITY;
- }
-
-}
Deleted: trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/ObjectPathConverter.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/ObjectPathConverter.java 2009-11-24 14:38:47 UTC (rev 18799)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/ObjectPathConverter.java 2009-11-24 14:49:42 UTC (rev 18800)
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.esb.core.model.converters;
-
-/**
- * @author Viacheslav Kabanovich
- */
-public class ObjectPathConverter extends ListConverter {
- static final String OBJECT_PATH_ENTITY = "ESBPreObjectPath";
- static final String OBJECT_PATHS = "object-paths";
-
- protected String getPropertyName() {
- return OBJECT_PATHS;
- }
-
- protected String getItemEntityName() {
- return OBJECT_PATH_ENTITY;
- }
-
-}
Deleted: trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/RouteToConverter.java
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/RouteToConverter.java 2009-11-24 14:38:47 UTC (rev 18799)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/converters/RouteToConverter.java 2009-11-24 14:49:42 UTC (rev 18800)
@@ -1,28 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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.esb.core.model.converters;
-
-/**
- * @author Viacheslav Kabanovich
- */
-public class RouteToConverter extends ListConverter {
- static final String ROUTE_TO_ENTITY = "ESBPreRouteTo";
- static final String DESTINATIONS = "destinations";
-
- protected String getPropertyName() {
- return DESTINATIONS;
- }
-
- protected String getItemEntityName() {
- return ROUTE_TO_ENTITY;
- }
-
-}
15 years, 1 month
JBoss Tools SVN: r18798 - in trunk: jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-11-24 09:01:57 -0500 (Tue, 24 Nov 2009)
New Revision: 18798
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesCSSClassHyperlink.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesCSSClassHyperlinkPartitioner.java
trunk/jst/plugins/org.jboss.tools.jst.text.ext/META-INF/MANIFEST.MF
trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java
Log:
JBIDE-5237: Update existing CSS Class Hyperlink for "class" attribute of HTML-tags to search thru CSS Stylesheets loaded using JSF tags like <a:loadStyle />
JBIDE-5149: Make OpenOn work for styleClass="|"
Issues are fixed
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java 2009-11-24 13:56:15 UTC (rev 18797)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/AbstractHyperlink.java 2009-11-24 14:01:57 UTC (rev 18798)
@@ -46,6 +46,7 @@
/**
*
*/
+@SuppressWarnings("restriction")
abstract public class AbstractHyperlink extends AbstractBaseHyperlink implements IHyperlink {
public static final String DOLLAR_PREFIX = "${"; //$NON-NLS-1$
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesCSSClassHyperlink.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesCSSClassHyperlink.java 2009-11-24 13:56:15 UTC (rev 18797)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesCSSClassHyperlink.java 2009-11-24 14:01:57 UTC (rev 18798)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.jsf.text.ext.richfaces.hyperlink;
import java.text.MessageFormat;
@@ -3,49 +14,23 @@
import java.util.List;
-import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
-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.sse.core.internal.provisional.IndexedRegion;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
import org.jboss.tools.jst.text.ext.hyperlink.CSSClassHyperlink;
import org.jboss.tools.jst.web.kb.ICSSContainerSupport;
-import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.PageContextFactory;
import org.jboss.tools.jst.web.kb.PageContextFactory.CSSStyleSheetDescriptor;
import org.w3c.dom.css.CSSRule;
import org.w3c.dom.css.CSSRuleList;
+/**
+ *
+ * @author Victor Rubezhny
+ *
+ */
+@SuppressWarnings("restriction")
public class RichfacesCSSClassHyperlink extends CSSClassHyperlink {
-
- @Override
- protected void doHyperlink(IRegion region) {
- ICSSContainerSupport cssContainerSupport = null;
- IPageContext context = PageContextFactory.createPageContext(getFile(), region.getOffset(), getContentType(getDocument()));
- if (!(context instanceof ICSSContainerSupport)) {
- openFileFailed();
- return;
- }
- cssContainerSupport = (ICSSContainerSupport)context;
- List<CSSStyleSheetDescriptor> descrs = cssContainerSupport.getCSSStyleSheetDescriptors();
-
- for (int i = (descrs == null) ? -1 : descrs.size() - 1; descrs != null && i >= 0; i--) {
- CSSStyleSheetDescriptor descr = descrs.get(i);
- CSSRuleList rules = descr.sheet.getCssRules();
- for (int r = 0; rules != null && r < rules.getLength(); r++) {
- if (isRuleMatch(rules.item(r), getStyleName(region))) {
- CSSRule rule = rules.item(r);
- System.out.println();
- showRegion(
- PageContextFactory.getFileFromProject(descr.source, getFile()),
- new Region(((IndexedRegion)rule).getStartOffset(), ((IndexedRegion)rule).getLength()));
- return;
- }
- }
- }
- }
-
/*
* (non-Javadoc)
@@ -60,31 +45,4 @@
return MessageFormat.format(Messages.OpenCSSStyle, styleName);
}
-
-
- /**
- * Returns the content type of document
- *
- * @param document -
- * assumes document is not null
- * @return String content type of given document
- */
- @SuppressWarnings("restriction")
- private String getContentType(IDocument document) {
- String type = null;
-
- IModelManager mgr = StructuredModelManager.getModelManager();
- IStructuredModel model = null;
- try {
- model = mgr.getExistingModelForRead(document);
- if (model != null) {
- type = model.getContentTypeIdentifier();
- }
- } finally {
- if (model != null) {
- model.releaseFromRead();
- }
- }
- return type;
- }
}
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesCSSClassHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesCSSClassHyperlinkPartitioner.java 2009-11-24 13:56:15 UTC (rev 18797)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.richfaces/src/org/jboss/tools/jsf/text/ext/richfaces/hyperlink/RichfacesCSSClassHyperlinkPartitioner.java 2009-11-24 14:01:57 UTC (rev 18798)
@@ -1,3 +1,14 @@
+/*******************************************************************************
+ * Copyright (c) 2009 Exadel, Inc. and 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
package org.jboss.tools.jsf.text.ext.richfaces.hyperlink;
import org.eclipse.jface.text.IDocument;
@@ -4,6 +15,11 @@
import org.jboss.tools.common.text.ext.hyperlink.IHyperlinkRegion;
import org.jboss.tools.jst.text.ext.hyperlink.CSSClassHyperlinkPartitioner;
+/**
+ *
+ * @author Victor Rubezhny
+ *
+ */
public class RichfacesCSSClassHyperlinkPartitioner extends CSSClassHyperlinkPartitioner {
public static final String RICHFACES_CSS_CLASS_PARTITION = "org.jboss.tools.common.text.ext.RICHFACES_CSS_CLASS"; //$NON-NLS-1$
private static final String RICHFACES_CSS_CLASS_TOKEN = "/styleClass/"; //$NON-NLS-1$
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/META-INF/MANIFEST.MF
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/META-INF/MANIFEST.MF 2009-11-24 13:56:15 UTC (rev 18797)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/META-INF/MANIFEST.MF 2009-11-24 14:01:57 UTC (rev 18798)
@@ -28,5 +28,6 @@
org.jboss.tools.common.el.core;bundle-version="2.0.0",
org.eclipse.emf.ecore;bundle-version="2.5.0",
org.eclipse.wst.css.core,
- org.eclipse.wst.html.core
+ org.eclipse.wst.html.core,
+ org.jboss.tools.jst.web.kb
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Modified: trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java 2009-11-24 13:56:15 UTC (rev 18797)
+++ trunk/jst/plugins/org.jboss.tools.jst.text.ext/src/org/jboss/tools/jst/text/ext/hyperlink/CSSClassHyperlink.java 2009-11-24 14:01:57 UTC (rev 18798)
@@ -10,12 +10,8 @@
******************************************************************************/
package org.jboss.tools.jst.text.ext.hyperlink;
-import java.io.IOException;
-import java.io.UnsupportedEncodingException;
import java.text.MessageFormat;
-import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.regex.Matcher;
@@ -29,200 +25,69 @@
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
-import org.eclipse.wst.css.core.internal.provisional.adapters.IModelProvideAdapter;
-import org.eclipse.wst.css.core.internal.provisional.adapters.IStyleSheetAdapter;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSDocument;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSModel;
-import org.eclipse.wst.css.core.internal.provisional.document.ICSSNode;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleSheet;
-import org.eclipse.wst.html.core.internal.htmlcss.LinkElementAdapter;
-import org.eclipse.wst.html.core.internal.htmlcss.URLModelProvider;
-import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.common.text.ext.hyperlink.xpl.Messages;
-import org.jboss.tools.common.text.ext.util.RegionHolder;
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.StructuredSelectionHelper;
import org.jboss.tools.common.text.ext.util.Utils;
+import org.jboss.tools.jst.web.kb.ICSSContainerSupport;
+import org.jboss.tools.jst.web.kb.PageContextFactory;
+import org.jboss.tools.jst.web.kb.PageContextFactory.CSSStyleSheetDescriptor;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
-import org.w3c.dom.Element;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
import org.w3c.dom.css.CSSRule;
import org.w3c.dom.css.CSSRuleList;
-import org.w3c.dom.css.CSSStyleSheet;
/**
* @author Jeremy
*/
+@SuppressWarnings("restriction")
public class CSSClassHyperlink extends AbstractHyperlink {
public static final String[] STYLE_TAGS = new String[] { "style", "link" }; //$NON-NLS-1$//$NON-NLS-2$
public static final String LINK_TAG = "link"; //$NON-NLS-1$
public static final String HREF_ATTRIBUTE = "href"; //$NON-NLS-1$
- public static final String COMPARE_CLASS_REGEX_PREFIX = "[\\.]?"; //$NON-NLS-1$
+ public static final String COMPARE_CLASS_REGEX_PREFIX = "([A-Za-z_][A-Za-z_0-9\\-]*)*[\\.]?"; //$NON-NLS-1$
public static final String CONTEXT_PATH_EXPRESSION = "^\\s*(\\#|\\$)\\{facesContext.externalContext.requestContextPath\\}"; //$NON-NLS-1$
-
- /**
- *
- */
+
+ @Override
protected void doHyperlink(IRegion region) {
-
- IDOMModel model = (IDOMModel) getModelManager()
- .getExistingModelForRead(getDocument());
-
- // get name of looked for style
- String styleName = getStyleName(region);
-
- // get elements which copntans information about styles (style and link
- // tags)
- List<Node> styleElementList = getStyleContainerList(model);
-
- // sort nodes by position in inverse order - from larger position to
- // smaller
- Collections.sort(styleElementList, new Comparator<Node>() {
-
- public int compare(Node o1, Node o2) {
- return ((IDOMNode) o2).getStartOffset()
- - ((IDOMNode) o1).getStartOffset();
- }
-
- });
-
- RegionHolder styleRegion = null;
- // look for style in each Style element
- for (Node styleContainer : styleElementList) {
-
- styleRegion = findStyleRegion(styleContainer, styleName);
-
- if (styleRegion != null) {
- showRegion(styleRegion);
- break;
- }
-
+ ICSSContainerSupport cssContainerSupport = null;
+ ELContext context = PageContextFactory.createPageContext(getFile());
+ if (!(context instanceof ICSSContainerSupport)) {
+ openFileFailed();
+ return;
}
+ cssContainerSupport = (ICSSContainerSupport)context;
+ List<CSSStyleSheetDescriptor> descrs = cssContainerSupport.getCSSStyleSheetDescriptors();
- model.releaseFromRead();
- }
-
- /**
- *
- * @param model
- * @return
- */
- private List<Node> getStyleContainerList(IDOMModel model) {
-
- // get model of current page
- IDOMDocument document = model.getDocument();
-
- List<Node> getStyleContainerList = new ArrayList<Node>();
-
- // get all tags which contains style ( link, style)
- for (String tagName : STYLE_TAGS) {
- getStyleContainerList.addAll(getList(document
- .getElementsByTagName(tagName)));
- }
-
- return getStyleContainerList;
- }
-
- /**
- * move nodes from NodeList to List
- *
- * @param nodeList
- * @return
- */
- List<Node> getList(NodeList nodeList) {
-
- List<Node> newContainerList = new ArrayList<Node>();
- for (int i = 0; i < nodeList.getLength(); i++) {
- newContainerList.add(nodeList.item(i));
- }
- return newContainerList;
- }
-
- /**
- *
- * @param stylesContainer
- * @param styleName
- * @return
- */
- public RegionHolder findStyleRegion(Node stylesContainer, String styleName) {
-
- // get style sheet
- CSSStyleSheet sheet = getSheet(stylesContainer);
-
- if (sheet != null) {
-
- CSSRuleList ruleList = sheet.getCssRules();
-
- // for each cssRule
- for (int i = 0; i < ruleList.getLength(); i++) {
-
- CSSRule cssRule = ruleList.item(i);
-
- // if cssRule describe looked for style
- if (isRuleMatch(cssRule, styleName)) {
-
- return new RegionHolder(getFile((ICSSNode) cssRule),
- getRegion(cssRule));
-
+ for (int i = (descrs == null) ? -1 : descrs.size() - 1; descrs != null && i >= 0; i--) {
+ CSSStyleSheetDescriptor descr = descrs.get(i);
+ CSSRuleList rules = descr.sheet.getCssRules();
+ for (int r = 0; rules != null && r < rules.getLength(); r++) {
+ if (isRuleMatch(rules.item(r), getStyleName(region))) {
+ CSSRule rule = rules.item(r);
+ System.out.println();
+ showRegion(
+ PageContextFactory.getFileFromProject(descr.source, getFile()),
+ new Region(((IndexedRegion)rule).getStartOffset(), ((IndexedRegion)rule).getLength()));
+ return;
}
}
-
}
- return null;
+ openFileFailed();
}
/**
*
- * @param stylesContainer
- * @return
- */
- private CSSStyleSheet getSheet(final Node stylesContainer) {
-
- INodeNotifier notifier = (INodeNotifier) stylesContainer;
-
- IStyleSheetAdapter adapter = (IStyleSheetAdapter) notifier
- .getAdapterFor(IStyleSheetAdapter.class);
-
- if (LINK_TAG.equalsIgnoreCase(stylesContainer.getNodeName())
- && !(adapter instanceof ExtendedLinkElementAdapter)) {
-
- notifier.removeAdapter(adapter);
- adapter = new ExtendedLinkElementAdapter(
- (Element) stylesContainer);
- notifier.addAdapter(adapter);
-
- }
-
- CSSStyleSheet sheet = null;
-
- if (adapter != null) {
- sheet = (CSSStyleSheet) adapter.getSheet();
-
- }
-
- return sheet;
-
- }
-
- protected String processURL(String href) {
- // TODO Auto-generated method stub
- return null;
- }
-
- /**
- *
* @param cssRule
* @param styleName
* @return
@@ -237,19 +102,20 @@
for (String styleText : styles) {
String[] styleWords = styleText.trim().split(" "); //$NON-NLS-1$
if (styleWords != null) {
- int searchIndex = Arrays.binarySearch(styleWords, styleName,
- new Comparator<String>() {
-
- public int compare(String o1, String o2) {
- Matcher matcher = Pattern.compile(
- COMPARE_CLASS_REGEX_PREFIX + o2)
- .matcher(o1);
- return matcher.matches() ? 0 : 1;
- }
-
- });
- if (searchIndex >= 0)
- return true;
+ int searchIndex = Arrays.binarySearch(styleWords, styleName,
+ new Comparator<String>() {
+
+ public int compare(String o1, String o2) {
+ Matcher matcher = Pattern.compile(
+ COMPARE_CLASS_REGEX_PREFIX + o2)
+ .matcher(o1);
+
+ return matcher.matches() ? 0 : 1;
+ }
+
+ });
+ if (searchIndex >= 0)
+ return true;
}
}
}
@@ -258,18 +124,6 @@
/**
*
- * @param node
- * @return
- */
- private IFile getFile(ICSSNode node) {
-
- ICSSDocument sheet = node.getOwnerDocument();
-
- return AbstractHyperlink.getFile(sheet.getModel());
- }
-
- /**
- *
* @param cssRule
* @return
*/
@@ -299,30 +153,6 @@
*
* @param styleRegion
*/
- protected void showRegion(RegionHolder styleRegion) {
-
- IWorkbenchPage workbenchPage = ExtensionsPlugin.getDefault()
- .getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IEditorPart part = null;
- if (styleRegion.file != null) {
- try {
- part = IDE.openEditor(workbenchPage, styleRegion.file, true);
- } catch (PartInitException e) {
- e.printStackTrace();
- }
- if (part == null) {
- openFileFailed();
- return;
- }
- }
- StructuredSelectionHelper.setSelectionAndReveal(part,
- styleRegion.region);
- }
-
- /**
- *
- * @param styleRegion
- */
protected void showRegion(IFile file, IRegion region) {
IWorkbenchPage workbenchPage = ExtensionsPlugin.getDefault()
@@ -343,7 +173,6 @@
region);
}
-
/**
*
* @param region
@@ -447,91 +276,8 @@
@Override
protected String findAndReplaceElVariable(String fileName) {
if (fileName != null)
- fileName = fileName
- .replaceFirst(
- "^\\s*(\\#|\\$)\\{facesContext.externalContext.requestContextPath\\}",
- "");
+ fileName = fileName.replaceFirst(CONTEXT_PATH_EXPRESSION,""); //$NON-NLS-1$
+
return super.findAndReplaceElVariable(fileName);
}
-
- public class ExtendedLinkElementAdapter extends LinkElementAdapter {
-
- private Element element;
-
- public ExtendedLinkElementAdapter(Element element) {
- this.element = element;
- }
-
- @Override
- public Element getElement() {
- return element;
- }
-
- @Override
- protected boolean isValidAttribute() {
- String href = getElement().getAttribute(HREF_ATTRIBUTE);
- if (href == null || href.length() == 0)
- return false;
- return true;
- }
-
- /**
- */
- public ICSSModel getModel() {
- ICSSModel model = super.getModel();
- if (model == null) {
- model = retrieveModel();
- setModel(model);
- }
- return model;
- }
-
- /**
- */
- private ICSSModel retrieveModel() {
- if (!isValidAttribute()) {
- return null;
- }
-
- // null,attr check is done in isValidAttribute()
- Element element = getElement();
- String href = findAndReplaceElVariable(element
- .getAttribute(HREF_ATTRIBUTE));
-
- IDOMModel baseModel = ((IDOMNode) element).getModel();
- if (baseModel == null)
- return null;
- Object id = baseModel.getId();
- if (!(id instanceof String))
- return null;
- // String base = (String)id;
-
- // get ModelProvideAdapter
- IModelProvideAdapter adapter = (IModelProvideAdapter) ((INodeNotifier) getElement())
- .getAdapterFor(IModelProvideAdapter.class);
-
- URLModelProvider provider = new URLModelProvider();
- try {
- IStructuredModel newModel = provider.getModelForRead(baseModel,
- href);
- if (newModel == null)
- return null;
- if (!(newModel instanceof ICSSModel)) {
- newModel.releaseFromRead();
- return null;
- }
-
- // notify adapter
- if (adapter != null)
- adapter.modelProvided(newModel);
-
- return (ICSSModel) newModel;
- } catch (UnsupportedEncodingException e) {
- } catch (IOException e) {
- }
-
- return null;
- }
- }
-
}
\ No newline at end of file
15 years, 1 month
JBoss Tools SVN: r18797 - in trunk: jsf/plugins/org.jboss.tools.jsf.text.ext.facelets and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-11-24 08:56:15 -0500 (Tue, 24 Nov 2009)
New Revision: 18797
Added:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/INameSpaceExtended.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibraryManager.java
Removed:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibriryManager.java
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/ICSSContainerSupport.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IIncludedContextSupport.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IPageContext.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IProposalProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/XmlContextImpl.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractAttribute.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomProposalType.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomProposalTypeFactory.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomTagLibAttribute.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/EnumerationProposalType.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/ExtendedProposalType.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FaceletsJsfCProposalType.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FacetNameProposalType.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/IDProposalType.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/ModelProposalType.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/NameSpace.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/ResourcePathProposalType.java
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/INameSpace.java
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationMessages.java
Log:
JBIDE-5119: Refactor PageContextFactory to improve perfomance of context creation
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELContext.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -27,12 +27,18 @@
/**
* Returns "var" attributes
- * @param offset
* @return
*/
Var[] getVars();
/**
+ * Returns "var" attributes which are available in particular offset.
+ * @param offset
+ * @return
+ */
+ Var[] getVars(int offset);
+
+ /**
* Returns EL Resolvers which are declared for this resource
* @return
*/
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/SimpleELContext.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -56,6 +56,14 @@
return vars.toArray(new Var[vars.size()]);
}
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.common.el.core.resolver.ELContext#getVars(int)
+ */
+ public Var[] getVars(int i) {
+ return getVars();
+ }
+
/**
* @param vars
*/
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/plugin.xml 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext.facelets/plugin.xml 2009-11-24 13:56:15 UTC (rev 18797)
@@ -118,7 +118,7 @@
<attribute name="template" />
</tag>
<tag name="include">
- <attribute name="page" />
+ <attribute name="src" />
</tag>
</include>
</extension>
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/AbstractXMLContentAssistProcessor.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -33,6 +33,7 @@
import org.eclipse.wst.sse.core.internal.provisional.text.ITextRegion;
import org.eclipse.wst.xml.core.internal.contentmodel.CMElementDeclaration;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText;
@@ -62,9 +63,10 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+@SuppressWarnings("restriction")
abstract public class AbstractXMLContentAssistProcessor extends AbstractContentAssistProcessor {
private static final char[] PROPOSAL_AUTO_ACTIVATION_CHARS = new char[] {
- '<', '=', '"', '\'', '.'
+ '<', '=', '"', '\'', '.', '{'
};
private IDocument fDocument;
@@ -278,7 +280,7 @@
*/
@Override
protected String getMatchString(IStructuredDocumentRegion parent, ITextRegion aRegion, int offset) {
- if (aRegion == null) return "";
+ if (aRegion == null) return ""; //$NON-NLS-1$
String matchString = super.getMatchString(parent, aRegion, offset);
String regionType = aRegion.getType();
if(regionType == DOMRegionContext.XML_TAG_ATTRIBUTE_VALUE && matchString.startsWith("\"")) { //$NON-NLS-1$
@@ -543,7 +545,7 @@
}
String regionType = completionRegion.getType();
- IStructuredDocumentRegion sdRegion = getStructuredDocumentRegion(documentPosition);
+// IStructuredDocumentRegion sdRegion = getStructuredDocumentRegion(documentPosition);
/*
* Jeremy: Add attribute name proposals before empty tag close
@@ -555,7 +557,8 @@
|| (regionType == DOMRegionContext.XML_CHAR_REFERENCE)
|| (regionType == DOMRegionContext.XML_ENTITY_REFERENCE)
|| (regionType == DOMRegionContext.XML_PE_REFERENCE)
- || (regionType == DOMRegionContext.BLOCK_TEXT)) {
+ || (regionType == DOMRegionContext.BLOCK_TEXT)
+ || (regionType == DOMRegionContext.XML_END_TAG_OPEN)) {
addTextELProposals(contentAssistRequest);
}
}
@@ -588,14 +591,6 @@
/**
- * Creates an empty <code>org.jboss.tools.common.el.core.resolver.ELContext</code> instance
- * to be used in <code>createContext()</code> method
- *
- *
- */
- abstract protected ELContext createContextInstance();
-
- /**
* Creates and fulfills the <code>org.jboss.tools.jst.web.kb.KbQuery</code>
* instance
* Important: the Context is to be set before any call to createKbQuery
@@ -934,6 +929,7 @@
* Returns URI for the current/parent tag
* @return
*/
+ @SuppressWarnings("deprecation")
protected TextRegion getELPrefix() {
IStructuredModel sModel = StructuredModelManager
.getModelManager()
@@ -956,27 +952,40 @@
String text = null;
ITextRegion region = null;
int startOffset = -1;
- if (n instanceof IDOMAttr) {
- text = ((IDOMAttr)n).getValueRegionText();
- region = ((IDOMAttr)n).getValueRegion();
- startOffset = ((IndexedRegion)((IDOMAttr)n).getOwnerElement()).getStartOffset();
- if(region != null) {
- startOffset += region.getStart();
- } else {
- region = ((IDOMAttr)n).getEqualRegion();
+ int offset = getOffset();
+ while (n != null && startOffset == -1) {
+ if (n instanceof IDOMAttr) {
+ text = ((IDOMAttr)n).getValueRegionText();
+ region = ((IDOMAttr)n).getValueRegion();
+ startOffset = ((IndexedRegion)((IDOMAttr)n).getOwnerElement()).getStartOffset();
if(region != null) {
- startOffset += region.getStart() + region.getLength();
+ startOffset += region.getStart();
} else {
- startOffset = ((IDOMAttr)n).getEndOffset();
+ region = ((IDOMAttr)n).getEqualRegion();
+ if(region != null) {
+ startOffset += region.getStart() + region.getLength();
+ } else {
+ startOffset = ((IDOMAttr)n).getEndOffset();
+ }
}
+ } else if (n instanceof IDOMText) {
+ text = ((IDOMText)n).getNodeValue();
+ region = ((IDOMText)n).getFirstStructuredDocumentRegion();
+ startOffset = ((IDOMText)n).getStartOffset();
+ } else {
+ // The EL may appear only in TEXT and ATTRIBUTE VALUE types of node
+ // But if the current offset is start of a tag - we should treat it as part of previous region
+ if (n instanceof IDOMElement) {
+ IDOMElement elem = (IDOMElement)n;
+ if ((elem.hasEndTag() && elem.getEndStartOffset() == offset) ||
+ elem.getStartOffset() == offset) {
+ n = findNodeForOffset(xmlDocument, --offset);
+ continue;
+ }
+ }
+
+ return null;
}
- } else if (n instanceof IDOMText) {
- text = ((IDOMText)n).getNodeValue();
- region = ((IDOMText)n).getFirstStructuredDocumentRegion();
- startOffset = ((IDOMText)n).getStartOffset();
- } else {
- // The EL may appear only in TEXT and ATTRIBUTE VALUE types of node
- return null;
}
int inValueOffset = getOffset() - startOffset;
@@ -987,7 +996,7 @@
return null;
}
- String matchString = text.substring(0, inValueOffset);
+// String matchString = text.substring(0, inValueOffset);
ELParser p = ELParserUtil.getJbossFactory().createParser();
ELModel model = p.parse(text);
@@ -1054,32 +1063,4 @@
return isELClosed;
}
}
- /*
- * Checks if the EL operand starting characters are present
- * @return
- */
- private int getELStartPosition(String matchString) {
- ELParser p = ELParserUtil.getJbossFactory().createParser();
- ELModel model = p.parse(matchString);
- ELInstance is = ELUtil.findInstance(model, matchString.length());
- return is == null ? -1 : is.getStartPosition();
- }
-
- /*
- * Checks if the EL operand ending character is present
- * @return
- */
- private int getELEndPosition(String matchString, String currentValue) {
- if (matchString == null || matchString.length() == 0 ||
- currentValue == null || currentValue.length() == 0 ||
- currentValue.length() < matchString.length())
- return -1;
-
- ELParser p = ELParserUtil.getJbossFactory().createParser();
- ELModel model = p.parse(currentValue);
- ELInstance is = ELUtil.findInstance(model, matchString.length());
- if(is == null || is.getCloseInstanceToken() == null) return -1;
-
- return is.getEndPosition();
- }
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/FaceletPageContectAssistProcessor.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -10,36 +10,16 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.contentassist;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.jface.text.IRegion;
-import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.contentassist.IContextInformation;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
-import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
import org.jboss.tools.jst.web.kb.IFaceletPageContext;
-import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
-import org.jboss.tools.jst.web.kb.PageContextFactory;
import org.jboss.tools.jst.web.kb.PageProcessor;
import org.jboss.tools.jst.web.kb.KbQuery.Type;
-import org.jboss.tools.jst.web.kb.internal.FaceletPageContextImpl;
-import org.jboss.tools.jst.web.kb.internal.taglib.NameSpace;
-import org.jboss.tools.jst.web.kb.taglib.CustomTagLibManager;
-import org.jboss.tools.jst.web.kb.taglib.INameSpace;
import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -49,127 +29,14 @@
* @author Jeremy
*
*/
+@SuppressWarnings("restriction")
public class FaceletPageContectAssistProcessor extends JspContentAssistProcessor {
private static final String JSFC_ATTRIBUTE_NAME = "jsfc"; //$NON-NLS-1$
private boolean replaceJsfcTags;
- @Override
- protected ELContext createContextInstance() {
- return new FaceletPageContextImpl();
- }
-
/*
* (non-Javadoc)
- * @see org.jboss.tools.jst.jsp.contentassist.JspContentAssistProcessor#createContext()
- */
- @Override
- protected IPageContext createContext() {
- IPageContext superContext = super.createContext();
-
- FaceletPageContextImpl context = (FaceletPageContextImpl)createContextInstance();
- context.setResource(superContext.getResource());
- context.setElResolvers(superContext.getElResolvers());
- setVars(context, superContext.getResource());
-
- context.setDocument(getDocument());
- setNameSpaces(superContext, context);
- context.setLibraries(getTagLibraries(context));
- context.setResourceBundles(super.getResourceBundles(context));
-
- PageContextFactory.collectIncludedAdditionalInfo(context);
-
- return context;
- }
-
- protected void setNameSpaces(IPageContext superContext, FaceletPageContextImpl context) {
- IStructuredModel sModel = StructuredModelManager
- .getModelManager()
- .getExistingModelForRead(getDocument());
- if (superContext != null) {
- IRegion region = new Region (0, getDocument().getLength());
- Map<String, List<INameSpace>> nameSpaces = superContext.getNameSpaces(getOffset());
- for (String uri : nameSpaces.keySet()) {
- List<INameSpace> ns = nameSpaces.get(uri);
- for (INameSpace n : ns) {
- context.addNameSpace(region, n);
- }
- }
- }
-
- try {
- if (sModel == null)
- return;
-
- Document xmlDocument = (sModel instanceof IDOMModel) ? ((IDOMModel) sModel)
- .getDocument()
- : null;
-
- if (xmlDocument == null)
- return;
-
- // Get Fixed Structured Document Region
- IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
- if (sdFixedRegion == null)
- return;
-
- Node n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
- while (n != null) {
- if (!(n instanceof Element)) {
- if (n instanceof Attr) {
- n = ((Attr) n).getOwnerElement();
- } else {
- n = n.getParentNode();
- }
- continue;
- }
-
- NamedNodeMap attrs = n.getAttributes();
- for (int j = 0; attrs != null && j < attrs.getLength(); j++) {
- Attr a = (Attr) attrs.item(j);
- String name = a.getName();
- if (name.startsWith("xmlns:")) { //$NON-NLS-1$
- final String prefix = name.substring("xmlns:".length()); //$NON-NLS-1$
- final String uri = a.getValue();
- if (prefix != null && prefix.trim().length() > 0 &&
- uri != null && uri.trim().length() > 0) {
-
- int start = ((IndexedRegion)n).getStartOffset();
- int length = ((IndexedRegion)n).getLength();
-
- IDOMElement domElement = (n instanceof IDOMElement ? (IDOMElement)n : null);
- if (domElement != null) {
- start = domElement.getStartOffset();
- length = (domElement.hasEndTag() ?
- domElement.getEndStructuredDocumentRegion().getEnd() :
- ((IDOMNode) xmlDocument).getEndOffset() - 1 - start);
-
- }
-
- Region region = new Region(start, length);
- INameSpace nameSpace = new NameSpace(uri.trim(), prefix.trim());
- context.addNameSpace(region, nameSpace);
- if (CustomTagLibManager.FACELETS_UI_TAG_LIB_URI.equals(uri)) {
- nameSpace = new NameSpace(CustomTagLibManager.FACELETS_HTML_TAG_LIB_URI, "");
- context.addNameSpace(region, nameSpace);
- }
- }
- }
- }
-
- n = n.getParentNode();
- }
-
- return;
- } finally {
- if (sModel != null) {
- sModel.releaseFromRead();
- }
- }
- }
-
- /*
- * (non-Javadoc)
* @see org.jboss.tools.jst.jsp.contentassist.JspContentAssistProcessor#getContext()
*/
@Override
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/JspContentAssistProcessor.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -10,26 +10,19 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.contentassist;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
-import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.xml.core.internal.document.NodeContainer;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImageHelper;
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
@@ -45,144 +38,32 @@
import org.jboss.tools.common.el.core.resolver.Var;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.web.kb.IPageContext;
-import org.jboss.tools.jst.web.kb.IResourceBundle;
import org.jboss.tools.jst.web.kb.KbQuery;
-import org.jboss.tools.jst.web.kb.PageContextFactory;
import org.jboss.tools.jst.web.kb.PageProcessor;
import org.jboss.tools.jst.web.kb.KbQuery.Type;
-import org.jboss.tools.jst.web.kb.internal.JspContextImpl;
-import org.jboss.tools.jst.web.kb.internal.ResourceBundle;
-import org.jboss.tools.jst.web.kb.internal.XmlContextImpl;
-import org.jboss.tools.jst.web.kb.internal.taglib.NameSpace;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
*
* @author Jeremy
*
*/
+@SuppressWarnings("restriction")
public class JspContentAssistProcessor extends XmlContentAssistProcessor {
-
- @Override
- protected ELContext createContextInstance() {
- return new JspContextImpl();
- }
-
/*
* (non-Javadoc)
- * @see org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor#createContext()
+ * @see org.jboss.tools.jst.jsp.contentassist.JspContentAssistProcessor#getContext()
*/
@Override
- protected IPageContext createContext() {
- IPageContext context = super.createContext();
- PageContextFactory.collectIncludedAdditionalInfo(context);
- return context;
+ public IPageContext getContext() {
+ return (IPageContext)super.getContext();
}
-
- /**
- * Collects the namespaces over the JSP-page and sets them up to the context specified.
- *
- * @param context
- */
- protected void setNameSpaces(XmlContextImpl context) {
- super.setNameSpaces(context);
-
- TLDCMDocumentManager manager = TaglibController.getTLDCMDocumentManager(getDocument());
- List trackers = (manager == null? null : manager.getCMDocumentTrackers(getOffset()));
- for (int i = 0; trackers != null && i < trackers.size(); i++) {
- TaglibTracker tt = (TaglibTracker)trackers.get(i);
- final String prefix = tt.getPrefix();
- final String uri = tt.getURI();
- if (prefix != null && prefix.trim().length() > 0 &&
- uri != null && uri.trim().length() > 0) {
-
- IRegion region = new Region(0, getDocument().getLength());
- INameSpace nameSpace = new NameSpace(uri.trim(), prefix.trim());
- context.addNameSpace(region, nameSpace);
- }
- }
- return;
- }
-
/**
- * Returns the resource bundles
- *
- * @return
- */
- protected IResourceBundle[] getResourceBundles(IPageContext context) {
- List<IResourceBundle> list = new ArrayList<IResourceBundle>();
- IStructuredModel sModel = StructuredModelManager.getModelManager().getExistingModelForRead(getDocument());
- if (sModel == null)
- return new IResourceBundle[0];
- try {
- Document dom = (sModel instanceof IDOMModel) ? ((IDOMModel) sModel).getDocument() : null;
- if (dom != null) {
- Element element = dom.getDocumentElement();
- NodeList children = (NodeContainer)dom.getChildNodes();
- if (element != null) {
- for (int i = 0; children != null && i < children.getLength(); i++) {
- IDOMNode xmlnode = (IDOMNode)children.item(i);
- update((IDOMNode)xmlnode, context, list);
- }
- }
- }
- }
- finally {
- if (sModel != null) {
- sModel.releaseFromRead();
- }
- }
-
- return list.toArray(new IResourceBundle[list.size()]);
- }
-
- private void update(IDOMNode element, IPageContext context, List<IResourceBundle> list) {
- if (element != null) {
- registerBundleForNode(element, context, list);
- for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) {
- if (child instanceof IDOMNode) {
- update((IDOMNode)child, context, list);
- }
- }
- }
- }
- private void registerBundleForNode(IDOMNode node, IPageContext context, List<IResourceBundle> list) {
- if (node == null) return;
- String name = node.getNodeName();
- if (name == null) return;
- if (!name.endsWith("loadBundle")) return; //$NON-NLS-1$
- if (name.indexOf(':') == -1) return;
- String prefix = name.substring(0, name.indexOf(':'));
-
- Map<String, List<INameSpace>> ns = context.getNameSpaces(node.getStartOffset());
- if (!containsPrefix(ns, prefix)) return;
-
- NamedNodeMap attributes = node.getAttributes();
- if (attributes == null) return;
- String basename = (attributes.getNamedItem("basename") == null ? null : attributes.getNamedItem("basename").getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
- String var = (attributes.getNamedItem("var") == null ? null : attributes.getNamedItem("var").getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
- if (basename == null || basename.length() == 0 ||
- var == null || var.length() == 0) return;
-
- list.add(new ResourceBundle(basename, var));
- }
- private boolean containsPrefix(Map<String, List<INameSpace>> ns, String prefix) {
- for (List<INameSpace> n: ns.values()) {
- for (INameSpace nameSpace : n) {
- if(prefix.equals(nameSpace.getPrefix())) return true;
- }
- }
- return false;
- }
-
- /**
* Returns URI string for the prefix specified using the namespaces collected for
* the {@link IPageContext} context.
* Important: The context must be created using createContext() method before using this method.
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/contentassist/XmlContentAssistProcessor.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -10,104 +10,39 @@
******************************************************************************/
package org.jboss.tools.jst.jsp.contentassist;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jface.text.Region;
import org.eclipse.jface.text.contentassist.IContextInformation;
-import org.eclipse.jface.text.templates.GlobalTemplateVariables.User;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.sse.core.StructuredModelManager;
-import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
-import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocumentRegion;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.ui.internal.contentassist.ContentAssistRequest;
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImageHelper;
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
import org.jboss.tools.common.el.core.resolver.ELContext;
-import org.jboss.tools.common.el.core.resolver.ELContextImpl;
-import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.jsp.JspEditorPlugin;
import org.jboss.tools.jst.jsp.messages.JstUIMessages;
import org.jboss.tools.jst.web.kb.IPageContext;
-import org.jboss.tools.jst.web.kb.IResourceBundle;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.PageContextFactory;
import org.jboss.tools.jst.web.kb.PageProcessor;
import org.jboss.tools.jst.web.kb.KbQuery.Type;
-import org.jboss.tools.jst.web.kb.include.IncludeContextBuilder;
-import org.jboss.tools.jst.web.kb.include.IncludeContextDefinition;
-import org.jboss.tools.jst.web.kb.internal.XmlContextImpl;
-import org.jboss.tools.jst.web.kb.internal.taglib.NameSpace;
-import org.jboss.tools.jst.web.kb.taglib.INameSpace;
-import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
-import org.jboss.tools.jst.web.kb.taglib.TagLibriryManager;
-import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
/**
*
* @author Jeremy
*
*/
+@SuppressWarnings("restriction")
public class XmlContentAssistProcessor extends AbstractXMLContentAssistProcessor {
protected static final Image JSF_EL_PROPOSAL_IMAGE = JspEditorPlugin.getDefault().getImage(JspEditorPlugin.CA_JSF_EL_IMAGE_PATH);
- @Override
- protected ELContext createContextInstance() {
- return new XmlContextImpl();
- }
-
/*
* (non-Javadoc)
* @see org.jboss.tools.jst.jsp.contentassist.AbstractXMLContentAssistProcessor#createContext()
*/
@Override
- protected IPageContext createContext() {
- IFile file = getResource();
- ELResolver[] elResolvers = getELResolvers(file);
-
- XmlContextImpl context = (XmlContextImpl)createContextInstance();
- context.setResource(file);
- context.setDocument(getDocument());
- context.setElResolvers(elResolvers);
- setVars(context, file);
-
- setNameSpaces(context);
- context.setLibraries(getTagLibraries(context));
- context.setResourceBundles(getResourceBundles(context));
- return context;
+ protected ELContext createContext() {
+ return PageContextFactory.createPageContext(getResource());
}
-
-
- protected void setVars(ELContextImpl context, IFile file) {
- // No vars can be set for this processor
- }
-
- /**
- * Returns the <code>org.jboss.tools.common.el.core.resolver.ELContext</code> instance
- *
- * @return
- */
- @Override
- public IPageContext getContext() {
- return (IPageContext)super.getContext();
- }
-
@Override
protected KbQuery createKbQuery(Type type, String query, String stringQuery) {
KbQuery kbQuery = new KbQuery();
@@ -191,7 +126,7 @@
if (image == null) {
image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
}
- String displayString = closingTag; //$NON-NLS-1$
+ String displayString = closingTag;
IContextInformation contextInformation = null;
String additionalProposalInfo = textProposal.getContextInfo();
int relevance = textProposal.getRelevance();
@@ -255,7 +190,7 @@
image = XMLEditorPluginImageHelper.getInstance().getImage(XMLEditorPluginImages.IMG_OBJ_TAG_GENERIC);
}
- String displayString = closingTag; //$NON-NLS-1$
+ String displayString = closingTag;
IContextInformation contextInformation = null;
String additionalProposalInfo = textProposal.getContextInfo();
int relevance = textProposal.getRelevance();
@@ -458,124 +393,4 @@
contentAssistRequest.addProposal(proposal);
}
}
-
- /**
- * Collects the namespaces over the JSP-page and sets them up to the context specified.
- *
- * @param context
- */
- protected void setNameSpaces(XmlContextImpl context) {
- IStructuredModel sModel = StructuredModelManager
- .getModelManager()
- .getExistingModelForRead(getDocument());
-
- try {
- if (sModel == null)
- return;
-
- Document xmlDocument = (sModel instanceof IDOMModel) ? ((IDOMModel) sModel)
- .getDocument()
- : null;
-
- if (xmlDocument == null)
- return;
-
- // Get Fixed Structured Document Region
- IStructuredDocumentRegion sdFixedRegion = this.getStructuredDocumentRegion(getOffset());
- if (sdFixedRegion == null)
- return;
-
- Node n = findNodeForOffset(xmlDocument, sdFixedRegion.getStartOffset());
- while (n != null) {
- if (!(n instanceof Element)) {
- if (n instanceof Attr) {
- n = ((Attr) n).getOwnerElement();
- } else {
- n = n.getParentNode();
- }
- continue;
- }
-
- NamedNodeMap attrs = n.getAttributes();
- for (int j = 0; attrs != null && j < attrs.getLength(); j++) {
- Attr a = (Attr) attrs.item(j);
- String name = a.getName();
- if (name.startsWith("xmlns:")) { //$NON-NLS-1$
- final String prefix = name.substring("xmlns:".length()); //$NON-NLS-1$
- final String uri = a.getValue();
- if (prefix != null && prefix.trim().length() > 0 &&
- uri != null && uri.trim().length() > 0) {
-
- int start = ((IndexedRegion)n).getStartOffset();
- int length = ((IndexedRegion)n).getLength();
-
- IDOMElement domElement = (n instanceof IDOMElement ? (IDOMElement)n : null);
- if (domElement != null) {
- start = domElement.getStartOffset();
- length = (domElement.hasEndTag() ?
- domElement.getEndStructuredDocumentRegion().getEnd() :
- ((IDOMNode) xmlDocument).getEndOffset() - 1 - start);
-
- }
-
- Region region = new Region(start, length);
- INameSpace nameSpace = new NameSpace(uri.trim(), prefix.trim());
- context.addNameSpace(region, nameSpace);
- }
- }
- }
-
- n = n.getParentNode();
- }
-
- return;
- } finally {
- if (sModel != null) {
- sModel.releaseFromRead();
- }
- }
- }
-
- protected static final ITagLibrary[] EMPTY_LIBRARIES = new ITagLibrary[0];
- protected static final IResourceBundle[] EMPTY_RESOURCE_BUNDLES = new IResourceBundle[0];
-
- /**
- * Returns the Tag Libraries for the namespaces collected in the context.
- * Important: The context must be created using createContext() method before using this method.
- *
- * @param context The context object instance
- * @return
- */
- public ITagLibrary[] getTagLibraries(IPageContext context) {
- Map<String, List<INameSpace>> nameSpaces = context.getNameSpaces(getOffset());
- if (nameSpaces == null || nameSpaces.isEmpty())
- return EMPTY_LIBRARIES;
-
- IProject project = context.getResource() == null ? null : context.getResource().getProject();
- if (project == null)
- return EMPTY_LIBRARIES;
-
- List<ITagLibrary> tagLibraries = new ArrayList<ITagLibrary>();
- for (List<INameSpace> nameSpace : nameSpaces.values()) {
- for (INameSpace n : nameSpace) {
- ITagLibrary[] libs = TagLibriryManager.getLibraries(project, n.getURI());
- if (libs != null && libs.length > 0) {
- for (ITagLibrary lib : libs) {
- tagLibraries.add(lib);
- }
- }
- }
- }
- return (tagLibraries.isEmpty() ? EMPTY_LIBRARIES :
- (ITagLibrary[])tagLibraries.toArray(new ITagLibrary[tagLibraries.size()]));
- }
-
- /**
- * Returns the resource bundles
- *
- * @return
- */
- protected IResourceBundle[] getResourceBundles(IPageContext context) {
- return EMPTY_RESOURCE_BUNDLES;
- }
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/jspeditor/JSPTextEditor.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -148,6 +148,7 @@
import org.jboss.tools.jst.web.kb.taglib.IAttribute;
import org.jboss.tools.jst.web.kb.taglib.IComponent;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
+import org.jboss.tools.jst.web.kb.taglib.TagLibraryManager;
import org.jboss.tools.jst.web.tld.VpeTaglibManager;
import org.jboss.tools.jst.web.tld.VpeTaglibManagerProvider;
import org.w3c.dom.DocumentType;
@@ -783,13 +784,17 @@
ValueHelper valueHelper = new ValueHelper();
processor = valueHelper.createContentAssistProcessor();
pageContext = valueHelper.createPageContext(processor, query.getOffset());
+
Map<String, List<INameSpace>> ns = pageContext.getNameSpaces(query.getOffset());
List<INameSpace> n = ns.get(query.getUri());
if(n == null && pageContext instanceof JspContextImpl) {
IRegion r = new Region(query.getOffset(), 0);
- ((JspContextImpl)pageContext).addNameSpace(r, new NameSpace(query.getUri(), query.getPrefix()));
- ((JspContextImpl)pageContext).setLibraries(processor.getTagLibraries(pageContext));
+ ((JspContextImpl)pageContext).addNameSpace(r, new NameSpace(query.getUri(), query.getPrefix(),
+ TagLibraryManager.getLibraries(
+ pageContext.getResource().getProject(), query.getUri())));
+// ((JspContextImpl)pageContext).setLibraries(processor.getTagLibraries(pageContext));
}
+
}
public void initContext(Properties context) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/JSPPropertySourceAdapter.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -65,6 +65,7 @@
* creation of property descriptors.
*/
+@SuppressWarnings("restriction")
public class JSPPropertySourceAdapter implements INodeAdapter, IPropertySource, IPropertySourceExtension, IPropertySource2 {//extends XMLPropertySourceAdapter {
protected final static String CATEGORY_ATTRIBUTES = XMLUIMessages.XMLPropertySourceAdapter_0;
private static final boolean SET_EXPERT_FILTER = false;
@@ -95,12 +96,14 @@
JspContentAssistProcessor processor;
int offset = 0;
KbQuery kbQuery, kbQueryAttr;
+ @SuppressWarnings("unchecked")
private Set attributeNames = new HashSet();
public JSPPropertySourceAdapter(INodeNotifier target) {
setTarget(target);
}
+ @SuppressWarnings("unchecked")
Map getWeights() {
return sorter == null ? new HashMap() : sorter.weights;
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/plugin.xml 2009-11-24 13:56:15 UTC (rev 18797)
@@ -88,7 +88,23 @@
<contexttype id="FACELETS_PAGE_CONTEXT_TYPE">
<contenttype id="org.eclipse.wst.html.core.htmlsource" />
</contexttype>
-
+
+ <contexttype id="XML_PAGE_CONTEXT_TYPE">
+ <contenttype id="org.eclipse.wst.xml.core.xmlsource" />
+ <contenttype id="org.eclipse.jst.jsf.facesconfig.facesConfigFile" />
+ <contenttype id="org.eclipse.core.runtime.xml" />
+ <contenttype id="org.eclipse.jst.j2ee.webDD" />
+ <contenttype id="org.eclipse.jst.jee.ee5webDD" />
+ <contenttype id="org.jboss.tools.common.model.ui.xml" />
+ <contenttype id="org.eclipse.jst.jsp.core.tldsource" />
+ <contenttype id="org.jboss.tools.seam.xml.ui.pages12xmlsource" />
+ <contenttype id="org.jboss.tools.seam.xml.ui.page12xmlsource" />
+ <contenttype id="org.jboss.tools.seam.xml.ui.pages20xmlsource" />
+ <contenttype id="org.jboss.tools.seam.xml.ui.page20xmlsource" />
+ <contenttype id="org.jboss.tools.seam.xml.ui.pages21xmlsource" />
+ <contenttype id="org.jboss.tools.seam.xml.ui.page21xmlsource" />
+ </contexttype>
+
<cssholder uri="">
<tag name="style" />
<tag name="link">
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/ICSSContainerSupport.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/ICSSContainerSupport.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/ICSSContainerSupport.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -14,7 +14,6 @@
import org.eclipse.core.resources.IFile;
import org.jboss.tools.jst.web.kb.PageContextFactory.CSSStyleSheetDescriptor;
-import org.w3c.dom.css.CSSStyleSheet;
/**
* The interface defines the methods to collect
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IIncludedContextSupport.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IIncludedContextSupport.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IIncludedContextSupport.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -14,6 +14,7 @@
import java.util.Map;
import org.eclipse.core.resources.IFile;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
/**
@@ -30,14 +31,14 @@
*
* @param includedContext
*/
- void addIncludedContext(IPageContext includedContext);
+ void addIncludedContext(ELContext includedContext);
/**
* Returns the list of all the collected contexts
*
* @return
*/
- List<IPageContext> getIncludedContexts();
+ List<ELContext> getIncludedContexts();
/**
* Returns Resource of the page
@@ -51,26 +52,4 @@
* @return
*/
Map<String, List<INameSpace>> getNameSpaces(int offset);
-
- /**
- * Checks if the context exists in parent contexts for the specified resource
- *
- * @param resource
- * @return
- */
- boolean contextExistsInParents(IFile resource);
-
- /**
- * Set up parent context
- *
- * @param parent
- */
- void setParent(IIncludedContextSupport parent);
-
- /**
- * Returns parent context
- *
- * @return
- */
- IIncludedContextSupport getParent();
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IPageContext.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IPageContext.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IPageContext.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -15,7 +15,6 @@
import org.eclipse.jface.text.IDocument;
import org.jboss.tools.common.el.core.resolver.ELContext;
-import org.jboss.tools.common.el.core.resolver.Var;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
@@ -23,7 +22,7 @@
* Page context
* @author Alexey Kazakov
*/
-public interface IPageContext extends ELContext, IIncludedContextSupport {
+public interface IPageContext extends ELContext {
/**
* Returns libraries which should be used in this context
@@ -48,7 +47,7 @@
* @param offset
* @return
*/
- Var[] getVars(int offset);
+// Var[] getVars(int offset);
/**
* Returns map of name spaces which are set in particular offset.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IProposalProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IProposalProcessor.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/IProposalProcessor.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jst.web.kb;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.TextProposal;
/**
@@ -21,6 +22,6 @@
/**
* @return proposals
*/
- public TextProposal[] getProposals(KbQuery query, IPageContext context);
+ public TextProposal[] getProposals(KbQuery query, ELContext context);
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageContextFactory.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -14,7 +14,9 @@
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.Comparator;
+import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -24,20 +26,24 @@
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
+import org.eclipse.jface.text.DocumentEvent;
import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentListener;
import org.eclipse.jface.text.IRegion;
import org.eclipse.jface.text.Region;
import org.eclipse.jst.jsp.core.internal.contentmodel.TaglibController;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TLDCMDocumentManager;
import org.eclipse.jst.jsp.core.internal.contentmodel.tld.TaglibTracker;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.texteditor.DocumentProviderRegistry;
-import org.eclipse.ui.texteditor.IDocumentProvider;
import org.eclipse.wst.common.componentcore.internal.ComponentResource;
import org.eclipse.wst.common.componentcore.internal.StructureEdit;
import org.eclipse.wst.common.componentcore.internal.WorkbenchComponent;
@@ -47,16 +53,21 @@
import org.eclipse.wst.html.core.internal.htmlcss.LinkElementAdapter;
import org.eclipse.wst.html.core.internal.htmlcss.URLModelProvider;
import org.eclipse.wst.sse.core.StructuredModelManager;
+import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
import org.eclipse.wst.sse.core.internal.provisional.INodeNotifier;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
-import org.eclipse.wst.xml.core.internal.document.NodeContainer;
+import org.eclipse.wst.xml.core.internal.provisional.document.IDOMDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.jboss.tools.common.el.core.GlobalELReferenceList;
-import org.jboss.tools.common.el.core.resolver.ELResolver;
+import org.jboss.tools.common.el.core.parser.ELParserUtil;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.el.core.resolver.ELContextImpl;
import org.jboss.tools.common.el.core.resolver.ELResolverFactoryManager;
+import org.jboss.tools.common.el.core.resolver.ElVarSearcher;
+import org.jboss.tools.common.el.core.resolver.Var;
import org.jboss.tools.common.resref.core.ResourceReference;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jst.web.kb.include.IncludeContextBuilder;
@@ -67,10 +78,8 @@
import org.jboss.tools.jst.web.kb.internal.taglib.NameSpace;
import org.jboss.tools.jst.web.kb.taglib.CustomTagLibManager;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
-import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
-import org.jboss.tools.jst.web.kb.taglib.TagLibriryManager;
+import org.jboss.tools.jst.web.kb.taglib.TagLibraryManager;
import org.w3c.dom.Attr;
-import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -78,171 +87,407 @@
import org.w3c.dom.css.CSSStyleSheet;
/**
+ *
* @author Alexey Kazakov
*/
-public class PageContextFactory {
+@SuppressWarnings("restriction")
+public class PageContextFactory implements IResourceChangeListener, IDocumentListener {
+ private static PageContextFactory fInstance;
+
+ public static final String XML_PAGE_CONTEXT_TYPE = "XML_PAGE_CONTEXT_TYPE"; //$NON-NLS-1$
+ public static final String JSP_PAGE_CONTEXT_TYPE = "JSP_PAGE_CONTEXT_TYPE"; //$NON-NLS-1$
+ public static final String FACELETS_PAGE_CONTEXT_TYPE = "FACELETS_PAGE_CONTEXT_TYPE"; //$NON-NLS-1$
- public static String JSP_PAGE_CONTEXT_TYPE = "JSP_PAGE_CONTEXT_TYPE";
- public static String FACELETS_PAGE_CONTEXT_TYPE = "FACELETS_PAGE_CONTEXT_TYPE";
+ private static final PageContextFactory getInstance() {
+ if (fInstance != null)
+ return fInstance;
+ return (fInstance = new PageContextFactory());
+ }
+ private PageContextFactory() {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ if (workspace != null) workspace.addResourceChangeListener(this);
+ }
-
- /**
- * Creates a page context for the specified context type
- * @
+ /*
+ * The cache to store the created contexts
+ * The key is IFile.getFullPath().toString() of the resource of the context
*/
- public static IPageContext createPageContext(IFile file, int offset, String contentType) {
- String contextType = IncludeContextBuilder.getInstance().getContextType(contentType);
- if (JSP_PAGE_CONTEXT_TYPE.equals(contextType)) {
- return createJSPContext(file, offset);
+ private Map<IFile, ELContext> cache = new HashMap<IFile, ELContext>();
+
+ private ELContext getSavedContext(IFile resource) {
+ synchronized (cache) {
+ return cache.get(resource);
}
- else if (FACELETS_PAGE_CONTEXT_TYPE.equals(contextType)) {
- return createFaceletPageContext(file, offset);
+ }
+
+ private void saveConvext(ELContext context) {
+ if (context != null && context.getResource() != null) {
+// int size = 0; // remove this line
+ synchronized (cache) {
+ cache.put(context.getResource(), context);
+// size = cache.size(); // remove this line
+ }
+// System.out.println("Saved Context : " +
+// (System.currentTimeMillis() - ctm) + "ms, "
+// + context.getResource().getFullPath().toString() + ", " + context.getClass().getSimpleName() + ", Totals: " + size);
}
- return null;
}
+
+ private ELContext removeSavedContext(IFile resource) {
+ ELContext removedContext = null; // Remove this line
+
+ synchronized (cache) {
+ removedContext = cache.remove(resource);
+ if (removedContext instanceof XmlContextImpl &&
+ ((XmlContextImpl)removedContext).getDocument() != null) {
+ ((XmlContextImpl)removedContext).getDocument().removeDocumentListener(this);
+ }
+ }
+
+// if (removedContext != null) { // TODO: Remove this statement
+// System.out.println("Removed Context : " + removedContext.getResource().getFullPath().toString() + ", " + removedContext.getClass().getSimpleName() + ", Totals: " + cache.size());
+// }
+ return removedContext;
+ }
+
/**
- * Creates a jsp context for given resource and offset.
- * @param file JSP
- * @param offset
+ * Creates a page context for the specified context type
+ *
+ * @param file
+ * @param contentType
* @return
*/
- private static IPageContext createJSPContext(IFile file, int offset) {
- JspContextImpl context = new JspContextImpl();
+ public static ELContext createPageContext(IFile file) {
+ return getInstance().createPageContext(file, null);
+ }
+// long ctm = 0;
+
+// String getContextType1(IFile file) {
+// if (file.getFileExtension().endsWith("jsp"))
+// return JSP_PAGE_CONTEXT_TYPE;
+// else if (file.getFileExtension().endsWith("html"))
+// return FACELETS_PAGE_CONTEXT_TYPE;
+// else if (file.getFileExtension().endsWith("xml"))
+// return XML_PAGE_CONTEXT_TYPE;
+// return null;
+// }
+
+ /**
+ * Creates a page context for the specified context type
+ *
+ * @param file
+ * @param contentType
+ * @param parents List of parent contexts
+ * @return
+ */
+ private ELContext createPageContext(IFile file, List<String> parents) {
+ ELContext context = getSavedContext(file);
+ if (context != null)
+ return context;
-
- IEditorInput input = new FileEditorInput(file);
+// ctm = System.currentTimeMillis();
+// System.out.println("Create Context : " + file.getFullPath().toString() + ", Totals: " + cache.size());
+ IModelManager manager = StructuredModelManager.getModelManager();
+ if(manager == null) {
+ // this may happen if plug-in org.eclipse.wst.sse.core
+ // is stopping or un-installed, that is Eclipse is shutting down.
+ // there is no need to report it, just stop validation.
+ return context;
+ }
+ IStructuredModel model = null;
try {
- ELResolver[] elResolvers = ELResolverFactoryManager.getInstance().getResolvers(file);
- context.setResource(file);
- context.setDocument(getConnectedDocument(input));
- context.setElResolvers(elResolvers);
-
- setXMLNameSpaces(context, offset);
- setJSPNameSpaces(context, offset);
- context.setLibraries(getTagLibraries(context, offset));
- context.setResourceBundles(getResourceBundles(context));
-
- collectIncludedAdditionalInfo(context);
+ model = manager.getModelForRead(file);
+ if (model instanceof IDOMModel) {
+ IDOMModel domModel = (IDOMModel) model;
+ IDOMDocument document = domModel.getDocument();
+
+ context = createPageContextInstance(domModel.getContentTypeIdentifier());
+ if (context == null)
+ return null;
+
+ context.setResource(file);
+ context.setElResolvers(ELResolverFactoryManager.getInstance().getResolvers(file));
+
+ if (context instanceof JspContextImpl && !(context instanceof FaceletPageContextImpl)) {
+ // Fill JSP namespaces defined in TLDCMDocumentManager
+ fillJSPNameSpaces((JspContextImpl)context);
+ }
+
+ // The subsequently called functions may use the file and document
+ // already stored in context for their needs
+ fillContextForChildNodes(document, context, parents);
+ }
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ } catch (IOException e) {
+ WebKbPlugin.getDefault().logError(e);
} finally {
- releaseConnectedDocument(input);
- context.setDocument(null);
+ if (model != null) {
+ model.releaseFromRead();
+ }
}
+
+ if (context != null) {
+ if (context instanceof XmlContextImpl) {
+ IDocument contextDocument = ((XmlContextImpl) context).getDocument();
+ if (contextDocument != null) {
+ contextDocument.addDocumentListener(this);
+ }
+ }
+ saveConvext(context);
+ }
+
return context;
}
+
+ private ELContext createPageContextInstance(String contentType) {
+ String contextType = IncludeContextBuilder.getContextType(contentType);
+ if (XML_PAGE_CONTEXT_TYPE.equals(contextType)) {
+ return new XmlContextImpl();
+ } else if (JSP_PAGE_CONTEXT_TYPE.equals(contextType)) {
+ return new JspContextImpl();
+ } else if (FACELETS_PAGE_CONTEXT_TYPE.equals(contextType)) {
+ return new FaceletPageContextImpl();
+ }
+ return null;
+ }
/**
- * Creates a facelet context for given resource and offset.
- * @param file Facelet
- * @param offset
- * @return
+ * Sets up the context with namespaces and according libraries from the TagLibraryManager
+ *
+ * @param node
+ * @param context
*/
- private static IFaceletPageContext createFaceletPageContext(IFile file, int offset) {
- FaceletPageContextImpl context = new FaceletPageContextImpl();
-
- IEditorInput input = new FileEditorInput(file);
- try {
- ELResolver[] elResolvers = ELResolverFactoryManager.getInstance().getResolvers(file);
- context.setResource(file);
- context.setDocument(getConnectedDocument(input));
- context.setElResolvers(elResolvers);
-
- setXMLNameSpaces(context, offset);
- setFaceletsNameSpaces(context, offset);
- context.setLibraries(getTagLibraries(context, offset));
- context.setResourceBundles(getResourceBundles(context));
-
- collectIncludedAdditionalInfo(context);
- } finally {
- releaseConnectedDocument(input);
- context.setDocument(null);
+ @SuppressWarnings({ "unchecked" })
+ private void fillJSPNameSpaces(JspContextImpl context) {
+ TLDCMDocumentManager manager = TaglibController.getTLDCMDocumentManager(context.getDocument());
+ List trackers = (manager == null? null : manager.getCMDocumentTrackers(context.getDocument().getLength() - 1));
+ for (int i = 0; trackers != null && i < trackers.size(); i++) {
+ TaglibTracker tt = (TaglibTracker)trackers.get(i);
+ final String prefix = tt.getPrefix() == null ? null : tt.getPrefix().trim();
+ final String uri = tt.getURI() == null ? null : tt.getURI().trim();
+ if (prefix != null && prefix.length() > 0 &&
+ uri != null && uri.length() > 0) {
+
+ IRegion region = new Region(0, context.getDocument().getLength());
+ INameSpace nameSpace = new NameSpace(
+ uri, prefix,
+ TagLibraryManager.getLibraries(
+ context.getResource().getProject(), uri));
+ context.addNameSpace(region, nameSpace);
+ }
}
- return context;
-
}
- /* Utility functions */
+ private void fillContextForChildNodes(IDOMNode parent, ELContext context, List<String> parents) {
+ NodeList children = parent.getChildNodes();
+ for(int i = 0; children != null && i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child instanceof IDOMNode) {
+ fillContextForNode((IDOMNode)child, context, parents);
+ fillContextForChildNodes((IDOMNode)child, context, parents);
+ }
+ }
+ }
- public static void collectIncludedAdditionalInfo(IPageContext context) {
- if (!(context instanceof IIncludedContextSupport) &&
- !(context instanceof ICSSContainerSupport))
+ private void fillContextForNode(IDOMNode node, ELContext context, List<String> parents) {
+ if (context instanceof JspContextImpl && !(node instanceof IDOMElement)) {
+ // There is no any useful info for JSP in text nodes
return;
+ }
+
+ if (context instanceof XmlContextImpl && node instanceof IDOMElement) {
+ fillXMLNamespacesForNode((IDOMElement)node, (XmlContextImpl)context);
+ }
- IStructuredModel sModel = StructuredModelManager.getModelManager()
- .getExistingModelForRead(context.getDocument());
+ if ((context instanceof JspContextImpl ||
+ context instanceof FaceletPageContextImpl) &&
+ node instanceof IDOMElement) {
+ fillVarsForNode((IDOMElement)node, (ELContextImpl)context);
+ }
- try {
- if (sModel == null)
- return;
+ if (context instanceof FaceletPageContextImpl) {
+ // Insert here the initialization code for FaceletPage context elements which may exist in Text nodes
+ }
+
+ if (context instanceof JspContextImpl && node instanceof IDOMElement) {
+ fillResourceBundlesForNode((IDOMElement)node, (JspContextImpl)context);
+ }
- Document xmlDocument = (sModel instanceof IDOMModel) ? ((IDOMModel) sModel)
- .getDocument()
- : null;
+ // There could be some context type to be initialized somehow that is different from JSP or FaceletPage context
+ // Insert its on-node initialization code here
+
+ // The only Elements may have include/CSS Stylesheet links and other additional info
+ if (context instanceof IPageContext && node instanceof IDOMElement) {
+ fillAdditionalInfoForNode((IDOMElement)node, (IPageContext)context, parents);
+ }
+ }
- if (xmlDocument == null)
- return;
+ private void fillVarsForNode (IDOMElement node, ELContextImpl context) {
+ Var var = ElVarSearcher.findVar(node, ELParserUtil.getJbossFactory());
+ if (var != null) {
+ int start = ((IndexedRegion) node).getStartOffset();
+ int length = ((IndexedRegion) node).getLength();
- if (xmlDocument instanceof IDOMNode) {
- createIncludedAdditionalInfoForNode((IDOMNode)xmlDocument, context);
- }
- } finally {
- if (sModel != null) {
- sModel.releaseFromRead();
- }
- }
+ start = node.getStartOffset();
+ length = (node.hasEndTag() ? node
+ .getEndStructuredDocumentRegion()
+ .getEnd() : ((IDOMNode) node.getOwnerDocument()).getEndOffset() - 1 - start);
+ context.addVar(new Region(start, length), var);
+ }
}
- private static void createIncludedAdditionalInfoForNode(IDOMNode node, IPageContext context) {
+
+ private void fillAdditionalInfoForNode(IDOMElement node, IPageContext context, List<String> parents) {
String prefix = node.getPrefix() == null ? "" : node.getPrefix(); //$NON-NLS-1$
String tagName = node.getLocalName();
- if (node instanceof IDOMElement) {
- Map<String, List<INameSpace>> nsMap = context.getNameSpaces(node.getStartOffset());
- String[] uris = getUrisByPrefix(nsMap, prefix);
-
- if (uris != null) {
- for (String uri : uris) {
- if (context instanceof IIncludedContextSupport) {
- String[] includeAttributes = IncludeContextBuilder.getIncludeAttributes(uri, tagName);
- if (includeAttributes != null) {
- for (String attr : includeAttributes) {
- createIncludedContextFromAttribute((IDOMElement)node, attr, context);
- }
+ Map<String, List<INameSpace>> nsMap = context.getNameSpaces(node.getStartOffset());
+ String[] uris = getUrisByPrefix(nsMap, prefix);
+
+ if (uris != null) {
+ for (String uri : uris) {
+ if (context instanceof IIncludedContextSupport) {
+ String[] includeAttributes = IncludeContextBuilder.getIncludeAttributes(uri, tagName);
+ if (includeAttributes != null) {
+ List<String> newParentList = parents == null ? new ArrayList<String>() : new ArrayList<String>(parents);
+ newParentList.add(context.getResource().getFullPath().toString());
+
+ for (String attr : includeAttributes) {
+ String fileName = node.getAttribute(attr);
+ if (fileName == null || fileName.trim().length() == 0)
+ continue;
+
+ IFile file = getFileFromProject(fileName, context.getResource());
+ if (file == null)
+ continue;
+
+ // Fix for JBIDE-5083 >>>
+ if (!checkCycling(parents, file))
+ continue;
+ // Fix for JBIDE-5083 <<<
+
+ ELContext includedContext = createPageContext(file, newParentList);
+ if (includedContext != null)
+ ((IIncludedContextSupport)context).addIncludedContext(includedContext);
}
}
- if (context instanceof ICSSContainerSupport) {
- if(IncludeContextBuilder.isCSSStyleSheetContainer(uri, tagName)) {
- createCSSStyleSheetFromElement((IDOMElement)node, (ICSSContainerSupport)context);
- } else {
- String[] cssAttributes = IncludeContextBuilder.getCSSStyleSheetAttributes(uri, tagName);
- if (cssAttributes != null) {
- for (String attr : cssAttributes) {
- createCSSStyleSheetFromAttribute((IDOMElement)node, attr, (ICSSContainerSupport)context);
- }
+ }
+ if (context instanceof ICSSContainerSupport) {
+ if(IncludeContextBuilder.isCSSStyleSheetContainer(uri, tagName)) {
+ fillCSSStyleSheetFromElement(node, (ICSSContainerSupport)context);
+ } else {
+ String[] cssAttributes = IncludeContextBuilder.getCSSStyleSheetAttributes(uri, tagName);
+ if (cssAttributes != null) {
+ for (String attr : cssAttributes) {
+ fillCSSStyleSheetFromAttribute(node, attr, (ICSSContainerSupport)context);
}
}
- }
+ }
}
}
- }
-
- NodeList children = node.getChildNodes();
- for (int i = 0; children != null && i < children.getLength(); i++) {
- if (children.item(i) instanceof IDOMElement) {
- createIncludedAdditionalInfoForNode((IDOMElement)children.item(i), context);
+ }
+ }
+
+ private boolean checkCycling(List<String> parents, IFile resource) {
+ String resourceId = resource.getFullPath().toString();
+ if (parents != null) {
+ for (String parentId : parents) {
+ if (resourceId.equals(parentId))
+ return false;
}
}
+ return true;
}
- private static void createCSSStyleSheetFromAttribute(IDOMElement node,
+ /**
+ * Sets up the context with namespaces and according libraries for the node
+ * For the Facelet Context the methods adds an additional special namespace for
+ * CustomTagLibManager.FACELETS_UI_TAG_LIB_URI when CustomTagLibManager.FACELETS_UI_TAG_LIB_URI
+ * is found in xmlns attributes
+ *
+ * @param node
+ * @param context
+ */
+ private void fillXMLNamespacesForNode(Element node, XmlContextImpl context) {
+ NamedNodeMap attrs = node.getAttributes();
+ for (int j = 0; attrs != null && j < attrs.getLength(); j++) {
+ Attr a = (Attr) attrs.item(j);
+ String name = a.getName();
+ if (name.startsWith("xmlns:")) { //$NON-NLS-1$
+ String prefix = name.substring("xmlns:".length()); //$NON-NLS-1$
+ String uri = a.getValue();
+
+ prefix = prefix == null ? null : prefix.trim();
+ uri = uri == null ? null : uri.trim();
+
+ if (prefix != null && prefix.length() > 0
+ && uri != null && uri.length() > 0) {
+
+ int start = ((IndexedRegion) node).getStartOffset();
+ int length = ((IndexedRegion) node).getLength();
+
+ IDOMElement domElement = (node instanceof IDOMElement ? (IDOMElement) node
+ : null);
+ if (domElement != null) {
+ start = domElement.getStartOffset();
+ length = (domElement.hasEndTag() ? domElement
+ .getEndStructuredDocumentRegion()
+ .getEnd() : ((IDOMNode) node.getOwnerDocument()).getEndOffset() - 1 - start);
+ }
+
+ Region region = new Region(start, length);
+ INameSpace nameSpace = new NameSpace(
+ uri, prefix,
+ TagLibraryManager.getLibraries(
+ context.getResource().getProject(), uri));
+
+ context.addNameSpace(region, nameSpace);
+ if (context instanceof FaceletPageContextImpl &&
+ CustomTagLibManager.FACELETS_UI_TAG_LIB_URI.equals(uri)) {
+ nameSpace = new NameSpace(
+ CustomTagLibManager.FACELETS_HTML_TAG_LIB_URI, "", //$NON-NLS-1$
+ TagLibraryManager.getLibraries(
+ context.getResource().getProject(),
+ CustomTagLibManager.FACELETS_HTML_TAG_LIB_URI));
+ context.addNameSpace(region, nameSpace);
+ }
+ }
+ }
+ }
+ }
+
+ private void fillResourceBundlesForNode(IDOMElement node, JspContextImpl context) {
+ String name = node.getNodeName();
+ if (name == null) return;
+ if (!name.endsWith("loadBundle")) return; //$NON-NLS-1$
+ if (name.indexOf(':') == -1) return;
+ String prefix = name.substring(0, name.indexOf(':'));
+
+ Map<String, List<INameSpace>> ns = context.getNameSpaces(node.getStartOffset());
+ if (!containsPrefix(ns, prefix)) return;
+
+ NamedNodeMap attributes = node.getAttributes();
+ if (attributes == null) return;
+ String basename = (attributes.getNamedItem("basename") == null ? null : attributes.getNamedItem("basename").getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
+ String var = (attributes.getNamedItem("var") == null ? null : attributes.getNamedItem("var").getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
+ if (basename == null || basename.length() == 0 ||
+ var == null || var.length() == 0)
+ return;
+
+ context.addResourceBundle(new ResourceBundle(basename, var));
+ }
+
+ private void fillCSSStyleSheetFromAttribute(IDOMElement node,
String attribute, ICSSContainerSupport context) {
CSSStyleSheetDescriptor descr = getSheetForTagAttribute(node, attribute);
if (descr != null)
context.addCSSStyleSheetDescriptor(descr);
}
- private static void createCSSStyleSheetFromElement(IDOMElement node,
+ private void fillCSSStyleSheetFromElement(IDOMElement node,
ICSSContainerSupport context) {
CSSStyleSheet sheet = getSheetForTag(node);
if (sheet != null)
@@ -258,12 +503,13 @@
this.sheet = sheet;
}
}
+
/**
*
* @param stylesContainer
* @return
*/
- private static CSSStyleSheetDescriptor getSheetForTagAttribute(final Node stylesContainer, String attribute) {
+ private CSSStyleSheetDescriptor getSheetForTagAttribute(final Node stylesContainer, String attribute) {
INodeNotifier notifier = (INodeNotifier) stylesContainer;
@@ -295,7 +541,7 @@
* @param stylesContainer
* @return
*/
- private static CSSStyleSheet getSheetForTag(final Node stylesContainer) {
+ private CSSStyleSheet getSheetForTag(final Node stylesContainer) {
INodeNotifier notifier = (INodeNotifier) stylesContainer;
@@ -311,428 +557,7 @@
return sheet;
}
- private static void createIncludedContextFromAttribute(IDOMElement node, String attribute, IIncludedContextSupport context) {
- String fileName = node.getAttribute(attribute);
- if (fileName == null || fileName.trim().length() == 0)
- return;
-
- IFile file = getFileFromProject(fileName, context.getResource());
- if (file == null)
- return;
-
- // Fix for JBIDE-5083 >>>
- if (context.contextExistsInParents(file))
- return;
- // Fix for JBIDE-5083 <<<
-
- IStructuredModel sModel = null;
-
- try {
- sModel = StructuredModelManager.getModelManager()
- .getModelForRead(file);
- } catch (IOException e) {
- WebKbPlugin.getDefault().logError(e);
- } catch (CoreException e) {
- WebKbPlugin.getDefault().logError(e);
- }
-
- if (sModel == null)
- return;
-
- try {
- Document xmlDocument = (sModel instanceof IDOMModel) ?
- ((IDOMModel) sModel).getDocument() : null;
-
- if (xmlDocument == null)
- return;
-
- if (xmlDocument instanceof IDOMNode) {
- String contentType = sModel.getContentTypeIdentifier();
- IPageContext includedContext = PageContextFactory.createPageContext(file, ((IDOMNode) xmlDocument).getEndOffset() - 1, contentType);
- if (includedContext != null)
- context.addIncludedContext(includedContext);
- }
- } finally {
- if (sModel != null) {
- sModel.releaseFromRead();
- }
- }
- }
-
- static Node findNodeForOffset(IDOMNode node, int offset) {
- if(node == null) return null;
- if (!node.contains(offset)) return null;
-
- if (node.hasChildNodes()) {
- // Try to find the node in children
- NodeList children = node.getChildNodes();
- for (int i = 0; children != null && i < children.getLength(); i++) {
- IDOMNode child = (IDOMNode)children.item(i);
- if (child.contains(offset)) {
- return findNodeForOffset(child, offset);
- }
- }
- }
- // Not found in children or nave no children
- if (node.hasAttributes()) {
- // Try to find in the node attributes
- NamedNodeMap attributes = node.getAttributes();
-
- for (int i = 0; attributes != null && i < attributes.getLength(); i++) {
- IDOMNode attr = (IDOMNode)attributes.item(i);
- if (attr.contains(offset)) {
- return attr;
- }
- }
- }
- // Return the node itself
- return node;
- }
-
- static Node findNodeForOffset(Node node, int offset) {
- return (node instanceof IDOMNode) ? findNodeForOffset((IDOMNode)node, offset) : null;
- }
-
- private static IDocument getConnectedDocument(IEditorInput input) {
- IDocumentProvider provider= DocumentProviderRegistry.getDefault().getDocumentProvider(input);
- try {
- provider.connect(input);
- } catch (CoreException e) {
- WebKbPlugin.getDefault().logError(e);
- }
- return provider.getDocument(input);
- }
-
- private static void releaseConnectedDocument(IEditorInput input) {
- IDocumentProvider provider= DocumentProviderRegistry.getDefault().getDocumentProvider(input);
- provider.disconnect(input);
- }
-
-
- private static Document getDocument(IFile file) {
- IStructuredModel sModel = null;
-
- try {
- sModel = StructuredModelManager.getModelManager()
- .getModelForRead(file);
- } catch (IOException e) {
- WebKbPlugin.getDefault().logError(e);
- } catch (CoreException e) {
- WebKbPlugin.getDefault().logError(e);
- }
-
- if (sModel == null)
- return null;
-
- try {
- return (sModel instanceof IDOMModel) ? ((IDOMModel) sModel)
- .getDocument()
- : null;
-
- } finally {
- if (sModel != null) {
- sModel.releaseFromRead();
- }
- }
- }
-
-
- /**
- * Collects the namespaces over the XML-page and sets them up to the context specified.
- *
- * @param context
- */
- private static void setXMLNameSpaces(XmlContextImpl context, int offset) {
- IStructuredModel sModel = null;
-
- try {
- sModel = StructuredModelManager.getModelManager()
- .getModelForRead(context.getResource());
- } catch (IOException e) {
- WebKbPlugin.getDefault().logError(e);
- } catch (CoreException e) {
- WebKbPlugin.getDefault().logError(e);
- }
-
- if (sModel == null)
- return;
-
- try {
- Document xmlDocument = (sModel instanceof IDOMModel) ? ((IDOMModel) sModel)
- .getDocument()
- : null;
-
- if (xmlDocument == null)
- return;
-
- Node n = findNodeForOffset(xmlDocument, offset);
- while (n != null) {
- if (!(n instanceof Element)) {
- if (n instanceof Attr) {
- n = ((Attr) n).getOwnerElement();
- } else {
- n = n.getParentNode();
- }
- continue;
- }
-
- NamedNodeMap attrs = n.getAttributes();
- for (int j = 0; attrs != null && j < attrs.getLength(); j++) {
- Attr a = (Attr) attrs.item(j);
- String name = a.getName();
- if (name.startsWith("xmlns:")) { //$NON-NLS-1$
- final String prefix = name.substring("xmlns:".length()); //$NON-NLS-1$
- final String uri = a.getValue();
- if (prefix != null && prefix.trim().length() > 0
- && uri != null && uri.trim().length() > 0) {
-
- int start = ((IndexedRegion) n).getStartOffset();
- int length = ((IndexedRegion) n).getLength();
-
- IDOMElement domElement = (n instanceof IDOMElement ? (IDOMElement) n
- : null);
- if (domElement != null) {
- start = domElement.getStartOffset();
- length = (domElement.hasEndTag() ? domElement
- .getEndStructuredDocumentRegion()
- .getEnd() : ((IDOMNode) xmlDocument).getEndOffset() - 1 - start);
- }
-
- Region region = new Region(start, length);
- INameSpace nameSpace = new NameSpace(uri.trim(),
- prefix.trim());
- context.addNameSpace(region, nameSpace);
- }
- }
- }
-
- n = n.getParentNode();
- }
-
- return;
- } finally {
- if (sModel != null) {
- sModel.releaseFromRead();
- }
- }
-
- }
-
- /**
- * Collects the namespaces over the JSP-page and sets them up to the context specified.
- *
- * @param context
- */
- private static void setJSPNameSpaces(JspContextImpl context, int offset) {
- TLDCMDocumentManager manager = TaglibController.getTLDCMDocumentManager(context.getDocument());
- List trackers = (manager == null? null : manager.getCMDocumentTrackers(offset));
- for (int i = 0; trackers != null && i < trackers.size(); i++) {
- TaglibTracker tt = (TaglibTracker)trackers.get(i);
- final String prefix = tt.getPrefix();
- final String uri = tt.getURI();
- if (prefix != null && prefix.trim().length() > 0 &&
- uri != null && uri.trim().length() > 0) {
-
- IRegion region = new Region(0, context.getDocument().getLength());
- INameSpace nameSpace = new NameSpace(uri.trim(), prefix.trim());
- context.addNameSpace(region, nameSpace);
- }
- }
-
- return;
- }
-
- /**
- * Collects the namespaces over the Facelets-page and sets them up to the context specified.
- *
- * @param context
- */
- private static void setFaceletsNameSpaces(FaceletPageContextImpl context, int offset) {
- IStructuredModel sModel = null;
-
- try {
- sModel = StructuredModelManager.getModelManager()
- .getModelForRead(context.getResource());
- } catch (IOException e) {
- WebKbPlugin.getDefault().logError(e);
- } catch (CoreException e) {
- WebKbPlugin.getDefault().logError(e);
- }
-
- if (sModel == null)
- return;
-
-
- try {
- Document xmlDocument = (sModel instanceof IDOMModel) ?
- ((IDOMModel) sModel).getDocument() : null;
-
- if (xmlDocument == null)
- return;
-
- Node n = findNodeForOffset(xmlDocument, offset);
- while (n != null) {
- if (!(n instanceof Element)) {
- if (n instanceof Attr) {
- n = ((Attr) n).getOwnerElement();
- } else {
- n = n.getParentNode();
- }
- continue;
- }
-
- NamedNodeMap attrs = n.getAttributes();
- for (int j = 0; attrs != null && j < attrs.getLength(); j++) {
- Attr a = (Attr) attrs.item(j);
- String name = a.getName();
- if (name.startsWith("xmlns:")) { //$NON-NLS-1$
- final String prefix = name.substring("xmlns:".length()); //$NON-NLS-1$
- final String uri = a.getValue();
- if (prefix != null && prefix.trim().length() > 0 &&
- uri != null && uri.trim().length() > 0) {
-
- int start = ((IndexedRegion)n).getStartOffset();
- int length = ((IndexedRegion)n).getLength();
-
- IDOMElement domElement = (n instanceof IDOMElement ? (IDOMElement)n : null);
- if (domElement != null) {
- start = domElement.getStartOffset();
- length = (domElement.hasEndTag() ?
- domElement.getEndStructuredDocumentRegion().getEnd() :
- ((IDOMNode) xmlDocument).getEndOffset() - 1 - start);
-
- }
-
- Region region = new Region(start, length);
- INameSpace nameSpace = new NameSpace(uri.trim(), prefix.trim());
- context.addNameSpace(region, nameSpace);
- if (CustomTagLibManager.FACELETS_UI_TAG_LIB_URI.equals(uri)) {
- nameSpace = new NameSpace(CustomTagLibManager.FACELETS_HTML_TAG_LIB_URI, ""); //$NON-NLS-1$
- context.addNameSpace(region, nameSpace);
- }
- }
- }
- }
-
- n = n.getParentNode();
- }
-
- return;
- } finally {
- if (sModel != null) {
- sModel.releaseFromRead();
- }
- }
- }
-
-
- private static final ITagLibrary[] EMPTY_LIBRARIES = new ITagLibrary[0];
- private static final IResourceBundle[] EMPTY_RESOURCE_BUNDLES = new IResourceBundle[0];
-
- /**
- * Returns the Tag Libraries for the namespaces collected in the context.
- * Important: The context must be created using createContext() method before using this method.
- *
- * @param context The context object instance
- * @return
- */
- public static ITagLibrary[] getTagLibraries(IPageContext context, int offset) {
- Map<String, List<INameSpace>> nameSpaces = context.getNameSpaces(offset);
- if (nameSpaces == null || nameSpaces.isEmpty())
- return EMPTY_LIBRARIES;
-
- IProject project = context.getResource() == null ? null : context.getResource().getProject();
- if (project == null)
- return EMPTY_LIBRARIES;
-
- List<ITagLibrary> tagLibraries = new ArrayList<ITagLibrary>();
- for (List<INameSpace> nameSpace : nameSpaces.values()) {
- for (INameSpace n : nameSpace) {
- ITagLibrary[] libs = TagLibriryManager.getLibraries(project, n.getURI());
- if (libs != null && libs.length > 0) {
- for (ITagLibrary lib : libs) {
- tagLibraries.add(lib);
- }
- }
- }
- }
- return (tagLibraries.isEmpty() ? EMPTY_LIBRARIES :
- (ITagLibrary[])tagLibraries.toArray(new ITagLibrary[tagLibraries.size()]));
- }
-
- /**
- * Returns the resource bundles
- *
- * @return
- */
- private static IResourceBundle[] getResourceBundles(IPageContext context) {
- List<IResourceBundle> list = new ArrayList<IResourceBundle>();
- IStructuredModel sModel = null;
-
- try {
- sModel = StructuredModelManager.getModelManager().getModelForRead(context.getResource());
- } catch (IOException e) {
- WebKbPlugin.getDefault().logError(e);
- } catch (CoreException e) {
- WebKbPlugin.getDefault().logError(e);
- }
-
- if (sModel == null)
- return new IResourceBundle[0];
- try {
- Document dom = (sModel instanceof IDOMModel) ? ((IDOMModel) sModel).getDocument() : null;
- if (dom != null) {
- Element element = dom.getDocumentElement();
- NodeList children = (NodeContainer)dom.getChildNodes();
- if (element != null) {
- for (int i = 0; children != null && i < children.getLength(); i++) {
- IDOMNode xmlnode = (IDOMNode)children.item(i);
- update((IDOMNode)xmlnode, context, list);
- }
- }
- }
- }
- finally {
- if (sModel != null) {
- sModel.releaseFromRead();
- }
- }
-
- return list.toArray(new IResourceBundle[list.size()]);
- }
-
- private static void update(IDOMNode element, IPageContext context, List<IResourceBundle> list) {
- if (element != null) {
- registerBundleForNode(element, context, list);
- for (Node child = element.getFirstChild(); child != null; child = child.getNextSibling()) {
- if (child instanceof IDOMNode) {
- update((IDOMNode)child, context, list);
- }
- }
- }
- }
- private static void registerBundleForNode(IDOMNode node, IPageContext context, List<IResourceBundle> list) {
- if (node == null) return;
- String name = node.getNodeName();
- if (name == null) return;
- if (!name.endsWith("loadBundle")) return; //$NON-NLS-1$
- if (name.indexOf(':') == -1) return;
- String prefix = name.substring(0, name.indexOf(':'));
-
- Map<String, List<INameSpace>> ns = context.getNameSpaces(node.getStartOffset());
- if (!containsPrefix(ns, prefix)) return;
-
- NamedNodeMap attributes = node.getAttributes();
- if (attributes == null) return;
- String basename = (attributes.getNamedItem("basename") == null ? null : attributes.getNamedItem("basename").getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
- String var = (attributes.getNamedItem("var") == null ? null : attributes.getNamedItem("var").getNodeValue()); //$NON-NLS-1$ //$NON-NLS-2$
- if (basename == null || basename.length() == 0 ||
- var == null || var.length() == 0) return;
-
- list.add(new ResourceBundle(basename, var));
- }
-
- private static boolean containsPrefix(Map<String, List<INameSpace>> ns, String prefix) {
+ private boolean containsPrefix(Map<String, List<INameSpace>> ns, String prefix) {
for (List<INameSpace> n: ns.values()) {
for (INameSpace nameSpace : n) {
if(prefix.equals(nameSpace.getPrefix())) return true;
@@ -884,8 +709,13 @@
private static final String SHARP_PREFIX = "#{"; //$NON-NLS-1$
+ public static final String CONTEXT_PATH_EXPRESSION = "^\\s*(\\#|\\$)\\{facesContext.externalContext.requestContextPath\\}"; //$NON-NLS-1$
+
// partly copied from org.jboss.tools.vpe.editor.util.ElService
- public static String findAndReplaceElVariable(String fileName){
+ private static String findAndReplaceElVariable(String fileName){
+ if (fileName != null)
+ fileName = fileName.replaceFirst(CONTEXT_PATH_EXPRESSION, ""); //$NON-NLS-1$
+
final IPath workspacePath = Platform.getLocation();
final ResourceReference[] gResources = GlobalELReferenceList.getInstance().getAllResources(workspacePath);
@@ -956,15 +786,15 @@
public ICSSModel getModel() {
// Fix for JBIDE-5079 >>>
if (super.isValidAttribute()) {
- source = getSourceFromAttribute("href");
+ source = getSourceFromAttribute("href"); //$NON-NLS-1$
} else if (isValidAttribute()) {
source = getSourceFromAttribute(hrefAttrName);
} else {
return null;
}
-
ICSSModel model = retrieveModel();
setModel(model);
+// System.out.println("get CSS: " + source + " ==>> " + (model == null ? "FAILED" : " SUCCESSFULL"));
return model;
}
@@ -1020,4 +850,125 @@
return null;
}
}
+
+ public void resourceChanged(IResourceChangeEvent event) {
+ if(cache == null || cache.size() == 0 || event == null || event.getDelta() == null) return;
+ if(!checkDelta(event.getDelta())) return;
+ processDelta(event.getDelta());
+ }
+
+ private boolean checkDelta(IResourceDelta delta) {
+ IResource resource = delta.getResource();
+ if(resource == null) return false;
+ if(resource instanceof IWorkspaceRoot) {
+ IResourceDelta[] d = delta.getAffectedChildren();
+ return (d.length > 0 && checkDelta(d[0]));
+ }
+ return true;
+ }
+
+ private void processDelta(IResourceDelta delta) {
+ if(delta == null) return;
+ int kind = delta.getKind();
+ IResource resource = delta.getResource();
+
+ if(kind == IResourceDelta.CHANGED ||
+ kind == IResourceDelta.ADDED ||
+ kind == IResourceDelta.REMOVED ||
+ kind == IResourceDelta.CONTENT) {
+ cleanUpChachedResource(resource);
+// } else {
+// System.out.println("Resource modified [" + kind + "]: " + resource.getFullPath());
+ }
+
+ IResourceDelta[] cs = delta.getAffectedChildren();
+ for (int i = 0; cs != null && i < cs.length; i++) {
+ processDelta(cs[i]);
+ }
+ return;
+ }
+
+ private void cleanUpChachedResource(IResource resource) {
+ if (resource instanceof IFile) {
+ synchronized (cache) {
+ ELContext removedContext = removeSavedContext((IFile)resource);
+ if (removedContext == null || removedContext.getResource() == null)
+ return;
+
+ // Remove all the contexts that are parent to the removed context
+ Collection<ELContext> contexts = cache.values();
+ if (contexts != null) {
+ for (ELContext context : contexts) {
+ if (isDependencyContext(context, (IFile)resource)) {
+ removeSavedContext((IFile)resource);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ private boolean isDependencyContext(ELContext context, IFile resource) {
+ if (resource.equals(context.getResource())) {
+ return true;
+ }
+
+ if(context instanceof IIncludedContextSupport) {
+ List<ELContext> includedContexts = ((IIncludedContextSupport)context).getIncludedContexts();
+ if (includedContexts != null) {
+ for (ELContext includedContext : includedContexts) {
+ if (isDependencyContext(includedContext, resource))
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ protected void finalize() throws Throwable {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ if (workspace != null) workspace.removeResourceChangeListener(this);
+
+ synchronized (cache) {
+ // Remove all the contexts that are parent to the removed context
+ Collection<ELContext> contexts = cache.values();
+ if (contexts != null) {
+ for (ELContext context : contexts) {
+ removeSavedContext(context.getResource());
+ }
+ }
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocumentListener#documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent)
+ */
+ public void documentAboutToBeChanged(DocumentEvent event) {
+ // Nothing to do
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.text.IDocumentListener#documentChanged(org.eclipse.jface.text.DocumentEvent)
+ */
+ public void documentChanged(DocumentEvent event) {
+ if (event.getDocument() == null)
+ return;
+
+ synchronized (cache) {
+ // Remove all the contexts that are parent to the removed context
+ Collection<ELContext> contexts = cache.values();
+ if (contexts != null) {
+ for (ELContext context : contexts) {
+ if (context instanceof XmlContextImpl &&
+ event.getDocument().equals(((XmlContextImpl)context).getDocument())) {
+ cleanUpChachedResource(context.getResource());
+ return;
+ }
+ }
+ }
+ }
+ }
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/PageProcessor.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -14,6 +14,7 @@
import java.util.HashMap;
import java.util.Map;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.el.core.resolver.ELResolver;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.web.kb.internal.XmlContextImpl;
@@ -50,45 +51,48 @@
* (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.ProposalProcessor#getProposals(org.jboss.tools.jst.web.kb.KbQuery, org.jboss.tools.jst.web.kb.PageContext)
*/
- public TextProposal[] getProposals(KbQuery query, IPageContext context) {
+ public TextProposal[] getProposals(KbQuery query, ELContext context) {
ArrayList<TextProposal> proposals = new ArrayList<TextProposal>();
if (!isQueryForELProposals(query, context)) {
- ITagLibrary[] libs = context.getLibraries();
- for (int i = 0; libs != null && i < libs.length; i++) {
- if(libs[i] instanceof IFacesConfigTagLibrary) {
- continue;
- }
- TextProposal[] libProposals = libs[i].getProposals(query, context);
- for (int j = 0; libProposals != null && j < libProposals.length; j++) {
- proposals.add(libProposals[j]);
- }
- }
- if (query.getType() == KbQuery.Type.ATTRIBUTE_VALUE) {
- Map<String, IAttribute> attrbMap = new HashMap<String, IAttribute>();
- for (TextProposal proposal : proposals) {
- if(proposal.getSource()!=null && proposal.getSource() instanceof IAttribute) {
- IAttribute att = (IAttribute)proposal.getSource();
- attrbMap.put(att.getName(), att);
+ if(context instanceof IPageContext) {
+ IPageContext pageContext = (IPageContext)context;
+ ITagLibrary[] libs = pageContext.getLibraries();
+ for (int i = 0; libs != null && i < libs.length; i++) {
+ if(libs[i] instanceof IFacesConfigTagLibrary) {
+ continue;
}
+ TextProposal[] libProposals = libs[i].getProposals(query, pageContext);
+ for (int j = 0; libProposals != null && j < libProposals.length; j++) {
+ proposals.add(libProposals[j]);
+ }
}
- IAttribute[] attrs = getAttributes(query, context, false);
- for (int i = 0; i < attrs.length; i++) {
- attrbMap.put(attrs[i].getName(), attrs[i]);
- }
- for (int i = 0; i < componentExtensions.length; i++) {
- if(attrbMap.containsKey(componentExtensions[i].getName())) {
- TextProposal[] attProposals = componentExtensions[i].getProposals(query, context);
- for (int j = 0; j < attProposals.length; j++) {
- proposals.add(attProposals[j]);
+ if (query.getType() == KbQuery.Type.ATTRIBUTE_VALUE) {
+ Map<String, IAttribute> attrbMap = new HashMap<String, IAttribute>();
+ for (TextProposal proposal : proposals) {
+ if(proposal.getSource()!=null && proposal.getSource() instanceof IAttribute) {
+ IAttribute att = (IAttribute)proposal.getSource();
+ attrbMap.put(att.getName(), att);
}
}
+ IAttribute[] attrs = getAttributes(query, pageContext, false);
+ for (int i = 0; i < attrs.length; i++) {
+ attrbMap.put(attrs[i].getName(), attrs[i]);
+ }
+ for (int i = 0; i < componentExtensions.length; i++) {
+ if(attrbMap.containsKey(componentExtensions[i].getName())) {
+ TextProposal[] attProposals = componentExtensions[i].getProposals(query, pageContext);
+ for (int j = 0; j < attProposals.length; j++) {
+ proposals.add(attProposals[j]);
+ }
+ }
+ }
}
- }
- for (int i = 0; customTagLibs != null && i < customTagLibs.length; i++) {
- TextProposal[] libProposals = customTagLibs[i].getProposals(query, context);
- for (int j = 0; libProposals != null && j < libProposals.length; j++) {
- proposals.add(libProposals[j]);
+ for (int i = 0; customTagLibs != null && i < customTagLibs.length; i++) {
+ TextProposal[] libProposals = customTagLibs[i].getProposals(query, pageContext);
+ for (int j = 0; libProposals != null && j < libProposals.length; j++) {
+ proposals.add(libProposals[j]);
+ }
}
}
} else {
@@ -102,15 +106,17 @@
return proposals.toArray(new TextProposal[proposals.size()]);
}
- private boolean isQueryForELProposals(KbQuery query, IPageContext context) {
- if (query.getType() != KbQuery.Type.ATTRIBUTE_VALUE &&
- ((query.getType() != KbQuery.Type.TEXT ) || !(context instanceof IFaceletPageContext || context instanceof XmlContextImpl))) {
- return false;
+ private boolean isQueryForELProposals(KbQuery query, ELContext context) {
+ if (query.getType() == KbQuery.Type.ATTRIBUTE_VALUE ||
+ (query.getType() == KbQuery.Type.TEXT &&
+ (context instanceof IFaceletPageContext ||
+ context instanceof XmlContextImpl))) {
+ return (query.getValue() != null &&
+ (query.getValue().startsWith("#{") || //$NON-NLS-1$
+ query.getValue().startsWith("${"))); //$NON-NLS-1$
+
}
-
- return (query.getValue() != null &&
- (query.getValue().startsWith("#{") || //$NON-NLS-1$
- query.getValue().startsWith("${"))); //$NON-NLS-1$
+ return false;
}
/**
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/JspContextImpl.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -14,34 +14,36 @@
import java.util.List;
import java.util.Map;
+import org.jboss.tools.common.el.core.resolver.ELContext;
+import org.jboss.tools.common.el.core.resolver.Var;
import org.jboss.tools.jst.web.kb.ICSSContainerSupport;
+import org.jboss.tools.jst.web.kb.IIncludedContextSupport;
import org.jboss.tools.jst.web.kb.IPageContext;
+import org.jboss.tools.jst.web.kb.IResourceBundle;
import org.jboss.tools.jst.web.kb.PageContextFactory.CSSStyleSheetDescriptor;
import org.jboss.tools.jst.web.kb.internal.taglib.NameSpace;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
-import org.w3c.dom.css.CSSStyleSheet;
+import org.jboss.tools.jst.web.kb.taglib.INameSpaceExtended;
+import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
/**
* JSP page context
* @author Alexey Kazakov
*/
-public class JspContextImpl extends XmlContextImpl implements ICSSContainerSupport {
- protected List<IPageContext> fIncludedContexts = null;
+public class JspContextImpl extends XmlContextImpl implements IPageContext, IIncludedContextSupport, ICSSContainerSupport {
+ protected List<IResourceBundle> bundles;
+
+ protected List<ELContext> fIncludedContexts = null;
protected List<CSSStyleSheetDescriptor> fCSSStyleSheetDescriptors = null;
-
- @Override
- public void addIncludedContext(IPageContext includedContext) {
+
+ public void addIncludedContext(ELContext includedContext) {
if (fIncludedContexts == null) {
- fIncludedContexts = new ArrayList<IPageContext>();
+ fIncludedContexts = new ArrayList<ELContext>();
}
fIncludedContexts.add(includedContext);
- // Fix for JBIDE-5083 >>>
- includedContext.setParent(this);
- // Fix for JBIDE-5083 <<<
}
- @Override
- public List<IPageContext> getIncludedContexts() {
+ public List<ELContext> getIncludedContexts() {
return fIncludedContexts;
}
@@ -56,6 +58,127 @@
return superNameSpaces;
}
+
+ @Override
+ public Var[] getVars() {
+ Var[] thisVars = super.getVars();
+
+ List<Var> includedVars = new ArrayList<Var>();
+ List<ELContext> includedContexts = getIncludedContexts();
+ if (includedContexts != null) {
+ for (ELContext includedContext : includedContexts) {
+ Var[] vars = includedContext.getVars();
+ if (vars != null) {
+ for (Var b : vars) {
+ includedVars.add(b);
+ }
+ }
+ }
+ }
+
+ Var[] result = new Var[thisVars == null ? 0 : thisVars.length + includedVars.size()];
+ if (thisVars != null && thisVars.length > 0) {
+ System.arraycopy(thisVars, 0, result, 0, thisVars.length);
+ }
+ if (!includedVars.isEmpty()) {
+ System.arraycopy(includedVars.toArray(new ITagLibrary[includedVars.size()]), 0,
+ result, thisVars == null ? 0 : thisVars.length, includedVars.size());
+ }
+ return result;
+ }
+
+ @Override
+ public Var[] getVars(int offset) {
+ Var[] thisVars = super.getVars(offset);
+
+ List<Var> includedVars = new ArrayList<Var>();
+ List<ELContext> includedContexts = getIncludedContexts();
+ if (includedContexts != null) {
+ for (ELContext includedContext : includedContexts) {
+ Var[] vars = includedContext.getVars(offset);
+ if (vars != null) {
+ for (Var b : vars) {
+ includedVars.add(b);
+ }
+ }
+ }
+ }
+
+ Var[] result = new Var[thisVars == null ? 0 : thisVars.length + includedVars.size()];
+ if (thisVars != null && thisVars.length > 0) {
+ System.arraycopy(thisVars, 0, result, 0, thisVars.length);
+ }
+ if (!includedVars.isEmpty()) {
+ System.arraycopy(includedVars.toArray(new ITagLibrary[includedVars.size()]), 0,
+ result, thisVars == null ? 0 : thisVars.length, includedVars.size());
+ }
+ return result;
+ }
+
+ public ITagLibrary[] getLibraries() {
+ List<ITagLibrary> libraries = new ArrayList<ITagLibrary>();
+
+ for (Map<String, INameSpace> nsMap : nameSpaces.values()) {
+ for (INameSpace ns : nsMap.values()) {
+ if (ns instanceof INameSpaceExtended) {
+ ITagLibrary[] libs = ((INameSpaceExtended)ns).getTagLibraries();
+ if (libs != null) {
+ for(ITagLibrary lib : libs) {
+ libraries.add(lib);
+ }
+ }
+ }
+ }
+ }
+
+ List<ELContext> includedContexts = getIncludedContexts();
+ if (includedContexts != null) {
+ for (ELContext includedContext : includedContexts) {
+ ITagLibrary[] includedLibraries = includedContext instanceof IPageContext ? ((IPageContext)includedContext).getLibraries() : null;
+ if (includedLibraries != null) {
+ for (ITagLibrary lib : includedLibraries) {
+ libraries.add(lib);
+ }
+ }
+ }
+ }
+
+ return libraries.toArray(new ITagLibrary[libraries.size()]);
+ }
+
+ /**
+ * Adds resource bundle to the context
+ *
+ * @param bundle
+ */
+ public void addResourceBundle(IResourceBundle bundle) {
+ if (bundles == null) {
+ bundles = new ArrayList<IResourceBundle>();
+ }
+ bundles.add(bundle);
+ }
+
+ public IResourceBundle[] getResourceBundles() {
+ List<IResourceBundle> resourceBundles = new ArrayList<IResourceBundle>();
+ if (bundles != null) {
+ resourceBundles.addAll(bundles);
+ }
+
+ List<ELContext> includedContexts = getIncludedContexts();
+ if (includedContexts != null) {
+ for (ELContext includedContext : includedContexts) {
+ IResourceBundle[] includedBundles = includedContext instanceof IPageContext ? ((IPageContext)includedContext).getResourceBundles() : null;
+ if (includedBundles != null) {
+ for (IResourceBundle b : includedBundles) {
+ resourceBundles.add(b);
+ }
+ }
+ }
+ }
+
+ return (IResourceBundle[])resourceBundles.toArray(new IResourceBundle[resourceBundles.size()]);
+ }
+
public void addCSSStyleSheetDescriptor(CSSStyleSheetDescriptor cssStyleSheetDescriptor) {
if (fCSSStyleSheetDescriptors == null) {
fCSSStyleSheetDescriptors = new ArrayList<CSSStyleSheetDescriptor>();
@@ -72,9 +195,9 @@
}
}
- List<IPageContext> includedContexts = getIncludedContexts();
+ List<ELContext> includedContexts = getIncludedContexts();
if (includedContexts != null) {
- for (IPageContext includedContext : includedContexts) {
+ for (ELContext includedContext : includedContexts) {
if (includedContext instanceof ICSSContainerSupport) {
List<CSSStyleSheetDescriptor> includedSheetDescriptors = ((ICSSContainerSupport)includedContext).getCSSStyleSheetDescriptors();
if (includedSheetDescriptors != null) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/XmlContextImpl.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/XmlContextImpl.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/XmlContextImpl.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -7,78 +7,42 @@
import java.util.Set;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.IRegion;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.texteditor.DocumentProviderRegistry;
+import org.eclipse.ui.texteditor.IDocumentProvider;
import org.jboss.tools.common.el.core.resolver.ELContextImpl;
-import org.jboss.tools.jst.web.kb.IIncludedContextSupport;
-import org.jboss.tools.jst.web.kb.IPageContext;
-import org.jboss.tools.jst.web.kb.IResourceBundle;
+import org.jboss.tools.jst.web.kb.WebKbPlugin;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
-import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
-public class XmlContextImpl extends ELContextImpl implements IPageContext {
+public class XmlContextImpl extends ELContextImpl {
protected IDocument document;
- protected ITagLibrary[] libs;
+ private FileEditorInput editorInput;
// Fix for JBIDE-5097: It must be a map of <IRegion to Map of <NS-Prefix to NS>>
protected Map<IRegion, Map<String, INameSpace>> nameSpaces = new HashMap<IRegion, Map<String, INameSpace>>();
- protected IResourceBundle[] bundles;
- private IIncludedContextSupport parentContext = null;
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.IPageContext#getLibraries()
+ /**
+ * Sets up the context resource and retrieves the document for the specified resource
*/
- public ITagLibrary[] getLibraries() {
- return libs;
- }
-
- public void setLibraries(ITagLibrary[] libs) {
- this.libs = libs;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.IPageContext#getResourceBundles()
- */
- public IResourceBundle[] getResourceBundles() {
- List<IResourceBundle> resourceBundles = new ArrayList<IResourceBundle>();
- if (bundles != null) {
- for (IResourceBundle bundle : bundles) {
- resourceBundles.add(bundle);
+ @Override
+ public void setResource(IFile resource) {
+ super.setResource(resource);
+ if (this.document != null) {
+ if (!resource.equals(editorInput.getFile())) {
+ releaseConnectedDocument(editorInput);
+ editorInput = null;
}
}
+ if (editorInput == null)
+ editorInput = new FileEditorInput(resource);
- List<IPageContext> includedContexts = getIncludedContexts();
- if (includedContexts != null) {
- for (IPageContext includedContext : includedContexts) {
- IResourceBundle[] includedBundles = includedContext.getResourceBundles();
- if (includedBundles != null) {
- for (IResourceBundle includedBundle : includedBundles) {
- resourceBundles.add(includedBundle);
- }
- }
- }
- }
-
- return (IResourceBundle[])resourceBundles.toArray(new IResourceBundle[resourceBundles.size()]);
+ document = getConnectedDocument(editorInput);
}
-
- /**
- * Sets resource bundles
- * @param bundles
- */
- public void setResourceBundles(IResourceBundle[] bundles) {
- this.bundles = bundles;
- }
-
- /**
- * @param document the document to set
- */
- public void setDocument(IDocument document) {
- this.document = document;
- }
-
+
/*
* (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.PageContext#getDocument()
@@ -87,7 +51,10 @@
return document;
}
- /* (non-Javadoc)
+ /*
+ * TODO: the visibility must differ between 'include'-like and 'template'-like inclusion
+ *
+ * (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.IPageContext#getNameSpaces(int)
*/
public Map<String, List<INameSpace>> getNameSpaces(int offset) {
@@ -152,40 +119,30 @@
nameSpaces.get(region).put(nameSpace.getPrefix(), nameSpace); // Fix for JBIDE-5097
}
- public void addIncludedContext(IPageContext includedContext) {
- throw new UnsupportedOperationException();
-
- }
- public List<IPageContext> getIncludedContexts() {
- return null;
- }
-
/**
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.IIncludedContextSupport#contextExistsInParents(org.eclipse.core.resources.IFile)
+ * Disconnects the editor input from the document provider
*/
- public boolean contextExistsInParents(IFile resource) {
- // Assuming that the resource must not be null here
- if (resource.equals(getResource()))
- return true;
-
- return getParent() == null ? false : getParent().contextExistsInParents(resource);
+ @Override
+ protected void finalize() throws Throwable {
+ if (editorInput != null) {
+ releaseConnectedDocument(editorInput);
+ }
+ super.finalize();
}
- /**
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.IIncludedContextSupport#getParent()
- */
- public IIncludedContextSupport getParent() {
- return parentContext;
+ private IDocument getConnectedDocument(IEditorInput input) {
+ IDocumentProvider provider= DocumentProviderRegistry.getDefault().getDocumentProvider(input);
+ try {
+ provider.connect(input);
+ } catch (CoreException e) {
+ WebKbPlugin.getDefault().logError(e);
+ }
+ return provider.getDocument(input);
}
-
- /**
- * (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.IIncludedContextSupport#setParent(org.jboss.tools.jst.web.kb.IIncludedContextSupport)
- */
- public void setParent(IIncludedContextSupport parent) {
- parentContext = parent;
+
+ private void releaseConnectedDocument(IEditorInput input) {
+ IDocumentProvider provider= DocumentProviderRegistry.getDefault().getDocumentProvider(input);
+ provider.disconnect(input);
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractAttribute.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractAttribute.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractAttribute.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -13,12 +13,12 @@
import java.util.List;
import java.util.Properties;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.project.ext.IValueInfo;
import org.jboss.tools.common.model.project.ext.event.Change;
import org.jboss.tools.common.model.project.ext.store.XMLStoreConstants;
import org.jboss.tools.common.text.TextProposal;
-import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.internal.KbObject;
import org.jboss.tools.jst.web.kb.internal.KbXMLStoreConstants;
@@ -112,9 +112,9 @@
}
/* (non-Javadoc)
- * @see org.jboss.tools.jst.web.kb.IProposalProcessor#getProposals(org.jboss.tools.jst.web.kb.KbQuery, org.jboss.tools.jst.web.kb.IPageContext)
+ * @see org.jboss.tools.jst.web.kb.IProposalProcessor#getProposals(org.jboss.tools.jst.web.kb.KbQuery, org.jboss.tools.jst.web.kb.ELContext)
*/
- public TextProposal[] getProposals(KbQuery query, IPageContext context) {
+ public TextProposal[] getProposals(KbQuery query, ELContext context) {
return EMPTY_PROPOSAL_LIST;
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractComponent.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -18,6 +18,7 @@
import java.util.Properties;
import java.util.Set;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.model.project.ext.IValueInfo;
import org.jboss.tools.common.model.project.ext.event.Change;
import org.jboss.tools.common.model.project.ext.store.XMLStoreConstants;
@@ -330,8 +331,11 @@
/* (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.IProposalProcessor#getProposals(org.jboss.tools.jst.web.kb.KbQuery, org.jboss.tools.jst.web.kb.IPageContext)
*/
- public TextProposal[] getProposals(KbQuery query, IPageContext context) {
- IAttribute[] attributes = getAttributes(query, context);
+ public TextProposal[] getProposals(KbQuery query, ELContext context) {
+ if (!(context instanceof IPageContext))
+ return EMPTY_PROPOSAL_LIST;
+
+ IAttribute[] attributes = getAttributes(query, (IPageContext)context);
if(attributes == null || attributes.length == 0) {
return EMPTY_PROPOSAL_LIST;
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/AbstractTagLib.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -22,6 +22,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.project.ext.IValueInfo;
import org.jboss.tools.common.model.project.ext.event.Change;
@@ -389,10 +390,13 @@
/* (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.ProposalProcessor#getProposals(org.jboss.tools.jst.web.kb.KbQuery, org.jboss.tools.jst.web.kb.PageContext)
*/
- public TextProposal[] getProposals(KbQuery query, IPageContext context) {
- List<String> prefixes = getPrefixes(query, context);
+ public TextProposal[] getProposals(KbQuery query, ELContext context) {
+ if (!(context instanceof IPageContext))
+ return EMPTY_PROPOSAL_LIST;
+
+ List<String> prefixes = getPrefixes(query, (IPageContext)context);
List<TextProposal> proposals = new ArrayList<TextProposal>();
- IComponent[] components = getComponentsByPrefixes(query, prefixes, context);
+ IComponent[] components = getComponentsByPrefixes(query, prefixes, (IPageContext)context);
if(query.getType() == KbQuery.Type.TAG_NAME || query.getType() == KbQuery.Type.TEXT) {
for (int i = 0; i < components.length; i++) {
if(!(components[i] instanceof CustomComponentExtension)) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CSSClassProposalType.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -18,9 +18,9 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.css.core.internal.provisional.document.ICSSStyleRule;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.web.kb.ICSSContainerSupport;
-import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.WebKbPlugin;
import org.jboss.tools.jst.web.kb.PageContextFactory.CSSStyleSheetDescriptor;
@@ -34,6 +34,7 @@
* @author Victor Rubezhny
*
*/
+@SuppressWarnings("restriction")
public class CSSClassProposalType extends CustomProposalType {
private static final String IMAGE_NAME = "EnumerationProposal.gif"; //$NON-NLS-1$
private static Image ICON;
@@ -44,7 +45,7 @@
Set<String> idList = new TreeSet<String>();
@Override
- protected void init(IPageContext context) {
+ protected void init(ELContext context) {
idList.clear();
if (context instanceof ICSSContainerSupport) {
ICSSContainerSupport cssSource = (ICSSContainerSupport)context;
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomProposalType.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomProposalType.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomProposalType.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -10,8 +10,8 @@
******************************************************************************/
package org.jboss.tools.jst.web.kb.internal.taglib;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.TextProposal;
-import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.IProposalProcessor;
import org.jboss.tools.jst.web.kb.KbQuery;
@@ -22,9 +22,9 @@
protected Param[] params;
protected String type;
- protected IPageContext context;
+ protected ELContext context;
- protected abstract void init(IPageContext context);
+ protected abstract void init(ELContext context);
/**
* @return the type
@@ -60,7 +60,7 @@
/* (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.IProposalProcessor#getProposals(org.jboss.tools.jst.web.kb.KbQuery, org.jboss.tools.jst.web.kb.IPageContext)
*/
- public TextProposal[] getProposals(KbQuery query, IPageContext context) {
+ public TextProposal[] getProposals(KbQuery query, ELContext context) {
this.context = context;
init(context);
return getProposals(query);
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomProposalTypeFactory.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomProposalTypeFactory.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomProposalTypeFactory.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -10,7 +10,6 @@
******************************************************************************/
package org.jboss.tools.jst.web.kb.internal.taglib;
-import org.jboss.tools.jst.web.kb.WebKbPlugin;
/**
* @author Alexey Kazakov
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomTagLibAttribute.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomTagLibAttribute.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/CustomTagLibAttribute.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -13,8 +13,8 @@
import java.util.ArrayList;
import java.util.List;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.TextProposal;
-import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.taglib.IComponent;
@@ -65,7 +65,7 @@
* @see org.jboss.tools.jst.web.kb.internal.taglib.AbstractAttribute#getProposals(org.jboss.tools.jst.web.kb.KbQuery, org.jboss.tools.jst.web.kb.IPageContext)
*/
@Override
- public TextProposal[] getProposals(KbQuery query, IPageContext context) {
+ public TextProposal[] getProposals(KbQuery query, ELContext context) {
CustomProposalType[] types = getProposals();
if(types.length==0) {
return EMPTY_PROPOSAL_LIST;
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/EnumerationProposalType.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/EnumerationProposalType.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/EnumerationProposalType.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -15,8 +15,8 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.TextProposal;
-import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.WebKbPlugin;
@@ -59,6 +59,6 @@
* @see org.jboss.tools.jst.web.kb.internal.taglib.CustomProposalType#init(org.jboss.tools.jst.web.kb.IPageContext)
*/
@Override
- protected void init(IPageContext context) {
+ protected void init(ELContext context) {
}
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/ExtendedProposalType.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/ExtendedProposalType.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/ExtendedProposalType.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -1,7 +1,7 @@
package org.jboss.tools.jst.web.kb.internal.taglib;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.TextProposal;
-import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
public class ExtendedProposalType extends CustomProposalType {
@@ -14,7 +14,7 @@
}
@Override
- protected void init(IPageContext context) {
+ protected void init(ELContext context) {
}
}
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FaceletsJsfCProposalType.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FaceletsJsfCProposalType.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FaceletsJsfCProposalType.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -18,6 +18,7 @@
import org.eclipse.swt.graphics.Image;
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImageHelper;
import org.eclipse.wst.xml.ui.internal.editor.XMLEditorPluginImages;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
@@ -30,6 +31,7 @@
/**
* @author Alexey Kazakov
*/
+@SuppressWarnings("restriction")
public class FaceletsJsfCProposalType extends CustomProposalType {
private static Image ICON;
@@ -39,6 +41,9 @@
*/
@Override
public TextProposal[] getProposals(KbQuery query) {
+ if (!(context instanceof IPageContext))
+ return EMPTY_PROPOSAL_LIST;
+
// trim first spaces
String value = query.getValue();
while(true) {
@@ -56,7 +61,7 @@
IComponent[] components = null;
List<TextProposal> proposals = null;
- components = PageProcessor.getInstance().getComponents(kbQuery, context);
+ components = PageProcessor.getInstance().getComponents(kbQuery, (IPageContext)context);
if(components.length==0) {
return EMPTY_PROPOSAL_LIST;
}
@@ -69,7 +74,7 @@
}
List<String> pfx = prefixes.get(lib.getURI());
if(pfx==null) {
- pfx = getPrefixes(context, components[i], kbQuery);
+ pfx = getPrefixes((IPageContext)context, components[i], kbQuery);
prefixes.put(lib.getURI(), pfx);
}
for (String prefix : pfx) {
@@ -121,6 +126,6 @@
* @see org.jboss.tools.jst.web.kb.internal.taglib.CustomProposalType#init(org.jboss.tools.jst.web.kb.IPageContext)
*/
@Override
- protected void init(IPageContext context) {
+ protected void init(ELContext context) {
}
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FacetNameProposalType.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FacetNameProposalType.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/FacetNameProposalType.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -15,6 +15,7 @@
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
@@ -31,13 +32,16 @@
private static final String IMAGE_NAME = "EnumerationProposal.gif"; //$NON-NLS-1$
private static Image ICON;
- private IPageContext context;
+ private ELContext context;
/* (non-Javadoc)
* @see org.jboss.tools.jst.web.kb.internal.taglib.CustomProposalType#getProposals(org.jboss.tools.jst.web.kb.KbQuery)
*/
@Override
public TextProposal[] getProposals(KbQuery query) {
+ if (!(context instanceof IPageContext))
+ return EMPTY_PROPOSAL_LIST;
+
String[] parentTags = query.getParentTags();
if(parentTags.length>1) {
String parentTag = parentTags[parentTags.length-2];
@@ -46,8 +50,8 @@
newQuery.setMask(false);
newQuery.setType(KbQuery.Type.TAG_NAME);
newQuery.setValue(parentTag);
- PageProcessor.getInstance().getComponents(query, context);
- ITagLibrary[] libs = context.getLibraries();
+ PageProcessor.getInstance().getComponents(query, (IPageContext)context);
+ ITagLibrary[] libs = ((IPageContext)context).getLibraries();
for (ITagLibrary l : libs) {
if(l instanceof IFaceletTagLibrary) {
//TODO
@@ -76,7 +80,7 @@
* @see org.jboss.tools.jst.web.kb.internal.taglib.CustomProposalType#init(org.jboss.tools.jst.web.kb.IPageContext)
*/
@Override
- protected void init(IPageContext context) {
+ protected void init(ELContext context) {
this.context = context;
}
}
\ No newline at end of file
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/IDProposalType.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/IDProposalType.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/IDProposalType.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -21,6 +21,7 @@
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.text.TextProposal;
import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
@@ -30,6 +31,7 @@
import org.w3c.dom.Node;
import org.w3c.dom.NodeList;
+@SuppressWarnings("restriction")
public class IDProposalType extends CustomProposalType {
private static final String IMAGE_NAME = "EnumerationProposal.gif"; //$NON-NLS-1$
private static Image ICON;
@@ -40,9 +42,12 @@
Set<String> idList = new TreeSet<String>();
@Override
- protected void init(IPageContext context) {
+ protected void init(ELContext context) {
idList.clear();
- IDocument document = context.getDocument();
+ if (!(context instanceof IPageContext))
+ return;
+
+ IDocument document = ((IPageContext)context).getDocument();
IStructuredModel sModel = StructuredModelManager.getModelManager().getExistingModelForRead(document);
try {
if (sModel != null) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/ModelProposalType.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/ModelProposalType.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/ModelProposalType.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -10,10 +10,10 @@
******************************************************************************/
package org.jboss.tools.jst.web.kb.internal.taglib;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.model.XModel;
import org.jboss.tools.common.model.project.IModelNature;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
-import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.project.list.WebPromptingProvider;
/**
@@ -28,7 +28,7 @@
* @see org.jboss.tools.jst.web.kb.internal.taglib.CustomProposalType#init(org.jboss.tools.jst.web.kb.IPageContext)
*/
@Override
- protected void init(IPageContext context) {
+ protected void init(ELContext context) {
provider = WebPromptingProvider.getInstance();
IModelNature nature = EclipseResourceUtil.getModelNature(context.getResource().getProject());
if(nature!=null) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/NameSpace.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/NameSpace.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/NameSpace.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -12,16 +12,19 @@
package org.jboss.tools.jst.web.kb.internal.taglib;
import org.jboss.tools.jst.web.kb.taglib.INameSpace;
+import org.jboss.tools.jst.web.kb.taglib.INameSpaceExtended;
+import org.jboss.tools.jst.web.kb.taglib.ITagLibrary;
/**
- * The Namespace holder object
+ * The Namespace and TagLibrary holder object
*
* @author Victor Rubezhny
*
*/
-public class NameSpace implements INameSpace {
+public class NameSpace implements INameSpaceExtended {
private String fPrefix;
private String fUri;
+ private ITagLibrary[] fTagLibraries;
/**
* Constructs NameSpace object
@@ -30,8 +33,19 @@
* @param prefix
*/
public NameSpace(String uri, String prefix) {
+ this(uri, prefix, null);
+ }
+
+ /**
+ * Constructs NameSpace object
+ *
+ * @param uri
+ * @param prefix
+ */
+ public NameSpace(String uri, String prefix, ITagLibrary[] libraries) {
this.fUri = uri;
this.fPrefix = prefix;
+ this.fTagLibraries = libraries;
}
/**
@@ -49,7 +63,19 @@
}
/**
+ * Returns TagLibrary for the Namespace object
+ *
+ * @return
+ */
+ public ITagLibrary[] getTagLibraries() {
+ return fTagLibraries;
+ }
+
+ /**
* Compares the NameSpace objects
+ * The method doesn't take in account the library
+ *
+ * @return
*/
public boolean equals(Object obj) {
if (obj instanceof INameSpace) {
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/ResourcePathProposalType.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/ResourcePathProposalType.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/taglib/ResourcePathProposalType.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -24,11 +24,11 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
+import org.jboss.tools.common.el.core.resolver.ELContext;
import org.jboss.tools.common.model.XModelObject;
import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.text.TextProposal;
-import org.jboss.tools.jst.web.kb.IPageContext;
import org.jboss.tools.jst.web.kb.KbQuery;
import org.jboss.tools.jst.web.kb.WebKbPlugin;
@@ -51,7 +51,7 @@
PAGE_FILE_EXTENSIONS.add(pages[i]);
}
}
- private static String PATH_ADDITION = "pathAddition";
+ private static String PATH_ADDITION = "pathAddition"; //$NON-NLS-1$
private IContainer webRootResource;
private Set<String> extensions;
@@ -61,7 +61,7 @@
* @see org.jboss.tools.jst.web.kb.internal.taglib.ModelProposalType#init(org.jboss.tools.jst.web.kb.IPageContext)
*/
@Override
- protected void init(IPageContext context) {
+ protected void init(ELContext context) {
super.init(context);
if(xModel != null) {
XModelObject webInf = FileSystemsHelper.getWebInf(xModel);
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/INameSpace.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/INameSpace.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/INameSpace.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -24,4 +24,5 @@
* @return prefix
*/
String getPrefix();
+
}
\ No newline at end of file
Added: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/INameSpaceExtended.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/INameSpaceExtended.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/INameSpaceExtended.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * 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.jst.web.kb.taglib;
+
+/**
+ *
+ * @author Victor Rubezhny
+ *
+ */
+public interface INameSpaceExtended extends INameSpace {
+ /**
+ *
+ * @return
+ */
+ ITagLibrary[] getTagLibraries();
+}
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/INameSpaceExtended.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Copied: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibraryManager.java (from rev 18686, trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibriryManager.java)
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibraryManager.java (rev 0)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibraryManager.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * 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.jst.web.kb.taglib;
+
+import org.eclipse.core.resources.IProject;
+import org.jboss.tools.jst.web.kb.IKbProject;
+import org.jboss.tools.jst.web.kb.KbProjectFactory;
+
+/**
+ * @author Alexey Kazakov
+ */
+public class TagLibraryManager {
+
+ /**
+ * Returns all tag libraries which have given URI and which are available in the project.
+ * @param project
+ * @param uri
+ * @return
+ */
+ public static ITagLibrary[] getLibraries(IProject project, String uri) {
+ IKbProject kbProject = KbProjectFactory.getKbProject(project, true);
+ if(kbProject == null) {
+ return new ITagLibrary[0];
+ }
+ return kbProject.getTagLibraries(uri);
+ }
+}
\ No newline at end of file
Property changes on: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibraryManager.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Deleted: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibriryManager.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibriryManager.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/taglib/TagLibriryManager.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * 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.jst.web.kb.taglib;
-
-import org.eclipse.core.resources.IProject;
-import org.jboss.tools.jst.web.kb.IKbProject;
-import org.jboss.tools.jst.web.kb.KbProjectFactory;
-import org.jboss.tools.jst.web.kb.WebKbPlugin;
-
-/**
- * @author Alexey Kazakov
- */
-public class TagLibriryManager {
-
- /**
- * Returns all tag libraries which have given URI and which are available in the project.
- * @param project
- * @param uri
- * @return
- */
- public static ITagLibrary[] getLibraries(IProject project, String uri) {
- IKbProject kbProject = KbProjectFactory.getKbProject(project, true);
- if(kbProject == null) {
- return new ITagLibrary[0];
- }
- return kbProject.getTagLibraries(uri);
- }
-}
\ No newline at end of file
Modified: trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationMessages.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationMessages.java 2009-11-24 04:57:39 UTC (rev 18796)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/validation/SeamValidationMessages.java 2009-11-24 13:56:15 UTC (rev 18797)
@@ -11,7 +11,6 @@
package org.jboss.tools.seam.internal.core.validation;
import org.eclipse.osgi.util.NLS;
-import org.jboss.tools.jsf.web.validation.JSFValidationMessages;
/**
* @author Alexey Kazakov
15 years, 1 month
JBoss Tools SVN: r18796 - trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/util.
by jbosstools-commits@lists.jboss.org
Author: Grid.Qian
Date: 2009-11-23 23:57:39 -0500 (Mon, 23 Nov 2009)
New Revision: 18796
Modified:
trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/util/DeployUtils.java
Log:
JBIDE-5248: can't display the port list in the bpel-deploy.xml editor
Modified: trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/util/DeployUtils.java
===================================================================
--- trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/util/DeployUtils.java 2009-11-24 02:48:16 UTC (rev 18795)
+++ trunk/bpel/plugins/org.eclipse.bpel.apache.ode.deploy.ui/src/org/eclipse/bpel/apache/ode/deploy/ui/util/DeployUtils.java 2009-11-24 04:57:39 UTC (rev 18796)
@@ -25,7 +25,6 @@
import org.eclipse.bpel.apache.ode.deploy.model.dd.ddFactory;
import org.eclipse.bpel.model.Process;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IResourceVisitor;
@@ -43,10 +42,6 @@
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.core.JavaProject;
-import org.eclipse.wst.common.componentcore.ComponentCore;
-import org.eclipse.wst.common.componentcore.resources.IVirtualComponent;
-import org.eclipse.wst.common.componentcore.resources.IVirtualResource;
import org.eclipse.wst.wsdl.Definition;
import org.eclipse.wst.wsdl.Port;
import org.eclipse.wst.wsdl.Service;
@@ -62,80 +57,88 @@
public static final String URL_PREFIX_RESOURCE = "resource"; //$NON-NLS-1$
public static final String NONE_STRING = "-- none -- "; //$NON-NLS-1$
-
- public static ProcessType findProcessTypeInDD(org.eclipse.bpel.model.Process process, TDeployment dd) {
+ public static ProcessType findProcessTypeInDD(
+ org.eclipse.bpel.model.Process process, TDeployment dd) {
for (ProcessType pt : dd.getProcess()) {
- if ( pt.getName().getLocalPart().equals(process.getName())
- && pt.getName().getNamespaceURI().equals(process.getTargetNamespace())) {
+ if (pt.getName().getLocalPart().equals(process.getName())
+ && pt.getName().getNamespaceURI().equals(
+ process.getTargetNamespace())) {
return pt;
}
}
return null;
}
- public static ProcessType createProcessStub(org.eclipse.bpel.model.Process process) {
+ public static ProcessType createProcessStub(
+ org.eclipse.bpel.model.Process process) {
ProcessType pt = ddFactory.eINSTANCE.createProcessType();
- QName processQName = new QName(process.getTargetNamespace(),process.getName() );
+ QName processQName = new QName(process.getTargetNamespace(), process
+ .getName());
pt.setName(processQName);
return pt;
}
public static QName getQNameFromSerialzedForm(String qNameAsString) {
-
+
int pos = qNameAsString.lastIndexOf("}"); //$NON-NLS-1$
-
+
String ns = qNameAsString.substring(1, pos);
- String name = qNameAsString.substring(pos+1, qNameAsString.length());
-
+ String name = qNameAsString.substring(pos + 1, qNameAsString.length());
+
QName qName = new QName(ns, name);
-
+
return qName;
}
-
-
- @SuppressWarnings("unchecked") //$NON-NLS-1$
- public static Port findPortByName(String name, IProject bpelProject, ResourceSet resourceSet){
-
+
+ @SuppressWarnings("unchecked")//$NON-NLS-1$
+ public static Port findPortByName(String name, IProject bpelProject,
+ ResourceSet resourceSet) {
+
List serviceList = new ArrayList();
List portList = new ArrayList();
-
- List<Definition> wsdlDefs = DeployUtils.loadAllWSDLFromProject(bpelProject, resourceSet);
- //Assemble All Services from WSDL's
- for (Iterator<Definition> iterator = wsdlDefs.iterator(); iterator.hasNext();) {
+
+ List<Definition> wsdlDefs = DeployUtils.loadAllWSDLFromProject(
+ bpelProject, resourceSet);
+ // Assemble All Services from WSDL's
+ for (Iterator<Definition> iterator = wsdlDefs.iterator(); iterator
+ .hasNext();) {
Definition current = (Definition) iterator.next();
Map services = current.getServices();
- if (!services.isEmpty()){
- Collection values = services.values();
- for (Iterator iterator2 = values.iterator(); iterator2.hasNext();) {
- Service name2 =(Service) iterator2.next();
- serviceList.add(name2);
+ if (!services.isEmpty()) {
+ Collection values = services.values();
+ for (Iterator iterator2 = values.iterator(); iterator2
+ .hasNext();) {
+ Service name2 = (Service) iterator2.next();
+ serviceList.add(name2);
}
}
}
-
- //now we have all services in a List .. get All Ports from these services
+
+ // now we have all services in a List .. get All Ports from these
+ // services
for (Iterator iterator = serviceList.iterator(); iterator.hasNext();) {
Service currentService = (Service) iterator.next();
Map portMap = currentService.getPorts();
Collection ports = portMap.values();
portList.addAll(ports);
}
-
+
for (Iterator iterator = portList.iterator(); iterator.hasNext();) {
Port currentPort = (Port) iterator.next();
- if (currentPort.getName().equals(name)){
+ if (currentPort.getName().equals(name)) {
return currentPort;
}
}
-
+
return null;
-
+
}
-
+
public static Process loadBPEL(IFile bpelFile, ResourceSet resourceSet) {
IPath fullProcessPath = bpelFile.getFullPath();
- URI uri = URI.createPlatformResourceURI(fullProcessPath.toString(), false);
+ URI uri = URI.createPlatformResourceURI(fullProcessPath.toString(),
+ false);
Resource bpelResource = resourceSet.getResource(uri, true);
EcorePackage instance = EcorePackage.eINSTANCE;
@@ -151,16 +154,17 @@
return (Process) contents.get(0);
}
} catch (Exception e) {
- //swallow exception
+ // swallow exception
}
return null;
}
-
+
public static Definition loadWSDL(IFile wsdlFile, ResourceSet resourceSet) {
IPath fullProcessPath = wsdlFile.getFullPath();
- URI uri = URI.createPlatformResourceURI(fullProcessPath.toString(), false);
+ URI uri = URI.createPlatformResourceURI(fullProcessPath.toString(),
+ false);
Resource wsdlResource = resourceSet.getResource(uri, true);
EcorePackage instance = EcorePackage.eINSTANCE;
@@ -173,71 +177,69 @@
return (Definition) contents.get(0);
}
} catch (Exception e) {
- //swallow exception
+ // swallow exception
}
return null;
}
-
- public static List<Definition> loadAllWSDLFromProject(IProject project, ResourceSet resourceSet)
- {
+
+ public static List<Definition> loadAllWSDLFromProject(IProject project,
+ ResourceSet resourceSet) {
List<Definition> wsdlFiles = new ArrayList<Definition>();
-
+
List<IFile> allFiles = DeployUtils.getAllFilesInProject(project);
-
+
for (IFile file : allFiles) {
- if (file.getFileExtension().equalsIgnoreCase("wsdl")) { //$NON-NLS-1$
-// load it
+ if (file.getFileExtension().equalsIgnoreCase("wsdl")) { //$NON-NLS-1$
+ // load it
Definition currentDef = loadWSDL(file, resourceSet);
-// stuff it in wsdlFiles
- wsdlFiles.add(currentDef);
+ // stuff it in wsdlFiles
+ wsdlFiles.add(currentDef);
}
}
-
+
return wsdlFiles;
}
-
- public static List<Process> loadAllBPELFromProject(IProject project, ResourceSet resourceSet)
- {
+
+ public static List<Process> loadAllBPELFromProject(IProject project,
+ ResourceSet resourceSet) {
List<Process> bpelFiles = new ArrayList<Process>();
-
+
List<IFile> allFiles = DeployUtils.getAllFilesInProject(project);
-
+
for (IFile file : allFiles) {
- if (file.getFileExtension().equalsIgnoreCase("bpel")) { //$NON-NLS-1$
-// load it
+ if (file.getFileExtension().equalsIgnoreCase("bpel")) { //$NON-NLS-1$
+ // load it
Process currentProcess = loadBPEL(file, resourceSet);
-// stuff it in bpelFiles
- bpelFiles.add(currentProcess);
+ // stuff it in bpelFiles
+ bpelFiles.add(currentProcess);
}
}
-
+
return bpelFiles;
}
-
-
+
public static List<IFile> getAllFilesInProject(IProject project) {
-
+
final List<IFile> files = new ArrayList<IFile>();
IResourceVisitor visitor = new IResourceVisitor() {
- public boolean visit(org.eclipse.core.resources.IResource resource) throws org.eclipse.core.runtime.CoreException {
+ public boolean visit(org.eclipse.core.resources.IResource resource)
+ throws org.eclipse.core.runtime.CoreException {
if (resource.getType() == IResource.FILE) {
- files.add((IFile)resource);
+ files.add((IFile) resource);
}
return true;
}
};
try {
- IResource[] reses = getSourceContainers(project);
- for(IResource res : reses){
- if(res instanceof IFolder){
- res.accept(visitor);
- }
+ IResource[] reses = project.getFolder("bpelContent").members();
+ for (IResource res : reses) {
+ res.accept(visitor);
+
}
- }
- catch (CoreException e) {
+ } catch (CoreException e) {
e.printStackTrace();
}
return files;
@@ -247,9 +249,8 @@
IJavaProject jProject = JavaCore.create(project);
if (jProject == null)
return new IResource[0];
- List list = new ArrayList();
- IVirtualComponent vc = ComponentCore.createComponent(project);
-
+ List<IResource> list = new ArrayList<IResource>();
+
IPackageFragmentRoot[] roots;
try {
roots = jProject.getPackageFragmentRoots();
@@ -258,41 +259,43 @@
continue;
IResource resource = roots[i].getResource();
list.add(resource);
-// if (null != resource) {
-// IVirtualResource[] vResources = ComponentCore.createResources(resource);
-// boolean found = false;
-// for (int j = 0; !found && j < vResources.length; j++) {
-// if (vResources[j].getComponent().equals(vc)) {
-// if (!list.contains(roots[i]))
-// list.add(roots[i]);
-// found = true;
-// }
-// }
-// }
+ // if (null != resource) {
+ // IVirtualResource[] vResources =
+ // ComponentCore.createResources(resource);
+ // boolean found = false;
+ // for (int j = 0; !found && j < vResources.length; j++) {
+ // if (vResources[j].getComponent().equals(vc)) {
+ // if (!list.contains(roots[i]))
+ // list.add(roots[i]);
+ // found = true;
+ // }
+ // }
+ // }
}
} catch (JavaModelException e) {
-// Logger.getLogger().logError(e);
+ // Logger.getLogger().logError(e);
}
return (IResource[]) list.toArray(new IResource[list.size()]);
}
-
-
+
public static IFile getIFileForURI(URI uri) {
- if(uri == null) return null;
-
- String filePath = null;
+ if (uri == null)
+ return null;
+
+ String filePath = null;
String scheme = uri.scheme();
if (URL_PREFIX_FILE.equals(scheme)) {
filePath = uri.toFileString();
- } else if (URL_PREFIX_PLATFORM.equals(scheme) && uri.segmentCount() > 1 && URL_PREFIX_RESOURCE.equals(uri.segment(0))) {
+ } else if (URL_PREFIX_PLATFORM.equals(scheme) && uri.segmentCount() > 1
+ && URL_PREFIX_RESOURCE.equals(uri.segment(0))) {
StringBuffer platformResourcePath = new StringBuffer();
for (int i = 1, size = uri.segmentCount(); i < size; ++i) {
platformResourcePath.append('/');
platformResourcePath.append(uri.segment(i));
}
- filePath = URI.decode(platformResourcePath.toString());
+ filePath = URI.decode(platformResourcePath.toString());
}
if (filePath == null)
@@ -300,15 +303,17 @@
IFile file = null;
- if (URL_PREFIX_FILE.equals(scheme)){ //44110
- if(uri.device()!= null){
+ if (URL_PREFIX_FILE.equals(scheme)) { // 44110
+ if (uri.device() != null) {
filePath = filePath.substring(filePath.indexOf(uri.device()));
}
- file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(new Path(filePath));
- }else
- file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(filePath));
+ file = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(
+ new Path(filePath));
+ } else
+ file = ResourcesPlugin.getWorkspace().getRoot().getFile(
+ new Path(filePath));
- return file;
+ return file;
}
-
+
}
15 years, 1 month
JBoss Tools SVN: r18794 - trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink.
by jbosstools-commits@lists.jboss.org
Author: vrubezhny
Date: 2009-11-23 20:27:04 -0500 (Mon, 23 Nov 2009)
New Revision: 18794
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java
Log:
JBIDE-5247: Endless cycling in org.jboss.tools.jsf.text.ext.hyperlink.JSPExprHyperlinkPartitioner.getRegion(IDocument, int) under some conditions
Issue is fixed
Modified: trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java 2009-11-24 01:11:08 UTC (rev 18793)
+++ trunk/jsf/plugins/org.jboss.tools.jsf.text.ext/src/org/jboss/tools/jsf/text/ext/hyperlink/JSPExprHyperlinkPartitioner.java 2009-11-24 01:27:04 UTC (rev 18794)
@@ -13,9 +13,6 @@
import org.eclipse.jface.text.IDocument;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMText;
-import org.w3c.dom.Document;
-import org.w3c.dom.Node;
-
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlinkPartitioner;
import org.jboss.tools.common.text.ext.hyperlink.HyperlinkRegion;
import org.jboss.tools.common.text.ext.hyperlink.IExclusiblePartitionerRecognition;
@@ -24,10 +21,13 @@
import org.jboss.tools.common.text.ext.util.StructuredModelWrapper;
import org.jboss.tools.common.text.ext.util.Utils;
import org.jboss.tools.jst.text.ext.hyperlink.jsp.JSPRootHyperlinkPartitioner;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
/**
* @author Jeremy
*/
+@SuppressWarnings("restriction")
public class JSPExprHyperlinkPartitioner extends AbstractHyperlinkPartitioner implements IHyperlinkPartitionRecognizer, IExclusiblePartitionerRecognition {
public static final String JSP_EXPRESSION_PARTITION = "org.jboss.tools.common.text.ext.jsp.JSP_EXPRESSION"; //$NON-NLS-1$
@@ -110,7 +110,7 @@
if (lineBreaker1 != -1 && lineBreaker1 + valStart < exprEnd) exprEnd = valStart + lineBreaker1;
exprLength = exprEnd - exprStart;
- if(exprLength==0) {
+ if(exprLength<=0) {
return null;
} else if (exprStart <= offset && exprEnd >= offset) {
int start = exprStart;
15 years, 1 month
JBoss Tools SVN: r18793 - in trunk: archives/tests/org.jboss.ide.eclipse.archives.ui.test and 17 other directories.
by jbosstools-commits@lists.jboss.org
Author: dgolovin
Date: 2009-11-23 20:11:08 -0500 (Mon, 23 Nov 2009)
New Revision: 18793
Added:
trunk/seam/features/org.jboss.tools.seam.feature/license.html
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam20XCreateTestProjectTest.java
Modified:
trunk/archives/features/org.jboss.ide.eclipse.archives.test.feature/feature.xml
trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/META-INF/MANIFEST.MF
trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/build.properties
trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/ArchivesUITestSuite.java
trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/preferences/MainPreferencePageTest.java
trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/views/ProjectsArchiveViewTest.java
trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/wizards/NewJARWizardTest.java
trunk/common/features/org.jboss.tools.common.all.tests.feature/feature.xml
trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/NewWebProjectWizardPage.java
trunk/seam/features/org.jboss.tools.seam.feature/build.properties
trunk/seam/features/org.jboss.tools.seam.feature/feature.xml
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/builder/ToggleSeamNatureAction.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/AbstractFileSetContentProvider.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/SeamFacetVersionChangeDialog.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamActionProvider.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/OpenSeamComponentDialog.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/RenameComponentWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/RenameSeamContextVariableWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectJavaPackageAction.java
trunk/seam/tests/org.jboss.tools.seam.core.test/META-INF/MANIFEST.MF
trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/SeamCreateTestProjectTest.java
Log:
JUnit tests fixes:
1. Errors in tests to create seam project with/without tetsts
2. Archives UI tests enabled in build
Modified: trunk/archives/features/org.jboss.ide.eclipse.archives.test.feature/feature.xml
===================================================================
--- trunk/archives/features/org.jboss.ide.eclipse.archives.test.feature/feature.xml 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/archives/features/org.jboss.ide.eclipse.archives.test.feature/feature.xml 2009-11-24 01:11:08 UTC (rev 18793)
@@ -13,20 +13,26 @@
[Enter Copyright Description here.]
</copyright>
- <license>Red Hat, Inc. licenses these features and plugins to you under
+ <license>
+ Red Hat, Inc. licenses these features and plugins to you under
certain open source licenses (or aggregations of such licenses), which
in a particular case may include the Eclipse Public License, the GNU
Lesser General Public License, and/or certain other open source
licenses. For precise licensing details, consult the corresponding
source code, or contact Red Hat Legal Affairs, 1801 Varsity Drive,
Raleigh NC 27606 USA.
-</license>
+ </license>
-
<plugin
id="org.jboss.ide.eclipse.archives.test"
download-size="0"
install-size="0"
version="0.0.0"/>
+ <plugin
+ id="org.jboss.ide.eclipse.archives.ui.test"
+ download-size="0"
+ install-size="0"
+ version="0.0.0"/>
+
</feature>
Modified: trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/META-INF/MANIFEST.MF 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/META-INF/MANIFEST.MF 2009-11-24 01:11:08 UTC (rev 18793)
@@ -14,3 +14,8 @@
org.eclipse.core.runtime;bundle-version="3.5.0",
org.jboss.ide.eclipse.archives.core;bundle-version="2.0.0",
org.eclipse.ui.navigator;bundle-version="3.4.1"
+Bundle-ClassPath: archives-ui-test.jar
+Export-Package: org.jboss.ide.eclipse.archives.ui.test,
+ org.jboss.ide.eclipse.archives.ui.test.preferences,
+ org.jboss.ide.eclipse.archives.ui.test.views,
+ org.jboss.ide.eclipse.archives.ui.test.wizards
Modified: trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/build.properties
===================================================================
--- trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/build.properties 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/build.properties 2009-11-24 01:11:08 UTC (rev 18793)
@@ -1,4 +1,6 @@
-source.. = src/
-output.. = bin/
+output.archives-ui-test.jar = bin/
bin.includes = META-INF/,\
- .
+ archives-ui-test.jar,\
+ projects/
+source.archives-ui-test.jar = src/
+jars.compile.order = archives-ui-test.jar
Modified: trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/ArchivesUITestSuite.java
===================================================================
--- trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/ArchivesUITestSuite.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/ArchivesUITestSuite.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -1,23 +1,21 @@
package org.jboss.ide.eclipse.archives.ui.test;
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
import org.jboss.ide.eclipse.archives.ui.test.preferences.MainPreferencePageTest;
-import org.jboss.ide.eclipse.archives.ui.test.wizards.FilesetWizardTest;
+import org.jboss.ide.eclipse.archives.ui.test.views.ProjectsArchiveViewTest;
import org.jboss.ide.eclipse.archives.ui.test.wizards.NewJARWizardTest;
-import org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesCommonView;
import org.jboss.tools.test.util.ProjectImportTestSetup;
-import junit.framework.Test;
-import junit.framework.TestSuite;
-
public class ArchivesUITestSuite {
public static final String TEST_SUITE_BUNDLE_ID = "org.jboss.ide.eclipse.archives.ui.test";
public static Test suite() {
TestSuite suite = new TestSuite();
suite.addTestSuite(MainPreferencePageTest.class);
- suite.addTestSuite(ProjectArchivesCommonView.class);
- suite.addTestSuite(FilesetWizardTest.class);
+ suite.addTestSuite(ProjectsArchiveViewTest.class);
+ //suite.addTestSuite(FilesetWizardTest.class);
suite.addTestSuite(NewJARWizardTest.class);
- return new ProjectImportTestSetup(suite, TEST_SUITE_BUNDLE_ID,"projects/archive-test", "archive-test");
+ return new ProjectImportTestSetup(suite, TEST_SUITE_BUNDLE_ID,"projects/archives-test", "archives-test");
}
-}
-
+}
\ No newline at end of file
Modified: trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/preferences/MainPreferencePageTest.java
===================================================================
--- trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/preferences/MainPreferencePageTest.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/preferences/MainPreferencePageTest.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -2,6 +2,19 @@
import junit.framework.TestCase;
+import org.eclipse.jface.preference.PreferenceDialog;
+import org.jboss.ide.eclipse.archives.ui.preferences.MainPreferencePage;
+import org.jboss.tools.test.util.WorkbenchUtils;
+
public class MainPreferencePageTest extends TestCase {
-
+ public void testArchivesPreferencePageIsShown() {
+ PreferenceDialog dialog = WorkbenchUtils.createPreferenceDialog("org.jboss.ide.eclipse.archives.ui.archivesPreferencePage");
+ try {
+ dialog.open();
+ Object page = dialog.getSelectedPage();
+ assertTrue(page instanceof MainPreferencePage);
+ } finally {
+ dialog.close();
+ }
+ }
}
Modified: trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/views/ProjectsArchiveViewTest.java
===================================================================
--- trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/views/ProjectsArchiveViewTest.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/views/ProjectsArchiveViewTest.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -1,7 +1,20 @@
package org.jboss.ide.eclipse.archives.ui.test.views;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IViewPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.jboss.ide.eclipse.archives.ui.views.ProjectArchivesCommonView;
+
import junit.framework.TestCase;
public class ProjectsArchiveViewTest extends TestCase {
+ public void testArchivesViewIsOpened() throws PartInitException {
+ IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+ IViewPart view = page.showView(ProjectArchivesCommonView.ID);
+ assertTrue(view instanceof ProjectArchivesCommonView);
+ }
}
Modified: trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/wizards/NewJARWizardTest.java
===================================================================
--- trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/wizards/NewJARWizardTest.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/archives/tests/org.jboss.ide.eclipse.archives.ui.test/src/org/jboss/ide/eclipse/archives/ui/test/wizards/NewJARWizardTest.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -30,7 +30,7 @@
@Override
protected void setUp() throws Exception {
- project = ResourcesPlugin.getWorkspace().getRoot().getProject("archive-test");
+ project = ResourcesPlugin.getWorkspace().getRoot().getProject("archives-test");
IWorkbenchPage page= PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IViewPart view= page.showView(IPageLayout.ID_RES_NAV);
Modified: trunk/common/features/org.jboss.tools.common.all.tests.feature/feature.xml
===================================================================
--- trunk/common/features/org.jboss.tools.common.all.tests.feature/feature.xml 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/common/features/org.jboss.tools.common.all.tests.feature/feature.xml 2009-11-24 01:11:08 UTC (rev 18793)
@@ -33,19 +33,6 @@
</requires>
<plugin
- id="org.eclipse.ant.optional.junit"
- download-size="0"
- install-size="0"
- version="0.0.0"
- fragment="true"/>
-
- <plugin
- id="org.eclipse.test"
- download-size="0"
- install-size="0"
- version="0.0.0"/>
-
- <plugin
id="org.jboss.tools.tests"
download-size="0"
install-size="0"
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/plugin.xml 2009-11-24 01:11:08 UTC (rev 18793)
@@ -137,7 +137,7 @@
<editor
class="org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor"
contributorClass="org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageContributor"
- extensions="html, htm, jsf"
+ extensions="html, htm, jsf, xhtml"
icon="$nl$/images/xstudio/editors/html_file.gif"
id="org.jboss.tools.jst.jsp.jspeditor.HTMLTextEditor"
matchingStrategy = "org.jboss.tools.common.core.resources.MatchingStrategyImpl"
@@ -591,4 +591,4 @@
point="org.eclipse.core.runtime.preferences">
<initializer class="org.jboss.tools.jst.jsp.preferences.VpePreferencesInitializer"/>
</extension>
-</plugin>
\ No newline at end of file
+</plugin>
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/NewWebProjectWizardPage.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/NewWebProjectWizardPage.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/wizards/project/NewWebProjectWizardPage.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -138,15 +138,7 @@
layout.marginHeight = 4;
layout.marginWidth = 4;
composite.setLayout(layout);
-
- introduction = new Label(composite, SWT.NO_FOCUS);
- String text = "" + WizardKeys.getString(getKey() + "_introduction"); //$NON-NLS-1$ //$NON-NLS-2$
- text = insertBreaks(introduction, text, 380);
- introduction.setText(text);
- gd = new GridData(GridData.FILL_HORIZONTAL);
- gd.horizontalSpan = 2;
- introduction.setLayoutData(gd);
-
+
// nameEditor
editor = nameEditor.getFieldEditor(composite);
editor.fillIntoGrid(composite, 2);
Modified: trunk/seam/features/org.jboss.tools.seam.feature/build.properties
===================================================================
--- trunk/seam/features/org.jboss.tools.seam.feature/build.properties 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/features/org.jboss.tools.seam.feature/build.properties 2009-11-24 01:11:08 UTC (rev 18793)
@@ -1,2 +1,3 @@
bin.includes = feature.xml,\
- feature.properties
+ feature.properties,\
+ license.html
Modified: trunk/seam/features/org.jboss.tools.seam.feature/feature.xml
===================================================================
--- trunk/seam/features/org.jboss.tools.seam.feature/feature.xml 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/features/org.jboss.tools.seam.feature/feature.xml 2009-11-24 01:11:08 UTC (rev 18793)
@@ -14,203 +14,8 @@
%copyright
</copyright>
- <license url="http://www.eclipse.org/legal/epl-v10.html">
- Eclipse Public License - v 1.0
-THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS
-ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR
-DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE
-OF THIS AGREEMENT.
-1. DEFINITIONS
-"Contribution" means:
-a) in the case of the initial Contributor, the initial code and
-documentation distributed under this Agreement, and
-b) in the case of each subsequent Contributor:
-i) changes to the Program, and
-ii) additions to the Program;
-where such changes and/or additions to the Program originate
-from and are distributed by that particular Contributor. A Contribution
-'originates' from a Contributor if it was added to the Program
-by such Contributor itself or anyone acting on such Contributor's
-behalf. Contributions do not include additions to the Program
-which: (i) are separate modules of software distributed in conjunction
-with the Program under their own license agreement, and (ii)
-are not derivative works of the Program.
-"Contributor" means any person or entity that distributes the
-Program.
-"Licensed Patents " mean patent claims licensable by a Contributor
-which are necessarily infringed by the use or sale of its Contribution
-alone or when combined with the Program.
-"Program" means the Contributions distributed in accordance with
-this Agreement.
-"Recipient" means anyone who receives the Program under this
-Agreement, including all Contributors.
-2. GRANT OF RIGHTS
-a) Subject to the terms of this Agreement, each Contributor hereby
-grants Recipient a non-exclusive, worldwide, royalty-free copyright
-license to reproduce, prepare derivative works of, publicly display,
-publicly perform, distribute and sublicense the Contribution
-of such Contributor, if any, and such derivative works, in source
-code and object code form.
-b) Subject to the terms of this Agreement, each Contributor hereby
-grants Recipient a non-exclusive, worldwide, royalty-free patent
-license under Licensed Patents to make, use, sell, offer to sell,
-import and otherwise transfer the Contribution of such Contributor,
-if any, in source code and object code form. This patent license
-shall apply to the combination of the Contribution and the Program
-if, at the time the Contribution is added by the Contributor,
-such addition of the Contribution causes such combination to
-be covered by the Licensed Patents. The patent license shall
-not apply to any other combinations which include the Contribution.
-No hardware per se is licensed hereunder.
-c) Recipient understands that although each Contributor grants
-the licenses to its Contributions set forth herein, no assurances
-are provided by any Contributor that the Program does not infringe
-the patent or other intellectual property rights of any other
-entity. Each Contributor disclaims any liability to Recipient
-for claims brought by any other entity based on infringement
-of intellectual property rights or otherwise. As a condition
-to exercising the rights and licenses granted hereunder, each
-Recipient hereby assumes sole responsibility to secure any other
-intellectual property rights needed, if any. For example, if
-a third party patent license is required to allow Recipient to
-distribute the Program, it is Recipient's responsibility to acquire
-that license before distributing the Program.
-d) Each Contributor represents that to its knowledge it has sufficient
-copyright rights in its Contribution, if any, to grant the copyright
-license set forth in this Agreement.
-3. REQUIREMENTS
-A Contributor may choose to distribute the Program in object
-code form under its own license agreement, provided that:
-a) it complies with the terms and conditions of this Agreement;
-and
-b) its license agreement:
-i) effectively disclaims on behalf of all Contributors all warranties
-and conditions, express and implied, including warranties or
-conditions of title and non-infringement, and implied warranties
-or conditions of merchantability and fitness for a particular
-purpose;
-ii) effectively excludes on behalf of all Contributors all liability
-for damages, including direct, indirect, special, incidental
-and consequential damages, such as lost profits;
-iii) states that any provisions which differ from this Agreement
-are offered by that Contributor alone and not by any other party;
-and
-iv) states that source code for the Program is available from
-such Contributor, and informs licensees how to obtain it in a
-reasonable manner on or through a medium customarily used for
-software exchange.
-When the Program is made available in source code form:
-a) it must be made available under this Agreement; and
-b) a copy of this Agreement must be included with each copy of
-the Program.
-Contributors may not remove or alter any copyright notices contained
-within the Program.
-Each Contributor must identify itself as the originator of its
-Contribution, if any, in a manner that reasonably allows subsequent
-Recipients to identify the originator of the Contribution.
-4. COMMERCIAL DISTRIBUTION
-Commercial distributors of software may accept certain responsibilities
-with respect to end users, business partners and the like. While
-this license is intended to facilitate the commercial use of
-the Program, the Contributor who includes the Program in a commercial
-product offering should do so in a manner which does not create
-potential liability for other Contributors. Therefore, if a Contributor
-includes the Program in a commercial product offering, such Contributor
-("Commercial Contributor") hereby agrees to defend and indemnify
-every other Contributor ("Indemnified Contributor") against any
-losses, damages and costs (collectively "Losses") arising from
-claims, lawsuits and other legal actions brought by a third party
-against the Indemnified Contributor to the extent caused by the
-acts or omissions of such Commercial Contributor in connection
-with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any
-claims or Losses relating to any actual or alleged intellectual
-property infringement. In order to qualify, an Indemnified Contributor
-must: a) promptly notify the Commercial Contributor in writing
-of such claim, and b) allow the Commercial Contributor to control,
-and cooperate with the Commercial Contributor in, the defense
-and any related settlement negotiations. The Indemnified Contributor
-may participate in any such claim at its own expense.
-For example, a Contributor might include the Program in a commercial
-product offering, Product X. That Contributor is then a Commercial
-Contributor. If that Commercial Contributor then makes performance
-claims, or offers warranties related to Product X, those performance
-claims and warranties are such Commercial Contributor's responsibility
-alone. Under this section, the Commercial Contributor would have
-to defend claims against the other Contributors related to those
-performance claims and warranties, and if a court requires any
-other Contributor to pay any damages as a result, the Commercial
-Contributor must pay those damages.
-5. NO WARRANTY
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM
-IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS
-OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, WITHOUT LIMITATION,
-ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, MERCHANTABILITY
-OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely
-responsible for determining the appropriateness of using and
-distributing the Program and assumes all risks associated with
-its exercise of rights under this Agreement , including but not
-limited to the risks and costs of program errors, compliance
-with applicable laws, damage to or loss of data, programs or
-equipment, and unavailability or interruption of operations.
-6. DISCLAIMER OF LIABILITY
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT
-NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT,
-INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
-(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND
-ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE
-OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY
-OF SUCH DAMAGES.
-7. GENERAL
-If any provision of this Agreement is invalid or unenforceable
-under applicable law, it shall not affect the validity or enforceability
-of the remainder of the terms of this Agreement, and without
-further action by the parties hereto, such provision shall be
-reformed to the minimum extent necessary to make such provision
-valid and enforceable.
-If Recipient institutes patent litigation against any entity
-(including a cross-claim or counterclaim in a lawsuit) alleging
-that the Program itself (excluding combinations of the Program
-with other software or hardware) infringes such Recipient's patent(s),
-then such Recipient's rights granted under Section 2(b) shall
-terminate as of the date such litigation is filed.
-All Recipient's rights under this Agreement shall terminate if
-it fails to comply with any of the material terms or conditions
-of this Agreement and does not cure such failure in a reasonable
-period of time after becoming aware of such noncompliance. If
-all Recipient's rights under this Agreement terminate, Recipient
-agrees to cease use and distribution of the Program as soon as
-reasonably practicable. However, Recipient's obligations under
-this Agreement and any licenses granted by Recipient relating
-to the Program shall continue and survive.
-Everyone is permitted to copy and distribute copies of this Agreement,
-but in order to avoid inconsistency the Agreement is copyrighted
-and may only be modified in the following manner. The Agreement
-Steward reserves the right to publish new versions (including
-revisions) of this Agreement from time to time. No one other
-than the Agreement Steward has the right to modify this Agreement.
-The Eclipse Foundation is the initial Agreement Steward. The
-Eclipse Foundation may assign the responsibility to serve as
-the Agreement Steward to a suitable separate entity. Each new
-version of the Agreement will be given a distinguishing version
-number. The Program (including Contributions) may always be distributed
-subject to the version of the Agreement under which it was received.
-In addition, after a new version of the Agreement is published,
-Contributor may elect to distribute the Program (including its
-Contributions) under the new version. Except as expressly stated
-in Sections 2(a) and 2(b) above, Recipient receives no rights
-or licenses to the intellectual property of any Contributor under
-this Agreement, whether expressly, by implication, estoppel or
-otherwise. All rights in the Program not expressly granted under
-this Agreement are reserved.
-This Agreement is governed by the laws of the State of New York
-and the intellectual property laws of the United States of America.
-No party to this Agreement will bring a legal action under this
-Agreement more than one year after the cause of action arose.
-Each party waives its rights to a jury trial in any resulting
-litigation.
+ <license url="%licenseURL">
+ %license
</license>
<url>
Added: trunk/seam/features/org.jboss.tools.seam.feature/license.html
===================================================================
--- trunk/seam/features/org.jboss.tools.seam.feature/license.html (rev 0)
+++ trunk/seam/features/org.jboss.tools.seam.feature/license.html 2009-11-24 01:11:08 UTC (rev 18793)
@@ -0,0 +1,14 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
+<html>
+
+<body>
+<p>Red Hat, Inc. licenses these features and plugins to you under
+certain open source licenses (or aggregations of such licenses), which
+in a particular case may include the Eclipse Public License, the GNU
+Lesser General Public License, and/or certain other open source
+licenses. For precise licensing details, consult the corresponding
+source code, or contact Red Hat Legal Affairs, 1801 Varsity Drive,
+Raleigh NC 27606 USA.
+</p>
+</body>
+</html>
\ No newline at end of file
Property changes on: trunk/seam/features/org.jboss.tools.seam.feature/license.html
___________________________________________________________________
Name: svn:executable
+ *
Name: svn:mime-type
+ text/plain
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/builder/ToggleSeamNatureAction.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/builder/ToggleSeamNatureAction.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/builder/ToggleSeamNatureAction.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -41,7 +41,7 @@
*/
public void run(IAction action) {
if (selection instanceof IStructuredSelection) {
- for (Iterator it = ((IStructuredSelection) selection).iterator(); it
+ for (Iterator<?> it = ((IStructuredSelection) selection).iterator(); it
.hasNext();) {
Object element = it.next();
IProject project = null;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/AbstractFileSetContentProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/AbstractFileSetContentProvider.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/AbstractFileSetContentProvider.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -28,12 +28,12 @@
protected static File[] ZERO_ARRAY = new File[0];
protected Object[] elements = ZERO_ARRAY;
- private final Comparator comparer = new Comparator() {
+ private final Comparator<File> comparer = new Comparator<File>() {
private Collator collator = Collator.getInstance();
- public int compare(Object arg0, Object arg1) {
- String s1 = ((File) arg0).getName();
- String s2 = ((File) arg1).getName();
+ public int compare(File arg0, File arg1) {
+ String s1 = arg0.getName();
+ String s2 = arg1.getName();
return collator.compare(s1, s2);
}
};
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/SeamFacetVersionChangeDialog.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/SeamFacetVersionChangeDialog.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/dialog/SeamFacetVersionChangeDialog.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -79,8 +79,6 @@
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
-import org.jboss.tools.seam.ui.widget.editor.CompositeEditor;
-import org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor;
import org.jboss.tools.seam.ui.widget.editor.SeamRuntimeListFieldEditor.SeamRuntimeNewWizard;
import org.jboss.tools.seam.ui.wizard.SeamFormWizard;
import org.jboss.tools.seam.ui.wizard.SeamWizardUtils;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamActionProvider.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamActionProvider.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/actions/SeamActionProvider.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -12,12 +12,10 @@
import org.eclipse.jdt.ui.actions.JdtActionConstants;
import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.jface.commands.ActionHandler;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.actions.ActionContext;
-import org.eclipse.ui.handlers.IHandlerService;
import org.eclipse.ui.navigator.CommonActionProvider;
import org.eclipse.ui.navigator.ICommonActionConstants;
import org.jboss.tools.seam.core.IOpenableElement;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/OpenSeamComponentDialog.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/OpenSeamComponentDialog.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/OpenSeamComponentDialog.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -17,7 +17,6 @@
import java.io.IOException;
import java.util.Collections;
import java.util.Comparator;
-import java.util.Iterator;
import java.util.List;
import org.eclipse.core.resources.IProject;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/RenameComponentWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/RenameComponentWizard.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/RenameComponentWizard.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -16,7 +16,6 @@
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/RenameSeamContextVariableWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/RenameSeamContextVariableWizard.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/RenameSeamContextVariableWizard.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -15,9 +15,7 @@
import java.util.Map;
import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.ltk.core.refactoring.Refactoring;
import org.eclipse.ltk.core.refactoring.RefactoringStatus;
@@ -28,10 +26,8 @@
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
-import org.jboss.tools.seam.core.ISeamComponent;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
-import org.jboss.tools.seam.internal.core.refactoring.RenameComponentProcessor;
import org.jboss.tools.seam.internal.core.refactoring.RenameSeamContextVariableProcessor;
import org.jboss.tools.seam.internal.core.refactoring.SeamRenameProcessor;
import org.jboss.tools.seam.ui.SeamUIMessages;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -15,19 +15,13 @@
import java.util.Map;
import org.eclipse.core.commands.operations.IUndoableOperation;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.INewWizard;
-import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.ui.ISeamHelpContextIds;
-import org.jboss.tools.seam.ui.SeamGuiPlugin;
import org.jboss.tools.seam.ui.SeamUIMessages;
import org.jboss.tools.seam.ui.widget.editor.INamedElement;
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -154,7 +154,7 @@
}
private Map<String, Object> loadParameters(IAdaptable info, SeamProjectsSet seamPrjSet) throws BackingStoreException {
- Map<String, INamedElement> params = (Map)info.getAdapter(Map.class);
+ Map<String, INamedElement> params = (Map<String, INamedElement>)info.getAdapter(Map.class);
IEclipsePreferences seamFacetPrefs = SeamCorePlugin.getSeamPreferences(seamPrjSet.getWarProject());
Map<String, Object> vars = new HashMap<String, Object>();
@@ -250,7 +250,7 @@
}
protected IProject getProject(IAdaptable info) {
- Map<String, INamedElement> params = (Map)info.getAdapter(Map.class);
+ Map<String, INamedElement> params = (Map<String, INamedElement>)info.getAdapter(Map.class);
return ResourcesPlugin.getWorkspace().getRoot().getProject(
params.get(IParameter.SEAM_PROJECT_NAME).getValueAsString());
@@ -295,7 +295,7 @@
* @param vars
* @return
*/
- public FilterSetCollection getFilterSetCollection(Map vars) {
+ public FilterSetCollection getFilterSetCollection(Map<String, Object> vars) {
return new FilterSetCollection(SeamFacetFilterSetFactory.createFiltersFilterSet(vars));
}
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizardPage1.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -11,13 +11,8 @@
package org.jboss.tools.seam.ui.wizard;
-import java.util.Map;
-
import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.widgets.Composite;
import org.jboss.tools.seam.ui.SeamUIMessages;
-import org.jboss.tools.seam.ui.internal.project.facet.IValidator;
-import org.jboss.tools.seam.ui.internal.project.facet.ValidatorFactory;
/**
* @author eskimo
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamProjectWizard.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -470,13 +470,13 @@
protected String[] getValidationPropertyNames() {
String[] superProperties = super.getValidationPropertyNames();
- List list = Arrays.asList(superProperties);
- ArrayList arrayList = new ArrayList();
+ List<String> list = Arrays.asList(superProperties);
+ ArrayList<String> arrayList = new ArrayList<String>();
arrayList.addAll( list );
arrayList.add( ISeamFacetDataModelProperties.JBOSS_AS_TARGET_RUNTIME);
arrayList.add( ISeamFacetDataModelProperties.JBOSS_AS_TARGET_SERVER);
arrayList.add( ISeamFacetDataModelProperties.SEAM_PROJECT_NAME);
- return (String[])arrayList.toArray( new String[0] );
+ return arrayList.toArray( new String[0] );
}
public boolean launchNewServerWizard(Shell shell, IDataModel model) {
Modified: trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectJavaPackageAction.java
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectJavaPackageAction.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SelectJavaPackageAction.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -92,7 +92,7 @@
String initialValue = getFieldEditor().getValue().toString();
IJavaElement initialElement = null;
- ArrayList packagesWithoutDefaultPackage = new ArrayList();
+ ArrayList<IJavaElement> packagesWithoutDefaultPackage = new ArrayList<IJavaElement>();
for (IJavaElement packageElement : packages) {
String packageName = packageElement.getElementName();
if(packageName.length()>0) {
@@ -103,7 +103,7 @@
}
}
- packages = (IJavaElement[])packagesWithoutDefaultPackage.toArray(new IJavaElement[packagesWithoutDefaultPackage.size()]);
+ packages = packagesWithoutDefaultPackage.toArray(new IJavaElement[packagesWithoutDefaultPackage.size()]);
ElementListSelectionDialog dialog = new ElementListSelectionDialog(Display.getCurrent().getActiveShell(), new JavaElementLabelProvider(
JavaElementLabelProvider.SHOW_DEFAULT));
dialog.setTitle(J2EEUIMessages.PACKAGE_SELECTION_DIALOG_TITLE);
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/META-INF/MANIFEST.MF 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/META-INF/MANIFEST.MF 2009-11-24 01:11:08 UTC (rev 18793)
@@ -11,7 +11,6 @@
Require-Bundle:
org.junit,
org.jboss.tools.seam.core,
- org.jboss.tools.seam.xml,
org.jboss.tools.common.test,
org.jboss.tools.jsf,
org.eclipse.wst.common.project.facet.core,
Modified: trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/tests/org.jboss.tools.seam.core.test/src/org/jboss/tools/seam/core/test/project/facet/AbstractSeamFacetTest.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -3,6 +3,7 @@
import java.io.File;
import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
@@ -10,6 +11,7 @@
import junit.framework.TestCase;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectNature;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRunnable;
@@ -70,7 +72,7 @@
}
- protected final Set<IResource> resourcesToCleanup = new HashSet<IResource>();
+ protected final ArrayList<IResource> resourcesToCleanup = new ArrayList<IResource>();
protected final List<Runnable> tearDownOperations = new ArrayList<Runnable>();
protected AbstractSeamFacetTest(final String name) {
@@ -123,8 +125,15 @@
for (IResource r : this.resourcesToCleanup) {
try {
System.out.println("Deleting resource " + r.getLocation());
+ if(r instanceof IProject) {
+ IProject project = (IProject)r;
+ for (String natureId : project.getDescription().getNatureIds()) {
+ IProjectNature nature = project.getNature(natureId);
+ nature.deconfigure();
+ }
+ }
r.delete(true, null);
- JobUtils.waitForIdle();
+// JobUtils.delay(5000);
} catch(Exception e) {
e.printStackTrace();
last = e;
@@ -142,9 +151,16 @@
}
protected final void addResourceToCleanup(final IResource resource) {
+ if(resource==null) throw new IllegalArgumentException();
+ if(resourcesToCleanup.contains(resource)) throw new IllegalArgumentException();
this.resourcesToCleanup.add(resource);
}
+ protected final void addResourcesToCleanup(final IResource[] resource) {
+ if(resource==null) throw new IllegalArgumentException();
+ this.resourcesToCleanup.addAll(Arrays.asList(resource));
+ }
+
protected final void addTearDownOperation(final Runnable runnable) {
this.tearDownOperations.add(runnable);
}
@@ -220,9 +236,10 @@
}
},new NullProgressMonitor());
- this.addResourceToCleanup(proj);
- this.addResourceToCleanup(ResourcesPlugin.getWorkspace().getRoot().getProject(baseProjectName + "-test"));
+
+ this.addResourcesToCleanup(seamProjectsSet.getAllProjects());
+
return fproj;
}
@@ -236,31 +253,21 @@
assertTrue(proj.getWorkspace().getRoot().getProject(proj.getName() + "-test").exists());
IProject testProject = proj.getWorkspace().getRoot().getProject(proj.getName() + "-test");
- this.addResourceToCleanup(testProject);
- this.addResourceToCleanup(proj);
+
return fproj;
}
protected IFacetedProject createSeamEarProject(String name) throws CoreException {
final IFacetedProject fproj = createSeamProject(name, createSeamDataModel("ear"));
-
+ SeamProjectsSet seamProjectsSet = new SeamProjectsSet(fproj.getProject());
final IProject proj = fproj.getProject();
assertNotNull(proj);
-
- IProject testProject = proj.getWorkspace().getRoot().getProject(proj.getName() + "-test");
- IProject ejbProject = proj.getWorkspace().getRoot().getProject(proj.getName() + "-ejb");
- IProject earProject = proj.getWorkspace().getRoot().getProject(proj.getName() + "-ear");
-
- this.resourcesToCleanup.add(proj);
- this.resourcesToCleanup.add(testProject);
- this.resourcesToCleanup.add(ejbProject);
- this.resourcesToCleanup.add(earProject);
- assertTrue(proj.exists());
- assertTrue(testProject.exists());
- assertTrue(ejbProject.exists());
- assertTrue(earProject.exists());
+ assertTrue(seamProjectsSet.getWarProject().exists());
+ assertTrue(seamProjectsSet.getTestProject().exists());
+ assertTrue(seamProjectsSet.getEjbProject().exists());
+ assertTrue(seamProjectsSet.getEarProject().exists());
return fproj;
}
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/SeamUiAllTests.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -24,6 +24,7 @@
import org.jboss.tools.seam.ui.test.view.SeamComponentsViewAllTests;
import org.jboss.tools.seam.ui.test.wizard.OpenSeamComponentDialogTest;
import org.jboss.tools.seam.ui.test.wizard.PackageNamesTest;
+import org.jboss.tools.seam.ui.test.wizard.Seam20XCreateTestProjectTest;
import org.jboss.tools.seam.ui.test.wizard.SeamActionNewWizardTest;
import org.jboss.tools.seam.ui.test.wizard.SeamCreateTestProjectTest;
import org.jboss.tools.seam.ui.test.wizard.SeamFormNewWizardTest;
@@ -55,6 +56,7 @@
suite.addTestSuite(PackageNamesTest.class);
suite.addTestSuite(JBide3989Test.class);
suite.addTestSuite(SeamCreateTestProjectTest.class);
+ suite.addTestSuite(Seam20XCreateTestProjectTest.class);
return suite;
}
}
\ No newline at end of file
Added: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam20XCreateTestProjectTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam20XCreateTestProjectTest.java (rev 0)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam20XCreateTestProjectTest.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -0,0 +1,53 @@
+package org.jboss.tools.seam.ui.test.wizard;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
+import org.jboss.tools.seam.core.project.facet.SeamVersion;
+import org.jboss.tools.seam.core.test.project.facet.AbstractSeamFacetTest;
+
+public class Seam20XCreateTestProjectTest extends SeamCreateTestProjectTest {
+
+ public Seam20XCreateTestProjectTest(String name) {
+ super(name);
+ }
+
+ @Override
+ protected void setUp() throws Exception {
+ assertSeamHomeAvailable();
+ File folder = getSeamHomeFolder();
+ SeamRuntimeManager.getInstance().addRuntime(SEAM_2_0_0, folder.getAbsolutePath(), SeamVersion.SEAM_2_0, true);
+ }
+
+ @Override
+ protected IProjectFacetVersion getSeamFacetVersion() {
+ IProjectFacet seamFacet = ProjectFacetsManager.getProjectFacet("jst.seam");
+ return seamFacet.getVersion("2.0");
+ }
+
+ @Override
+ protected String getSystemPropertyName() {
+ // TODO Auto-generated method stub
+ return AbstractSeamFacetTest.SEAM_2_0_HOME;
+ }
+
+ public void testSeamWarProjectWithTestProject() throws CoreException{
+ checkTestProjectCreation("test_seam20_war_t", SEAM_2_0_0, WAR, true);
+ }
+
+ public void testSeamWarProjectWithoutTestProject() throws CoreException{
+ checkTestProjectCreation("test_seam20_war", SEAM_2_0_0, WAR, false);
+ }
+
+ public void testSeamEarProjectWithTestProject() throws CoreException{
+ checkTestProjectCreation("test_seam20_ear_t", SEAM_2_0_0, EAR, true);
+ }
+
+ public void testSeamEarProjectWithoutTestProject() throws CoreException{
+ checkTestProjectCreation("test_seam20_ear", SEAM_2_0_0, EAR, false);
+ }
+}
Property changes on: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam20XCreateTestProjectTest.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/SeamCreateTestProjectTest.java
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/SeamCreateTestProjectTest.java 2009-11-23 20:46:27 UTC (rev 18792)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/SeamCreateTestProjectTest.java 2009-11-24 01:11:08 UTC (rev 18793)
@@ -10,10 +10,17 @@
******************************************************************************/
package org.jboss.tools.seam.ui.test.wizard;
+import java.io.File;
+
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
+import org.eclipse.wst.common.project.facet.core.IProjectFacet;
+import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
+import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
+import org.jboss.tools.seam.core.project.facet.SeamVersion;
import org.jboss.tools.seam.core.test.project.facet.AbstractSeamFacetTest;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
@@ -28,8 +35,8 @@
public SeamCreateTestProjectTest(String name) {
super(name);
}
-
- private void checkTestProjectCreation(String name, String seamVersion, String deployType, boolean createTestProject){
+
+ protected void checkTestProjectCreation(String name, String seamVersion, String deployType, boolean createTestProject) throws CoreException{
IDataModel model = createSeamDataModel(deployType);
// set property to create test project
@@ -37,56 +44,34 @@
model.setStringProperty(ISeamFacetDataModelProperties.SEAM_RUNTIME_NAME, seamVersion);
- try{
- final IFacetedProject fproj = createSeamProject(name, model);
-
- final IProject proj = fproj.getProject();
-
- assertNotNull(proj);
- assertTrue(proj.exists());
- if(createTestProject){
- assertTrue(proj.getWorkspace().getRoot().getProject(proj.getName() + "-test").exists());
- IProject testProject = proj.getWorkspace().getRoot().getProject(proj.getName() + "-test");
- this.addResourceToCleanup(testProject);
- }else{
- assertFalse(proj.getWorkspace().getRoot().getProject(proj.getName() + "-test").exists());
- }
- this.addResourceToCleanup(proj);
- }catch(CoreException ex){
- fail(ex.getMessage());
+
+ final IFacetedProject fproj = createSeamProject(name, model);
+
+ final IProject proj = fproj.getProject();
+
+ assertNotNull(proj);
+ assertTrue(proj.exists());
+ if(createTestProject){
+ assertTrue(proj.getWorkspace().getRoot().getProject(proj.getName() + "-test").exists());
+ IProject testProject = proj.getWorkspace().getRoot().getProject(proj.getName() + "-test");
+ }else{
+ assertFalse(proj.getWorkspace().getRoot().getProject(proj.getName() + "-test").exists());
}
}
- public void testSeam12WarProjectWithTestProject(){
+ public void testSeamWarProjectWithTestProject() throws CoreException{
checkTestProjectCreation("test_seam12_war_t", SEAM_1_2_0, WAR, true);
}
- public void testSeam12WarProjectWithoutTestProject(){
+ public void testSeamWarProjectWithoutTestProject() throws CoreException{
checkTestProjectCreation("test_seam12_war", SEAM_1_2_0, WAR, false);
}
- public void testSeam20WarProjectWithTestProject(){
- checkTestProjectCreation("test_seam20_war_t", SEAM_2_0_0, WAR, true);
- }
-
- public void testSeam20WarProjectWithoutTestProject(){
- checkTestProjectCreation("test_seam20_war", SEAM_2_0_0, WAR, false);
- }
-
- public void testSeam12EarProjectWithTestProject(){
+ public void testSeamEarProjectWithTestProject() throws CoreException{
checkTestProjectCreation("test_seam12_ear_t", SEAM_1_2_0, EAR, true);
}
- public void testSeam12EarProjectWithoutTestProject(){
+ public void testSeamEarProjectWithoutTestProject() throws CoreException{
checkTestProjectCreation("test_seam12_ear", SEAM_1_2_0, EAR, false);
}
-
- public void testSeam20EarProjectWithTestProject(){
- checkTestProjectCreation("test_seam20_ear_t", SEAM_2_0_0, EAR, true);
- }
-
- public void testSeam20EarProjectWithoutTestProject(){
- checkTestProjectCreation("test_seam20_ear", SEAM_2_0_0, EAR, false);
- }
-
}
15 years, 1 month
JBoss Tools SVN: r18792 - trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core.
by jbosstools-commits@lists.jboss.org
Author: akazakov
Date: 2009-11-23 15:46:27 -0500 (Mon, 23 Nov 2009)
New Revision: 18792
Added:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPointField.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPointParameter.java
Modified:
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4943
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2009-11-23 18:43:21 UTC (rev 18791)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IBeanManager.java 2009-11-23 20:46:27 UTC (rev 18792)
@@ -20,17 +20,24 @@
public interface IBeanManager {
/**
- * Returns the set of beans which match the given EL name
+ * Returns the set of beans which match the given EL name.
*
* @param name
* the name used to restrict the beans matched
+ * @param attemptToResolveAmbiguousNames
+ * if there are a few beans with the given name and
+ * attemptToResolveAmbiguousNames==true the manager should try to
+ * resolve the EL name. If any of the beans are alternatives, the
+ * manager will eliminate all beans that are not alternatives,
+ * expect for producer methods and fields of beans that are
+ * alternatives.
* @return the matched beans
*/
- Set<IBean> getBeans(String name);
+ Set<IBean> getBeans(String name, boolean attemptToResolveAmbiguousNames);
/**
- * Returns the set of beans which have the given required type and qualifier type
- * If no qualifiers are given, the
+ * Returns the set of beans which have the given required type and qualifier
+ * type If no qualifiers are given, the
* {@linkplain javax.enterprise.inject.Default default qualifier} is
* assumed.
*
@@ -40,5 +47,14 @@
* the required qualifiers
* @return the resulting set of beans
*/
- Set<IBean> getBeans(IType beanType, IType... qualifierTypes);
+ Set<IBean> getBeans(IType beanType, IAnnotationDeclaration... qualifiers);
+
+ /**
+ * Returns the set of beans which are eligible for the given injection
+ * points.
+ *
+ * @param injectionPoints
+ * @return the resulting set of beans
+ */
+ Set<IBean> getBeans(IInjectionPoint injectionPoints);
}
\ No newline at end of file
Modified: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java 2009-11-23 18:43:21 UTC (rev 18791)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPoint.java 2009-11-23 20:46:27 UTC (rev 18792)
@@ -12,43 +12,30 @@
import java.util.Set;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IJavaElement;
-import org.jboss.tools.common.text.ITextSourceReference;
+import org.eclipse.jdt.core.IType;
/**
* Represents an injection point.
*
* @author Alexey Kazakov
*/
-public interface IInjectionPoint extends ICDIElement, ITextSourceReference {
+public interface IInjectionPoint extends ICDIElement, IBeanMember {
/**
- * Gets the required qualifiers of the injection point.
+ * Returns the required type of this injection point.
*
- * @return the required qualifiers
+ * @return the required type of this injection point.
*/
- Set<IAnnotation> getQualifiers();
+ IType getType();
/**
- * Gets the object representing the bean that defines the injection point. If
- * the injection point does not belong to a bean, return a null value.
+ * Gets the required qualifiers of the injection point.
*
- * @return the object representing bean that defines the injection point, of
- * null if the injection point does not belong to a bean
+ * @return the required qualifiers
*/
- IBean getBean();
+ Set<IAnnotationDeclaration> getQualifierDeclarations();
/**
- * Obtains an instance of IMember or ITypeParameter, depending upon whether
- * the injection point is an injected field or a constructor/method
- * parameter.
- *
- * @return an IMember or ITypeParameter
- */
- IJavaElement getSourceElement();
-
- /**
* Determines if the injection point is a decorator delegate injection
* point.
*
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPointField.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPointField.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPointField.java 2009-11-23 20:46:27 UTC (rev 18792)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * 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.cdi.core;
+
+/**
+ * Represents an injection point which is a filed of a bean class.
+ *
+ * @author Alexey Kazakov
+ */
+public interface IInjectionPointField extends IBeanField, IInjectionPoint {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPointField.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Added: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPointParameter.java
===================================================================
--- trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPointParameter.java (rev 0)
+++ trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPointParameter.java 2009-11-23 20:46:27 UTC (rev 18792)
@@ -0,0 +1,20 @@
+/*******************************************************************************
+ * 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.cdi.core;
+
+/**
+ * Represents an injection point which is a parameter of a method.
+ *
+ * @author Alexey Kazakov
+ */
+public interface IInjectionPointParameter extends IParameter, IInjectionPoint {
+
+}
\ No newline at end of file
Property changes on: trunk/cdi/plugins/org.jboss.tools.cdi.core/src/org/jboss/tools/cdi/core/IInjectionPointParameter.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
15 years, 1 month
JBoss Tools SVN: r18791 - trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2009-11-23 13:43:21 -0500 (Mon, 23 Nov 2009)
New Revision: 18791
Modified:
trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5240, patch from Sergey Dzmitrovich has been applied
Modified: trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java 2009-11-23 18:23:29 UTC (rev 18790)
+++ trunk/jst/plugins/org.jboss.tools.jst.jsp/src/org/jboss/tools/jst/jsp/outline/cssdialog/CSSClassDialog.java 2009-11-23 18:43:21 UTC (rev 18791)
@@ -270,6 +270,9 @@
// select new class, after it in handleSelectorSwitched() dialog will be
// updated
classCombo.select(classCombo.getItemCount() - 1);
+
+ //this is require
+ applyButton.setEnabled(true);
}
@Override
15 years, 1 month
JBoss Tools SVN: r18790 - in trunk: jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide and 1 other directory.
by jbosstools-commits@lists.jboss.org
Author: mareshkau
Date: 2009-11-23 13:23:29 -0500 (Mon, 23 Nov 2009)
New Revision: 18790
Modified:
trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/FaceletSourceTagHyperlink.java
trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4509Test.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-4635
Modified: trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/FaceletSourceTagHyperlink.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/FaceletSourceTagHyperlink.java 2009-11-23 17:43:57 UTC (rev 18789)
+++ trunk/common/plugins/org.jboss.tools.common.text.ext/src/org/jboss/tools/common/text/ext/hyperlink/xml/FaceletSourceTagHyperlink.java 2009-11-23 18:23:29 UTC (rev 18790)
@@ -10,14 +10,30 @@
******************************************************************************/
package org.jboss.tools.common.text.ext.hyperlink.xml;
+import java.util.zip.ZipEntry;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IStorage;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.internal.core.JarEntryFile;
+import org.eclipse.jdt.internal.core.JarPackageFragmentRoot;
import org.eclipse.jdt.internal.ui.javaeditor.JarEntryEditorInput;
import org.eclipse.jface.text.IRegion;
import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IStorageEditorInput;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PlatformUI;
+import org.jboss.tools.common.text.ext.ExtensionsPlugin;
import org.jboss.tools.common.text.ext.hyperlink.LinkHyperlink;
+
/**
* @author mareshkau
*
@@ -48,9 +64,86 @@
openFileFailed();
}
}
- } else {
- super.doHyperlink(region);
+ return;
+ }
+ else if(editorPart.getEditorInput() instanceof IStorageEditorInput) {
+ IStorageEditorInput modelObjectStorageEditorInput =
+ (IStorageEditorInput) editorPart.getEditorInput();
+ try {
+
+ IStorage storage = modelObjectStorageEditorInput.getStorage();
+ if(storage!=null && getFilePath(region)!=null) {
+ if(openOnFromModelEditorIntup(storage.getFullPath(), getFilePath(region))){
+ return;
+ }
+ }
+ } catch (CoreException e) {
+ ExtensionsPlugin.getDefault().logError(e);
+ }
+ }
+ super.doHyperlink(region);
+ }
+ /**
+ *
+ * @param xmodelPaht it's path to file in jar archive on which we are trying to make open on
+ * Example 'JBIDE3247/FileSystems/lib-mydomain.jar/META-INF/custom.taglib.xml'
+ * @param fileToOpen jar archive relative name for which we are trying to make open on
+ * Example '/inputCurrency.xhtml's
+ */
+ private boolean openOnFromModelEditorIntup(IPath xmodelPath, String fileToOpen) {
+ if(xmodelPath==null || fileToOpen==null) {
+ return false;
}
+ String projectName = xmodelPath.segment(0);
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
+ JarEntryEditorInput editorInputToOpenEditor=seachResourceInClassPath(project,new Path(fileToOpen.substring(1)),xmodelPath);
+ if(editorInputToOpenEditor==null) {
+ return false;
+ }
+ IEditorPart openedEditor = openFileInEditor(editorInputToOpenEditor,
+ editorInputToOpenEditor.getName());
+ if(openedEditor==null) {
+ openFileFailed();
+ return false;
+ }
+ return true;
}
-
+ /**
+ *
+ * @param project project from which we are going to open File
+ * @param classPathResource resource relativy to class path
+ * @param xmodelPath xmodel path to file
+ * @return
+ */
+ private static JarEntryEditorInput seachResourceInClassPath(IProject project, IPath classPathResource, IPath xmodelPath) {
+ IJavaProject javaProject = JavaCore.create(project);
+ try {
+ for (IPackageFragmentRoot fragmentRoot : javaProject.getAllPackageFragmentRoots()) {
+ if(fragmentRoot instanceof JarPackageFragmentRoot) {
+ JarPackageFragmentRoot jarPackageFragmentRoot = (JarPackageFragmentRoot) fragmentRoot;
+ ZipEntry zipEntry = jarPackageFragmentRoot.getJar().getEntry(classPathResource.toString());
+ //the name of jar file shoul be in xmodel path
+ //for now if model have following
+ if(zipEntry!=null&&xmodelPath.toString().contains(fragmentRoot.getElementName())){
+ JarEntryFile fileInJar = new JarEntryFile(classPathResource.lastSegment());
+ Object parent = null;
+ String parentName =classPathResource.removeLastSegments(1).toString();
+ if(parentName.length()==0) {
+ parent = jarPackageFragmentRoot;
+ }else{
+ parent = jarPackageFragmentRoot.getPackageFragment(classPathResource.removeLastSegments(1).toString());
+ }
+ fileInJar.setParent(parent);
+ JarEntryEditorInput jarEditorInput = new JarEntryEditorInput(fileInJar);
+ return jarEditorInput;
+ }
+ }
+ }
+ } catch (JavaModelException e) {
+ ExtensionsPlugin.getDefault().logError(e);
+ } catch (CoreException e) {
+ ExtensionsPlugin.getDefault().logError(e);
+ }
+ return null;
+ }
}
Modified: trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4509Test.java
===================================================================
--- trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4509Test.java 2009-11-23 17:43:57 UTC (rev 18789)
+++ trunk/jsf/tests/org.jboss.tools.jsf.vpe.jsf.test/src/org/jboss/tools/jsf/vpe/jsf/test/jbide/JBIDE4509Test.java 2009-11-23 18:23:29 UTC (rev 18790)
@@ -36,8 +36,10 @@
import org.eclipse.ui.part.MultiPageEditorPart;
import org.eclipse.ui.texteditor.AbstractTextEditor;
import org.eclipse.wst.sse.ui.StructuredTextEditor;
+import org.jboss.tools.common.model.ui.editor.EditorPartWrapper;
import org.jboss.tools.common.text.ext.hyperlink.AbstractHyperlink;
import org.jboss.tools.jsf.vpe.jsf.test.JsfAllTests;
+import org.jboss.tools.jst.jsp.jspeditor.JSPMultiPageEditor;
import org.jboss.tools.vpe.ui.test.TestUtil;
import org.jboss.tools.vpe.ui.test.VpeTest;
@@ -96,6 +98,17 @@
IEditorInput editorInput = new FileEditorInput(file);
JBIDE4509Test.checkOpenOnInEditor(editorInput, getEditorId(file.getName()), 22, 23, "IfHandler.java"); //$NON-NLS-1$
}
+ //test for https://jira.jboss.org/jira/browse/JBIDE-4635
+ public void testJBIDE4635OpenOn() throws Throwable{
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(JsfAllTests.IMPORT_JBIDE3247_PROJECT_NAME);
+ IFile file = (IFile) project.findMember("WebContent/pages/index.xhtml"); //$NON-NLS-1$
+ IEditorInput editorInput = new FileEditorInput(file);
+ JBIDE4509Test.checkOpenOnInEditor(editorInput, getEditorId(file.getName()), 11, 11, "mareshkau.taglib.xml"); //$NON-NLS-1$
+ IEditorPart activeEditor = PlatformUI.getWorkbench()
+ .getActiveWorkbenchWindow().getActivePage().getActiveEditor();
+ JBIDE4509Test.checkOpenOnInEditor(activeEditor.getEditorInput(),getEditorId(activeEditor.getEditorInput().getName()),
+ 8,23,"echo.xhtml"); //$NON-NLS-1$
+ }
/**
* Function for checking openOn functionality in jar file;
*
@@ -138,12 +151,21 @@
* @author mareshkau
*/
private static final void checkOpenOnInEditor(IEditorInput editorInput,String editorId,int lineNumber, int lineOffset, String openedOnFileName) throws Throwable {
- MultiPageEditorPart editorPart = (MultiPageEditorPart) PlatformUI
+ IEditorPart editorPart = PlatformUI
.getWorkbench().getActiveWorkbenchWindow().getActivePage()
.openEditor(editorInput, editorId);
- IEditorPart[] editorParts = editorPart.findEditors(editorInput);
- editorPart.setActiveEditor(editorParts[0]);
- StructuredTextEditor textEditor = (StructuredTextEditor) editorParts[0];
+ StructuredTextEditor textEditor = null;
+ if(editorPart instanceof MultiPageEditorPart){
+ IEditorPart[] editorParts = ((MultiPageEditorPart)editorPart).findEditors(editorInput);
+ ((MultiPageEditorPart)editorPart).setActiveEditor(editorParts[0]);
+ textEditor = (StructuredTextEditor) editorParts[0];
+ } else if(editorPart instanceof JSPMultiPageEditor) {
+ textEditor = ((JSPMultiPageEditor)editorPart).getSourceEditor();
+ } else if(editorPart instanceof EditorPartWrapper) {
+ IEditorPart[] editorParts = ((MultiPageEditorPart)((EditorPartWrapper)editorPart).getEditor()).findEditors(editorInput);
+ ((MultiPageEditorPart)((EditorPartWrapper)editorPart).getEditor()).setActiveEditor(editorParts[1]);
+ textEditor = (StructuredTextEditor) editorParts[1];
+ }
int openOnPosition = TestUtil.getLinePositionOffcet(textEditor
.getTextViewer(),lineNumber, lineOffset);
// hack to get hyperlinks detectors, no other was have been founded
@@ -172,6 +194,7 @@
}
+
private static final String getEditorId(String filename) {
IWorkbench workbench = PlatformUI.getWorkbench();
IEditorRegistry editorRegistry = workbench.getEditorRegistry();
15 years, 1 month
JBoss Tools SVN: r18789 - trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2009-11-23 12:43:57 -0500 (Mon, 23 Nov 2009)
New Revision: 18789
Modified:
trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/XMarkerManager.java
Log:
https://jira.jboss.org/jira/browse/JBIDE-5191
Modified: trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/XMarkerManager.java
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/XMarkerManager.java 2009-11-23 17:21:03 UTC (rev 18788)
+++ trunk/common/plugins/org.jboss.tools.common.model/src/org/jboss/tools/common/model/markers/XMarkerManager.java 2009-11-23 17:43:57 UTC (rev 18789)
@@ -36,29 +36,41 @@
private Set<XModelObject> warningObjects = new HashSet<XModelObject>();
private XMarkerManager() {
- reload();
+ reload(null);
ModelPlugin.getWorkspace().addResourceChangeListener(this);
}
public void resourceChanged(IResourceChangeEvent event) {
+ IProject project = null;
+ Object o = event.getSource();
+ if(o instanceof IWorkspace) {
+ IResourceDelta d = event.getDelta();
+ IResourceDelta[] cs = d.getAffectedChildren();
+ for (int i = 0; i < cs.length && project == null; i++) {
+ project = cs[i].getResource().getProject();
+ }
+ }
+ final IProject p = project;
if(ResourcesPlugin.getWorkspace().isTreeLocked()) {
XJob.addRunnable(new XRunnable() {
public String getId() {
return "XMarkerManager"; //$NON-NLS-1$
}
public void run() {
- reload();
+ reload(p);
}
});
} else {
- reload();
+ reload(p);
}
}
- public void reload() {
+ public void reload(IProject project) {
IMarker[] ms = new IMarker[0];
try {
- ms = ModelPlugin.getWorkspace().getRoot().findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
+ ms = (project == null || !project.isAccessible())
+ ? ModelPlugin.getWorkspace().getRoot().findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE)
+ : project.findMarkers(IMarker.PROBLEM, true, IResource.DEPTH_INFINITE);
} catch (CoreException e) {
ModelPlugin.getPluginLog().logError(e);
}
@@ -79,7 +91,9 @@
if(o == null) continue;
es.add(o);
String attr = ms[i].getAttribute("attribute", null); //$NON-NLS-1$
- if(attr != null && attr.length() > 0) ((XModelObjectImpl)o).addErrorAttributeDirty(attr);
+ if(attr != null && attr.length() > 0) {
+ ((XModelObjectImpl)o).addErrorAttributeDirty(attr);
+ }
}
synchronized(objects) {
Iterator<XModelObject> it = objects.iterator();
@@ -93,6 +107,8 @@
} else if(es.contains(o)) {
if(severity > o.getErrorState()) {
o.setErrorState(severity);
+ } else {
+ ((XModelObjectImpl)o).commitErrorAttributes();
}
es.remove(o);
}
@@ -102,7 +118,9 @@
XModelObject o = (XModelObject)it.next();
if(severity > o.getErrorState()) {
o.setErrorState(severity);
- }
+ } else {
+ ((XModelObjectImpl)o).commitErrorAttributes();
+ }
if(!objects.contains(o)) {
objects.add(o);
}
15 years, 1 month