Author: bfitzpat
Date: 2012-01-26 14:46:53 -0500 (Thu, 26 Jan 2012)
New Revision: 38217
Added:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/
workspace/bfitzpat/org.jboss.tools.esb.visualizer/.classpath
workspace/bfitzpat/org.jboss.tools.esb.visualizer/.project
workspace/bfitzpat/org.jboss.tools.esb.visualizer/.settings/
workspace/bfitzpat/org.jboss.tools.esb.visualizer/.settings/org.eclipse.jdt.core.prefs
workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/
workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/MANIFEST.MF
workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/hairy-jboss-esb.xml
workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/jboss-esb.xml
workspace/bfitzpat/org.jboss.tools.esb.visualizer/build.properties
workspace/bfitzpat/org.jboss.tools.esb.visualizer/icons/
workspace/bfitzpat/org.jboss.tools.esb.visualizer/icons/horizontalTreeLayout.gif
workspace/bfitzpat/org.jboss.tools.esb.visualizer/icons/radialLayout.gif
workspace/bfitzpat/org.jboss.tools.esb.visualizer/icons/verticalTreeLayout.gif
workspace/bfitzpat/org.jboss.tools.esb.visualizer/plugin.xml
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/Activator.java
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ESBDomParser.java
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ESBVisualizerView.java
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/FileSelectionGroup.java
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/TreeObject.java
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/TreeParent.java
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ViewerFileFilter.java
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/WorkbenchFileSelectionDialog.java
Log:
[JBIDE-10726] Checking in initial work for ESB visualizer to personal workspace
Added: workspace/bfitzpat/org.jboss.tools.esb.visualizer/.classpath
===================================================================
--- workspace/bfitzpat/org.jboss.tools.esb.visualizer/.classpath
(rev 0)
+++ workspace/bfitzpat/org.jboss.tools.esb.visualizer/.classpath 2012-01-26 19:46:53 UTC
(rev 38217)
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con"
path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
Property changes on: workspace/bfitzpat/org.jboss.tools.esb.visualizer/.classpath
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/bfitzpat/org.jboss.tools.esb.visualizer/.project
===================================================================
--- workspace/bfitzpat/org.jboss.tools.esb.visualizer/.project
(rev 0)
+++ workspace/bfitzpat/org.jboss.tools.esb.visualizer/.project 2012-01-26 19:46:53 UTC
(rev 38217)
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.jboss.tools.esb.visualizer</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
Property changes on: workspace/bfitzpat/org.jboss.tools.esb.visualizer/.project
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/.settings/org.eclipse.jdt.core.prefs
===================================================================
---
workspace/bfitzpat/org.jboss.tools.esb.visualizer/.settings/org.eclipse.jdt.core.prefs
(rev 0)
+++
workspace/bfitzpat/org.jboss.tools.esb.visualizer/.settings/org.eclipse.jdt.core.prefs 2012-01-26
19:46:53 UTC (rev 38217)
@@ -0,0 +1,8 @@
+#Tue Nov 08 13:56:22 MST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.source=1.6
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/.settings/org.eclipse.jdt.core.prefs
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/MANIFEST.MF
===================================================================
--- workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/MANIFEST.MF
(rev 0)
+++ workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/MANIFEST.MF 2012-01-26
19:46:53 UTC (rev 38217)
@@ -0,0 +1,15 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: ESB Configuration Visualizer
+Bundle-SymbolicName: org.jboss.tools.esb.visualizer; singleton:=true
+Bundle-Version: 1.0.0.qualifier
+Bundle-Activator: org.jboss.tools.esb.visualizer.Activator
+Bundle-Vendor:
JBoss.org
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.zest.core,
+ org.eclipse.zest.layouts,
+ org.eclipse.ui.ide,
+ org.eclipse.core.resources
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/MANIFEST.MF
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/hairy-jboss-esb.xml
===================================================================
--- workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/hairy-jboss-esb.xml
(rev 0)
+++
workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/hairy-jboss-esb.xml 2012-01-26
19:46:53 UTC (rev 38217)
@@ -0,0 +1,315 @@
+<?xml version="1.0"?>
+<jbossesb parameterReloadSecs="5"
+
xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc...
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trun...
http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc/schemas/xml...
+ <providers>
+ <jms-provider connection-factory="ConnectionFactory"
+ jndi-URL="jnp://127.0.0.1:1099"
+ jndi-context-factory="org.jnp.interfaces.NamingContextFactory"
+ jndi-pkg-prefix="org.jboss.naming:org.jnp.interfaces"
name="JMSProvider">
+ <jms-bus busid="startGwChannel">
+ <jms-message-filter dest-name="queue/quickstart_simple_cbr_Request"
dest-type="QUEUE"/>
+ <!-- quickstart_bpm_orchestration5_start_gw
+ This queue is used for JPetstore's order
+ queue/quickstart_simple_cbr_Request -->
+ </jms-bus>
+ <jms-bus busid="startEsbChannel">
+ <jms-message-filter
+ dest-name="queue/quickstart_bpm_orchestration5_start_esb"
dest-type="QUEUE"/>
+ </jms-bus>
+ <jms-bus busid="intakeServiceEsbChannel">
+ <jms-message-filter
+ dest-name="queue/quickstart_bpm_orchestration5_intake_service_esb"
dest-type="QUEUE"/>
+ </jms-bus>
+ <jms-bus busid="discountServiceEsbChannel">
+ <jms-message-filter
+ dest-name="queue/quickstart_bpm_orchestration5_discount_service_esb"
dest-type="QUEUE"/>
+ </jms-bus>
+ <jms-bus busid="shippingServiceEsbChannel">
+ <jms-message-filter
+ dest-name="queue/quickstart_bpm_orchestration5_shipping_service_esb"
dest-type="QUEUE"/>
+ </jms-bus>
+ <jms-bus busid="expressServiceEsbChannel">
+ <jms-message-filter
+ dest-name="queue/quickstart_bpm_orchestration5_ConciergeManager"
dest-type="QUEUE"/>
+ </jms-bus>
+ <jms-bus busid="distributionServiceEsbChannel">
+ <jms-message-filter
+ dest-name="queue/quickstart_bpm_orchestration5_DistributionManager"
dest-type="QUEUE"/>
+ </jms-bus>
+ <jms-bus busid="basicShippingServiceEsbChannel">
+ <jms-message-filter
+ dest-name="queue/quickstart_bpm_orchestration5_BasicShipping"
dest-type="QUEUE"/>
+ </jms-bus>
+ <jms-bus busid="rejectionEsbChannel">
+ <jms-message-filter
+ dest-name="queue/quickstart_bpm_orchestration5_Rejection"
dest-type="QUEUE"/>
+ </jms-bus>
+ <jms-bus busid="rejectionWorkflowChannel">
+ <jms-message-filter
+ dest-name="queue/quickstart_bpm_orchestration5_RejectionWorkflow"
dest-type="QUEUE"/>
+ </jms-bus>
+ <jms-bus busid="timeoutChannel">
+ <jms-message-filter
+ dest-name="queue/quickstart_bpm_orchestration5_Timeout"
dest-type="QUEUE"/>
+ </jms-bus>
+ </jms-provider>
+ <fs-provider name="FileSystemProvider">
+ <fs-bus busid="warehouseCallbackChannel">
+ <fs-message-filter directory="/tmp/fromWarehouse"
+ error-delete="true" error-suffix="error"
+ input-suffix="shipmentNotice.xml" post-delete="true"
+ post-suffix="done" work-suffix="working"/>
+ </fs-bus>
+ <fs-bus busid="warehouseCallbackChannelESB">
+ <fs-message-filter directory="/tmp/fromWarehouse"
+ error-delete="true" error-suffix="esbError"
+ input-suffix="shipmentNotice.xml.esb" post-delete="true"
work-suffix="esbWorking"/>
+ </fs-bus>
+ </fs-provider>
+ </providers>
+ <services>
+ <!-- removed the deploy service, the process definition needs to be deployed by a
.par and/or from
+ the graphical process designer -->
+ <service category="BPM_orchestration5_Starter_Service"
+ description="BPM Orchestration Sample 5: Use this service to start a process
instance" name="Starter_Service">
+ <listeners>
+ <jms-listener busidref="startGwChannel" is-gateway="true"
+ maxThreads="1" name="JMS-Gateway"/>
+ <jms-listener busidref="startEsbChannel" maxThreads="1"
name="ESB-Listener"/>
+ </listeners>
+ <actions>
+ <action
+ class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor"
name="setup_key">
+ <property name="script"
value="/scripts/setup_key.groovy"/>
+ </action>
+ <action class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor"
name="start_a_new_order_process">
+ <property name="command"
value="StartProcessInstanceCommand"/>
+ <property name="esbToBpmVars">
+ <mapping bpm="entireOrderAsXML" esb="BODY_CONTENT"/>
+ </property>
+ <property name="key" value="body.businessKey"/>
+ <property name="process-definition-name"
value="bpm5_ESBOrderProcess"/>
+ </action>
+ <action class="org.jboss.soa.esb.actions.SystemPrintln"
name="dump2">
+ <property name="message" value="After"/>
+ <property name="printfull" value="true"/>
+ </action>
+ </actions>
+ </service>
+ <service category="BPM_Orchestration5"
+ description="IntakeService: transforms, massages, calculates priority"
name="IntakeService">
+ <listeners>
+ <jms-listener busidref="intakeServiceEsbChannel"
maxThreads="1" name="ESB-Listener"/>
+ </listeners>
+ <actions mep="RequestResponse">
+ <action
+ class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor"
name="groovy">
+ <property name="script"
value="/scripts/intake_service.groovy"/>
+ </action>
+ <!-- transform -->
+ <action
+ class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor"
name="discover-message-origin">
+ <property name="script"
value="/scripts/check-origin.groovy"/>
+ </action>
+ <action
+ class="org.jboss.soa.esb.actions.converters.SmooksTransformer"
name="transform">
+ <property name="resource-config"
value="/smooks-config.xml"/>
+ </action>
+ <action
+
class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration5.esb_actions.SetupMessage"
name="setupMessage">
+ <property name="status" value="40"/>
+ <!-- status was not in order XML, this is just for demo purposes -->
+ </action>
+ <action
+ class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor"
name="display">
+ <property name="script" value="/scripts/display.groovy"/>
+ </action>
+ <!-- Use the BRP to calculate the order priority -->
+ <action class="org.jboss.soa.esb.actions.BusinessRulesProcessor"
name="calc_order_priority">
+ <property name="object-paths">
+ <object-path esb="body.orderHeader"/>
+ <object-path esb="body.customer"/>
+ </property>
+ <property name="ruleReload" value="true"/>
+ <property name="ruleSet" value="Priority_Rules.drl"/>
+ </action>
+ <action
+ class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor"
name="setupPriority">
+ <property name="script"
value="/scripts/setup_priority.groovy"/>
+ </action>
+ <action
+
class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration5.esb_actions.SimpleJMSNotifier"
name="monitor">
+ <property name="ALERT_QUEUE_NAME"
value="quickstart_bpm_orchestration5_monitor"/>
+ <property name="BODY_KEY" value="order_orderPriority"/>
+ <property name="PREPENDED_TEXT" value="Priority"/>
+ </action>
+ </actions>
+ </service>
+ <service category="BPM_Orchestration5"
description="DiscountService" name="DiscountService">
+ <listeners>
+ <jms-listener busidref="discountServiceEsbChannel"
maxThreads="1" name="ESB-Listener"/>
+ </listeners>
+ <actions mep="RequestResponse">
+ <action
+ class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor"
name="groovy">
+ <property name="script"
value="/scripts/discount_service.groovy"/>
+ </action>
+ <action
+ class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor"
name="display">
+ <property name="script" value="/scripts/display.groovy"/>
+ </action>
+ <action class="org.jboss.soa.esb.actions.BusinessRulesProcessor"
name="discount_calc">
+ <property name="object-paths">
+ <object-path esb="body.orderHeader"/>
+ <object-path esb="body.customer"/>
+ </property>
+ <property name="ruleReload" value="true"/>
+ <property name="ruleSet" value="Discount_Rules.drl"/>
+ </action>
+ <action
+ class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor"
name="setupDiscount">
+ <property name="script"
value="/scripts/setup_discount.groovy"/>
+ </action>
+ <action
+
class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration5.esb_actions.SimpleJMSNotifier"
name="monitor">
+ <property name="ALERT_QUEUE_NAME"
value="quickstart_bpm_orchestration5_monitor"/>
+ <property name="BODY_KEY" value="order_orderDiscount"/>
+ <property name="PREPENDED_TEXT" value="Discount
Service"/>
+ </action>
+ </actions>
+ </service>
+ <service category="BPM_Orchestration5"
description="ShippingService" name="ShippingService">
+ <listeners>
+ <jms-listener busidref="shippingServiceEsbChannel"
maxThreads="1" name="ESB-Listener"/>
+ </listeners>
+ <actions mep="RequestResponse">
+ <action
+ class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor"
name="groovy">
+ <property name="script"
value="/scripts/shipping_service.groovy"/>
+ </action>
+ <action class="org.jboss.soa.esb.actions.ContentBasedRouter"
name="ContentBasedRouter">
+ <property name="destinations">
+ <route-to destination-name="SuperSpecialCustomerService"
+ service-category="ExpressWarehouseManager"
service-name="ExpressWarehouseService"/>
+ <route-to destination-name="SpecialCustomerService"
+ service-category="DistributionWarehouseManager"
service-name="DistributionWarehouseService"/>
+ <route-to destination-name="RegularCustomerService"
+ service-category="BasicShipping"
service-name="BasicShipperService"/>
+ </property>
+ <property name="object-paths">
+ <object-path esb="body.orderHeader"/>
+ <object-path esb="body.customer"/>
+ </property>
+ <property name="ruleReload" value="true"/>
+ <property name="ruleSet" value="CBRRules.drl"/>
+ </action>
+ </actions>
+ </service>
+ <service category="ExpressWarehouseManager"
+ description="For highest priority customers"
name="ExpressWarehouseService">
+ <listeners>
+ <jms-listener busidref="expressServiceEsbChannel"
maxThreads="1" name="expressServiceEsbChannel"/>
+ </listeners>
+ <actions mep="OneWay">
+ <action
+
class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration5.esb_actions.SimpleJMSNotifier"
name="monitor">
+ <property name="ALERT_QUEUE_NAME"
value="quickstart_bpm_orchestration5_monitor"/>
+ <property name="BODY_KEY" value="orderHeader"/>
+ <property name="PREPENDED_TEXT" value="Express:Highest Priority
Customers/Orders"/>
+ </action>
+ </actions>
+ </service>
+ <service category="DistributionWarehouseManager"
+ description="For medium priority customers"
name="DistributionWarehouseService">
+ <listeners>
+ <jms-listener busidref="distributionServiceEsbChannel"
+ maxThreads="1" name="distributionServiceEsbChannel"/>
+ </listeners>
+ <actions mep="OneWay">
+ <action
+
class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration5.esb_actions.SimpleJMSNotifier"
name="monitor">
+ <property name="ALERT_QUEUE_NAME"
value="quickstart_bpm_orchestration5_monitor"/>
+ <property name="BODY_KEY" value="orderHeader"/>
+ <property name="PREPENDED_TEXT" value="Distribution Manager:Medium
Priority Customers/Orders"/>
+ </action>
+ </actions>
+ </service>
+ <service category="BasicShipping"
+ description="For low priority customers"
name="BasicShipperService">
+ <listeners>
+ <jms-listener busidref="basicShippingServiceEsbChannel"
+ maxThreads="1" name="basicShippingServiceEsbChannel"/>
+ </listeners>
+ <actions mep="OneWay">
+ <action
+
class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration5.esb_actions.SimpleJMSNotifier"
name="monitor">
+ <property name="ALERT_QUEUE_NAME"
value="quickstart_bpm_orchestration5_monitor"/>
+ <property name="BODY_KEY" value="orderHeader"/>
+ <property name="PREPENDED_TEXT" value="Basic:Lowest Priority
Customers/Orders"/>
+ </action>
+ </actions>
+ </service>
+ <service category="RejectionCategory" description="Handles
Rejection" name="RejectionService">
+ <listeners>
+ <jms-listener busidref="rejectionEsbChannel" maxThreads="1"
name="rejectionListener"/>
+ </listeners>
+ <actions mep="RequestResponse">
+ <action
+
class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration5.esb_actions.SimpleJMSNotifier"
name="monitor">
+ <property name="ALERT_QUEUE_NAME"
value="quickstart_bpm_orchestration5_monitor"/>
+ <property name="PREPENDED_TEXT" value="REJECT, REJECT! Bye,
Bye"/>
+ </action>
+ </actions>
+ </service>
+ <service category="bpm_orchestration5"
+ description="Handles Async Callback from Warehouse"
name="WarehouseCallbackService">
+ <listeners>
+ <fs-listener busidref="warehouseCallbackChannel"
is-gateway="true"
+ maxThreads="1" name="warehouseCallbackGatewayListener"/>
+ <fs-listener busidref="warehouseCallbackChannelESB"
maxThreads="1" name="warehouseCallbackESBListener"/>
+ </listeners>
+ <actions mep="OneWay">
+ <action
+ class="org.jboss.soa.esb.actions.scripting.GroovyActionProcessor"
name="signalCallback">
+ <property name="script"
value="/scripts/shipping_callback_service.groovy"/>
+ </action>
+ <action
+
class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration5.esb_actions.SimpleJMSNotifier"
name="monitor">
+ <property name="ALERT_QUEUE_NAME"
value="quickstart_bpm_orchestration5_monitor"/>
+ <property name="PREPENDED_TEXT" value="Received Shipment
Notice"/>
+ </action>
+ </actions>
+ </service>
+ <service category="bpm_orchestration5"
+ description="starts another workflow"
name="RejectionWorkflow">
+ <listeners>
+ <jms-listener busidref="rejectionWorkflowChannel"
maxThreads="1" name="rejectionWorkflowListener"/>
+ </listeners>
+ <actions mep="OneWay">
+ <action class="org.jboss.soa.esb.services.jbpm.actions.BpmProcessor"
name="start_a_new_rejection_workflow">
+ <property name="command"
value="StartProcessInstanceCommand"/>
+ <property name="esbToBpmVars">
+ <mapping bpm="entireOrderAsXML" esb="BODY_CONTENT"/>
+ </property>
+ <property name="key" value="body.businessKey"/>
+ <property name="process-definition-name"
value="rejectionWorkflow"/>
+ </action>
+ </actions>
+ </service>
+ <service category="bpm_orchestration5"
+ description="sends a msg to the monitor"
name="TimeoutService">
+ <listeners>
+ <jms-listener busidref="timeoutChannel" maxThreads="1"
name="timeoutListener"/>
+ </listeners>
+ <actions mep="OneWay">
+ <action
+
class="org.jboss.soa.esb.samples.quickstarts.bpm_orchestration5.esb_actions.SimpleJMSNotifier"
name="monitor">
+ <property name="ALERT_QUEUE_NAME"
value="quickstart_bpm_orchestration5_monitor"/>
+ <property name="PREPENDED_TEXT" value="Still
Waiting..."/>
+ </action>
+
+ </actions>
+ </service>
+ </services>
+</jbossesb>
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/hairy-jboss-esb.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/jboss-esb.xml
===================================================================
--- workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/jboss-esb.xml
(rev 0)
+++ workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/jboss-esb.xml 2012-01-26
19:46:53 UTC (rev 38217)
@@ -0,0 +1,53 @@
+<?xml version = "1.0" encoding = "UTF-8"?>
+<jbossesb
xmlns="http://anonsvn.labs.jboss.com/labs/jbossesb/trunk/product/etc...
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://anonsvn.labs.jboss.com/labs/jbossesb/trun...
http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk/product/etc/schem...
+ parameterReloadSecs="5">
+
+ <providers>
+ <jms-provider name="JBossMQ"
connection-factory="ConnectionFactory">
+ <jms-bus busid="quickstartGwChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_helloworld_Request_gw"
+ />
+ </jms-bus>
+ <jms-bus busid="quickstartEsbChannel">
+ <jms-message-filter
+ dest-type="QUEUE"
+ dest-name="queue/quickstart_helloworld_Request_esb"
+ />
+ </jms-bus>
+
+ </jms-provider>
+ </providers>
+
+ <services>
+ <service
+ category="FirstServiceESB"
+ name="SimpleListener"
+ description="Hello World">
+ <listeners>
+ <jms-listener name="JMS-Gateway"
+ busidref="quickstartGwChannel"
+ is-gateway="true"
+ />
+ <jms-listener name="helloWorld"
+ busidref="quickstartEsbChannel"
+ />
+ </listeners>
+ <actions mep="OneWay">
+ <action name="action1"
+
class="org.jboss.soa.esb.samples.quickstart.helloworld.MyJMSListenerAction"
+ process="displayMessage"
+ />
+ <action name="action2"
class="org.jboss.soa.esb.actions.SystemPrintln">
+ <property name="printfull"
value="false"/>
+ </action>
+ <!-- The next action is for Continuous Integration testing -->
+ <action name="testStore"
class="org.jboss.soa.esb.actions.TestMessageStore"/>
+ </actions>
+ </service>
+ </services>
+
+</jbossesb>
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/META-INF/jboss-esb.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/bfitzpat/org.jboss.tools.esb.visualizer/build.properties
===================================================================
--- workspace/bfitzpat/org.jboss.tools.esb.visualizer/build.properties
(rev 0)
+++ workspace/bfitzpat/org.jboss.tools.esb.visualizer/build.properties 2012-01-26 19:46:53
UTC (rev 38217)
@@ -0,0 +1,6 @@
+source.. = src/
+output.. = bin/
+bin.includes = plugin.xml,\
+ META-INF/,\
+ .,\
+ icons/
Property changes on: workspace/bfitzpat/org.jboss.tools.esb.visualizer/build.properties
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: workspace/bfitzpat/org.jboss.tools.esb.visualizer/icons/horizontalTreeLayout.gif
===================================================================
(Binary files differ)
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/icons/horizontalTreeLayout.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/bfitzpat/org.jboss.tools.esb.visualizer/icons/radialLayout.gif
===================================================================
(Binary files differ)
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/icons/radialLayout.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/bfitzpat/org.jboss.tools.esb.visualizer/icons/verticalTreeLayout.gif
===================================================================
(Binary files differ)
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/icons/verticalTreeLayout.gif
___________________________________________________________________
Added: svn:mime-type
+ application/octet-stream
Added: workspace/bfitzpat/org.jboss.tools.esb.visualizer/plugin.xml
===================================================================
--- workspace/bfitzpat/org.jboss.tools.esb.visualizer/plugin.xml
(rev 0)
+++ workspace/bfitzpat/org.jboss.tools.esb.visualizer/plugin.xml 2012-01-26 19:46:53 UTC
(rev 38217)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+ <extension
+ point="org.eclipse.ui.views">
+ <category
+ name="ESB"
+ id="org.jboss.tools.esb.visualizer">
+ </category>
+ <view
+ name="ESB Configuration Visualizer"
+ icon="icons/esb/esb_file.gif"
+ category="org.jboss.tools.esb.visualizer"
+ class="org.jboss.tools.esb.visualizer.views.ESBVisualizerView"
+ id="org.jboss.tools.esb.visualizer.views.ESBVisualizerView">
+ </view>
+ </extension>
+
+</plugin>
Property changes on: workspace/bfitzpat/org.jboss.tools.esb.visualizer/plugin.xml
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/Activator.java
===================================================================
---
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/Activator.java
(rev 0)
+++
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/Activator.java 2012-01-26
19:46:53 UTC (rev 38217)
@@ -0,0 +1,61 @@
+package org.jboss.tools.esb.visualizer;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class Activator extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.esb.visualizer";
//$NON-NLS-1$
+
+ // The shared instance
+ private static Activator plugin;
+
+ /**
+ * The constructor
+ */
+ public Activator() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static Activator getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+ return imageDescriptorFromPlugin(PLUGIN_ID, path);
+ }
+}
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/Activator.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ESBDomParser.java
===================================================================
---
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ESBDomParser.java
(rev 0)
+++
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ESBDomParser.java 2012-01-26
19:46:53 UTC (rev 38217)
@@ -0,0 +1,197 @@
+package org.jboss.tools.esb.visualizer.views;
+
+import java.io.File;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.util.Collections;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.eclipse.core.runtime.FileLocator;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.jboss.tools.esb.visualizer.Activator;
+import org.jboss.tools.esb.visualizer.views.TreeObject.ESBType;
+import org.osgi.framework.Bundle;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+import org.xml.sax.SAXException;
+
+public class ESBDomParser {
+
+ Document dom;
+ TreeParent root;
+
+ public boolean isFileESBConfig ( String filepath ) {
+ //get the factory
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+ try {
+
+ //Using factory get an instance of document builder
+ DocumentBuilder db = dbf.newDocumentBuilder();
+
+ //parse using builder to get DOM representation of the XML file
+ dom = db.parse(filepath);
+
+ dom.getDocumentElement().normalize();
+
+ if (dom.getDocumentElement().getTagName().equalsIgnoreCase("jbossesb")) {
+ return true;
+ }
+ }catch(ParserConfigurationException pce) {
+ pce.printStackTrace();
+ }catch(SAXException se) {
+ se.printStackTrace();
+ }catch(IOException ioe) {
+ ioe.printStackTrace();
+ }
+
+ return false;
+ }
+
+ public void parseXmlFile(String filepath){
+
+ root = new TreeParent("Invisible Root");
+
+ //get the factory
+ DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+
+ try {
+
+ //Using factory get an instance of document builder
+ DocumentBuilder db = dbf.newDocumentBuilder();
+
+ try {
+ if (filepath == null) {
+ Bundle bundle = Activator.getDefault().getBundle();
+ IPath path = new Path("META-INF/jboss-esb.xml");
+ URL setupUrl = FileLocator.find(bundle, path, Collections.EMPTY_MAP);
+ File setupFile = new File(FileLocator.toFileURL(setupUrl).toURI());
+ filepath = setupFile.getAbsolutePath();
+ }
+ } catch (URISyntaxException e) {
+ e.printStackTrace();
+ }
+
+ //parse using builder to get DOM representation of the XML file
+ dom = db.parse(filepath);
+ dom.getDocumentElement().normalize();
+ root.setName(dom.getDocumentElement().getTagName());
+ root.setEsbObjectType(ESBType.ESB);
+
+ parseDocument();
+
+ }catch(ParserConfigurationException pce) {
+ pce.printStackTrace();
+ }catch(SAXException se) {
+ se.printStackTrace();
+ }catch(IOException ioe) {
+ ioe.printStackTrace();
+ }
+ }
+
+ private void parseDocument(){
+ //get the root elememt
+ Element docEle = dom.getDocumentElement();
+
+ //get a nodelist of <providers> elements
+ NodeList nl = docEle.getElementsByTagName("providers");
+ if(nl != null && nl.getLength() > 0) {
+ Element providersElement= null;
+ for (int j = 0; j < nl.getLength(); j++) {
+ if (nl.item(j) instanceof Element) {
+ providersElement = (Element) nl.item(j);
+ break;
+ }
+ }
+ if(providersElement != null) {
+ TreeParent providersRoot = new TreeParent("Providers");
+ providersRoot.setEsbObjectType(TreeObject.ESBType.PROVIDER);
+ processChildren(providersRoot, providersElement);
+ root.addChild(providersRoot);
+ }
+ }
+
+ //get a nodelist of <services> elements
+ NodeList nl2 = docEle.getElementsByTagName("services");
+ if(nl2 != null && nl2.getLength() > 0) {
+ Element servicesElement= null;
+ for (int j = 0; j < nl2.getLength(); j++) {
+ if (nl2.item(j) instanceof Element) {
+ servicesElement = (Element) nl2.item(j);
+ break;
+ }
+ }
+ if(servicesElement != null) {
+ TreeParent servicesRoot = new TreeParent("Services");
+ servicesRoot.setEsbObjectType(TreeObject.ESBType.SERVICE);
+ processChildren(servicesRoot, servicesElement);
+ root.addChild(servicesRoot);
+ }
+ }
+ }
+
+ private void processChildren ( TreeParent parent, Element el ) {
+ el.normalize();
+ parent.setData(el);
+
+ if (parent.getEsbObjectType() == null) {
+ String tag = el.getTagName();
+ if (tag.endsWith("-bus") && el.getAttribute("busid") !=
null) {
+ parent.setEsbObjectType(ESBType.BUS);
+ } else if (tag.endsWith("-listener") &&
el.getAttribute("busidref") != null) {
+ parent.setEsbObjectType(ESBType.LISTENER);
+ } else if (tag.endsWith("-provider")) {
+ parent.setEsbObjectType(ESBType.PROVIDER);
+ } else if (tag.equalsIgnoreCase("service")) {
+ parent.setEsbObjectType(ESBType.SERVICE);
+ } else if (tag.equalsIgnoreCase("listeners")) {
+ parent.setEsbObjectType(ESBType.LISTENER);
+ } else if (tag.equalsIgnoreCase("actions")) {
+ parent.setEsbObjectType(ESBType.ACTION);
+ } else if (tag.equalsIgnoreCase("action")) {
+ parent.setEsbObjectType(ESBType.ACTION);
+ } else if (tag.equalsIgnoreCase("property")) {
+ parent.setEsbObjectType(ESBType.PROPERTY);
+ return;
+ }
+ }
+ NodeList children = el.getChildNodes();
+ for (int i = 0; i < children.getLength(); i++) {
+ if (children.item(i) instanceof Element) {
+ Element child = (Element) children.item(i);
+ String name = child.getAttribute("name");
+ if (name == null || name.trim().length() == 0) {
+ name = child.getAttribute("busid");
+ }
+ if (name == null || name.trim().length() == 0) {
+ name = child.getAttribute("dest-name");
+ }
+ if (name == null || name.trim().length() == 0) {
+ name = child.getTagName();
+ }
+
+ TreeParent childNode = new TreeParent(name);
+ String ref = child.getAttribute("busidref");
+ if (ref != null && ref.trim().length() > 0) {
+ childNode.setRef(ref);
+ }
+ processChildren(childNode, child);
+ if (childNode.getEsbObjectType() != null &&
!childNode.getEsbObjectType().equals(ESBType.PROPERTY)) {
+ parent.addChild(childNode);
+ childNode.setEsbObjectType(parent.getEsbObjectType());
+ }
+ }
+ }
+ }
+
+ public TreeParent getRoot() {
+ return this.root;
+ }
+
+}
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ESBDomParser.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ESBVisualizerView.java
===================================================================
---
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ESBVisualizerView.java
(rev 0)
+++
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ESBVisualizerView.java 2012-01-26
19:46:53 UTC (rev 38217)
@@ -0,0 +1,504 @@
+package org.jboss.tools.esb.visualizer.views;
+
+import java.util.Iterator;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Menu;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.dialogs.ISelectionValidator;
+import org.eclipse.ui.part.ViewPart;
+import org.eclipse.zest.core.viewers.AbstractZoomableViewer;
+import org.eclipse.zest.core.viewers.GraphViewer;
+import org.eclipse.zest.core.viewers.IZoomableWorkbenchPart;
+import org.eclipse.zest.core.viewers.ZoomContributionViewItem;
+import org.eclipse.zest.core.widgets.ConstraintAdapter;
+import org.eclipse.zest.core.widgets.Graph;
+import org.eclipse.zest.core.widgets.GraphConnection;
+import org.eclipse.zest.core.widgets.GraphNode;
+import org.eclipse.zest.core.widgets.ZestStyles;
+import org.eclipse.zest.layouts.LayoutAlgorithm;
+import org.eclipse.zest.layouts.LayoutStyles;
+import org.eclipse.zest.layouts.algorithms.HorizontalTreeLayoutAlgorithm;
+import org.eclipse.zest.layouts.algorithms.RadialLayoutAlgorithm;
+import org.eclipse.zest.layouts.algorithms.TreeLayoutAlgorithm;
+import org.eclipse.zest.layouts.constraints.BasicEntityConstraint;
+import org.eclipse.zest.layouts.constraints.LayoutConstraint;
+import org.jboss.tools.esb.visualizer.Activator;
+import org.jboss.tools.esb.visualizer.views.TreeObject.ESBType;
+
+/**
+ * This class serves as a simple read-only way to visualize an ESB configuration
+ * graphically.
+ *
+ * @author bfitzpat
+ *
+ */
+public class ESBVisualizerView extends ViewPart implements IZoomableWorkbenchPart{
+
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID =
"org.jboss.tools.esb.visualizer.views.ESBVisualizerView";
+
+ private GraphViewer gv;
+ private Action openESBFileAction;
+ private Color defaultBackground;
+
+ // toolbar buttons for different layouts
+ private IAction horizontalLayoutAction;
+ private IAction verticalLayoutAction;
+ private IAction radialLayoutAction;
+
+ // the listener we register with the selection service
+ private ISelectionListener listener = new ISelectionListener() {
+ public void selectionChanged(IWorkbenchPart sourcepart, ISelection selection) {
+ // we ignore our own selections
+ if (sourcepart != ESBVisualizerView.this) {
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+ if (ssel.getFirstElement() instanceof IFile) {
+ IFile selectedFile = (IFile) ssel.getFirstElement();
+ String path = selectedFile.getLocation().toOSString();
+ ESBDomParser parser = new ESBDomParser();
+ if (parser.isFileESBConfig(path)) {
+ visualizeESB(path);
+ }
+ }
+ }
+ }
+ }
+ };
+
+ /**
+ * The constructor.
+ */
+ public ESBVisualizerView() {
+ // empty
+ }
+
+ /**
+ * This is a callback that will allow us
+ * to create the viewer and initialize it.
+ */
+ public void createPartControl(Composite parent) {
+ this.gv = new GraphViewer(parent, SWT.NONE);
+ gv.getGraphControl().addConstraintAdapter(new ESBViewerConstraintAdapter());
+ gv.addDoubleClickListener(new FixNodeDoubleClickListener());
+ makeActions();
+ hookContextMenu();
+ fillToolBar();
+ visualizeESB(null);
+ horizontalLayoutAction.setChecked(true);
+ horizontalLayoutAction.run();
+ getSite().getWorkbenchWindow().getSelectionService().addSelectionListener(listener);
+ }
+
+ /*
+ * Clear all the graph nodes and connections
+ */
+ private void clearGraph() {
+ while (gv.getGraphControl().getNodes().size() > 0) {
+ GraphNode node = (GraphNode) gv.getGraphControl().getNodes().remove(0);
+ node.dispose();
+ }
+ while (gv.getGraphControl().getConnections().size() > 0) {
+ GraphConnection node = (GraphConnection)
gv.getGraphControl().getConnections().remove(0);
+ node.dispose();
+ }
+ }
+
+ /*
+ * Import the esb XML file and render nodes and connections
+ * @param filepath
+ */
+ private void visualizeESB ( String filepath ) {
+ ESBDomParser parser = new ESBDomParser();
+ parser.parseXmlFile(filepath);
+ clearGraph();
+ TreeParent root = parser.getRoot();
+ root.setEsbObjectType(ESBType.ESB);
+ GraphNode rootnode = new GraphNode(gv.getGraphControl(), ZestStyles.NODES_CACHE_LABEL,
root.getName());
+ rootnode.setImage(getImageFromPlugin("/icons/esb/esb_file.gif"));
+ this.defaultBackground = rootnode.getBackgroundColor();
+ rootnode.setData(root);
+ drawNodes(rootnode, root);
+ drawRefs(rootnode);
+ if (horizontalLayoutAction.isChecked()) {
+ horizontalLayoutAction.run();
+ } else if (verticalLayoutAction.isChecked()) {
+ verticalLayoutAction.run();
+ } else if (radialLayoutAction.isChecked()) {
+ radialLayoutAction.run();
+ }
+ }
+
+ /*
+ * Simple image management
+ * @param path
+ * @return
+ */
+ private Image getImageFromPlugin( String path ) {
+ if (Activator.getDefault().getImageRegistry().get(path) == null) {
+ ImageDescriptor descriptor = Activator.getImageDescriptor(path);
+ if (descriptor != null) {
+ Activator.getDefault().getImageRegistry().put(path, descriptor);
+ return Activator.getDefault().getImageRegistry().get(path);
+ }
+ }
+ return Activator.getDefault().getImageRegistry().get(path);
+ }
+
+ /*
+ * Actually draw the nodes and connections from the parsed ESB xml file
+ * @param root
+ * @param parent
+ */
+ private void drawNodes ( GraphNode root, TreeParent parent ) {
+ if (parent.hasChildren()) {
+ for (int i = 0; i < parent.getChildren().length; i++) {
+ TreeParent tp = (TreeParent) parent.getChildren()[i];
+ GraphNode p = new GraphNode(gv.getGraphControl(), SWT.NONE, tp.getName());
+ if (tp.getEsbObjectType() != null) {
+ switch (tp.getEsbObjectType()) {
+ case ACTION:
+ p.setImage(getImageFromPlugin("/icons/esb/action.gif"));
+ break;
+ case SERVICE:
+ p.setImage(getImageFromPlugin("/icons/esb/service.gif"));
+ break;
+ case PROVIDER:
+ p.setImage(getImageFromPlugin("/icons/esb/provider.gif"));
+ break;
+ case BUS:
+ p.setImage(getImageFromPlugin("/icons/esb/bus.gif"));
+ break;
+ case PROPERTY:
+ p.setImage(getImageFromPlugin("/icons/esb/property.gif"));
+ break;
+ case LISTENER:
+ p.setImage(getImageFromPlugin("/icons/esb/listener.gif"));
+ break;
+ case ESB:
+ p.setImage(getImageFromPlugin("/icons/esb/esb_file.gif"));
+ break;
+ default:
+ break;
+ }
+ }
+ p.setData(tp);
+ drawNodes(p, tp);
+ new GraphConnection(gv.getGraphControl(), ZestStyles.CONNECTIONS_DASH, root, p);
+ }
+ }
+ }
+
+ /*
+ * Draw any references between items
+ * @param root
+ */
+ private void drawRefs ( GraphNode root ) {
+ if (gv.getGraphControl().getGraphModel().getNodes() != null &&
gv.getGraphControl().getGraphModel().getNodes().size() > 0) {
+ @SuppressWarnings("unchecked")
+ Iterator<GraphNode> nodeIter =
gv.getGraphControl().getGraphModel().getNodes().iterator();
+ while (nodeIter.hasNext()) {
+ GraphNode node = nodeIter.next();
+ if (node.getData() != null && node.getData() instanceof TreeParent) {
+ TreeParent tp = (TreeParent) node.getData();
+ if (tp.getRef() != null && tp.getRef().trim().length() > 0) {
+ GraphNode refNode = findNode(tp.getRef(), root);
+ if (refNode != null) {
+ GraphConnection refConnection =
+ new GraphConnection(gv.getGraphControl(), ZestStyles.CONNECTIONS_DIRECTED, node,
refNode);
+ refConnection.changeLineColor(gv.getGraphControl().getDisplay().getSystemColor(
+ SWT.COLOR_BLUE));
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * Look for a node by name (for reference connections)
+ * @param name
+ * @param root
+ * @return
+ */
+ private GraphNode findNode ( String name, GraphNode root ) {
+ if (name != null && name.trim().length() > 0) {
+ if (gv.getGraphControl().getGraphModel().getNodes() != null &&
gv.getGraphControl().getGraphModel().getNodes().size() > 0) {
+ @SuppressWarnings("unchecked")
+ Iterator<GraphNode> nodeIter =
gv.getGraphControl().getGraphModel().getNodes().iterator();
+ while (nodeIter.hasNext()) {
+ GraphNode node = nodeIter.next();
+ if (node.getText().equalsIgnoreCase(name)) {
+ return node;
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ public void setFocus() {
+ gv.getGraphControl().setFocus();
+ }
+
+ /*
+ * Fill the view menu
+ */
+ private void hookContextMenu() {
+ MenuManager menuMgr = new MenuManager("#PopupMenu");
+ menuMgr.setRemoveAllWhenShown(true);
+ menuMgr.addMenuListener(new IMenuListener() {
+ public void menuAboutToShow(IMenuManager manager) {
+ ESBVisualizerView.this.fillContextMenu(manager);
+ }
+ });
+ Menu menu = menuMgr.createContextMenu(gv.getGraphControl());
+ gv.getGraphControl().setMenu(menu);
+
+ // if we decide to add a popup menu...
+// getSite().registerContextMenu(menuMgr, );
+ }
+
+ /*
+ * Add any menus
+ * @param manager
+ */
+ private void fillContextMenu(IMenuManager manager) {
+ manager.add(openESBFileAction);
+ }
+
+ /*
+ * Make the few actions we have
+ */
+ private void makeActions() {
+ openESBFileAction = new Action() {
+ public void run() {
+
+ WorkbenchFileSelectionDialog dialog = new WorkbenchFileSelectionDialog(
+ ESBVisualizerView.this.getSite().getShell().getShell(),
+ null,
+ "Select ESB file:",
+ ".xml");
+ dialog.setTitle("Open ESB Configuration");
+ dialog.setImage(getImageFromPlugin("/icons/esb/esb_file.gif"));
+ dialog.setValidator(new ISelectionValidator() {
+
+ @Override
+ public String isValid(Object selection) {
+ if (selection instanceof IPath) {
+ IPath selectedpath = (IPath) selection;
+ IPath totalPath =
ResourcesPlugin.getWorkspace().getRoot().getLocation().append(selectedpath);
+ String path = totalPath.toOSString();
+ ESBDomParser parser = new ESBDomParser();
+ if (parser.isFileESBConfig(path)) {
+ return null;
+ }
+ return "Please select an ESB configuration file.";
+ } else if (selection == null) {
+ return "Please select an ESB configuration file.";
+ }
+ return null;
+ }
+ });
+ int rtn_code = dialog.open();
+
+ if (rtn_code == WorkbenchFileSelectionDialog.OK) {
+ IPath resultPath = dialog.getFullPath();
+ IPath totalPath =
ResourcesPlugin.getWorkspace().getRoot().getLocation().append(resultPath);
+ String path = totalPath.toOSString();
+ visualizeESB(path);
+ }
+ }
+ };
+ openESBFileAction.setText("Open ESB Configuration");
+ openESBFileAction.setToolTipText("Open ESB Configuration");
+ openESBFileAction.setImageDescriptor(Activator.getImageDescriptor("/icons/esb/new_esb_file.gif"));
+
+ }
+
+ /*
+ * Fill the toolbar with a few buttons
+ */
+ private void fillToolBar() {
+ ZoomContributionViewItem toolbarZoomContributionViewItem = new
ZoomContributionViewItem(
+ this);
+ IActionBars bars = getViewSite().getActionBars();
+ bars.getMenuManager().add(openESBFileAction);
+
+ IToolBarManager toolbar = bars.getToolBarManager();
+
+ horizontalLayoutAction = new LayoutAction(gv, new
HorizontalTreeLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING));
+ horizontalLayoutAction.setImageDescriptor(Activator.getImageDescriptor("/icons/horizontalTreeLayout.gif"));
+ horizontalLayoutAction.addPropertyChangeListener(new IPropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equalsIgnoreCase("checked")) {
+ Boolean state = (Boolean)event.getNewValue();
+ if (state.equals(Boolean.TRUE)) {
+ verticalLayoutAction.setChecked(false);
+ radialLayoutAction.setChecked(false);
+ } else {
+ if (!verticalLayoutAction.isChecked() &&
+ !radialLayoutAction.isChecked())
+ horizontalLayoutAction.setChecked(true);
+ }
+ }
+ }
+ });
+ toolbar.add(horizontalLayoutAction);
+
+ verticalLayoutAction = new LayoutAction(gv, new
TreeLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING));
+ verticalLayoutAction.setImageDescriptor(Activator.getImageDescriptor("/icons/verticalTreeLayout.gif"));
+ verticalLayoutAction.addPropertyChangeListener(new IPropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equalsIgnoreCase("checked")) {
+ Boolean state = (Boolean)event.getNewValue();
+ if (state.equals(Boolean.TRUE)) {
+ horizontalLayoutAction.setChecked(false);
+ radialLayoutAction.setChecked(false);
+ } else {
+ if (!horizontalLayoutAction.isChecked() &&
+ !radialLayoutAction.isChecked())
+ verticalLayoutAction.setChecked(true);
+ }
+ }
+ }
+ });
+ toolbar.add(verticalLayoutAction);
+
+ radialLayoutAction = new LayoutAction(gv, new
RadialLayoutAlgorithm(LayoutStyles.NO_LAYOUT_NODE_RESIZING));
+ radialLayoutAction.setImageDescriptor(Activator.getImageDescriptor("/icons/radialLayout.gif"));
+ radialLayoutAction.addPropertyChangeListener(new IPropertyChangeListener() {
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (event.getProperty().equalsIgnoreCase("checked")) {
+ Boolean state = (Boolean)event.getNewValue();
+ if (state.equals(Boolean.TRUE)) {
+ horizontalLayoutAction.setChecked(false);
+ verticalLayoutAction.setChecked(false);
+ } else {
+ if (!horizontalLayoutAction.isChecked() &&
+ !verticalLayoutAction.isChecked())
+ radialLayoutAction.setChecked(true);
+ }
+ }
+ }
+ });
+ toolbar.add(radialLayoutAction);
+
+ toolbar.add(toolbarZoomContributionViewItem);
+ }
+
+ @Override
+ public AbstractZoomableViewer getZoomableViewer() {
+ return gv;
+ }
+
+ /*
+ * @author bfitzpat
+ * Check to see if the node has been "frozen" and if so, don't move it
+ * when we redo the layout
+ */
+ private class ESBViewerConstraintAdapter implements ConstraintAdapter {
+ @Override
+ public void populateConstraint(Object object, LayoutConstraint constraint) {
+ if (constraint instanceof BasicEntityConstraint) {
+
+ BasicEntityConstraint basicEntityConstraint = (BasicEntityConstraint) constraint;
+ GraphNode graphnode = (GraphNode) object;
+
+ Object data = graphnode.getData();
+ if (data != null && data instanceof TreeObject) {
+ boolean wasMoved = ((TreeObject)data).wasMoved();
+ basicEntityConstraint.hasPreferredLocation = wasMoved;
+ }
+ }
+ }
+ }
+
+ /*
+ * @author bfitzpat
+ * If the user double-clicks on a node, "fix" it in place. If they double-
+ * click again, un-"fix" it.
+ */
+ private class FixNodeDoubleClickListener implements IDoubleClickListener {
+ @Override
+ public void doubleClick(DoubleClickEvent e) {
+ if (e.getSource() instanceof GraphViewer) {
+ Graph graph = ((GraphViewer) e.getSource()).getGraphControl();
+ if (!graph.getSelection().isEmpty()) {
+ GraphNode node = (GraphNode) graph.getSelection().get(0);
+ if (node.getData() != null && node.getData() instanceof TreeObject) {
+ TreeObject to = (TreeObject)node.getData();
+ to.setWasMoved(!to.wasMoved());
+ if (to.wasMoved()) {
+ node.setBackgroundColor(gv.getGraphControl().getDisplay().getSystemColor(
+ SWT.COLOR_GREEN));
+ } else {
+ node.setBackgroundColor(defaultBackground);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ /*
+ * @author bfitzpat
+ * Handle layout duties
+ */
+ private class LayoutAction extends Action {
+
+ private LayoutAlgorithm[] layouts;
+ private int currentLayout = 0;
+ private GraphViewer gv;
+
+ public LayoutAction(GraphViewer gv, LayoutAlgorithm layout) {
+ super("Change Layout");
+ this.gv = gv;
+ layouts = new LayoutAlgorithm[1];
+ layouts[0] = layout;
+ }
+
+ @Override
+ public void run() {
+ super.run();
+ int temp = currentLayout + 1;
+ if (temp == layouts.length)
+ temp = 0;
+ currentLayout = temp;
+ gv.setLayoutAlgorithm(layouts[currentLayout], true);
+ }
+
+ }
+
+
+}
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ESBVisualizerView.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/FileSelectionGroup.java
===================================================================
---
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/FileSelectionGroup.java
(rev 0)
+++
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/FileSelectionGroup.java 2012-01-26
19:46:53 UTC (rev 38217)
@@ -0,0 +1,221 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.esb.visualizer.views;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.part.DrillDownComposite;
+
+public class FileSelectionGroup extends Composite {
+
+ // The listener to notify of events
+ private Listener listener;
+
+ private String message;
+
+ // Last selection made by user
+ private IResource selectedResource;
+
+ // handle on parts
+ private TreeViewer treeViewer;
+
+ // Filters
+ private ViewerFileFilter viewerFileFilter;
+ // private ViewerFileFilterMatcher viewerFileFilterMatcher
+ private String filterPatterns;
+ // sizing constants
+ private static final int SIZING_SELECTION_PANE_HEIGHT = 175;
+ private static final int SIZING_SELECTION_PANE_WIDTH = 200;
+ /**
+ * Creates a new instance of the widget.
+ */
+ public FileSelectionGroup(
+ Composite parent,
+ Listener listener,
+ String message) {
+ this(parent, listener, message, null);
+ }
+ public FileSelectionGroup(
+ Composite parent,
+ Listener listener,
+ String message,
+ String filterPatterns) {
+ super(parent, SWT.NONE);
+
+ this.filterPatterns = filterPatterns;
+ this.listener = listener;
+ this.message = message;
+ this.setFont(parent.getFont());
+
+ createViewerFileFilter();
+ createContents();
+ }
+ public void setFileFilter(String filter) {
+ filterPatterns = filter;
+ createViewerFileFilter();
+ treeViewer.setFilters(new ViewerFilter[] {viewerFileFilter});
+ treeViewer.setInput(ResourcesPlugin.getWorkspace());
+ }
+ /**
+ * Creates ViewerFileFilter using array of objects.
+ */
+ public void createViewerFileFilter() {
+ if (filterPatterns != null) {
+ viewerFileFilter = new ViewerFileFilter(filterPatterns);
+ }
+ }
+ /**
+ * Creates the contents of the composite.
+ */
+ public void createContents() {
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ setLayout(layout);
+ setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Label label = new Label(this, SWT.WRAP);
+ label.setText(message != null ? message : ""); //$NON-NLS-1$
+ label.setFont(this.getFont());
+
+ createTreeViewer();
+ }
+ /**
+ * Returns a new drill down viewer for this dialog.
+ */
+ protected void createTreeViewer() {
+
+ // Create drill down.
+ DrillDownComposite drillDown = new DrillDownComposite(this, SWT.BORDER);
+ GridData spec =
+ new GridData(
+ GridData.VERTICAL_ALIGN_FILL
+ | GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.GRAB_HORIZONTAL
+ | GridData.GRAB_VERTICAL);
+ spec.widthHint = SIZING_SELECTION_PANE_WIDTH;
+ spec.heightHint = SIZING_SELECTION_PANE_HEIGHT;
+ drillDown.setLayoutData(spec);
+
+ // Create tree viewer inside drill down.
+ treeViewer = new TreeViewer(drillDown, SWT.NONE);
+ drillDown.setChildTree(treeViewer);
+ treeViewer.setContentProvider(new WorkbenchContentProvider());
+ treeViewer.setLabelProvider(new WorkbenchLabelProvider());
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ resourceSelectionChanged((IResource) selection.getFirstElement());
+ // allow null
+ }
+ });
+ treeViewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ Object item = ((IStructuredSelection) selection).getFirstElement();
+ if (treeViewer.getExpandedState(item))
+ treeViewer.collapseToLevel(item, 1);
+ else
+ treeViewer.expandToLevel(item, 1);
+ }
+ }
+ });
+
+ if (viewerFileFilter != null)
+ treeViewer.addFilter(viewerFileFilter);
+ // This has to be done after the viewer has been laid out
+ treeViewer.setInput(ResourcesPlugin.getWorkspace());
+ }
+ /**
+ * Returns the "full path" (i.e. first segment is project name) of the
currently selected file.
+ */
+ public IPath getResourceFullPath() {
+ if (selectedResource == null) return null;
+ return selectedResource.getFullPath();
+ }
+
+
+ public IResource getSelectedResource () {
+ return selectedResource;
+ }
+
+
+ /**
+ * Returns the tree viewer.
+ */
+ public TreeViewer getTreeViewer() {
+ return treeViewer;
+ }
+ /**
+ * The file selection has changed in the
+ * tree view. Update the file name field
+ * value and notify all listeners.
+ */
+ public void resourceSelectionChanged(IResource resource) {
+ selectedResource = resource;
+
+ // fire an event so the parent can update its controls
+ if (listener != null) {
+ Event changeEvent = new Event();
+ changeEvent.type = SWT.Selection;
+ changeEvent.widget = this;
+ listener.handleEvent(changeEvent);
+ }
+ }
+ /**
+ * Gives focus to one of the widgets in the group, as determined by the group.
+ */
+ public void setInitialFocus() {
+ treeViewer.getTree().setFocus();
+ }
+ /**
+ * Sets the selected existing file.
+ */
+ public void setSelectedResource(IResource resource) {
+ //
https://issues.jboss.org/browse/JBIDE-8738
+ if (resource==null)
+ return;
+ selectedResource = resource;
+
+ //expand to and select the specified file
+ List<IContainer> itemsToExpand = new ArrayList<IContainer>();
+ IContainer parent = resource.getParent();
+ while (parent != null) {
+ itemsToExpand.add(0, parent);
+ parent = parent.getParent();
+ }
+ treeViewer.setExpandedElements(itemsToExpand.toArray());
+ treeViewer.setSelection(new StructuredSelection(resource), true);
+ }
+}
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/FileSelectionGroup.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/TreeObject.java
===================================================================
---
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/TreeObject.java
(rev 0)
+++
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/TreeObject.java 2012-01-26
19:46:53 UTC (rev 38217)
@@ -0,0 +1,64 @@
+package org.jboss.tools.esb.visualizer.views;
+
+import org.eclipse.core.runtime.IAdaptable;
+
+public class TreeObject implements IAdaptable {
+ private String name;
+ private TreeParent parent;
+ private String ref;
+ private boolean wasMovedFlag = false;
+ private ESBType esbObjectType;
+ private Object data;
+
+ public enum ESBType {
+ ACTION, BUS, LISTENER, PROVIDER,
+ ESB, PROPERTY, SERVICE
+ }
+
+ public TreeObject(String name) {
+ this.name = name;
+ }
+ public String getName() {
+ return name;
+ }
+ public void setName(String newName) {
+ this.name = newName;
+ }
+ public void setParent(TreeParent parent) {
+ this.parent = parent;
+ }
+ public TreeParent getParent() {
+ return parent;
+ }
+ public String toString() {
+ return getName();
+ }
+ @SuppressWarnings("rawtypes")
+ public Object getAdapter(Class key) {
+ return null;
+ }
+ public String getRef() {
+ return ref;
+ }
+ public void setRef(String ref) {
+ this.ref = ref;
+ }
+ protected boolean wasMoved() {
+ return wasMovedFlag;
+ }
+ protected void setWasMoved(boolean wasMoved) {
+ this.wasMovedFlag = wasMoved;
+ }
+ protected ESBType getEsbObjectType() {
+ return esbObjectType;
+ }
+ protected void setEsbObjectType(ESBType esbObjectType) {
+ this.esbObjectType = esbObjectType;
+ }
+ protected Object getData() {
+ return data;
+ }
+ protected void setData(Object data) {
+ this.data = data;
+ }
+}
\ No newline at end of file
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/TreeObject.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/TreeParent.java
===================================================================
---
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/TreeParent.java
(rev 0)
+++
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/TreeParent.java 2012-01-26
19:46:53 UTC (rev 38217)
@@ -0,0 +1,26 @@
+package org.jboss.tools.esb.visualizer.views;
+
+import java.util.ArrayList;
+
+public class TreeParent extends TreeObject {
+
+ private ArrayList<TreeObject> children;
+ public TreeParent(String name) {
+ super(name);
+ children = new ArrayList<TreeObject>();
+ }
+ public void addChild(TreeObject child) {
+ children.add(child);
+ child.setParent(this);
+ }
+ public void removeChild(TreeObject child) {
+ children.remove(child);
+ child.setParent(null);
+ }
+ public TreeObject [] getChildren() {
+ return (TreeObject [])children.toArray(new TreeObject[children.size()]);
+ }
+ public boolean hasChildren() {
+ return children.size()>0;
+ }
+}
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/TreeParent.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ViewerFileFilter.java
===================================================================
---
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ViewerFileFilter.java
(rev 0)
+++
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ViewerFileFilter.java 2012-01-26
19:46:53 UTC (rev 38217)
@@ -0,0 +1,81 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.esb.visualizer.views;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+
+public class ViewerFileFilter extends ViewerFilter {
+
+ private String[] patterns;
+
+ static String COMMA_SEPARATOR = ","; //$NON-NLS-1$
+
+ public ViewerFileFilter() {
+ this(null);
+ }
+ /**
+ * Creates a new resource pattern filter.
+ */
+ public ViewerFileFilter(String patterns) {
+ super();
+
+ if (patterns != null) {
+ //Get the strings separated by a comma and filter them from the currently
+ //defined ones
+ StringTokenizer entries = new StringTokenizer(patterns, COMMA_SEPARATOR);
+ List<String> localPatterns = new ArrayList<String>();
+
+ while (entries.hasMoreElements()) {
+ String nextToken = entries.nextToken();
+ if (patterns.indexOf(nextToken) > -1)
+ localPatterns.add(nextToken);
+ }
+
+ //Convert to an array of Strings
+ String[] patternArray = new String[localPatterns.size()];
+ localPatterns.toArray(patternArray);
+ setPatterns(patternArray);
+ }
+ }
+ /**
+ * Return the currently configured StringMatchers. If there aren't any look
+ * them up.
+ */
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ IResource resource = null;
+ if (element instanceof IFile) {
+ resource = (IFile) element;
+ }
+ else
+ return true;
+ String name = resource.getName();
+ for (int i = 0; i < patterns.length; i++) {
+ if (name.endsWith(patterns[i]))
+ return true;
+ }
+ return false;
+ }
+ /**
+ * Sets the patterns to filter out for the receiver.
+ */
+ public void setPatterns(String[] newPatterns) {
+
+ this.patterns = newPatterns;
+ }
+}
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/ViewerFileFilter.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/WorkbenchFileSelectionDialog.java
===================================================================
---
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/WorkbenchFileSelectionDialog.java
(rev 0)
+++
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/WorkbenchFileSelectionDialog.java 2012-01-26
19:46:53 UTC (rev 38217)
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.jboss.tools.esb.visualizer.views;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+
+
+public class WorkbenchFileSelectionDialog
+ extends org.eclipse.ui.dialogs.SelectionDialog {
+
+ // the initial selection
+ private IResource initialSelection;
+
+ // message and title
+ private String title;
+ private String message;
+
+ // image
+ private Image image;
+
+ // Filters
+ private String filterPatterns;
+ // the result
+ private IPath resultPath;
+
+ // the validation message
+ private Label statusMessage;
+
+ //for validating the selection
+ private org.eclipse.ui.dialogs.ISelectionValidator validator;
+
+ // the widget group;
+ private FileSelectionGroup resourceGroup;
+ /**
+ * A WorkbenchFileSelectionDialog takes the following arguments:
+ * <ul>
+ * <li> parentShell, the parent shell of the caller.(required)</li>
+ * <li> initialSelection, (resuired)</li>
+ * = null, takes the initial selection of the file from store, where it was
memorizaed
+ * != null, starts the selection right from the specified path.
+ * <li> message, shows the message on titel bar for this
dialog.(required)</li>
+ * <li> filterPatterns, a string of extentions separated with "," as
deliminator (eg; "wsdl, xsd, java")(optional)
+ */
+ public WorkbenchFileSelectionDialog(
+ Shell parentShell,
+ IPath initialSelection,
+ String message) {
+ this(parentShell, initialSelection, message, null);
+ }
+ /**
+ * A WorkbenchFileSelectionDialog takes the following arguments:
+ * <ul>
+ * <li> parentShell, the parent shell of the caller.(required)</li>
+ * <li> initialSelection, (resuired)</li>
+ * = null, takes the initial selection of the file from store, where it was
memorizaed
+ * != null, starts the selection right from the specified path.
+ * <li> message, shows the message on titel bar for this
dialog.(required)</li>
+ * <li> filterPatterns, a string of extentions separated with "," as
deliminator (eg; "wsdl, xsd, java")(optional)
+ */
+ public WorkbenchFileSelectionDialog(
+ Shell parentShell,
+ IPath initialSelection,
+ String message,
+ String filterPatterns) {
+ super(parentShell);
+
+ IPath initial = initialSelection;
+ if (initial == null) {
+ // Before launch the dialog, get the path in WorkbenchSlectionDialogStore, which is
the path recently selected
+ //String pathString =
(String)WorkbenchSlectionDialogStore.getInstance().getPreferences(workbenchFileSlectionStoreID);
+ //if (pathString.length()>0) {
+ // initial=(IPath)new Path(pathString);
+ //}
+ }
+ try {
+ if (initial != null) {
+ this.initialSelection =
+ ResourcesPlugin.getWorkspace().getRoot().getFile(initial);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ this.title = "Some fun title";
+ this.message = message;
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ this.filterPatterns = filterPatterns;
+ }
+
+ /* (non-Javadoc)
+ * Method declared in Window.
+ */
+ @Override
+ protected void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(title);
+ if (image != null)
+ shell.setImage(image);
+ }
+ /* (non-Javadoc)
+ * Method declared on Dialog.
+ */
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);
+ createButton(
+ parent,
+ IDialogConstants.CANCEL_ID,
+ IDialogConstants.CANCEL_LABEL,
+ false);
+ }
+ /* (non-Javadoc)
+ * Method declared on Dialog.
+ */
+ @Override
+ protected Control createDialogArea(Composite parent) {
+
+ // create composite
+ Composite dialogArea = (Composite) super.createDialogArea(parent);
+
+ Listener listener = new Listener() {
+ public void handleEvent(Event event) {
+ if (statusMessage != null && validator != null) {
+ String errorMsg =
+ validator.isValid(resourceGroup.getResourceFullPath());
+ if (errorMsg == null || errorMsg.equals("")) { //$NON-NLS-1$
+ statusMessage.setText(""); //$NON-NLS-1$
+ getOkButton().setEnabled(true);
+ } else {
+ statusMessage.setForeground(
+ statusMessage.getDisplay().getSystemColor(SWT.COLOR_RED));
+ statusMessage.setText(errorMsg);
+ getOkButton().setEnabled(false);
+ }
+ }
+ }
+ };
+
+ // file selection group
+ resourceGroup =
+ new FileSelectionGroup(dialogArea, listener, message, filterPatterns);
+ resourceGroup.getTreeViewer().addDoubleClickListener(new IDoubleClickListener() {
+
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ if (!selection.isEmpty()) {
+ if (((IStructuredSelection) selection).getFirstElement() instanceof IFile) {
+ IFile resultFile = (IFile) ((IStructuredSelection) selection).getFirstElement();
+ resultPath = resultFile.getFullPath();
+ okPressed();
+ }
+ }
+ }
+ }
+ });
+
+ if (initialSelection != null) {
+ resourceGroup.setSelectedResource(initialSelection);
+ }
+
+ statusMessage = new Label(parent, SWT.NONE);
+ statusMessage.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ return dialogArea;
+ }
+
+ /**
+ * Returns the "full path" (i.e. first segment is project name) of the
selected file.
+ */
+ public IPath getFullPath() {
+ return resultPath;
+ }
+ /**
+ * Closes this dialog.
+ */
+ @Override
+ protected void okPressed() {
+ resultPath = resourceGroup.getResourceFullPath();
+ // after file selected, save the path to WorkbenchSlectionDialogStore
+ //WorkbenchSlectionDialogStore.getInstance().setPreferences(workbenchFileSlectionStoreID,result.toString());
+
+ super.okPressed();
+ }
+ /**
+ * Sets the validator to use.
+ */
+ public void setValidator(org.eclipse.ui.dialogs.ISelectionValidator validator) {
+ this.validator = validator;
+ }
+ @Override
+ public void setTitle(String title) {
+ super.setTitle(title);
+ this.title = title;
+ }
+ public void setImage(Image image) {
+ this.image = image;
+ }
+}
Property changes on:
workspace/bfitzpat/org.jboss.tools.esb.visualizer/src/org/jboss/tools/esb/visualizer/views/WorkbenchFileSelectionDialog.java
___________________________________________________________________
Added: svn:mime-type
+ text/plain