[jboss-svn-commits] JBL Code SVN: r10641 - in labs/jbossrules/trunk/drools-eclipse: drools-eclipse-feature and 64 other directories.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Fri Mar 30 09:50:46 EDT 2007
Author: mark.proctor at jboss.com
Date: 2007-03-30 09:50:45 -0400 (Fri, 30 Mar 2007)
New Revision: 10641
Added:
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DRLInfo.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DroolsIDEPlugin.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DroolsPerspective.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DroolsPluginImages.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/IDroolsConstants.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/action/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/DroolsElement.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/DroolsModelBuilder.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Expander.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Function.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Global.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Import.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Package.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Query.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Rule.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/RuleAttribute.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/RuleSet.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Template.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AgendaLogicalStructureDelegate.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AgendaView.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AgendaViewContentProvider.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/ApplicationDataView.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/ApplicationDataViewContentProvider.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AuditView.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AuditViewContentProvider.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/DebugUtil.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/DroolsDebugEventHandlerView.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/DroolsDebugViewContentProvider.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/ObjectWrapper.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/VariableWrapper.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/WorkingMemoryView.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/WorkingMemoryViewContentProvider.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/AbstractRuleEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/BRLSourceViewerConfig.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/ColorManager.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLAnnotationModel.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLDocumentProvider.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLProblemAnnotation.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLReconcilingStrategy.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLRuleEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLRuleEditor2.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLRuleEditorActionContributor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLSourceViewerConfig.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DSLAdapter.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DroolsLineBreakpointAdapter.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DroolsPairMatcher.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/Keywords.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/RuleEditorPlugin.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/ZoomInAction2.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/ZoomOutAction2.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/java_keywords.properties
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/keywords.properties
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/outline/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/ReteViewer.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/ReteooLayoutFactory.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/Row.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/RowList.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/commands/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/figure/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/part/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/datatype/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/datatype/DefaultDataTypeRegistry.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/datatype/IDataTypeRegistry.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/datatype/impl/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/GenericActionBarContributor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/GenericContextMenuProvider.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/GenericModelEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/ObjectInputStreamWithLoader.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/OverviewOutlinePage.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/DefaultElementWrapper.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ElementConnection.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ElementConnectionFactory.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ElementWrapper.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ModelEvent.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ModelListener.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ProcessWrapper.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ElementCellEditorLocator.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ElementConnectionEditPart.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ElementEditPart.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ProcessEditPart.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/figure/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/IDataTypeEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/IEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/property/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFilePage.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFileWizard.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/SampleRuleFlow.rf.template
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowModelEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowPaletteFactory.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/action/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/constraint/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/variable/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/menu/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/preferences/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/util/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/view/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/view/rules/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/decisiontable/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/dsl/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/project/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/rule/
Removed:
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DRLInfo.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsIDEPlugin.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsPerspective.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsPluginImages.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/IDroolsConstants.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/action/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/builder/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/dsl/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/datatype/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericActionBarContributor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericContextMenuProvider.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericModelEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/ObjectInputStreamWithLoader.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/OverviewOutlinePage.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/editpart/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/policy/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/datatype/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/property/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/launching/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/menu/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/preferences/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/util/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/view/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/decisiontable/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/dsl/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/project/
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/rule/
Modified:
labs/jbossrules/trunk/drools-eclipse/allElements.xml
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-feature/feature.xml
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/.project
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/META-INF/MANIFEST.MF
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/export.xml
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/plugin.xml
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/action/ConvertToDroolsProjectAction.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/DroolsBuildMarker.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/DroolsBuilder.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/IDroolsModelMarker.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/Util.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/DroolsContentProvider.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/DroolsFilter.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/DroolsLabelProvider.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/DroolsTreeSorter.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/FilterAction.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/FilterActionGroup.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/DeleteLogAction.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/OpenLogAction.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/RefreshLogAction.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/ShowEventCauseAction.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/ShowLogicalStructureAction.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugModel.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugModelPresentation.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugTarget.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsLineBreakpoint.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsLineBreakpointMarkerUpdater.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsLocalVariable.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsStackFrame.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsThisVariable.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/IDroolsDebugConstants.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/DSLContentProvider.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/DSLEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/DSLLabelProvider.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/DSLMappingSorter.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/IMappingListViewer.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/MappingEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/NLGrammarModel.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/AbstractCompletionProcessor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/CompletionUtil.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/DSLTree.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/DefaultCompletionProcessor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/LocationDeterminator.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/Node.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/RuleCompletionProcessor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/RuleCompletionProposal.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/outline/RuleContentOutlinePage.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/commands/NodeSetConstraintCommand.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/figure/ConnectionFigure.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/figure/VertexFigure.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/Connection.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/GraphicalVertex.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/ModelElement.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/ReteGraph.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/VertexPropertySource.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/part/ConnectionEditPart.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/part/DiagramEditPart.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/part/VertexEditPart.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/part/VertexEditPartFactory.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/DRLPartionScanner.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/DRLScanner.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/RuleEditorMessages.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/RuleWordDetector.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/WhitespaceDetector.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/datatype/impl/DataTypeRegistry.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/AddElementCommand.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/ChangeConstraintCommand.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/CreateBendpointCommand.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/DeleteBendpointCommand.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/DeleteConnectionCommand.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/DeleteElementCommand.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/ElementConnectionCreateCommand.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/MoveBendpointCommand.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/ReconnectElementConnectionSourceCommand.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/ReconnectElementConnectionTargetCommand.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/RenameElementCommand.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/SplitConnectionCommand.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/figure/ElementFigure.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ConnectionBendpointEditPolicy.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ConnectionEditPolicy.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ElementDirectEditManager.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ElementDirectEditPolicy.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ElementEditPolicy.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ElementNodeEditPolicy.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ProcessLayoutEditPolicy.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/BooleanEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/DataTypeCombo.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/DataTypeEditorComposite.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/EditorComposite.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/EmptyEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/FloatEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/IntegerEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/StringEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/property/BeanDialogCellEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/property/EditBeanDialog.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/property/EditListDialog.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/property/ListPropertyDescriptor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/ConnectionWrapper.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/ConnectionWrapperFactory.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/EndNodeWrapper.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/JoinWrapper.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/NodeWrapper.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/RuleFlowProcessWrapper.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/RuleSetNodeWrapper.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/SplitWrapper.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/StartNodeWrapper.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/action/CheckRuleFlowAction.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/EndNodeEditPart.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/JoinEditPart.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleFlowConnectionEditPart.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleFlowEditPartFactory.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleSetNodeEditPart.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/SplitEditPart.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/StartNodeEditPart.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/constraint/ConstraintListCellEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/constraint/ConstraintListDialog.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/constraint/ConstraintsPropertyDescriptor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/constraint/RuleFlowConstraintDialog.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/variable/VariableDialog.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/variable/VariableListCellEditor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/variable/VariableListDialog.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsApplicationLaunchShortcut.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsLaunchConfigurationDelegate.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsSourceLookupDirector.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsSourceLookupParticipant.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsSourcePathComputerDelegate.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsVMDebugger.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/menu/RuleHelperActionDelegate.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/preferences/DroolsPreferencePage.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/preferences/IDroolsConstants.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/util/DroolsClasspathContainer.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/util/DroolsClasspathContainerInitializer.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/util/ProjectClassLoader.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/view/rules/RulesView.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/decisiontable/NewDTFilePage.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/decisiontable/NewDTFileWizard.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/dsl/NewDSLFilePage.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/dsl/NewDSLFileWizard.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/project/NewDroolsProjectWizard.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/project/NewDroolsProjectWizardPage.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/rule/DRLGenerator.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/rule/NewRulePackagePage.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/rule/NewRulePackageWizard.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/AccumulateNodeVertex.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/AlphaNodeVertex.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/BaseVertex.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/CollectNodeVertex.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/EvalConditionNodeVertex.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ExistsNodeVertex.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/FromNodeVertex.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/JoinNodeVertex.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/LeftInputAdapterNodeVertex.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/NotNodeVertex.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ObjectTypeNodeVertex.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/QueryTerminalNodeVertex.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ReteVertex.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ReteooVisitor.java
labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/RuleTerminalNodeVertex.java
Log:
JBRULES-761 Automate the Eclipse build
-big refactor from org.drools.ide to org.drools.eclipse
Modified: labs/jbossrules/trunk/drools-eclipse/allElements.xml
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/allElements.xml 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/allElements.xml 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,5 +1,5 @@
<project name="allElements Delegator">
-
+
<!-- ===================================================================== -->
<!-- Run a given ${target} on all elements being built -->
<!-- Replace element.id with the id of the top level element being built. -->
@@ -11,10 +11,10 @@
<target name="allElementsDelegator">
<ant antfile="${genericTargets}" target="${target}">
<property name="type" value="feature" />
- <property name="id" value="org.drools.ide.feature" />
+ <property name="id" value="org.drools.eclipse.feature" />
</ant>
</target>
-
+
<!-- ===================================================================== -->
<!-- Targets to assemble the built elements for particular configurations -->
<!-- These generally call the generated assemble scripts (named in -->
@@ -22,7 +22,7 @@
<!-- Add one target for each root element and each configuration -->
<!-- Replace element.id with the id of the top level element being built -->
<!-- ===================================================================== -->
- <target name="assemble.org.drools.ide.feature">
+ <target name="assemble.org.drools.eclipse.feature">
<property name="archiveName" value="${zipFile}"/>
<ant antfile="${assembleScriptName}" dir="${buildDirectory}"/>
</target>
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-feature/feature.xml
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-feature/feature.xml 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-feature/feature.xml 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature
- id="org.drools.ide.feature"
+ id="org.drools.eclipse.feature"
label="JBossRules Feature"
version="3.1.0.1"
provider-name="JBoss, Inc.">
@@ -18,7 +18,7 @@
</license>
<plugin
- id="org.drools.ide"
+ id="org.drools.eclipse"
download-size="0"
install-size="0"
version="3.1.0.1"/>
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/.project
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/.project 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/.project 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,5 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
- <name>drools-ide</name>
+ <name>drools-eclipse</name>
<comment></comment>
<projects>
</projects>
@@ -24,4 +25,4 @@
<nature>org.eclipse.pde.PluginNature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
-</projectDescription>
\ No newline at end of file
+</projectDescription>
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/META-INF/MANIFEST.MF
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/META-INF/MANIFEST.MF 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/META-INF/MANIFEST.MF 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,9 +1,9 @@
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: JBoss Rules IDE Plug-in
-Bundle-SymbolicName: org.drools.ide;singleton:=true
+Bundle-SymbolicName: org.drools.eclipse;singleton:=true
Bundle-Version: 3.1.0.1
-Bundle-Activator: org.drools.ide.DroolsIDEPlugin
+Bundle-Activator: org.drools.eclipse.DroolsIDEPlugin
Bundle-Vendor: krisv,mic
Bundle-Localization: plugin
Require-Bundle: org.eclipse.core.runtime,
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/export.xml
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/export.xml 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/export.xml 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project default="plugin_export" name="build">
<target name="plugin_export">
- <pde.exportPlugins destination="." exportSource="false" exportType="directory" plugins="org.drools.ide" useJARFormat="true"/>
+ <pde.exportPlugins destination="." exportSource="false" exportType="directory" plugins="org.drools.eclipse" useJARFormat="true"/>
</target>
</project>
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/plugin.xml
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/plugin.xml 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/plugin.xml 2007-03-30 13:50:45 UTC (rev 10641)
@@ -4,50 +4,50 @@
<extension point="org.eclipse.ui.views">
<category
name="JBoss Rules"
- id="org.drools.ide.views">
+ id="org.drools.eclipse.views">
</category>
<view
name="Working Memory View"
icon="icons/drools.gif"
- category="org.drools.ide.views"
- class="org.drools.ide.debug.WorkingMemoryView"
- id="org.drools.ide.debug.WorkingMemoryView">
+ category="org.drools.eclipse.views"
+ class="org.drools.eclipse.debug.WorkingMemoryView"
+ id="org.drools.eclipse.debug.WorkingMemoryView">
</view>
<view
name="Agenda View"
icon="icons/drools.gif"
- category="org.drools.ide.views"
- class="org.drools.ide.debug.AgendaView"
- id="org.drools.ide.debug.AgendaView">
+ category="org.drools.eclipse.views"
+ class="org.drools.eclipse.debug.AgendaView"
+ id="org.drools.eclipse.debug.AgendaView">
</view>
<view
name="Global Data View"
icon="icons/drools.gif"
- category="org.drools.ide.views"
- class="org.drools.ide.debug.ApplicationDataView"
- id="org.drools.ide.debug.ApplicationDataView">
+ category="org.drools.eclipse.views"
+ class="org.drools.eclipse.debug.ApplicationDataView"
+ id="org.drools.eclipse.debug.ApplicationDataView">
</view>
<view
name="Audit View"
icon="icons/drools.gif"
- category="org.drools.ide.views"
- class="org.drools.ide.debug.AuditView"
- id="org.drools.ide.debug.AuditView">
+ category="org.drools.eclipse.views"
+ class="org.drools.eclipse.debug.AuditView"
+ id="org.drools.eclipse.debug.AuditView">
</view>
<view
name="Rules View"
icon="icons/drools.gif"
- category="org.drools.ide.views"
- class="org.drools.ide.view.rules.RulesView"
- id="org.drools.ide.view.rules.RulesView">
+ category="org.drools.eclipse.views"
+ class="org.drools.eclipse.view.rules.RulesView"
+ id="org.drools.eclipse.view.rules.RulesView">
</view>
</extension>
<extension
point="org.eclipse.debug.core.logicalStructureTypes">
<logicalStructureType
- id="org.drools.ide.debug.AgendaLogicalStructures"
- class="org.drools.ide.debug.AgendaLogicalStructureDelegate"
+ id="org.drools.eclipse.debug.AgendaLogicalStructures"
+ class="org.drools.eclipse.debug.AgendaLogicalStructureDelegate"
modelIdentifier="org.eclipse.jdt.debug"
description="Agenda Item">
</logicalStructureType>
@@ -55,77 +55,77 @@
<extension
point="org.eclipse.ui.editors">
<editor
- class="org.drools.ide.editors.DRLRuleEditor2"
- contributorClass="org.drools.ide.editors.DRLRuleEditorActionContributor"
+ class="org.drools.eclipse.editors.DRLRuleEditor2"
+ contributorClass="org.drools.eclipse.editors.DRLRuleEditorActionContributor"
extensions="drl,jbrule,drools,rule"
icon="icons/drools.gif"
- id="org.drools.ide.editors.DRLRuleEditor"
+ id="org.drools.eclipse.editors.DRLRuleEditor"
name="Rule Editor"/>
<!--
<editor
- class="org.drools.ide.editors.dsl.DSLRuleEditor2"
- contributorClass="org.drools.ide.editors.DRLRuleEditorActionContributor"
+ class="org.drools.eclipse.editors.dsl.DSLRuleEditor2"
+ contributorClass="org.drools.eclipse.editors.DRLRuleEditorActionContributor"
extensions="dslr,dslrule"
icon="icons/drools.gif"
- id="org.drools.ide.editors.dsl.DSLRuleEditor"
+ id="org.drools.eclipse.editors.dsl.DSLRuleEditor"
name="DSL Rule Editor"/> -->
<editor
- class="org.drools.ide.dsl.editor.DSLEditor"
+ class="org.drools.eclipse.dsl.editor.DSLEditor"
contributorClass="org.eclipse.ui.editors.text.TextEditorActionContributor"
default="false"
extensions="dsl,lang"
icon="icons/dsl.GIF"
- id="org.drools.ide.editor.DomainSpecLangEditor"
+ id="org.drools.eclipse.editor.DomainSpecLangEditor"
name="DSL Editor"/>
</extension>
<extension
point="org.eclipse.ui.newWizards">
<wizard
- category="org.drools.ide.new"
- class="org.drools.ide.wizard.rule.NewRulePackageWizard"
+ category="org.drools.eclipse.new"
+ class="org.drools.eclipse.wizard.rule.NewRulePackageWizard"
descriptionImage="icons/drools-large.PNG"
icon="icons/drools.gif"
- id="org.drools.ide.new.file"
+ id="org.drools.eclipse.new.file"
name="New Rule Resource"/>
<wizard
- category="org.drools.ide.new"
- class="org.drools.ide.wizard.dsl.NewDSLFileWizard"
+ category="org.drools.eclipse.new"
+ class="org.drools.eclipse.wizard.dsl.NewDSLFileWizard"
descriptionImage="icons/dsl-large.png"
icon="icons/dsl.GIF"
- id="org.drools.ide.new.dsl"
+ id="org.drools.eclipse.new.dsl"
name="New Domain Specific Language"/>
<wizard
- id = "org.drools.ide.wizards.new.project"
+ id = "org.drools.eclipse.wizards.new.project"
name = "New Rule Project"
- class= "org.drools.ide.wizard.project.NewDroolsProjectWizard"
- category= "org.drools.ide.new"
+ class= "org.drools.eclipse.wizard.project.NewDroolsProjectWizard"
+ category= "org.drools.eclipse.new"
project= "true"
icon= "icons/drools.gif">
<description>This wizard creates a new Rule project.</description>
</wizard>
<category
- id="org.drools.ide.new"
+ id="org.drools.eclipse.new"
name="JBoss Rules"/>
<wizard
- category="org.drools.ide.new"
- class="org.drools.ide.wizard.decisiontable.NewDTFileWizard"
+ category="org.drools.eclipse.new"
+ class="org.drools.eclipse.wizard.decisiontable.NewDTFileWizard"
descriptionImage="icons/dt_large.gif"
icon="icons/dt_small.gif"
- id="org.drools.ide.new.decisiontable"
+ id="org.drools.eclipse.new.decisiontable"
name="New Decision Table"/>
</extension>
<extension
- id="org.drools.ide.actionSet"
+ id="org.drools.eclipse.actionSet"
name="JBoss Rules"
point="org.eclipse.ui.actionSets">
<actionSet
- id="org.drools.ide.workbenchMenu"
+ id="org.drools.eclipse.workbenchMenu"
label="JBoss Rules"
visible="true">
<action
- class="org.drools.ide.menu.RuleHelperActionDelegate"
+ class="org.drools.eclipse.menu.RuleHelperActionDelegate"
icon="icons/drools.gif"
- id="org.drools.ide.openRulesWorkbench"
+ id="org.drools.eclipse.openRulesWorkbench"
label="JBoss Rules wizards"
style="pulldown"
toolbarPath="Normal/additions"
@@ -136,7 +136,7 @@
<extension
id="droolsbuilder" name="JBoss Rules Builder" point="org.eclipse.core.resources.builders">
<builder>
- <run class="org.drools.ide.builder.DroolsBuilder"/>
+ <run class="org.drools.eclipse.builder.DroolsBuilder"/>
</builder>
</extension>
@@ -160,17 +160,17 @@
<extension point="org.eclipse.debug.core.breakpoints">
<breakpoint
id="droolsBreakpoint"
- markerType="org.drools.ide.droolsBreakpointMarker"
- class="org.drools.ide.debug.core.DroolsLineBreakpoint">
+ markerType="org.drools.eclipse.droolsBreakpointMarker"
+ class="org.drools.eclipse.debug.core.DroolsLineBreakpoint">
</breakpoint>
</extension>
<extension point="org.eclipse.jdt.core.classpathContainerInitializer">
- <classpathContainerInitializer class="org.drools.ide.util.DroolsClasspathContainerInitializer" id="DROOLS" />
+ <classpathContainerInitializer class="org.drools.eclipse.util.DroolsClasspathContainerInitializer" id="DROOLS" />
</extension>
<extension point="org.eclipse.ui.editors.annotationTypes">
- <type super="org.eclipse.ui.workbench.texteditor.error" markerSeverity="2" markerType="org.eclipse.core.resources.problemmarker" name="org.drools.ide.editors.error_annotation"/>
+ <type super="org.eclipse.ui.workbench.texteditor.error" markerSeverity="2" markerType="org.eclipse.core.resources.problemmarker" name="org.drools.eclipse.editors.error_annotation"/>
</extension>
<extension point="org.eclipse.help.toc">
@@ -178,8 +178,8 @@
</extension>
<extension point = "org.eclipse.ui.preferencePages">
- <page id="org.drools.ide.preferences.DroolsPreferencePage"
- class="org.drools.ide.preferences.DroolsPreferencePage"
+ <page id="org.drools.eclipse.preferences.DroolsPreferencePage"
+ class="org.drools.eclipse.preferences.DroolsPreferencePage"
name="JBoss Rules Preferences">
</page>
</extension>
@@ -189,8 +189,8 @@
<perspective
name="JBoss Rules"
icon="icons/drools.gif"
- class="org.drools.ide.DroolsPerspective"
- id="org.drools.ide.DroolsPerspective">
+ class="org.drools.eclipse.DroolsPerspective"
+ id="org.drools.eclipse.DroolsPerspective">
</perspective>
</extension>
@@ -198,10 +198,10 @@
<extension point = "org.eclipse.debug.core.launchConfigurationTypes">
<launchConfigurationType
- id="org.drools.ide.launching.DroolsLaunchConfigurationDelegate"
+ id="org.drools.eclipse.launching.DroolsLaunchConfigurationDelegate"
name="JBoss Rules Application"
- delegate="org.drools.ide.launching.DroolsLaunchConfigurationDelegate"
- sourceLocatorId="org.drools.ide.launching.DroolsSourceLookupDirector"
+ delegate="org.drools.eclipse.launching.DroolsLaunchConfigurationDelegate"
+ sourceLocatorId="org.drools.eclipse.launching.DroolsSourceLookupDirector"
sourcePathComputerId="org.eclipse.jdt.launching.sourceLookup.javaSourcePathComputer"
modes= "debug" />
</extension>
@@ -209,15 +209,15 @@
<extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
<launchConfigurationTypeImage
icon="icons/drools.gif"
- configTypeID="org.drools.ide.launching.DroolsLaunchConfigurationDelegate"
- id="org.drools.ide.launching.DroolsLaunchConfigurationDelegate.Image">
+ configTypeID="org.drools.eclipse.launching.DroolsLaunchConfigurationDelegate"
+ id="org.drools.eclipse.launching.DroolsLaunchConfigurationDelegate.Image">
</launchConfigurationTypeImage>
</extension>
<extension
point="org.eclipse.debug.ui.launchConfigurationTabGroups">
<launchConfigurationTabGroup
- type="org.drools.ide.launching.DroolsLaunchConfigurationDelegate"
+ type="org.drools.eclipse.launching.DroolsLaunchConfigurationDelegate"
class="org.eclipse.jdt.internal.debug.ui.launcher.LocalJavaApplicationTabGroup"
id="org.eclipse.jdt.debug.ui.launchConfigurationTabGroup.localJavaApplication">
<launchMode
@@ -236,32 +236,32 @@
point="org.eclipse.debug.core.sourceLocators">
<sourceLocator
name="JBoss Rules Source Lookup Director"
- class="org.drools.ide.launching.DroolsSourceLookupDirector"
- id="org.drools.ide.launching.DroolsSourceLookupDirector">
+ class="org.drools.eclipse.launching.DroolsSourceLookupDirector"
+ id="org.drools.eclipse.launching.DroolsSourceLookupDirector">
</sourceLocator>
</extension>
<extension point="org.eclipse.ui.editors.markerUpdaters">
<updater
- markerType="org.drools.ide.droolsBreakpointMarker"
- class="org.drools.ide.debug.core.DroolsLineBreakpointMarkerUpdater"
- id="org.drools.ide.debug.core.DroolsLineBreakpointMarkerUpdater" />
+ markerType="org.drools.eclipse.droolsBreakpointMarker"
+ class="org.drools.eclipse.debug.core.DroolsLineBreakpointMarkerUpdater"
+ id="org.drools.eclipse.debug.core.DroolsLineBreakpointMarkerUpdater" />
</extension>
<!-- not used anymore
<extension
point="org.eclipse.debug.core.sourcePathComputers">
<sourcePathComputer
- class="org.drools.ide.launching.DroolsSourcePathComputerDelegate"
- id="org.drools.ide.launching.DroolsSourcePathComputerDelegate">
+ class="org.drools.eclipse.launching.DroolsSourcePathComputerDelegate"
+ id="org.drools.eclipse.launching.DroolsSourcePathComputerDelegate">
</sourcePathComputer>
</extension> -->
<extension
point="org.eclipse.debug.ui.debugModelPresentations">
<debugModelPresentation
- class="org.drools.ide.debug.core.DroolsDebugModelPresentation"
- id="org.drools.ide.debug">
+ class="org.drools.eclipse.debug.core.DroolsDebugModelPresentation"
+ id="org.drools.eclipse.debug">
</debugModelPresentation>
</extension>
@@ -270,9 +270,9 @@
<shortcut
label="JBoss Rules Application"
icon="icons/drools.gif"
- class="org.drools.ide.launching.DroolsApplicationLaunchShortcut"
+ class="org.drools.eclipse.launching.DroolsApplicationLaunchShortcut"
modes="debug"
- id="org.drools.ide.launching.DroolsApplicationLaunchShortcut">
+ id="org.drools.eclipse.launching.DroolsApplicationLaunchShortcut">
<perspective id="org.eclipse.jdt.ui.JavaPerspective" />
<perspective id="org.eclipse.jdt.ui.JavaHierarchyPerspective" />
<perspective id="org.eclipse.jdt.ui.JavaBrowsingPerspective" />
@@ -283,14 +283,14 @@
<!-- not working if using multipage editor -->
<extension point="org.eclipse.ui.editorActions">
<editorContribution
- targetID="org.drools.ide.editors.DRLRuleEditor"
- id="org.drools.ide.editors.DRLRuleEditor.RulerActions">
+ targetID="org.drools.eclipse.editors.DRLRuleEditor"
+ id="org.drools.eclipse.editors.DRLRuleEditor.RulerActions">
<action
label="Not Used"
class="org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate"
style="push"
actionID="RulerDoubleClick"
- id="org.drools.ide.editors.DRLRuleEditor.ToggleBreakpointRulerAction" />
+ id="org.drools.eclipse.editors.DRLRuleEditor.ToggleBreakpointRulerAction" />
</editorContribution>
</extension>
@@ -298,27 +298,27 @@
<extension point="org.eclipse.ui.popupMenus">
<viewerContribution
targetID="#TextRulerContext"
- id="org.drools.ide.editors.DRLRuleEditor.RulerPopupActions">
+ id="org.drools.eclipse.editors.DRLRuleEditor.RulerPopupActions">
<action
label="Toggle Breakpoint"
class="org.eclipse.debug.ui.actions.RulerToggleBreakpointActionDelegate"
menubarPath="additions"
- id="org.drools.ide.editors.DRLRuleEditor.rulerContextMenu.ToggleBreakpointRulerAction">
+ id="org.drools.eclipse.editors.DRLRuleEditor.rulerContextMenu.ToggleBreakpointRulerAction">
</action>
</viewerContribution>
</extension>
<extension point = "org.eclipse.ui.popupMenus">
<objectContribution
- id="org.drools.ide.action.ConvertToDroolsProject"
+ id="org.drools.eclipse.action.ConvertToDroolsProject"
objectClass="org.eclipse.core.resources.IFile"
nameFilter=".project">
- <action id="org.drools.ide.action.ConvertToDroolsProjectAction"
+ <action id="org.drools.eclipse.action.ConvertToDroolsProjectAction"
label="Convert to JBoss Rules Project"
icon="icons/drools.gif"
menubarPath="additions"
- class="org.drools.ide.action.ConvertToDroolsProjectAction"
- definitionId="org.drools.ide.action.ConvertToDroolsProjectAction"
+ class="org.drools.eclipse.action.ConvertToDroolsProjectAction"
+ definitionId="org.drools.eclipse.action.ConvertToDroolsProjectAction"
enablesFor="1">
</action>
</objectContribution>
@@ -330,24 +330,24 @@
name="RuleFlow Editor"
extensions="rf, ruleflow, rflow"
icon="icons/process.gif"
- contributorClass="org.drools.ide.flow.common.editor.GenericActionBarContributor"
- class="org.drools.ide.flow.ruleflow.editor.RuleFlowModelEditor"
- id="org.drools.ide.flow.ruleflow.editor.RuleFlowModelEditor">
+ contributorClass="org.drools.eclipse.flow.common.editor.GenericActionBarContributor"
+ class="org.drools.eclipse.flow.ruleflow.editor.RuleFlowModelEditor"
+ id="org.drools.eclipse.flow.ruleflow.editor.RuleFlowModelEditor">
</editor>
</extension>
<extension
point = "org.eclipse.ui.editorActions">
<editorContribution
- id="org.drools.ide.flow.ruleflow.editor.action.CheckRuleFlowAction"
- targetID="org.drools.ide.flow.ruleflow.editor.RuleFlowModelEditor">
+ id="org.drools.eclipse.flow.ruleflow.editor.action.CheckRuleFlowAction"
+ targetID="org.drools.eclipse.flow.ruleflow.editor.RuleFlowModelEditor">
<action
- id="org.drools.ide.flow.ruleflow.editor.action.CheckRuleFlowAction"
+ id="org.drools.eclipse.flow.ruleflow.editor.action.CheckRuleFlowAction"
label="Check RuleFlow"
toolbarPath="JBoss Rules"
icon="icons/check.gif"
tooltip="Check the ruleflow model"
- class="org.drools.ide.flow.ruleflow.editor.action.CheckRuleFlowAction"
+ class="org.drools.eclipse.flow.ruleflow.editor.action.CheckRuleFlowAction"
/>
</editorContribution>
</extension>
@@ -355,14 +355,14 @@
<extension
point = "org.eclipse.ui.newWizards">
<category
- id = "org.drools.ide.flow.new"
+ id = "org.drools.eclipse.flow.new"
name="RuleFlow">
</category>
<wizard
- id = "org.drools.ide.flow.ruleflow.NewRuleFlowFileWizard"
+ id = "org.drools.eclipse.flow.ruleflow.NewRuleFlowFileWizard"
name = "RuleFlow File"
- class="org.drools.ide.flow.ruleflow.NewRuleFlowFileWizard"
- category="org.drools.ide.new"
+ class="org.drools.eclipse.flow.ruleflow.NewRuleFlowFileWizard"
+ category="org.drools.eclipse.new"
icon="icons/process.gif">
<description>A wizard that creates a new ruleflow file</description>
<selection class="org.eclipse.core.resources.IResource"/>
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DRLInfo.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DRLInfo.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DRLInfo.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DRLInfo.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,246 @@
+package org.drools.eclipse;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.compiler.DroolsError;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.drools.lang.descr.RuleDescr;
+import org.drools.rule.Package;
+
+public class DRLInfo {
+
+ private static final DroolsError[] EMPTY_DROOLS_ERROR_ARRAY = new DroolsError[0];
+ private static final List EMPTY_LIST = Collections.unmodifiableList(Collections.EMPTY_LIST);
+
+ private String sourcePathName;
+ private PackageDescr packageDescr;
+ private List parserErrors;
+ private Package compiledPackage;
+ private DroolsError[] builderErrors;
+ // cached entry
+ private transient RuleInfo[] ruleInfos;
+ private transient FunctionInfo[] functionInfos;
+
+ public DRLInfo(String sourcePathName, PackageDescr packageDescr, List parserErrors) {
+ if (sourcePathName == null || "".equals(sourcePathName)) {
+ throw new IllegalArgumentException("Invalid sourcePathName " + sourcePathName);
+ }
+ if (packageDescr == null) {
+ throw new IllegalArgumentException("Null packageDescr");
+ }
+ this.sourcePathName = sourcePathName;
+ this.packageDescr = packageDescr;
+ this.parserErrors =
+ parserErrors == null ? EMPTY_LIST : Collections.unmodifiableList(parserErrors);
+ this.builderErrors = EMPTY_DROOLS_ERROR_ARRAY;
+ }
+
+ public DRLInfo(String pathName, PackageDescr packageDescr, List parserErrors, Package compiledPackage, DroolsError[] builderErrors) {
+ this(pathName, packageDescr, parserErrors);
+ if (compiledPackage == null) {
+ throw new IllegalArgumentException("Null package");
+ }
+ this.compiledPackage = compiledPackage;
+ this.builderErrors =
+ builderErrors == null ? EMPTY_DROOLS_ERROR_ARRAY : builderErrors;
+ }
+
+ public String getSourcePathName() {
+ return sourcePathName;
+ }
+
+ public PackageDescr getPackageDescr() {
+ return packageDescr;
+ }
+
+ public List getParserErrors() {
+ return parserErrors;
+ }
+
+ public Package getPackage() {
+ return compiledPackage;
+ }
+
+ public DroolsError[] getBuilderErrors() {
+ return builderErrors;
+ }
+
+ public String getPackageName() {
+ return packageDescr.getName();
+ }
+
+ public boolean isCompiled() {
+ return compiledPackage != null;
+ }
+
+ public RuleInfo[] getRuleInfos() {
+ if (ruleInfos == null) {
+ List ruleInfosList = new ArrayList();
+ for (Iterator rules = packageDescr.getRules().iterator(); rules.hasNext(); ) {
+ RuleDescr ruleDescr = (RuleDescr) rules.next();
+ RuleInfo ruleInfo = new RuleInfo(ruleDescr);
+ ruleInfosList.add(ruleInfo);
+ }
+ ruleInfos = (RuleInfo[]) ruleInfosList.toArray(new RuleInfo[0]);
+ }
+ return ruleInfos;
+ }
+
+ public RuleInfo getRuleInfo(int drlLineNumber) {
+ RuleInfo[] ruleInfos = getRuleInfos();
+ int ruleLine = -1;
+ RuleInfo result = null;
+ for (int i = 0; i < ruleInfos.length; i++) {
+ int ruleDrlLineNumber = ruleInfos[i].getDrlLineNumber();
+ if (ruleDrlLineNumber > ruleLine
+ && ruleDrlLineNumber <= drlLineNumber + 1) {
+ ruleLine = ruleDrlLineNumber;
+ result = ruleInfos[i];
+ }
+ }
+ return result;
+ }
+
+ public class RuleInfo {
+
+ private RuleDescr ruleDescr;
+ // cached entries
+ private transient String className;
+ private transient int consequenceJavaLineNumber = -1;
+
+ public RuleInfo(RuleDescr ruleDescr) {
+ if (ruleDescr == null) {
+ throw new IllegalArgumentException("Null ruleDescr");
+ }
+ this.ruleDescr = ruleDescr;
+ }
+
+ public String getSourcePathName() {
+ return DRLInfo.this.getSourcePathName();
+ }
+
+ public String getClassName() {
+ // ruleDescr is only filled in during compilation
+ if (!isCompiled()) {
+ throw new IllegalArgumentException("Package has not been compiled");
+ }
+ if (className == null) {
+ className = getPackageName() + "." + ruleDescr.getClassName();
+ }
+ return className;
+ }
+
+ public int getDrlLineNumber() {
+ return ruleDescr.getLine();
+ }
+
+ public int getConsequenceDrlLineNumber() {
+ return ruleDescr.getConsequenceLine();
+ }
+
+ public int getConsequenceJavaLineNumber() {
+ if (consequenceJavaLineNumber == -1) {
+ if (!isCompiled()) {
+ throw new IllegalArgumentException("Package has not been compiled");
+ }
+ consequenceJavaLineNumber = compiledPackage
+ .getPackageCompilationData().getLineMappings(className).getOffset();
+ }
+ return consequenceJavaLineNumber;
+ }
+
+ public String getPackageName() {
+ return packageDescr.getName();
+ }
+
+ public String getRuleName() {
+ return ruleDescr.getName();
+ }
+ }
+
+ public FunctionInfo[] getFunctionInfos() {
+ if (functionInfos == null) {
+ List functionInfosList = new ArrayList();
+ for (Iterator functions = packageDescr.getFunctions().iterator(); functions.hasNext(); ) {
+ FunctionDescr functionDescr = (FunctionDescr) functions.next();
+ FunctionInfo functionInfo = new FunctionInfo(functionDescr);
+ functionInfosList.add(functionInfo);
+ }
+ functionInfos = (FunctionInfo[]) functionInfosList.toArray(new FunctionInfo[0]);
+ }
+ return functionInfos;
+ }
+
+ public FunctionInfo getFunctionInfo(int drlLineNumber) {
+ FunctionInfo[] functionInfos = getFunctionInfos();
+ int functionLine = -1;
+ FunctionInfo result = null;
+ for (int i = 0; i < functionInfos.length; i++) {
+ int functionDrlLineNumber = functionInfos[i].getDrlLineNumber();
+ if (functionDrlLineNumber > functionLine
+ && functionDrlLineNumber <= drlLineNumber + 1) {
+ functionLine = functionDrlLineNumber;
+ result = functionInfos[i];
+ }
+ }
+ return result;
+ }
+
+ public class FunctionInfo {
+
+ private FunctionDescr functionDescr;
+ // cached entries
+ private transient String className;
+ private transient int javaLineNumber = -1;
+
+ public FunctionInfo(FunctionDescr functionDescr) {
+ if (functionDescr == null) {
+ throw new IllegalArgumentException("Null functionDescr");
+ }
+ this.functionDescr = functionDescr;
+ }
+
+ public String getSourcePathName() {
+ return DRLInfo.this.getSourcePathName();
+ }
+
+ public String getClassName() {
+ // functionDescr is only filled in during compilation
+ if (!isCompiled()) {
+ throw new IllegalArgumentException("Package has not been compiled");
+ }
+ if (className == null) {
+ className = functionDescr.getClassName();
+ }
+ return className;
+ }
+
+ public int getDrlLineNumber() {
+ return functionDescr.getLine();
+ }
+
+ public int getJavaLineNumber() {
+ if (javaLineNumber == -1) {
+ if (!isCompiled()) {
+ throw new IllegalArgumentException("Package has not been compiled");
+ }
+ javaLineNumber = compiledPackage
+ .getPackageCompilationData().getLineMappings(className).getOffset();
+ }
+ return javaLineNumber;
+ }
+
+ public String getPackageName() {
+ return packageDescr.getName();
+ }
+
+ public String getFunctionName() {
+ return functionDescr.getName();
+ }
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DroolsIDEPlugin.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsIDEPlugin.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DroolsIDEPlugin.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DroolsIDEPlugin.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,365 @@
+package org.drools.eclipse;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Reader;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.drools.compiler.DrlParser;
+import org.drools.compiler.DroolsParserException;
+import org.drools.compiler.PackageBuilder;
+import org.drools.compiler.PackageBuilderConfiguration;
+import org.drools.eclipse.DRLInfo.FunctionInfo;
+import org.drools.eclipse.DRLInfo.RuleInfo;
+import org.drools.eclipse.builder.DroolsBuilder;
+import org.drools.eclipse.builder.Util;
+import org.drools.eclipse.editors.AbstractRuleEditor;
+import org.drools.eclipse.editors.DRLRuleEditor;
+import org.drools.eclipse.editors.DSLAdapter;
+import org.drools.eclipse.preferences.IDroolsConstants;
+import org.drools.eclipse.util.ProjectClassLoader;
+import org.drools.lang.descr.PackageDescr;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The main plugin class to be used in the desktop.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class DroolsIDEPlugin extends AbstractUIPlugin {
+
+ public static final int INTERNAL_ERROR = 120;
+ public static final String PLUGIN_ID = "org.drools.eclipse";
+ public static final String BUILD_RESULT_PACKAGE = "Package";
+ public static final String BUILD_RESULT_PACKAGE_DESCR = "PackageDescr";
+
+ //The shared instance.
+ private static DroolsIDEPlugin plugin;
+ //Resource bundle.
+ private ResourceBundle resourceBundle;
+ private Map colors = new HashMap();
+ private Map parsedRules = new HashMap();
+ private Map compiledRules = new HashMap();
+ private Map ruleInfoByClassNameMap = new HashMap();
+ private Map functionInfoByClassNameMap = new HashMap();
+ private boolean useCachePreference;
+
+ /**
+ * The constructor.
+ */
+ public DroolsIDEPlugin() {
+ super();
+ plugin = this;
+ }
+
+ /**
+ * This method is called upon plug-in activation
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ IPreferenceStore preferenceStore = getPreferenceStore();
+ useCachePreference = preferenceStore.getBoolean(IDroolsConstants.CACHE_PARSED_RULES);
+ preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ if (IDroolsConstants.CACHE_PARSED_RULES.equals(event.getProperty())) {
+ useCachePreference = ((Boolean) event.getNewValue()).booleanValue();
+ if (!useCachePreference) {
+ parsedRules.clear();
+ compiledRules.clear();
+ ruleInfoByClassNameMap.clear();
+ functionInfoByClassNameMap.clear();
+ }
+ }
+ }
+ });
+
+ }
+
+ /**
+ * This method is called when the plug-in is stopped
+ */
+ public void stop(BundleContext context) throws Exception {
+ super.stop(context);
+ plugin = null;
+ resourceBundle = null;
+ parsedRules = null;
+ compiledRules = null;
+ Iterator iterator = colors.values().iterator();
+ while (iterator.hasNext()) {
+ ((Color) iterator.next()).dispose();
+ }
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static DroolsIDEPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle,
+ * or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle = DroolsIDEPlugin.getDefault().getResourceBundle();
+ try {
+ return (bundle != null) ? bundle.getString(key) : key;
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ try {
+ if (resourceBundle == null)
+ resourceBundle = ResourceBundle.getBundle("droolsIDE.DroolsIDEPluginResources");
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ return resourceBundle;
+ }
+
+ /**
+ * Returns an image descriptor for the image file at the given
+ * plug-in relative path.
+ * Uses the plug ins image registry to "cache" it.
+ *
+ * @param path the path
+ * @return the image descriptor
+ */
+ public static ImageDescriptor getImageDescriptor(String path) {
+
+ DroolsIDEPlugin plugin = getDefault();
+ ImageRegistry reg = plugin.getImageRegistry();
+ ImageDescriptor des = reg.getDescriptor( path );
+ if (des == null) {
+ des = AbstractUIPlugin.imageDescriptorFromPlugin("org.drools.eclipse", path);
+ reg.put( path, des );
+ }
+ return des;
+ }
+
+ public static String getUniqueIdentifier() {
+ if (getDefault() == null) {
+ return PLUGIN_ID;
+ }
+ return getDefault().getBundle().getSymbolicName();
+ }
+
+ public static void log(Throwable t) {
+ Throwable top = t;
+ if (t instanceof DebugException) {
+ DebugException de = (DebugException) t;
+ IStatus status = de.getStatus();
+ if (status.getException() != null) {
+ top = status.getException();
+ }
+ }
+ log(new Status(IStatus.ERROR, getUniqueIdentifier(),
+ INTERNAL_ERROR, "Internal error in Drools Plugin: ", top));
+ }
+
+ public static void log(IStatus status) {
+ getDefault().getLog().log(status);
+ }
+
+ public Color getColor(String type) {
+ return (Color) colors.get(type);
+ }
+
+ public void setColor(String type, Color color) {
+ colors.put(type, color);
+ }
+
+ protected void initializeDefaultPreferences(IPreferenceStore store) {
+ store.setDefault(IDroolsConstants.BUILD_ALL, false);
+ store.setDefault(IDroolsConstants.EDITOR_FOLDING, true);
+ store.setDefault(IDroolsConstants.CACHE_PARSED_RULES, true);
+ }
+
+ public DRLInfo parseResource(IResource resource, boolean compile) throws DroolsParserException {
+ DRLInfo result = (DRLInfo) compiledRules.get(resource);
+ if (result == null && !compile) {
+ result = (DRLInfo) parsedRules.get(resource);
+ }
+ if (result != null) {
+ return result;
+ }
+ return generateParsedResource(resource, compile);
+ }
+
+ public DRLInfo parseResource(AbstractRuleEditor editor, boolean useUnsavedContent, boolean compile) throws DroolsParserException {
+ IResource resource = editor.getResource();
+ if (!editor.isDirty() || !useUnsavedContent) {
+ DRLInfo result = (DRLInfo) compiledRules.get(resource);
+ if (result == null && !compile) {
+ result = (DRLInfo) parsedRules.get(resource);
+ }
+ if (result != null) {
+ return result;
+ }
+ }
+ if (!editor.isDirty()) {
+ return generateParsedResource(editor.getContent(), resource, true, compile);
+ }
+ // TODO: can we cache result when using unsaved content as well?
+ return generateParsedResource(editor.getContent(), resource, !useUnsavedContent, compile);
+ }
+
+ public DRLInfo parseXLSResource(String content, IResource resource) throws DroolsParserException {
+ DRLInfo result = (DRLInfo) compiledRules.get(resource);
+ if (result != null) {
+ return result;
+ }
+ return generateParsedResource(content, resource, false, true);
+ }
+
+ public void invalidateResource(IResource resource) {
+ DRLInfo cached = (DRLInfo) compiledRules.remove(resource);
+ if (cached != null) {
+ RuleInfo[] ruleInfos = cached.getRuleInfos();
+ for (int i = 0; i < ruleInfos.length; i++) {
+ ruleInfoByClassNameMap.remove(ruleInfos[i].getClassName());
+ }
+ FunctionInfo[] functionInfos = cached.getFunctionInfos();
+ for (int i = 0; i < functionInfos.length; i++) {
+ functionInfoByClassNameMap.remove(functionInfos[i].getClassName());
+ }
+ }
+ parsedRules.remove(resource);
+ }
+
+ private DRLInfo generateParsedResource(IResource resource, boolean compile) throws DroolsParserException {
+ if (resource instanceof IFile) {
+ IFile file = (IFile) resource;
+ try {
+ String content = new String(Util.getResourceContentsAsCharArray(file));
+ return generateParsedResource(content, file, true, compile);
+ } catch (CoreException e) {
+ log(e);
+ }
+ }
+ return null;
+ }
+
+ private DRLInfo generateParsedResource(String content, IResource resource, boolean useCache, boolean compile) throws DroolsParserException {
+ useCache = useCache && useCachePreference;
+ DrlParser parser = new DrlParser();
+ try {
+ Reader dslReader = DSLAdapter.getDSLContent(content, resource);
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ ClassLoader newLoader = DroolsBuilder.class.getClassLoader();
+ PackageBuilderConfiguration builder_configuration = new PackageBuilderConfiguration();
+ if (resource.getProject().getNature("org.eclipse.jdt.core.javanature") != null) {
+ IJavaProject project = JavaCore.create(resource.getProject());
+ newLoader = ProjectClassLoader.getProjectClassLoader(project);
+ String level = project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
+ builder_configuration.setJavaLanguageLevel(level);
+ }
+ try {
+ builder_configuration.setClassLoader(newLoader);
+ Thread.currentThread().setContextClassLoader(newLoader);
+
+ // first parse the source
+ PackageDescr packageDescr = null;
+ if (useCache) {
+ DRLInfo cachedDrlInfo = (DRLInfo) parsedRules.get(resource);
+ if (cachedDrlInfo != null) {
+ packageDescr = cachedDrlInfo.getPackageDescr();
+ }
+ }
+ if (packageDescr == null) {
+ if (dslReader != null) {
+ packageDescr = parser.parse(content, dslReader);
+ } else {
+ packageDescr = parser.parse(content);
+ }
+ }
+ PackageBuilder builder = null;
+ DRLInfo result = null;
+ // compile parsed rules if necessary
+ if (compile && !parser.hasErrors()) {
+ builder = new PackageBuilder(builder_configuration);
+ builder.addPackage(packageDescr);
+ result = new DRLInfo(
+ resource.getProjectRelativePath().toString(),
+ packageDescr, parser.getErrors(),
+ builder.getPackage(), builder.getErrors());
+ } else {
+ result = new DRLInfo(
+ resource.getProjectRelativePath().toString(),
+ packageDescr, parser.getErrors());
+ }
+
+ // cache result
+ if (useCache) {
+ if (compile && !parser.hasErrors()) {
+ parsedRules.remove(resource);
+ compiledRules.put(resource, result);
+ RuleInfo[] ruleInfos = result.getRuleInfos();
+ for (int i = 0; i < ruleInfos.length; i++) {
+ ruleInfoByClassNameMap.put(ruleInfos[i].getClassName(), ruleInfos[i]);
+ }
+ FunctionInfo[] functionInfos = result.getFunctionInfos();
+ for (int i = 0; i < functionInfos.length; i++) {
+ functionInfoByClassNameMap.put(functionInfos[i].getClassName(), functionInfos[i]);
+ }
+ } else {
+ parsedRules.put(resource, result);
+ }
+ }
+ return result;
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ } catch (CoreException e) {
+ log(e);
+ }
+ return null;
+ }
+
+ public RuleInfo getRuleInfoByClass(String ruleClassName) {
+ return (RuleInfo) ruleInfoByClassNameMap.get(ruleClassName);
+ }
+
+ public FunctionInfo getFunctionInfoByClass(String functionClassName) {
+ return (FunctionInfo) functionInfoByClassNameMap.get(functionClassName);
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DroolsPerspective.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsPerspective.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DroolsPerspective.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DroolsPerspective.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,77 @@
+package org.drools.eclipse;
+
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.ui.IFolderLayout;
+import org.eclipse.ui.IPageLayout;
+import org.eclipse.ui.IPerspectiveFactory;
+import org.eclipse.ui.console.IConsoleConstants;
+import org.eclipse.ui.progress.IProgressConstants;
+
+public class DroolsPerspective implements IPerspectiveFactory {
+
+ public void createInitialLayout(IPageLayout layout) {
+ String editorArea = layout.getEditorArea();
+
+ IFolderLayout folder= layout.createFolder("left", IPageLayout.LEFT, (float)0.25, editorArea); //$NON-NLS-1$
+ folder.addView(JavaUI.ID_PACKAGES);
+ folder.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
+ folder.addView(IPageLayout.ID_RES_NAV);
+
+ IFolderLayout rulesfolder= layout.createFolder("leftbottom", IPageLayout.BOTTOM, (float)0.5, "left"); //$NON-NLS-1$
+ rulesfolder.addView(IDroolsConstants.RULES_VIEW);
+
+ IFolderLayout outputfolder= layout.createFolder("bottom", IPageLayout.BOTTOM, (float)0.75, editorArea); //$NON-NLS-1$
+ outputfolder.addView(IPageLayout.ID_PROBLEM_VIEW);
+ outputfolder.addView(IPageLayout.ID_PROP_SHEET);
+ outputfolder.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
+ outputfolder.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
+ outputfolder.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
+ outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
+ outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
+
+ // *** Drools-specific extensions ***
+ outputfolder.addView(IDroolsConstants.AUDIT_VIEW);
+ layout.addShowViewShortcut(IDroolsConstants.AUDIT_VIEW);
+ layout.addNewWizardShortcut("org.drools.eclipse.new.file");
+ layout.addNewWizardShortcut("org.drools.eclipse.new.dsl");
+ layout.addNewWizardShortcut("org.drools.eclipse.wizards.new.project");
+ // **********************************
+
+ layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, (float)0.75, editorArea);
+
+ layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
+ layout.addActionSet(JavaUI.ID_ACTION_SET);
+ layout.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
+ layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
+
+ // views - java
+ layout.addShowViewShortcut(JavaUI.ID_PACKAGES);
+ layout.addShowViewShortcut(JavaUI.ID_TYPE_HIERARCHY);
+ layout.addShowViewShortcut(JavaUI.ID_SOURCE_VIEW);
+ layout.addShowViewShortcut(JavaUI.ID_JAVADOC_VIEW);
+
+ // views - debugging
+ layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
+
+ // views - standard workbench
+ layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
+ layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
+ layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
+ layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
+ layout.addShowViewShortcut(IProgressConstants.PROGRESS_VIEW_ID);
+
+ // new actions - Java project creation wizard
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewEnumCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard"); //$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
+ layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");//$NON-NLS-1$
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DroolsPluginImages.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsPluginImages.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DroolsPluginImages.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/DroolsPluginImages.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,144 @@
+package org.drools.eclipse;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.net.MalformedURLException;
+import java.net.URL;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Handles the images used in this plugin.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class DroolsPluginImages {
+
+ public static final String IMG_LOGICAL = "ImageLogical";
+ public static final String IMG_LOGICAL_DISABLED = "ImageLogicalDisabled";
+ public static final String REFRESH_LOG = "RefreshLog";
+ public static final String REFRESH_LOG_DISABLED = "RefreshLogDisabled";
+ public static final String OPEN_LOG = "OpenLog";
+ public static final String DELETE_LOG = "ClearLog";
+ public static final String DELETE_LOG_DISABLED = "ClearLogDisabled";
+ public static final String ASSERT_OBJECT = "AssertObject";
+ public static final String MODIFY_OBJECT = "ModifyObject";
+ public static final String RETRACT_OBJECT = "RetractObject";
+ public static final String CREATE_ACTIVATION = "CreateActivation";
+ public static final String CANCEL_ACTIVATION = "CancelActivation";
+ public static final String EXECUTE_ACTIVATION = "ExecuteActivation";
+ public static final String CLASS = "Class";
+ public static final String PACKAGE = "Package";
+ public static final String METHOD = "Method";
+ public static final String VARIABLE = "Variable";
+ public static final String DROOLS = "Drools";
+ public static final String RULE = "DroolsRule";
+ public static final String QUERY = "DroolsQuery";
+ public static final String DSL_EXPRESSION = "DslExpression";
+ public static final String IMPORT = "Import";
+ public static final String DSL = "DSL";
+ public static final String GLOBAL = "Global";
+
+ private static ImageRegistry imageRegistry;
+ private static final String PATH_SUFFIX = "/icons/";
+ private static final URL ICON_BASE_URL =
+ DroolsIDEPlugin.getDefault().getBundle().getEntry(PATH_SUFFIX);
+
+ private static void declareImages() {
+ declareRegistryImage(IMG_LOGICAL, "logical_structure.gif");
+ declareRegistryImage(IMG_LOGICAL_DISABLED, "logical_structure_disabled.gif");
+ declareRegistryImage(REFRESH_LOG, "refresh.gif");
+ declareRegistryImage(REFRESH_LOG_DISABLED, "refresh_disabled.gif");
+ declareRegistryImage(OPEN_LOG, "open.gif");
+ declareRegistryImage(DELETE_LOG, "clear.gif");
+ declareRegistryImage(DELETE_LOG_DISABLED, "clear_disabled.gif");
+ declareRegistryImage(ASSERT_OBJECT, "greensquare.GIF");
+ declareRegistryImage(MODIFY_OBJECT, "yellowsquare.GIF");
+ declareRegistryImage(RETRACT_OBJECT, "redsquare.GIF");
+ declareRegistryImage(CREATE_ACTIVATION, "arrowright.GIF");
+ declareRegistryImage(CANCEL_ACTIVATION, "arrowleft.GIF");
+ declareRegistryImage(EXECUTE_ACTIVATION, "bluediamond.GIF");
+ declareRegistryImage(CLASS, "class_obj.gif");
+ declareRegistryImage(PACKAGE, "package_obj.gif");
+ declareRegistryImage(METHOD, "methpub_obj.gif");
+ declareRegistryImage(VARIABLE, "field_private_obj.gif");
+ declareRegistryImage(DROOLS, "drools.gif");
+ declareRegistryImage(RULE, "drools-rule.GIF");
+ declareRegistryImage(QUERY, "drools-query.GIF");
+ declareRegistryImage(DSL_EXPRESSION, "dsl_expression.gif");
+ declareRegistryImage(IMPORT, "import.gif");
+ declareRegistryImage(DSL, "dsl.GIF");
+ declareRegistryImage(GLOBAL, "field_public_obj.gif");
+ }
+
+ /**
+ * Declare an Image in the registry table.
+ * @param key The key to use when registering the image
+ * @param path The path where the image can be found. This path is relative to where
+ * this plugin class is found (i.e. typically the packages directory)
+ */
+ private final static void declareRegistryImage(String key, String path) {
+ ImageDescriptor desc= ImageDescriptor.getMissingImageDescriptor();
+ try {
+ desc= ImageDescriptor.createFromURL(makeIconFileURL(path));
+ } catch (MalformedURLException e) {
+ DroolsIDEPlugin.log(e);
+ }
+ imageRegistry.put(key, desc);
+ }
+
+ /**
+ * Returns the ImageRegistry.
+ */
+ public static ImageRegistry getImageRegistry() {
+ if (imageRegistry == null) {
+ initializeImageRegistry();
+ }
+ return imageRegistry;
+ }
+
+ public static ImageRegistry initializeImageRegistry() {
+ imageRegistry = new ImageRegistry();
+ declareImages();
+ return imageRegistry;
+ }
+
+ /**
+ * Returns the <code>Image</code> identified by the given key,
+ * or <code>null</code> if it does not exist.
+ */
+ public static Image getImage(String key) {
+ return getImageRegistry().get(key);
+ }
+
+ /**
+ * Returns the <code>ImageDescriptor</code> identified by the given key,
+ * or <code>null</code> if it does not exist.
+ */
+ public static ImageDescriptor getImageDescriptor(String key) {
+ return getImageRegistry().getDescriptor(key);
+ }
+
+ private static URL makeIconFileURL(String iconPath) throws MalformedURLException {
+ if (ICON_BASE_URL == null) {
+ throw new MalformedURLException();
+ }
+
+ return new URL(ICON_BASE_URL, iconPath);
+ }
+}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/IDroolsConstants.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/IDroolsConstants.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/IDroolsConstants.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/IDroolsConstants.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,8 @@
+package org.drools.eclipse;
+
+public interface IDroolsConstants {
+
+ final String AUDIT_VIEW = "org.drools.eclipse.debug.AuditView";
+ final String RULES_VIEW = "org.drools.eclipse.view.rules.RulesView";
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/action (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/action)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/action/ConvertToDroolsProjectAction.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/action/ConvertToDroolsProjectAction.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/action/ConvertToDroolsProjectAction.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,8 +1,8 @@
-package org.drools.ide.action;
+package org.drools.eclipse.action;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.builder.DroolsBuilder;
-import org.drools.ide.wizard.project.NewDroolsProjectWizard;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.builder.DroolsBuilder;
+import org.drools.eclipse.wizard.project.NewDroolsProjectWizard;
import org.drools.util.ArrayUtils;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IFile;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/builder)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/DroolsBuildMarker.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/builder/DroolsBuildMarker.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/DroolsBuildMarker.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.builder;
+package org.drools.eclipse.builder;
public class DroolsBuildMarker {
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/DroolsBuilder.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/builder/DroolsBuilder.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/DroolsBuilder.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.builder;
+package org.drools.eclipse.builder;
import java.util.ArrayList;
import java.util.Iterator;
@@ -17,9 +17,9 @@
import org.drools.compiler.RuleError;
import org.drools.decisiontable.InputType;
import org.drools.decisiontable.SpreadsheetCompiler;
-import org.drools.ide.DRLInfo;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.preferences.IDroolsConstants;
+import org.drools.eclipse.DRLInfo;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.preferences.IDroolsConstants;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
@@ -46,7 +46,7 @@
*/
public class DroolsBuilder extends IncrementalProjectBuilder {
- public static final String BUILDER_ID = "org.drools.ide.droolsbuilder";
+ public static final String BUILDER_ID = "org.drools.eclipse.droolsbuilder";
protected IProject[] build(int kind, Map args, IProgressMonitor monitor)
throws CoreException {
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/IDroolsModelMarker.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/builder/IDroolsModelMarker.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/IDroolsModelMarker.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,6 +1,6 @@
-package org.drools.ide.builder;
+package org.drools.eclipse.builder;
-import org.drools.ide.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsIDEPlugin;
/**
* The drools problem marker id.
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/Util.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/builder/Util.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/builder/Util.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.builder;
+package org.drools.eclipse.builder;
import java.io.BufferedInputStream;
import java.io.IOException;
@@ -6,7 +6,7 @@
import java.io.InputStreamReader;
-import org.drools.ide.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsIDEPlugin;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/DroolsElement.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/DroolsElement.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/DroolsElement.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/DroolsElement.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,66 @@
+package org.drools.eclipse.core;
+
+import org.eclipse.core.resources.IFile;
+
+/**
+ * This represents a drools model element. It is linked to its direct
+ * parents and its children. If relevant, Drools model elements refer
+ * to the file they are defined in and the offset and length of that
+ * element in the file.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public abstract class DroolsElement {
+
+ public static final int RULESET = 0;
+ public static final int PACKAGE = 1;
+ public static final int RULE = 2;
+ public static final int QUERY = 3;
+ public static final int FUNCTION = 4;
+ public static final int TEMPLATE = 5;
+ public static final int EXPANDER = 6;
+ public static final int GLOBAL = 7;
+ public static final int IMPORT = 8;
+ public static final int RULE_ATTRIBUTE = 9;
+
+ protected static final DroolsElement[] NO_ELEMENTS = new DroolsElement[0];
+
+ private DroolsElement parent;
+ private IFile file;
+ private int offset;
+ private int length;
+
+ protected DroolsElement(DroolsElement parent) {
+ this.parent = parent;
+ }
+
+ public abstract int getType();
+
+ public DroolsElement getParent() {
+ return parent;
+ }
+
+ public abstract DroolsElement[] getChildren();
+
+ public IFile getFile() {
+ return file;
+ }
+
+ public int getOffset() {
+ return offset;
+ }
+
+ public int getLength() {
+ return length;
+ }
+
+ // These are helper methods for creating the model and should not
+ // be used directly. Use DroolsModelBuilder instead.
+
+ void setFile(IFile file, int offset, int length) {
+ this.file = file;
+ this.offset = offset;
+ this.length = length;
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/DroolsModelBuilder.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/DroolsModelBuilder.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/DroolsModelBuilder.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/DroolsModelBuilder.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,174 @@
+package org.drools.eclipse.core;
+
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+
+public class DroolsModelBuilder {
+
+ public static RuleSet createRuleSet() {
+ return new RuleSet();
+ }
+
+ public static Package createPackage(String packageName, int offset, int length) {
+ Package pkg = new Package(null, packageName);
+ pkg.setFile(null, offset, length);
+ return pkg;
+ }
+
+ public static Package addPackage(RuleSet ruleSet, String packageName, int offset, int length) {
+ Package pkg = new Package(ruleSet, packageName);
+ pkg.setFile(null, offset, length);
+ ruleSet.addPackage(pkg);
+ return pkg;
+ }
+
+ public static void removePackage(Package pkg) {
+ RuleSet ruleSet = pkg.getParentRuleSet();
+ if (ruleSet != null) {
+ ruleSet.removePackage(pkg.getPackageName());
+ }
+ }
+
+ public static void clearRuleSet(RuleSet ruleSet) {
+ ruleSet.clear();
+ }
+
+ public static Rule addRule(Package pkg, String ruleName, IFile file, int offset, int length, Map attributes) {
+ Rule rule = new Rule(pkg, ruleName);
+ rule.setFile(file, offset, length);
+ if (attributes != null) {
+ for (Iterator iterator = attributes.entrySet().iterator(); iterator.hasNext();) {
+ Map.Entry entry = (Map.Entry) iterator.next();
+ RuleAttribute attribute = new RuleAttribute(rule, (String) entry.getKey(), entry.getValue());
+ attribute.setFile(file, offset, length);
+ rule.addAttribute(attribute);
+ }
+ }
+ pkg.addRule(rule);
+ return rule;
+ }
+
+ public static void removeRule(Rule rule) {
+ Package pkg = rule.getParentPackage();
+ if (pkg != null) {
+ pkg.removeRule(rule);
+ if (pkg.getChildren().length == 0) {
+ removePackage(pkg);
+ }
+ }
+ }
+
+ public static Function addFunction(Package pkg, String functionName, IFile file, int offset, int length) {
+ Function function = new Function(pkg, functionName);
+ function.setFile(file, offset, length);
+ pkg.addFunction(function);
+ return function;
+ }
+
+ public static void removeFunction(Function function) {
+ Package pkg = function.getParentPackage();
+ if (pkg != null) {
+ pkg.removeFunction(function);
+ }
+ }
+
+ public static void addExpander(Package pkg, String expanderName, IFile file, int offset, int length) {
+ Expander expander = new Expander(pkg, expanderName);
+ expander.setFile(file, offset, length);
+ pkg.addExpander(expander);
+ }
+
+ public static void removeExpander(Expander expander) {
+ Package pkg = expander.getParentPackage();
+ if (pkg != null) {
+ pkg.removeExpander(expander);
+ }
+ }
+
+ public static void addImport(Package pkg, String importClass, IFile file, int offset, int length) {
+ Import imp = new Import(pkg, importClass);
+ imp.setFile(file, offset, length);
+ pkg.addImport(imp);
+ }
+
+ public static void removeImport(Import imp) {
+ Package pkg = imp.getParentPackage();
+ if (pkg != null) {
+ pkg.removeImport(imp);
+ }
+ }
+
+ public static Global addGlobal(Package pkg, String globalName, IFile file, int offset, int length) {
+ Global global = new Global(pkg, globalName);
+ global.setFile(file, offset, length);
+ pkg.addGlobal(global);
+ return global;
+ }
+
+ public static void removeGlobal(Global global) {
+ Package pkg = global.getParentPackage();
+ if (pkg != null) {
+ pkg.removeGlobal(global);
+ }
+ }
+
+ public static Query addQuery(Package pkg, String queryName, IFile file, int offset, int length) {
+ Query query = new Query(pkg, queryName);
+ query.setFile(file, offset, length);
+ pkg.addQuery(query);
+ return query;
+ }
+
+ public static void removeQuery(Query query) {
+ Package pkg = query.getParentPackage();
+ if (pkg != null) {
+ pkg.removeQuery(query);
+ }
+ }
+
+ public static Template addTemplate(Package pkg, String templateName, IFile file, int offset, int length) {
+ Template template = new Template(pkg, templateName);
+ template.setFile(file, offset, length);
+ pkg.addTemplate(template);
+ return template;
+ }
+
+ public static void removeTemplate(Template template) {
+ Package pkg = template.getParentPackage();
+ if (pkg != null) {
+ pkg.removeTemplate(template);
+ }
+ }
+
+ public static void removeElement(DroolsElement element) {
+ switch (element.getType()) {
+ case DroolsElement.RULESET:
+ clearRuleSet((RuleSet) element);
+ break;
+ case DroolsElement.PACKAGE:
+ removePackage((Package) element);
+ break;
+ case DroolsElement.RULE:
+ removeRule((Rule) element);
+ break;
+ case DroolsElement.QUERY:
+ removeQuery((Query) element);
+ break;
+ case DroolsElement.FUNCTION:
+ removeFunction((Function) element);
+ break;
+ case DroolsElement.TEMPLATE:
+ removeTemplate((Template) element);
+ break;
+ case DroolsElement.EXPANDER:
+ removeExpander((Expander) element);
+ break;
+ case DroolsElement.GLOBAL:
+ removeGlobal((Global) element);
+ break;
+ }
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Expander.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/Expander.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Expander.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Expander.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,37 @@
+package org.drools.eclipse.core;
+
+/**
+ * This represents an expander.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class Expander extends DroolsElement {
+
+ private final String expander;
+
+ Expander(Package parent, String expander) {
+ super(parent);
+ this.expander = expander;
+ }
+
+ public Package getParentPackage() {
+ return (Package) getParent();
+ }
+
+ public String getExpander() {
+ return expander;
+ }
+
+ public int getType() {
+ return EXPANDER;
+ }
+
+ public DroolsElement[] getChildren() {
+ return NO_ELEMENTS;
+ }
+
+ public String toString() {
+ return expander;
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Function.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/Function.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Function.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Function.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,37 @@
+package org.drools.eclipse.core;
+
+/**
+ * This represents a function.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class Function extends DroolsElement {
+
+ private final String functionName;
+
+ Function(Package parent, String functionName) {
+ super(parent);
+ this.functionName = functionName;
+ }
+
+ public Package getParentPackage() {
+ return (Package) getParent();
+ }
+
+ public String getFunctionName() {
+ return functionName;
+ }
+
+ public int getType() {
+ return FUNCTION;
+ }
+
+ public DroolsElement[] getChildren() {
+ return NO_ELEMENTS;
+ }
+
+ public String toString() {
+ return functionName;
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Global.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/Global.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Global.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Global.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,37 @@
+package org.drools.eclipse.core;
+
+/**
+ * This represents a global.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class Global extends DroolsElement {
+
+ private final String globalName;
+
+ Global(Package parent, String globalName) {
+ super(parent);
+ this.globalName = globalName;
+ }
+
+ public Package getParentPackage() {
+ return (Package) getParent();
+ }
+
+ public String getGlobalName() {
+ return globalName;
+ }
+
+ public int getType() {
+ return GLOBAL;
+ }
+
+ public DroolsElement[] getChildren() {
+ return NO_ELEMENTS;
+ }
+
+ public String toString() {
+ return globalName;
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Import.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/Import.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Import.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Import.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,37 @@
+package org.drools.eclipse.core;
+
+/**
+ * This represents an import.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class Import extends DroolsElement {
+
+ private final String importClass;
+
+ Import(Package parent, String importClass) {
+ super(parent);
+ this.importClass = importClass;
+ }
+
+ public Package getParentPackage() {
+ return (Package) getParent();
+ }
+
+ public String getImportClass() {
+ return importClass;
+ }
+
+ public int getType() {
+ return IMPORT;
+ }
+
+ public DroolsElement[] getChildren() {
+ return NO_ELEMENTS;
+ }
+
+ public String toString() {
+ return importClass;
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Package.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/Package.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Package.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Package.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,115 @@
+package org.drools.eclipse.core;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This represents a package.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class Package extends DroolsElement {
+
+ private String packageName;
+ private List rules = new ArrayList();
+ private List functions = new ArrayList();
+ private List expanders = new ArrayList();
+ private List imports = new ArrayList();
+ private List globals = new ArrayList();
+ private List queries = new ArrayList();
+ private List templates = new ArrayList();
+
+ Package(RuleSet parent, String packageName) {
+ super(parent);
+ this.packageName =
+ packageName == null ? "(default package)" : packageName;
+ }
+
+ public RuleSet getParentRuleSet() {
+ return (RuleSet) getParent();
+ }
+
+ public String getPackageName() {
+ return packageName;
+ }
+
+ public int getType() {
+ return PACKAGE;
+ }
+
+ public DroolsElement[] getChildren() {
+ List children = new ArrayList();
+ children.addAll(rules);
+ children.addAll(queries);
+ children.addAll(globals);
+ children.addAll(functions);
+ children.addAll(expanders);
+ children.addAll(imports);
+ children.addAll(templates);
+ return (DroolsElement[]) children.toArray(new DroolsElement[0]);
+ }
+
+ public String toString() {
+ return packageName;
+ }
+
+ // These are helper methods for creating the model and should not
+ // be used directly. Use DroolsModelBuilder instead.
+
+ void addRule(Rule rule) {
+ rules.add(rule);
+ }
+
+ void removeRule(Rule rule) {
+ rules.remove(rule);
+ }
+
+ void addFunction(Function function) {
+ functions.add(function);
+ }
+
+ void removeFunction(Function function) {
+ functions.remove(function);
+ }
+
+ void addExpander(Expander expander) {
+ expanders.add(expander);
+ }
+
+ void removeExpander(Expander expander) {
+ expanders.remove(expander);
+ }
+
+ void addImport(Import imp) {
+ imports.add(imp);
+ }
+
+ void removeImport(Import imp) {
+ imports.remove(imp);
+ }
+
+ void addGlobal(Global global) {
+ globals.add(global);
+ }
+
+ void removeGlobal(Global global) {
+ globals.remove(global);
+ }
+
+ void addQuery(Query query) {
+ queries.add(query);
+ }
+
+ void removeQuery(Query query) {
+ queries.remove(query);
+ }
+
+ void addTemplate(Template template) {
+ templates.add(template);
+ }
+
+ void removeTemplate(Template template) {
+ templates.remove(template);
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Query.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/Query.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Query.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Query.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,37 @@
+package org.drools.eclipse.core;
+
+/**
+ * This represents a query.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class Query extends DroolsElement {
+
+ private final String query;
+
+ Query(Package parent, String query) {
+ super(parent);
+ this.query = query;
+ }
+
+ public Package getParentPackage() {
+ return (Package) getParent();
+ }
+
+ public String getQueryName() {
+ return query;
+ }
+
+ public int getType() {
+ return QUERY;
+ }
+
+ public DroolsElement[] getChildren() {
+ return NO_ELEMENTS;
+ }
+
+ public String toString() {
+ return query;
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Rule.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/Rule.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Rule.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Rule.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,52 @@
+package org.drools.eclipse.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This represents a rule.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class Rule extends DroolsElement {
+
+ private final String ruleName;
+ private Map attributes = new HashMap();
+
+ Rule(Package parent, String ruleName) {
+ super(parent);
+ this.ruleName = ruleName;
+ }
+
+ public Package getParentPackage() {
+ return (Package) getParent();
+ }
+
+ public String getRuleName() {
+ return ruleName;
+ }
+
+ public RuleAttribute getAttribute(String attributeName) {
+ return (RuleAttribute) attributes.get(attributeName);
+ }
+
+ public int getType() {
+ return RULE;
+ }
+
+ public DroolsElement[] getChildren() {
+ return NO_ELEMENTS;
+ }
+
+ public String toString() {
+ return ruleName;
+ }
+
+ // These are helper methods for creating the model and should not
+ // be used directly. Use DroolsModelBuilder instead.
+
+ void addAttribute(RuleAttribute attribute) {
+ attributes.put(attribute.getAttributeName(), attribute);
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/RuleAttribute.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/RuleAttribute.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/RuleAttribute.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/RuleAttribute.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,39 @@
+package org.drools.eclipse.core;
+
+/**
+ * This represents a rule attribute.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class RuleAttribute extends DroolsElement {
+
+ private final String attributeName;
+ private final Object attributeValue;
+
+ RuleAttribute(Rule parent, String attributeName, Object attributeValue) {
+ super(parent);
+ this.attributeName = attributeName;
+ this.attributeValue = attributeValue;
+ }
+
+ public Rule getParentRule() {
+ return (Rule) getParent();
+ }
+
+ public String getAttributeName() {
+ return attributeName;
+ }
+
+ public int getType() {
+ return RULE_ATTRIBUTE;
+ }
+
+ public DroolsElement[] getChildren() {
+ return NO_ELEMENTS;
+ }
+
+ public String toString() {
+ return attributeName + " = " + attributeValue;
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/RuleSet.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/RuleSet.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/RuleSet.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/RuleSet.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,47 @@
+package org.drools.eclipse.core;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * This represents a rule set.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleSet extends DroolsElement {
+
+ private Map packages = new HashMap();
+
+ RuleSet() {
+ super(null);
+ }
+
+ public Package getPackage(String packageName) {
+ return (Package) packages.get(packageName);
+ }
+
+ public int getType() {
+ return RULESET;
+ }
+
+ public DroolsElement[] getChildren() {
+ return (DroolsElement[]) packages.values().toArray(
+ new DroolsElement[packages.size()]);
+ }
+
+ // These are helper methods for creating the model and should not
+ // be used directly. Use DroolsModelBuilder instead.
+
+ void addPackage(Package pkg) {
+ packages.put(pkg.getPackageName(), pkg);
+ }
+
+ void removePackage(String packageName) {
+ packages.remove(packageName);
+ }
+
+ void clear() {
+ packages.clear();
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Template.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/Template.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Template.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/Template.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,37 @@
+package org.drools.eclipse.core;
+
+/**
+ * This represents a template.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class Template extends DroolsElement {
+
+ private final String templateName;
+
+ Template(Package parent, String templateName) {
+ super(parent);
+ this.templateName = templateName;
+ }
+
+ public Package getParentPackage() {
+ return (Package) getParent();
+ }
+
+ public String getTemplateName() {
+ return templateName;
+ }
+
+ public int getType() {
+ return TEMPLATE;
+ }
+
+ public DroolsElement[] getChildren() {
+ return NO_ELEMENTS;
+ }
+
+ public String toString() {
+ return templateName;
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/ui)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/DroolsContentProvider.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/ui/DroolsContentProvider.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/DroolsContentProvider.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,6 +1,6 @@
-package org.drools.ide.core.ui;
+package org.drools.eclipse.core.ui;
-import org.drools.ide.core.DroolsElement;
+import org.drools.eclipse.core.DroolsElement;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/DroolsFilter.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/ui/DroolsFilter.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/DroolsFilter.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,6 +1,6 @@
-package org.drools.ide.core.ui;
+package org.drools.eclipse.core.ui;
-import org.drools.ide.core.DroolsElement;
+import org.drools.eclipse.core.DroolsElement;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/DroolsLabelProvider.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/ui/DroolsLabelProvider.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/DroolsLabelProvider.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,7 +1,7 @@
-package org.drools.ide.core.ui;
+package org.drools.eclipse.core.ui;
-import org.drools.ide.DroolsPluginImages;
-import org.drools.ide.core.DroolsElement;
+import org.drools.eclipse.DroolsPluginImages;
+import org.drools.eclipse.core.DroolsElement;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/DroolsTreeSorter.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/ui/DroolsTreeSorter.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/DroolsTreeSorter.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,16 +1,16 @@
-package org.drools.ide.core.ui;
+package org.drools.eclipse.core.ui;
-import org.drools.ide.core.DroolsElement;
-import org.drools.ide.core.Expander;
-import org.drools.ide.core.Function;
-import org.drools.ide.core.Global;
-import org.drools.ide.core.Import;
-import org.drools.ide.core.Package;
-import org.drools.ide.core.Query;
-import org.drools.ide.core.Rule;
-import org.drools.ide.core.RuleAttribute;
-import org.drools.ide.core.RuleSet;
-import org.drools.ide.core.Template;
+import org.drools.eclipse.core.DroolsElement;
+import org.drools.eclipse.core.Expander;
+import org.drools.eclipse.core.Function;
+import org.drools.eclipse.core.Global;
+import org.drools.eclipse.core.Import;
+import org.drools.eclipse.core.Package;
+import org.drools.eclipse.core.Query;
+import org.drools.eclipse.core.Rule;
+import org.drools.eclipse.core.RuleAttribute;
+import org.drools.eclipse.core.RuleSet;
+import org.drools.eclipse.core.Template;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/FilterAction.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/ui/FilterAction.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/FilterAction.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,6 +1,6 @@
-package org.drools.ide.core.ui;
+package org.drools.eclipse.core.ui;
-import org.drools.ide.DroolsPluginImages;
+import org.drools.eclipse.DroolsPluginImages;
import org.eclipse.jface.action.Action;
/**
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/FilterActionGroup.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/core/ui/FilterActionGroup.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/core/ui/FilterActionGroup.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,7 +1,7 @@
-package org.drools.ide.core.ui;
+package org.drools.eclipse.core.ui;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.DroolsPluginImages;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsPluginImages;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.util.Assert;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AgendaLogicalStructureDelegate.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/AgendaLogicalStructureDelegate.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AgendaLogicalStructureDelegate.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AgendaLogicalStructureDelegate.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,81 @@
+package org.drools.eclipse.debug;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.ILogicalStructureTypeDelegate;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaArray;
+import org.eclipse.jdt.debug.core.IJavaClassType;
+import org.eclipse.jdt.debug.core.IJavaInterfaceType;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaType;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
+
+/**
+ * The logical structures of Agenda.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class AgendaLogicalStructureDelegate implements ILogicalStructureTypeDelegate {
+
+ public boolean providesLogicalStructure(IValue value) {
+ if (!(value instanceof IJavaObject)) {
+ return false;
+ }
+ IJavaObject javaValue= (IJavaObject) value;
+ try {
+ IJavaType type= javaValue.getJavaType();
+ if (!(type instanceof IJavaClassType)) {
+ return false;
+ }
+ IJavaClassType classType = (IJavaClassType) type;
+ IJavaInterfaceType[] interfaceTypes = classType.getAllInterfaces();
+ for ( int i = 0; i < interfaceTypes.length; i++ ) {
+ if ("org.drools.spi.Activation".equals(interfaceTypes[i].getName())) {
+ return true;
+ }
+ }
+ return false;
+ } catch (DebugException e) {
+ DroolsIDEPlugin.log(e);
+ return false;
+ }
+ }
+
+ public IValue getLogicalStructure(IValue value) throws CoreException {
+ if (!(value instanceof IJavaObject)) {
+ return null;
+ }
+ IJavaObject javaValue = (IJavaObject) value;
+ if (!providesLogicalStructure(value)) {
+ return null;
+ }
+ IJavaArray ruleParameters = (IJavaArray) DebugUtil.getValueByExpression("return getRule().getDeclarations();", value);
+ List variables = new ArrayList();
+ variables.add(new VariableWrapper("ruleName", (IJavaValue) DebugUtil.getValueByExpression("return getRule().getName();", value)));
+
+ IJavaValue[] javaValues = ruleParameters.getValues();
+ for ( int j = 0; j < javaValues.length; j++ ) {
+ IJavaValue declaration = javaValues[j];
+ IVariable[] vars = declaration.getVariables();
+ for ( int k = 0; k < vars.length; k++ ) {
+ IVariable declarationVar = vars[k];
+ if ("identifier".equals(declarationVar.getName())) {
+ String paramName = declarationVar.getValue().getValueString();
+ IJavaValue varValue = (IJavaValue) DebugUtil.getValueByExpression("return getRule().getDeclaration(\"" + paramName + "\").getValue(((org.drools.common.InternalFactHandle) getTuple().get(getRule().getDeclaration(\"" + paramName + "\"))).getObject());", value);
+ if (varValue != null) {
+ variables.add(new VariableWrapper(paramName, varValue));
+ }
+ break;
+ }
+ }
+ }
+ return new ObjectWrapper(javaValue, (IJavaVariable[]) variables.toArray(new IJavaVariable[variables.size()]));
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AgendaView.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/AgendaView.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AgendaView.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AgendaView.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,19 @@
+package org.drools.eclipse.debug;
+
+import org.eclipse.jface.viewers.IContentProvider;
+
+/**
+ * The Agenda View.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class AgendaView extends DroolsDebugEventHandlerView {
+
+ protected IContentProvider createContentProvider() {
+ return new AgendaViewContentProvider(this);
+ }
+
+ protected int getAutoExpandLevel() {
+ return 2;
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AgendaViewContentProvider.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/AgendaViewContentProvider.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AgendaViewContentProvider.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AgendaViewContentProvider.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,105 @@
+package org.drools.eclipse.debug;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaArray;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
+
+/**
+ * The Agenda View content provider.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class AgendaViewContentProvider extends DroolsDebugViewContentProvider {
+
+ private DroolsDebugEventHandlerView view;
+
+ public AgendaViewContentProvider(DroolsDebugEventHandlerView view) {
+ this.view = view;
+ }
+
+ protected String getEmptyString() {
+ return "The selected working memory has an empty agenda.";
+ }
+
+ public Object[] getChildren(Object obj) {
+ try {
+ Object[] variables = null;
+ if (obj != null && obj instanceof IJavaObject
+ && "org.drools.reteoo.ReteooWorkingMemory".equals(
+ ((IJavaObject) obj).getReferenceTypeName())) {
+ variables = getAgendaElements((IJavaObject) obj);
+ } else if (obj instanceof IVariable) {
+ if (view.isShowLogicalStructure()) {
+ IValue value = getLogicalValue(((IVariable) obj).getValue(), new ArrayList());
+ variables = value.getVariables();
+ }
+ if (variables == null) {
+ variables = ((IVariable) obj).getValue().getVariables();
+ }
+ }
+ if (variables == null) {
+ return new Object[0];
+ } else {
+ cache(obj, variables);
+ return variables;
+ }
+ } catch (DebugException e) {
+ DroolsIDEPlugin.log(e);
+ return new Object[0];
+ }
+ }
+
+ private Object[] getAgendaElements(IJavaObject workingMemoryImpl) throws DebugException {
+ List result = new ArrayList();
+ IValue agendaGroupObjects = DebugUtil.getValueByExpression("return getAgenda().getAgendaGroups();", workingMemoryImpl);
+ IValue focus = DebugUtil.getValueByExpression("return getAgenda().getFocus();", workingMemoryImpl);
+ if (agendaGroupObjects instanceof IJavaArray) {
+ IJavaArray agendaGroupArray = (IJavaArray) agendaGroupObjects;
+ IJavaValue[] agendaGroupValueArray = agendaGroupArray.getValues();
+ for (int i = 0; i < agendaGroupValueArray.length; i++) {
+ IJavaValue agendaGroup = agendaGroupValueArray[i];
+ String name = "";
+ List activationsResult = new ArrayList();
+ IVariable[] agendaGroupVarArray = agendaGroup.getVariables();
+ for (int j = 0; j < agendaGroupVarArray.length; j++) {
+ IVariable agendaGroupVar = agendaGroupVarArray[j];
+ if ("name".equals(agendaGroupVar.getName())) {
+ name = agendaGroupVar.getValue().getValueString();
+ break;
+ }
+ }
+ IJavaArray activations = (IJavaArray) DebugUtil.getValueByExpression("return getActivations();", agendaGroup);
+ IJavaValue[] activationArray = activations.getValues();
+ for (int l = 0; l < activationArray.length; l++) {
+ IJavaValue activation = activationArray[l];
+ if (activation.getJavaType() != null) {
+ activationsResult.add(new VariableWrapper("[" + l + "]", activation));
+ }
+ }
+ boolean active = false;
+ if (agendaGroup.equals(focus)) {
+ active = true;
+ }
+ // because the debug view does not handle spaces well, all spaces
+ // in the agenda group name are replaced with '_'s.
+ name = replaceSpaces(name);
+ result.add(new VariableWrapper(name + "[" + (active ? "focus" : "nofocus") + "]",
+ new ObjectWrapper((IJavaObject) agendaGroup,
+ (IJavaVariable[]) activationsResult.toArray(new IJavaVariable[activationsResult.size()]))));
+ }
+ }
+ return result.toArray(new IVariable[0]);
+ }
+
+ private String replaceSpaces(String name) {
+ return name.replace(' ', '_');
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/ApplicationDataView.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/ApplicationDataView.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/ApplicationDataView.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/ApplicationDataView.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,16 @@
+package org.drools.eclipse.debug;
+
+import org.eclipse.jface.viewers.IContentProvider;
+
+/**
+ * The Application Data View.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class ApplicationDataView extends DroolsDebugEventHandlerView {
+
+ protected IContentProvider createContentProvider() {
+ ApplicationDataViewContentProvider contentProvider = new ApplicationDataViewContentProvider(this);
+ return contentProvider;
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/ApplicationDataViewContentProvider.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/ApplicationDataViewContentProvider.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/ApplicationDataViewContentProvider.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/ApplicationDataViewContentProvider.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,85 @@
+package org.drools.eclipse.debug;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaArray;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaValue;
+
+/**
+ * The Application Data View content provider.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class ApplicationDataViewContentProvider extends DroolsDebugViewContentProvider {
+
+ private DroolsDebugEventHandlerView view;
+
+ public ApplicationDataViewContentProvider(DroolsDebugEventHandlerView view) {
+ this.view = view;
+ }
+
+ protected String getEmptyString() {
+ return "The selected working memory has no globals defined.";
+ }
+
+ public Object[] getChildren(Object obj) {
+ try {
+ IVariable[] variables = null;
+ if (obj != null && obj instanceof IJavaObject
+ && "org.drools.reteoo.ReteooWorkingMemory".equals(
+ ((IJavaObject) obj).getReferenceTypeName())) {
+ variables = getApplicationDataElements((IJavaObject) obj);
+ } else if (obj instanceof IVariable) {
+ if (view.isShowLogicalStructure()) {
+ IValue value = getLogicalValue(((IVariable) obj).getValue(), new ArrayList());
+ variables = value.getVariables();
+ }
+ if (variables == null) {
+ variables = ((IVariable) obj).getValue().getVariables();
+ }
+ }
+ if (variables == null) {
+ return new Object[0];
+ } else {
+ cache(obj, variables);
+ return variables;
+ }
+ } catch (DebugException e) {
+ DroolsIDEPlugin.log(e);
+ return new Object[0];
+ }
+ }
+
+ private IVariable[] getApplicationDataElements(IJavaObject stackObj) throws DebugException {
+ IValue objects = DebugUtil.getValueByExpression("return getGlobals().entrySet().toArray();", stackObj);
+ if (objects instanceof IJavaArray) {
+ IJavaArray array = (IJavaArray) objects;
+ List result = new ArrayList();
+ IJavaValue[] javaVals = array.getValues();
+ for ( int i = 0; i < javaVals.length; i++ ) {
+ IJavaValue mapEntry = javaVals[i];
+ String key = null;
+ IJavaValue value = null;
+
+ IVariable[] vars = mapEntry.getVariables();
+ for ( int j = 0; j < vars.length; j++ ) {
+ IVariable var = vars[j];
+ if ("key".equals(var.getName())) {
+ key = var.getValue().getValueString();
+ } else if ("value".equals(var.getName())) {
+ value = (IJavaValue) var.getValue();
+ }
+ }
+ result.add(new VariableWrapper(key, value));
+ }
+ return (IVariable[]) result.toArray(new IVariable[result.size()]);
+ }
+ return null;
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AuditView.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/AuditView.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AuditView.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AuditView.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,339 @@
+package org.drools.eclipse.debug;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.ObjectInputStream;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.audit.event.ActivationLogEvent;
+import org.drools.audit.event.LogEvent;
+import org.drools.audit.event.ObjectLogEvent;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsPluginImages;
+import org.drools.eclipse.debug.actions.DeleteLogAction;
+import org.drools.eclipse.debug.actions.OpenLogAction;
+import org.drools.eclipse.debug.actions.RefreshLogAction;
+import org.drools.eclipse.debug.actions.ShowEventCauseAction;
+import org.eclipse.debug.ui.AbstractDebugView;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IMemento;
+import org.eclipse.ui.IViewSite;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.PartInitException;
+
+import com.thoughtworks.xstream.XStream;
+
+public class AuditView extends AbstractDebugView {
+
+ private static final String LOG_FILE_NAME = "LogFileName";
+ private static final String CAUSE_EVENT_COLOR = "CauseEventColor";
+
+ private String logFileName;
+ private IAction deleteAction;
+ private IAction refreshAction;
+
+ public Viewer createViewer(Composite parent) {
+ final TreeViewer variablesViewer = new TreeViewer(parent);
+ variablesViewer.setContentProvider(new AuditViewContentProvider());
+ variablesViewer.setLabelProvider(new AuditLabelProvider());
+ variablesViewer.setUseHashlookup(true);
+ variablesViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ getViewer().refresh();
+ }
+ });
+ return variablesViewer;
+ }
+
+ public void setLogFile(String logFileName) {
+ this.logFileName = logFileName;
+ refresh();
+ deleteAction.setEnabled(logFileName != null);
+ refreshAction.setEnabled(logFileName != null);
+ }
+
+ public void refresh() {
+ if (logFileName == null) {
+ getViewer().setInput(null);
+ return;
+ }
+ try {
+ XStream xstream = new XStream();
+ // TODO
+ ObjectInputStream in = xstream.createObjectInputStream(
+ new FileReader(logFileName));
+ List logEvents = (List) in.readObject();
+ Iterator iterator = logEvents.iterator();
+ List events = new ArrayList();
+ Event currentBeforeActivationEvent = null;
+ List newActivations = new ArrayList();
+ Map activationMap = new HashMap();
+ Map objectMap = new HashMap();
+ while (iterator.hasNext()) {
+ LogEvent inEvent = (LogEvent) iterator.next();
+ Event event = new Event(inEvent.getType());
+ switch (inEvent.getType()) {
+ case LogEvent.OBJECT_ASSERTED:
+ ObjectLogEvent inObjectEvent = (ObjectLogEvent) inEvent;
+ event.setString("Object asserted (" + inObjectEvent.getFactId() + "): " + inObjectEvent.getObjectToString());
+ if (currentBeforeActivationEvent != null) {
+ currentBeforeActivationEvent.addSubEvent(event);
+ } else {
+ events.add(event);
+ }
+ event.addSubEvents(newActivations);
+ newActivations.clear();
+ objectMap.put(new Long(((ObjectLogEvent) inEvent).getFactId()), event);
+ break;
+ case LogEvent.OBJECT_MODIFIED:
+ inObjectEvent = (ObjectLogEvent) inEvent;
+ event.setString("Object modified (" + inObjectEvent.getFactId() + "): " + inObjectEvent.getObjectToString());
+ if (currentBeforeActivationEvent != null) {
+ currentBeforeActivationEvent.addSubEvent(event);
+ } else {
+ events.add(event);
+ }
+ event.addSubEvents(newActivations);
+ newActivations.clear();
+ Event assertEvent = (Event) objectMap.get(new Long(((ObjectLogEvent) inEvent).getFactId()));
+ if (assertEvent != null) {
+ event.setCauseEvent(assertEvent);
+ }
+ break;
+ case LogEvent.OBJECT_RETRACTED:
+ inObjectEvent = (ObjectLogEvent) inEvent;
+ event.setString("Object retracted (" + inObjectEvent.getFactId() + "): " + inObjectEvent.getObjectToString());
+ if (currentBeforeActivationEvent != null) {
+ currentBeforeActivationEvent.addSubEvent(event);
+ } else {
+ events.add(event);
+ }
+ event.addSubEvents(newActivations);
+ newActivations.clear();
+ assertEvent = (Event) objectMap.get(new Long(((ObjectLogEvent) inEvent).getFactId()));
+ if (assertEvent != null) {
+ event.setCauseEvent(assertEvent);
+ }
+ break;
+ case LogEvent.ACTIVATION_CREATED:
+ ActivationLogEvent inActivationEvent = (ActivationLogEvent) inEvent;
+ event.setString("Activation created: Rule " + inActivationEvent.getRule() + " " + inActivationEvent.getDeclarations());
+ newActivations.add(event);
+ activationMap.put(((ActivationLogEvent) inEvent).getActivationId(), event);
+ break;
+ case LogEvent.ACTIVATION_CANCELLED:
+ inActivationEvent = (ActivationLogEvent) inEvent;
+ event.setString("Activation cancelled: Rule " + inActivationEvent.getRule() + " " + inActivationEvent.getDeclarations());
+ newActivations.add(event);
+ event.setCauseEvent((Event) activationMap.get(((ActivationLogEvent) inEvent).getActivationId()));
+ break;
+ case LogEvent.BEFORE_ACTIVATION_FIRE:
+ inActivationEvent = (ActivationLogEvent) inEvent;
+ event.setString("Activation executed: Rule " + inActivationEvent.getRule() + " " + inActivationEvent.getDeclarations());
+ events.add(event);
+ currentBeforeActivationEvent = event;
+ event.setCauseEvent((Event) activationMap.get(((ActivationLogEvent) inEvent).getActivationId()));
+ break;
+ case LogEvent.AFTER_ACTIVATION_FIRE:
+ currentBeforeActivationEvent = null;
+ break;
+ }
+ }
+ getViewer().setInput(events);
+ // TODO: this is necessary because otherwise, the show cause action
+ // cannot find the cause event if it hasn't been shown yet
+ ((TreeViewer) getViewer()).expandAll();
+ } catch (FileNotFoundException e) {
+ setLogFile(null);
+ getViewer().setInput(null);
+ } catch (Throwable t) {
+ DroolsIDEPlugin.log(t);
+ getViewer().setInput(null);
+ }
+ }
+
+ public void deleteLog() {
+ if (logFileName != null) {
+ File file = new File(logFileName);
+ try {
+ file.delete();
+ // TODO delete file cause this doesn't seem to work
+ setLogFile(null);
+ refresh();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ DroolsIDEPlugin.log(t);
+ }
+ }
+ }
+
+ protected void becomesVisible() {
+ refresh();
+ }
+
+ protected String getHelpContextId() {
+ return null;
+ }
+
+ public Event getSelectedEvent() {
+ ISelection selection = getViewer().getSelection();
+ if (selection instanceof IStructuredSelection) {
+ Object selected = ((IStructuredSelection) selection).getFirstElement();
+ if (selected instanceof Event) {
+ return (Event) selected;
+ }
+ }
+ return null;
+ }
+
+ public void showEvent(Event event) {
+ ((TreeViewer) getViewer()).reveal(event);
+ }
+
+ protected void fillContextMenu(IMenuManager menu) {
+ Event selected = getSelectedEvent();
+ if (selected != null) {
+ Event causeEvent = selected.getCauseEvent();
+ if (causeEvent != null) {
+ menu.add(getAction("ShowEventCause"));
+ }
+ }
+ menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ protected void createActions() {
+ deleteAction = new DeleteLogAction(this);
+ setAction("ClearLog", deleteAction);
+ deleteAction.setEnabled(logFileName != null);
+ refreshAction = new RefreshLogAction(this);
+ setAction("RefreshLog", refreshAction);
+ refreshAction.setEnabled(logFileName != null);
+ IAction action = new OpenLogAction(this);
+ setAction("OpenLog", action);
+ action = new ShowEventCauseAction(this);
+ setAction("ShowEventCause", action);
+ }
+
+ protected void configureToolBar(IToolBarManager tbm) {
+ tbm.add(getAction("OpenLog"));
+ tbm.add(getAction("RefreshLog"));
+ tbm.add(getAction("ClearLog"));
+ }
+
+ public void saveState(IMemento memento) {
+ memento.putString(LOG_FILE_NAME, logFileName);
+ }
+
+ public void init(IViewSite site, IMemento memento) throws PartInitException {
+ super.init(site, memento);
+ if (memento != null) {
+ logFileName = memento.getString(LOG_FILE_NAME);
+ }
+ }
+
+ public class Event {
+
+ private String toString;
+ private int type;
+ private List subEvents = new ArrayList();
+ private Event causeEvent;
+
+ public Event(int type) {
+ this.type = type;
+ }
+
+ public void setString(String toString) {
+ this.toString = toString;
+ }
+
+ public String toString() {
+ return toString;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void addSubEvent(Event subEvent) {
+ subEvents.add(subEvent);
+ }
+
+ public void addSubEvents(Collection subEvents) {
+ this.subEvents.addAll(subEvents);
+ }
+
+ public Object[] getSubEvents() {
+ return subEvents.toArray();
+ }
+
+ public boolean hasSubEvents() {
+ return !subEvents.isEmpty();
+ }
+
+ public void setCauseEvent(Event causeEvent) {
+ this.causeEvent = causeEvent;
+ }
+
+ public Event getCauseEvent() {
+ return causeEvent;
+ }
+ }
+
+ public class AuditLabelProvider extends LabelProvider implements IColorProvider {
+
+ public Color getForeground(Object element) {
+ return null;
+ }
+
+ public Color getBackground(Object element) {
+ Event selected = getSelectedEvent();
+ if (selected != null) {
+ if (element.equals(selected.getCauseEvent())) {
+ Color color = DroolsIDEPlugin.getDefault().getColor(CAUSE_EVENT_COLOR);
+ if (color == null) {
+ color = new Color(getControl().getDisplay(), 0, 255, 0);
+ DroolsIDEPlugin.getDefault().setColor(CAUSE_EVENT_COLOR, color);
+ }
+ return color;
+ }
+ }
+ return null;
+ }
+
+ public Image getImage(Object element) {
+ if (element instanceof Event) {
+ int type = ((Event) element).getType();
+ switch (type) {
+ case LogEvent.OBJECT_ASSERTED: return DroolsPluginImages.getImage(DroolsPluginImages.ASSERT_OBJECT);
+ case LogEvent.OBJECT_MODIFIED: return DroolsPluginImages.getImage(DroolsPluginImages.MODIFY_OBJECT);
+ case LogEvent.OBJECT_RETRACTED: return DroolsPluginImages.getImage(DroolsPluginImages.RETRACT_OBJECT);
+ case LogEvent.ACTIVATION_CREATED: return DroolsPluginImages.getImage(DroolsPluginImages.CREATE_ACTIVATION);
+ case LogEvent.ACTIVATION_CANCELLED: return DroolsPluginImages.getImage(DroolsPluginImages.CANCEL_ACTIVATION);
+ case LogEvent.BEFORE_ACTIVATION_FIRE: return DroolsPluginImages.getImage(DroolsPluginImages.EXECUTE_ACTIVATION);
+ }
+ return null;
+ }
+ return null;
+ }
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AuditViewContentProvider.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/AuditViewContentProvider.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AuditViewContentProvider.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/AuditViewContentProvider.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,29 @@
+package org.drools.eclipse.debug;
+
+import java.util.List;
+
+import org.drools.eclipse.debug.AuditView.Event;
+
+public class AuditViewContentProvider extends DroolsDebugViewContentProvider {
+
+ protected String getEmptyString() {
+ return "The selected audit log is empty.";
+ }
+
+ public Object[] getChildren(Object obj) {
+ if (obj instanceof List) {
+ return ((List) obj).toArray();
+ }
+ if (obj instanceof Event) {
+ return ((Event) obj).getSubEvents();
+ }
+ return new Object[0];
+ }
+
+ public boolean hasChildren(Object obj) {
+ if (obj instanceof Event) {
+ return ((Event) obj).hasSubEvents();
+ }
+ return false;
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/DebugUtil.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/DebugUtil.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/DebugUtil.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/DebugUtil.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,204 @@
+package org.drools.eclipse.debug;
+
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.debug.core.DebugEvent;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.IStatusHandler;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.ISourceLocator;
+import org.eclipse.debug.core.model.IThread;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.sourcelookup.ISourceLookupDirector;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.debug.core.IJavaClassType;
+import org.eclipse.jdt.debug.core.IJavaDebugTarget;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaReferenceType;
+import org.eclipse.jdt.debug.core.IJavaStackFrame;
+import org.eclipse.jdt.debug.core.IJavaThread;
+import org.eclipse.jdt.debug.core.IJavaType;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.eval.IAstEvaluationEngine;
+import org.eclipse.jdt.debug.eval.ICompiledExpression;
+import org.eclipse.jdt.debug.eval.IEvaluationListener;
+import org.eclipse.jdt.debug.eval.IEvaluationResult;
+import org.eclipse.jdt.internal.debug.core.JDIDebugPlugin;
+
+public class DebugUtil {
+
+ public static final int INFO_EVALUATION_STACK_FRAME = 111;
+ private static IStatus fgNeedStackFrame = new Status(IStatus.INFO,
+ DroolsIDEPlugin.getUniqueIdentifier(), INFO_EVALUATION_STACK_FRAME,
+ "Provides thread context for an evaluation", null);
+ private static IStatusHandler fgStackFrameProvider;
+
+ public static IValue getValueByExpression(String expression, IValue value) {
+ if (!(value instanceof IJavaObject)) {
+ return null;
+ }
+ IJavaObject javaValue = (IJavaObject) value;
+ try {
+ IJavaType type = javaValue.getJavaType();
+ if (!(type instanceof IJavaClassType)) {
+ return null;
+ }
+ IJavaStackFrame stackFrame = getStackFrame(javaValue);
+ if (stackFrame == null) {
+ return null;
+ }
+
+ // find the project the snippets will be compiled in.
+ ISourceLocator locator= javaValue.getLaunch().getSourceLocator();
+ Object sourceElement= null;
+ if (locator instanceof ISourceLookupDirector) {
+ String[] sourcePaths = ((IJavaClassType) type).getSourcePaths(null);
+ if (sourcePaths != null && sourcePaths.length > 0) {
+ sourceElement = ((ISourceLookupDirector) locator).getSourceElement(sourcePaths[0]);
+ }
+ if (!(sourceElement instanceof IJavaElement) && sourceElement instanceof IAdaptable) {
+ sourceElement = ((IAdaptable) sourceElement).getAdapter(IJavaElement.class);
+ }
+ }
+ if (sourceElement == null) {
+ sourceElement = locator.getSourceElement(stackFrame);
+ if (!(sourceElement instanceof IJavaElement) && sourceElement instanceof IAdaptable) {
+ Object newSourceElement = ((IAdaptable) sourceElement).getAdapter(IJavaElement.class);
+ // if the source is a drl during the execution of the rule
+ if (newSourceElement != null) {
+ sourceElement = newSourceElement;
+ }
+ }
+ }
+ IJavaProject project = null;
+ if (sourceElement instanceof IJavaElement) {
+ project = ((IJavaElement) sourceElement).getJavaProject();
+ } else if (sourceElement instanceof IResource) {
+ IJavaProject resourceProject = JavaCore.create(((IResource) sourceElement).getProject());
+ if (resourceProject.exists()) {
+ project = resourceProject;
+ }
+ }
+ if (project == null) {
+ return null;
+ }
+
+ IAstEvaluationEngine evaluationEngine = JDIDebugPlugin.getDefault()
+ .getEvaluationEngine(project,
+ (IJavaDebugTarget) stackFrame.getDebugTarget());
+
+ EvaluationBlock evaluationBlock = new EvaluationBlock(javaValue,
+ (IJavaReferenceType) type, (IJavaThread) stackFrame.getThread(),
+ evaluationEngine);
+ return evaluationBlock.evaluate(expression);
+
+ } catch (CoreException e) {
+ DroolsIDEPlugin.log(e);
+ }
+ return null;
+ }
+
+ /**
+ * Return the current stack frame context, or a valid stack frame for the
+ * given value.
+ */
+ private static IJavaStackFrame getStackFrame(IValue value)
+ throws CoreException {
+ IStatusHandler handler = getStackFrameProvider();
+ if (handler != null) {
+ IJavaStackFrame stackFrame = (IJavaStackFrame) handler
+ .handleStatus(fgNeedStackFrame, value);
+ if (stackFrame != null) {
+ return stackFrame;
+ }
+ }
+ IDebugTarget target = value.getDebugTarget();
+ IJavaDebugTarget javaTarget = (IJavaDebugTarget) target
+ .getAdapter(IJavaDebugTarget.class);
+ if (javaTarget != null) {
+ IThread[] threads = javaTarget.getThreads();
+ for (int i = 0; i < threads.length; i++) {
+ IThread thread = threads[i];
+ if (thread.isSuspended()) {
+ return (IJavaStackFrame) thread.getTopStackFrame();
+ }
+ }
+ }
+ return null;
+ }
+
+ private static IStatusHandler getStackFrameProvider() {
+ if (fgStackFrameProvider == null) {
+ fgStackFrameProvider = DebugPlugin.getDefault().getStatusHandler(
+ fgNeedStackFrame);
+ }
+ return fgStackFrameProvider;
+ }
+
+ private static class EvaluationBlock implements IEvaluationListener {
+
+ private IJavaObject fEvaluationValue;
+ private IJavaReferenceType fEvaluationType;
+ private IJavaThread fThread;
+ private IAstEvaluationEngine fEvaluationEngine;
+ private IEvaluationResult fResult;
+
+ public EvaluationBlock(IJavaObject value, IJavaReferenceType type,
+ IJavaThread thread, IAstEvaluationEngine evaluationEngine) {
+ fEvaluationValue = value;
+ fEvaluationType = type;
+ fThread = thread;
+ fEvaluationEngine = evaluationEngine;
+ }
+
+ public void evaluationComplete(IEvaluationResult result) {
+ synchronized (this) {
+ fResult = result;
+ this.notify();
+ }
+ }
+
+ public IJavaValue evaluate(String snippet) throws DebugException {
+ ICompiledExpression compiledExpression = fEvaluationEngine
+ .getCompiledExpression(snippet, fEvaluationType);
+ if (compiledExpression.hasErrors()) {
+ String[] errorMessages = compiledExpression.getErrorMessages();
+ String message = "";
+
+ for ( int i = 0; i < errorMessages.length; i++ ) {
+ message += errorMessages[i] + "\n";
+ }
+ throw new DebugException(new Status(IStatus.ERROR,
+ DroolsIDEPlugin.PLUGIN_ID, DroolsIDEPlugin.INTERNAL_ERROR,
+ "Error when compiling snippet " + snippet + ": " + message, null));
+ }
+ fResult = null;
+ fEvaluationEngine.evaluateExpression(compiledExpression,
+ fEvaluationValue, fThread, this,
+ DebugEvent.EVALUATION_IMPLICIT, false);
+ synchronized (this) {
+ if (fResult == null) {
+ try {
+ this.wait();
+ } catch (InterruptedException e) {
+ }
+ }
+ }
+ if (fResult == null) {
+ return null;
+ }
+ if (fResult.hasErrors()) {
+ return null;
+ }
+ return fResult.getValue();
+ }
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/DroolsDebugEventHandlerView.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/DroolsDebugEventHandlerView.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/DroolsDebugEventHandlerView.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/DroolsDebugEventHandlerView.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,267 @@
+package org.drools.eclipse.debug;
+
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.debug.actions.ShowLogicalStructureAction;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.debug.internal.ui.VariablesViewModelPresentation;
+import org.eclipse.debug.internal.ui.contexts.DebugContextManager;
+import org.eclipse.debug.internal.ui.contexts.provisional.IDebugContextListener;
+import org.eclipse.debug.ui.AbstractDebugView;
+import org.eclipse.debug.ui.IDebugModelPresentation;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaStackFrame;
+import org.eclipse.jdt.debug.core.IJavaThread;
+import org.eclipse.jface.action.GroupMarker;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.IColorProvider;
+import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.IWorkbenchActionConstants;
+import org.eclipse.ui.IWorkbenchPart;
+
+/**
+ * A generic Drools debug view.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public abstract class DroolsDebugEventHandlerView extends AbstractDebugView implements IDebugContextListener, ISelectionListener {
+
+ private VariablesViewModelPresentation modelPresentation;
+ private boolean showLogical = true;
+
+ public void dispose() {
+ DebugContextManager.getDefault().removeDebugContextListener(this, getSite().getWorkbenchWindow());
+ getSite().getPage().removeSelectionListener(IDebugUIConstants.ID_VARIABLE_VIEW, this);
+ super.dispose();
+ }
+
+ public boolean isShowLogicalStructure() {
+ return showLogical;
+ }
+
+ public void setShowLogicalStructure(boolean showLogical) {
+ this.showLogical = showLogical;
+ }
+
+ protected void setViewerInput(Object context) {
+ Object input = null;
+
+ // if a working memory has been expressively selected as variable, use this
+ if (context instanceof IVariable) {
+ IVariable variable = (IVariable) context;
+ try {
+ IValue value = ((IVariable) context).getValue();
+ if (value != null && value instanceof IJavaObject
+ && "org.drools.reteoo.ReteooWorkingMemory".equals(
+ variable.getValue().getReferenceTypeName())) {
+ input = value;
+ }
+ } catch (Throwable t) {
+ DroolsIDEPlugin.log(t);
+ }
+ }
+ // else get selected thread and determine if any of the stack frames
+ // is executing in a working memory, if so, use that one
+ if (input == null) {
+ ISelection stackSelection = DebugContextManager.getDefault().getActiveContext(getSite().getWorkbenchWindow());
+ if (stackSelection instanceof IStructuredSelection) {
+ Object selection = ((IStructuredSelection) stackSelection).getFirstElement();
+ if (selection instanceof IJavaStackFrame) {
+ try {
+ IJavaThread thread = (IJavaThread) ((IJavaStackFrame) selection).getThread();
+ IStackFrame[] frames = thread.getStackFrames();
+ for (int i = 0; i < frames.length; i++) {
+ IJavaObject stackObj = ((IJavaStackFrame) frames[i]).getThis();
+ if ((stackObj != null)
+ && (stackObj.getJavaType() != null)
+ && ("org.drools.reteoo.ReteooWorkingMemory".equals(
+ stackObj.getJavaType().getName()))) {
+ input = stackObj;
+ break;
+ }
+ }
+ } catch (Throwable t) {
+ DroolsIDEPlugin.log(t);
+ }
+ }
+ }
+ }
+
+ Object current = getViewer().getInput();
+
+ if (current == null && input == null) {
+ return;
+ }
+
+ Object[] expandedElements = ((TreeViewer) getViewer()).getExpandedElements();
+ getViewer().setInput(input);
+ if (input != null) {
+ ((TreeViewer) getViewer()).setExpandedElements(expandedElements);
+ ((TreeViewer) getViewer()).expandToLevel(getAutoExpandLevel());
+ }
+ }
+
+ protected Viewer createViewer(Composite parent) {
+ TreeViewer variablesViewer = new TreeViewer(parent);
+ variablesViewer.setContentProvider(createContentProvider());
+ variablesViewer.setLabelProvider(new VariablesViewLabelProvider(
+ getModelPresentation()));
+ variablesViewer.setUseHashlookup(true);
+ DebugContextManager.getDefault().addDebugContextListener(this, getSite().getWorkbenchWindow());
+ getSite().getPage().addSelectionListener(IDebugUIConstants.ID_VARIABLE_VIEW, this);
+ return variablesViewer;
+ }
+
+ protected int getAutoExpandLevel() {
+ return 0;
+ }
+
+ protected abstract IContentProvider createContentProvider();
+
+ protected String getHelpContextId() {
+ return null;
+ }
+
+ protected void becomesHidden() {
+ setViewerInput(null);
+ super.becomesHidden();
+ }
+
+ protected void becomesVisible() {
+ super.becomesVisible();
+ ISelection selection = getSite().getPage().getSelection(
+ IDebugUIConstants.ID_VARIABLE_VIEW);
+ if (selection instanceof IStructuredSelection) {
+ setViewerInput(((IStructuredSelection) selection).getFirstElement());
+ }
+ }
+
+ protected void createActions() {
+ IAction action = new ShowLogicalStructureAction(this);
+ setAction("ShowLogicalStructure", action);
+ }
+
+ protected void configureToolBar(IToolBarManager tbm) {
+ tbm.add(getAction("ShowLogicalStructure"));
+ }
+
+ protected void fillContextMenu(IMenuManager menu) {
+ menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
+ }
+
+ public void contextActivated(ISelection selection, IWorkbenchPart part) {
+ if (!isAvailable() || !isVisible()) {
+ return;
+ }
+
+ if (selection instanceof IStructuredSelection) {
+ setViewerInput(((IStructuredSelection)selection).getFirstElement());
+ }
+ showViewer();
+ }
+
+ public void contextChanged(ISelection selection, IWorkbenchPart part) {
+ }
+
+ public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+ if (!isAvailable()) {
+ return;
+ }
+ if (selection == null) {
+ setViewerInput(null);
+ } else if (selection instanceof IStructuredSelection) {
+ setViewerInput(((IStructuredSelection) selection).getFirstElement());
+ }
+ }
+
+ protected void initActionState(IAction action) {
+ // The show logical structure action is always enabled by default
+ // when (re)starting the view
+ String id = action.getId();
+ if (id.endsWith("ShowLogicalStructureAction")) {
+ action.setChecked(true);
+ } else {
+ super.initActionState(action);
+ }
+ }
+
+ protected IDebugModelPresentation getModelPresentation() {
+ if (modelPresentation == null) {
+ modelPresentation = new VariablesViewModelPresentation();
+ }
+ return modelPresentation;
+ }
+
+ private class VariablesViewLabelProvider implements ILabelProvider, IColorProvider {
+
+ private IDebugModelPresentation presentation;
+
+ public VariablesViewLabelProvider(IDebugModelPresentation presentation) {
+ this.presentation = presentation;
+ }
+
+ public IDebugModelPresentation getPresentation() {
+ return presentation;
+ }
+
+ public Image getImage(Object element) {
+ return presentation.getImage(element);
+ }
+
+ public String getText(Object element) {
+ return presentation.getText(element);
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+ presentation.addListener(listener);
+ }
+
+ public void dispose() {
+ presentation.dispose();
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return presentation.isLabelProperty(element, property);
+ }
+
+ public void removeListener(ILabelProviderListener listener) {
+ presentation.removeListener(listener);
+ }
+
+ public Color getForeground(Object element) {
+ if (element instanceof IVariable) {
+ IVariable variable = (IVariable) element;
+ try {
+ if (variable.hasValueChanged()) {
+ return JFaceResources.getColorRegistry()
+ .get(IDebugUIConstants.PREF_CHANGED_DEBUG_ELEMENT_COLOR);
+ }
+ } catch (DebugException e) {
+ DroolsIDEPlugin.log(e);
+ }
+ }
+ return null;
+ }
+
+ public Color getBackground(Object element) {
+ return null;
+ }
+
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/DroolsDebugViewContentProvider.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/DroolsDebugViewContentProvider.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/DroolsDebugViewContentProvider.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/DroolsDebugViewContentProvider.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,140 @@
+package org.drools.eclipse.debug;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILogicalStructureType;
+import org.eclipse.debug.core.model.IStackFrame;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * A generic Drools debug view content provider.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class DroolsDebugViewContentProvider implements ITreeContentProvider {
+
+ private Map parentCache;
+
+ public DroolsDebugViewContentProvider() {
+ parentCache = new HashMap(10);
+ }
+
+ public Object[] getChildren(Object parent) {
+ return null;
+ }
+
+ public Object[] getElements(Object parent) {
+ Object[] result = getChildren(parent);
+ if (result != null && result.length == 0) {
+ return new Object[] { getEmptyString() };
+ }
+ return result;
+ }
+
+ protected String getEmptyString() {
+ return "Empty";
+ }
+
+ protected void cache(Object parent, Object[] children) {
+ for (int i = 0; i < children.length; i++) {
+ parentCache.put(children[i], parent);
+ }
+ }
+
+ public Object getParent(Object item) {
+ return parentCache.get(item);
+ }
+
+ public void dispose() {
+ parentCache= null;
+ }
+
+ protected void clearCache() {
+ if (parentCache != null) {
+ parentCache.clear();
+ }
+ }
+
+ public void removeCache(Object[] children) {
+ if (parentCache == null) {
+ return;
+ }
+ for (int i = 0; i < children.length; i++) {
+ parentCache.remove(children[i]);
+ }
+ }
+
+ public boolean hasChildren(Object element) {
+ try {
+ if (element instanceof IVariable) {
+ IValue v = ((IVariable)element).getValue();
+ return v != null && v.hasVariables();
+ }
+ if (element instanceof IValue) {
+ return ((IValue)element).hasVariables();
+ }
+ if (element instanceof IStackFrame) {
+ return ((IStackFrame)element).hasVariables();
+ }
+ } catch (DebugException e) {
+ DroolsIDEPlugin.log(e);
+ return false;
+ }
+ return false;
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ clearCache();
+ }
+
+ public List getCachedDecendants(Object parent) {
+ Iterator children = parentCache.keySet().iterator();
+ List cachedChildren = new ArrayList(10);
+ while (children.hasNext()) {
+ Object child = children.next();
+ if (isCachedDecendant(child, parent)) {
+ cachedChildren.add(child);
+ }
+ }
+ return cachedChildren;
+ }
+
+ protected boolean isCachedDecendant(Object child, Object parent) {
+ Object p = getParent(child);
+ while (p != null) {
+ if (p.equals(parent)) {
+ return true;
+ }
+ p = getParent(p);
+ }
+ return false;
+ }
+
+ protected IValue getLogicalValue(IValue value, List previousStructureIds) {
+ ILogicalStructureType[] types = DebugPlugin.getLogicalStructureTypes(value);
+ if (types.length > 0) {
+ ILogicalStructureType type = DebugPlugin.getDefaultStructureType(types);
+ if (type != null && !previousStructureIds.contains(type.getId())) {
+ try {
+ value = type.getLogicalStructure(value);
+ previousStructureIds.add(type.getId());
+ return getLogicalValue(value, previousStructureIds);
+ } catch (CoreException e) {
+ // unable to display logical structure
+ }
+ }
+ }
+ return value;
+ }
+}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/ObjectWrapper.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/ObjectWrapper.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/ObjectWrapper.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/ObjectWrapper.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,100 @@
+package org.drools.eclipse.debug;
+
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaFieldVariable;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaThread;
+import org.eclipse.jdt.debug.core.IJavaType;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
+
+/**
+ * Creates a IJavaObject from an IJavaObject and given variables.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class ObjectWrapper implements IJavaObject {
+
+ private IJavaObject object;
+ private IJavaVariable[] variables;
+
+ public ObjectWrapper(IJavaObject object, IJavaVariable[] variables) {
+ this.object = object;
+ this.variables = variables;
+ }
+
+ public IJavaValue sendMessage(String selector, String signature, IJavaValue[] args, IJavaThread thread, boolean superSend) throws DebugException {
+ return object.sendMessage(selector, signature, args, thread, superSend);
+ }
+
+ public IJavaValue sendMessage(String selector, String signature, IJavaValue[] args, IJavaThread thread, String typeSignature) throws DebugException {
+ return object.sendMessage(selector, signature, args, thread, typeSignature);
+ }
+
+ public IJavaFieldVariable getField(String name, boolean superField) throws DebugException {
+ return object.getField(name, superField);
+ }
+
+ public IJavaFieldVariable getField(String name, String typeSignature) throws DebugException {
+ return object.getField(name, typeSignature);
+ }
+
+ public String getSignature() throws DebugException {
+ return object.getSignature();
+ }
+
+ public String getGenericSignature() throws DebugException {
+ return object.getGenericSignature();
+ }
+
+ public IJavaType getJavaType() throws DebugException {
+ return object.getJavaType();
+ }
+
+ public String getReferenceTypeName() throws DebugException {
+ return object.getReferenceTypeName();
+ }
+
+ public String getValueString() throws DebugException {
+ return object.getValueString();
+ }
+
+ public boolean isAllocated() throws DebugException {
+ return object.isAllocated();
+ }
+
+ public IVariable[] getVariables() {
+ return variables;
+ }
+
+ public boolean hasVariables() {
+ return variables.length > 0;
+ }
+
+ public String getModelIdentifier() {
+ return object.getModelIdentifier();
+ }
+
+ public IDebugTarget getDebugTarget() {
+ return object.getDebugTarget();
+ }
+
+ public ILaunch getLaunch() {
+ return object.getLaunch();
+ }
+
+ public Object getAdapter(Class adapter) {
+ return object.getAdapter(adapter);
+ }
+
+ public IJavaThread[] getWaitingThreads() throws DebugException {
+ return null;
+ }
+
+ public IJavaThread getOwningThread() throws DebugException {
+ return null;
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/VariableWrapper.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/VariableWrapper.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/VariableWrapper.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/VariableWrapper.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,138 @@
+package org.drools.eclipse.debug;
+
+import org.eclipse.core.runtime.PlatformObject;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.jdt.debug.core.IJavaModifiers;
+import org.eclipse.jdt.debug.core.IJavaType;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
+
+/**
+ * Creates a Variable from an IValue and a given name.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class VariableWrapper extends PlatformObject implements IJavaVariable {
+
+ private String name;
+ private IJavaValue value;
+
+ public VariableWrapper(String name, IJavaValue value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getSignature() throws DebugException {
+ return ((IJavaValue) getValue()).getSignature();
+ }
+
+ public String getGenericSignature() throws DebugException {
+ return ((IJavaValue) getValue()).getGenericSignature();
+ }
+
+ public IJavaType getJavaType() throws DebugException {
+ return ((IJavaValue) getValue()).getJavaType();
+ }
+
+ public boolean isLocal() {
+ return false;
+ }
+
+ public IValue getValue() {
+ return value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getReferenceTypeName() throws DebugException {
+ return ((IJavaValue) getValue()).getReferenceTypeName();
+ }
+
+ public boolean hasValueChanged() {
+ return false;
+ }
+
+ public boolean isPublic() {
+ return false;
+ }
+
+ public boolean isPrivate() {
+ return false;
+ }
+
+ public boolean isProtected() {
+ return false;
+ }
+
+ public boolean isPackagePrivate() {
+ return false;
+ }
+
+ public boolean isFinal() {
+ return false;
+ }
+
+ public boolean isStatic() {
+ return false;
+ }
+
+ public boolean isSynthetic() {
+ return false;
+ }
+
+ public String getModelIdentifier() {
+ return getValue().getModelIdentifier();
+ }
+
+ public IDebugTarget getDebugTarget() {
+ return ((IJavaValue) getValue()).getDebugTarget();
+ }
+
+ public ILaunch getLaunch() {
+ return getValue().getLaunch();
+ }
+
+ public void setValue(String expression) {
+ }
+
+ public void setValue(IValue value) {
+ }
+
+ public boolean supportsValueModification() {
+ return false;
+ }
+
+ public boolean verifyValue(String expression) {
+ return false;
+ }
+
+ public boolean verifyValue(IValue value) {
+ return false;
+ }
+
+ public Object getAdapter(Class adapter) {
+ if (IJavaVariable.class.equals(adapter) ||
+ IJavaModifiers.class.equals(adapter)) {
+ return this;
+ }
+ return super.getAdapter(adapter);
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof VariableWrapper) {
+ VariableWrapper var = (VariableWrapper) obj;
+ return var.getName().equals(getName()) && var.getValue().equals(getValue());
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ return name.hashCode() + value.hashCode();
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/WorkingMemoryView.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/WorkingMemoryView.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/WorkingMemoryView.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/WorkingMemoryView.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,16 @@
+package org.drools.eclipse.debug;
+
+import org.eclipse.jface.viewers.IContentProvider;
+
+/**
+ * The Working Memory view.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class WorkingMemoryView extends DroolsDebugEventHandlerView {
+
+ protected IContentProvider createContentProvider() {
+ WorkingMemoryViewContentProvider contentProvider = new WorkingMemoryViewContentProvider(this);
+ return contentProvider;
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/WorkingMemoryViewContentProvider.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/WorkingMemoryViewContentProvider.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/WorkingMemoryViewContentProvider.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/WorkingMemoryViewContentProvider.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,203 @@
+package org.drools.eclipse.debug;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.model.IDebugTarget;
+import org.eclipse.debug.core.model.IValue;
+import org.eclipse.debug.core.model.IVariable;
+import org.eclipse.jdt.debug.core.IJavaArray;
+import org.eclipse.jdt.debug.core.IJavaModifiers;
+import org.eclipse.jdt.debug.core.IJavaObject;
+import org.eclipse.jdt.debug.core.IJavaType;
+import org.eclipse.jdt.debug.core.IJavaValue;
+import org.eclipse.jdt.debug.core.IJavaVariable;
+
+/**
+ * The Working Memory view content provider.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
+ */
+public class WorkingMemoryViewContentProvider extends DroolsDebugViewContentProvider {
+
+ private DroolsDebugEventHandlerView view;
+
+ public WorkingMemoryViewContentProvider(DroolsDebugEventHandlerView view) {
+ this.view = view;
+ }
+
+ protected String getEmptyString() {
+ return "The selected working memory is empty.";
+ }
+
+ public Object[] getChildren(Object obj) {
+ try {
+ IVariable[] variables = null;
+ if (obj != null && obj instanceof IJavaObject
+ && "org.drools.reteoo.ReteooWorkingMemory".equals(
+ ((IJavaObject) obj).getReferenceTypeName())) {
+ variables = getWorkingMemoryElements((IJavaObject) obj);
+ } else if (obj instanceof IVariable) {
+ if (view.isShowLogicalStructure()) {
+ IValue value = getLogicalValue(((IVariable) obj).getValue(), new ArrayList());
+ variables = value.getVariables();
+ }
+ if (variables == null) {
+ variables = ((IVariable) obj).getValue().getVariables();
+ }
+ }
+ if (variables == null) {
+ return new Object[0];
+ } else {
+ cache(obj, variables);
+ return variables;
+ }
+ } catch (DebugException e) {
+ DroolsIDEPlugin.log(e);
+ return new Object[0];
+ }
+ }
+
+ private IVariable[] getWorkingMemoryElements(IJavaObject stackObj) throws DebugException {
+ IValue objects = DebugUtil.getValueByExpression("return getObjects().toArray();", stackObj);
+ if (objects instanceof IJavaArray) {
+ IJavaArray array = (IJavaArray) objects;
+ List result = new ArrayList();
+
+ IJavaValue[] vals = array.getValues();
+
+ for ( int i = 0; i < vals.length; i++ ) {
+ result.add(new MyJavaVariable("[" + i + "]", vals[i]));
+ }
+
+
+ return (IVariable[]) result.toArray(new IVariable[0]);
+ }
+ return null;
+ }
+
+ public class MyJavaVariable implements IJavaVariable {
+
+ private String name;
+ private IJavaValue value;
+
+ public MyJavaVariable(String name, IJavaValue value) {
+ this.name = name;
+ this.value = value;
+ }
+
+ public String getSignature() throws DebugException {
+ return ((IJavaValue)getValue()).getSignature();
+ }
+
+ public String getGenericSignature() throws DebugException {
+ return ((IJavaValue)getValue()).getGenericSignature();
+ }
+
+ public IJavaType getJavaType() throws DebugException {
+ return ((IJavaValue)getValue()).getJavaType();
+ }
+
+ public boolean isLocal() {
+ return false;
+ }
+
+ public IValue getValue() {
+ return value;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getReferenceTypeName() throws DebugException {
+ return ((IJavaValue) getValue()).getReferenceTypeName();
+ }
+
+ public boolean hasValueChanged() {
+ return false;
+ }
+
+ public boolean isPublic() {
+ return false;
+ }
+
+ public boolean isPrivate() {
+ return false;
+ }
+
+ public boolean isProtected() {
+ return false;
+ }
+
+ public boolean isPackagePrivate() {
+ return false;
+ }
+
+ public boolean isFinal() {
+ return false;
+ }
+
+ public boolean isStatic() {
+ return false;
+ }
+
+ public boolean isSynthetic() {
+ return false;
+ }
+
+ public String getModelIdentifier() {
+ return getValue().getModelIdentifier();
+ }
+
+ public IDebugTarget getDebugTarget() {
+ return ((IJavaValue)getValue()).getDebugTarget();
+ }
+
+ public ILaunch getLaunch() {
+ return getValue().getLaunch();
+ }
+
+ public void setValue(String expression) {
+ }
+
+ public void setValue(IValue value) {
+ }
+
+ public boolean supportsValueModification() {
+ return false;
+ }
+
+ public boolean verifyValue(String expression) {
+ return false;
+ }
+
+ public boolean verifyValue(IValue value) {
+ return false;
+ }
+
+ public Object getAdapter(Class adapter) {
+ if (IJavaVariable.class.equals(adapter) ||
+ IJavaModifiers.class.equals(adapter)) {
+ return this;
+ }
+ return null;
+ }
+
+ public boolean equals(Object obj) {
+ if (obj instanceof MyJavaVariable) {
+ MyJavaVariable var = (MyJavaVariable) obj;
+ return var.getName().equals(getName()) && var.getValue().equals(getValue());
+ }
+ return false;
+ }
+
+ public int hashCode() {
+ return name.hashCode() + value.hashCode();
+ }
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/actions)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/DeleteLogAction.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/actions/DeleteLogAction.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/DeleteLogAction.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,9 +1,9 @@
-package org.drools.ide.debug.actions;
+package org.drools.eclipse.debug.actions;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.DroolsPluginImages;
-import org.drools.ide.debug.AuditView;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsPluginImages;
+import org.drools.eclipse.debug.AuditView;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.swt.custom.BusyIndicator;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/OpenLogAction.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/actions/OpenLogAction.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/OpenLogAction.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,9 +1,9 @@
-package org.drools.ide.debug.actions;
+package org.drools.eclipse.debug.actions;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.DroolsPluginImages;
-import org.drools.ide.debug.AuditView;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsPluginImages;
+import org.drools.eclipse.debug.AuditView;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.swt.custom.BusyIndicator;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/RefreshLogAction.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/actions/RefreshLogAction.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/RefreshLogAction.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,9 +1,9 @@
-package org.drools.ide.debug.actions;
+package org.drools.eclipse.debug.actions;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.DroolsPluginImages;
-import org.drools.ide.debug.AuditView;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsPluginImages;
+import org.drools.eclipse.debug.AuditView;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.swt.custom.BusyIndicator;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/ShowEventCauseAction.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/actions/ShowEventCauseAction.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/ShowEventCauseAction.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,9 +1,9 @@
-package org.drools.ide.debug.actions;
+package org.drools.eclipse.debug.actions;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.debug.AuditView;
-import org.drools.ide.debug.AuditView.Event;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.debug.AuditView;
+import org.drools.eclipse.debug.AuditView.Event;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/ShowLogicalStructureAction.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/actions/ShowLogicalStructureAction.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/actions/ShowLogicalStructureAction.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,9 +1,9 @@
-package org.drools.ide.debug.actions;
+package org.drools.eclipse.debug.actions;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.DroolsPluginImages;
-import org.drools.ide.debug.DroolsDebugEventHandlerView;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsPluginImages;
+import org.drools.eclipse.debug.DroolsDebugEventHandlerView;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.swt.custom.BusyIndicator;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/core)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugModel.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/core/DroolsDebugModel.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugModel.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,6 +1,6 @@
-package org.drools.ide.debug.core;
+package org.drools.eclipse.debug.core;
-import org.drools.ide.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsIDEPlugin;
import org.eclipse.core.resources.IWorkspaceRunnable;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugModelPresentation.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/core/DroolsDebugModelPresentation.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugModelPresentation.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.debug.core;
+package org.drools.eclipse.debug.core;
import org.eclipse.debug.core.model.IBreakpoint;
import org.eclipse.jdt.internal.debug.ui.JDIModelPresentation;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugTarget.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/core/DroolsDebugTarget.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsDebugTarget.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,11 +1,11 @@
-package org.drools.ide.debug.core;
+package org.drools.eclipse.debug.core;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.drools.ide.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsIDEPlugin;
import org.eclipse.core.resources.IMarkerDelta;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.debug.core.DebugEvent;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsLineBreakpoint.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/core/DroolsLineBreakpoint.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsLineBreakpoint.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,12 +1,12 @@
-package org.drools.ide.debug.core;
+package org.drools.eclipse.debug.core;
import java.util.HashMap;
import java.util.Map;
-import org.drools.ide.DRLInfo;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.DRLInfo.FunctionInfo;
-import org.drools.ide.DRLInfo.RuleInfo;
+import org.drools.eclipse.DRLInfo;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.DRLInfo.FunctionInfo;
+import org.drools.eclipse.DRLInfo.RuleInfo;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsLineBreakpointMarkerUpdater.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/core/DroolsLineBreakpointMarkerUpdater.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsLineBreakpointMarkerUpdater.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,6 +1,6 @@
-package org.drools.ide.debug.core;
+package org.drools.eclipse.debug.core;
-import org.drools.ide.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsIDEPlugin;
import org.eclipse.core.resources.IMarker;
import org.eclipse.jface.text.IDocument;
import org.eclipse.jface.text.Position;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsLocalVariable.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/core/DroolsLocalVariable.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsLocalVariable.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.debug.core;
+package org.drools.eclipse.debug.core;
import org.eclipse.jdt.internal.debug.core.model.JDILocalVariable;
import org.eclipse.jdt.internal.debug.core.model.JDIStackFrame;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsStackFrame.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/core/DroolsStackFrame.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsStackFrame.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.debug.core;
+package org.drools.eclipse.debug.core;
import java.util.ArrayList;
import java.util.Collections;
@@ -6,9 +6,9 @@
import java.util.Iterator;
import java.util.List;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.DRLInfo.FunctionInfo;
-import org.drools.ide.DRLInfo.RuleInfo;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.DRLInfo.FunctionInfo;
+import org.drools.eclipse.DRLInfo.RuleInfo;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.DebugEvent;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsThisVariable.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/core/DroolsThisVariable.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsThisVariable.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.debug.core;
+package org.drools.eclipse.debug.core;
import org.eclipse.jdt.internal.debug.core.model.JDIDebugTarget;
import org.eclipse.jdt.internal.debug.core.model.JDIThisVariable;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/core/DroolsThread.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/DroolsThread.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.debug.core;
+package org.drools.eclipse.debug.core;
import java.text.MessageFormat;
import java.util.ArrayList;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/IDroolsDebugConstants.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/debug/core/IDroolsDebugConstants.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/debug/core/IDroolsDebugConstants.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,10 +1,10 @@
-package org.drools.ide.debug.core;
+package org.drools.eclipse.debug.core;
public interface IDroolsDebugConstants {
- String ID_DROOLS_DEBUG_MODEL = "org.drools.ide.debug";
- String DROOLS_MARKER_TYPE = "org.drools.ide.droolsBreakpointMarker";
+ String ID_DROOLS_DEBUG_MODEL = "org.drools.eclipse.debug";
+ String DROOLS_MARKER_TYPE = "org.drools.eclipse.droolsBreakpointMarker";
String DRL_LINE_NUMBER = "Drools_DRL_LineNumber";
- String LAUNCH_CONFIGURATION_TYPE = "org.drools.ide.launching.DroolsLaunchConfigurationDelegate";
+ String LAUNCH_CONFIGURATION_TYPE = "org.drools.eclipse.launching.DroolsLaunchConfigurationDelegate";
}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/dsl/editor)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/DSLContentProvider.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/dsl/editor/DSLContentProvider.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/DSLContentProvider.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.dsl.editor;
+package org.drools.eclipse.dsl.editor;
import org.drools.lang.dsl.DSLMappingEntry;
import org.eclipse.jface.viewers.IStructuredContentProvider;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/DSLEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/dsl/editor/DSLEditor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/DSLEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.dsl.editor;
+package org.drools.eclipse.dsl.editor;
import java.io.File;
import java.io.FileWriter;
@@ -9,8 +9,8 @@
import java.util.Iterator;
import java.util.List;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.builder.IDroolsModelMarker;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.builder.IDroolsModelMarker;
import org.drools.lang.dsl.DSLMappingEntry;
import org.drools.lang.dsl.DSLMappingFile;
import org.drools.lang.dsl.DefaultDSLMappingEntry;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/DSLLabelProvider.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/dsl/editor/DSLLabelProvider.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/DSLLabelProvider.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.dsl.editor;
+package org.drools.eclipse.dsl.editor;
import org.drools.lang.dsl.DSLMappingEntry;
import org.eclipse.jface.viewers.ITableLabelProvider;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/DSLMappingSorter.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/dsl/editor/DSLMappingSorter.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/DSLMappingSorter.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.dsl.editor;
+package org.drools.eclipse.dsl.editor;
import org.drools.lang.dsl.DSLMappingEntry;
import org.eclipse.jface.viewers.Viewer;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/IMappingListViewer.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/dsl/editor/IMappingListViewer.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/IMappingListViewer.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.dsl.editor;
+package org.drools.eclipse.dsl.editor;
import org.drools.lang.dsl.DSLMappingEntry;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/MappingEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/dsl/editor/MappingEditor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/MappingEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.dsl.editor;
+package org.drools.eclipse.dsl.editor;
import org.drools.lang.dsl.DSLMappingEntry;
import org.drools.lang.dsl.DefaultDSLMappingEntry;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/NLGrammarModel.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/dsl/editor/NLGrammarModel.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/dsl/editor/NLGrammarModel.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.dsl.editor;
+package org.drools.eclipse.dsl.editor;
import java.util.HashSet;
import java.util.Set;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/AbstractRuleEditor.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/AbstractRuleEditor.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/AbstractRuleEditor.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/AbstractRuleEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,324 @@
+package org.drools.eclipse.editors;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.drools.compiler.DroolsParserException;
+import org.drools.eclipse.DRLInfo;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.debug.core.IDroolsDebugConstants;
+import org.drools.eclipse.editors.outline.RuleContentOutlinePage;
+import org.drools.eclipse.editors.scanners.RuleEditorMessages;
+import org.drools.eclipse.preferences.IDroolsConstants;
+import org.drools.lang.descr.FactTemplateDescr;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.FunctionImportDescr;
+import org.drools.lang.descr.ImportDescr;
+import org.drools.lang.descr.PackageDescr;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
+import org.eclipse.debug.ui.actions.ToggleBreakpointAction;
+import org.eclipse.jdt.core.CompletionRequestor;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.IVerticalRuler;
+import org.eclipse.jface.text.source.projection.ProjectionAnnotation;
+import org.eclipse.jface.text.source.projection.ProjectionAnnotationModel;
+import org.eclipse.jface.text.source.projection.ProjectionSupport;
+import org.eclipse.jface.text.source.projection.ProjectionViewer;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.editors.text.TextEditor;
+import org.eclipse.ui.texteditor.ITextEditorActionConstants;
+import org.eclipse.ui.texteditor.ITextEditorActionDefinitionIds;
+import org.eclipse.ui.texteditor.SourceViewerDecorationSupport;
+import org.eclipse.ui.texteditor.TextOperationAction;
+import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+/**
+ * Generic rule editor for drools.
+ * @author Michael Neale
+ */
+public abstract class AbstractRuleEditor extends TextEditor {
+
+ //used to provide additional content assistance/popups when DSLs are used.
+ protected DSLAdapter dslAdapter;
+ protected List imports;
+ protected List functions;
+ protected Map templates;
+ protected String packageName;
+ protected List classesInPackage;
+ protected RuleContentOutlinePage ruleContentOutline = null;
+
+ protected Annotation[] oldAnnotations;
+ protected ProjectionAnnotationModel annotationModel;
+ protected DroolsPairMatcher bracketMatcher = new DroolsPairMatcher();
+
+ public AbstractRuleEditor() {
+ super();
+ }
+
+ public void createPartControl(Composite parent) {
+ super.createPartControl(parent);
+ ProjectionViewer viewer = (ProjectionViewer) getSourceViewer();
+ ProjectionSupport projectionSupport = new ProjectionSupport(viewer,
+ getAnnotationAccess(), getSharedColors());
+ projectionSupport.install();
+ // turn projection mode on
+ viewer.doOperation(ProjectionViewer.TOGGLE);
+ annotationModel = viewer.getProjectionAnnotationModel();
+ }
+
+ protected ISourceViewer createSourceViewer(Composite parent,
+ IVerticalRuler ruler, int styles) {
+ ISourceViewer viewer = new ProjectionViewer(parent, ruler,
+ getOverviewRuler(), isOverviewRulerVisible(), styles);
+ // ensure decoration support has been created and configured.
+ getSourceViewerDecorationSupport(viewer);
+ return viewer;
+ }
+
+ protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
+ support.setCharacterPairMatcher(bracketMatcher);
+ support.setMatchingCharacterPainterPreferenceKeys(
+ IDroolsConstants.DRL_EDITOR_MATCHING_BRACKETS,
+ IDroolsConstants.DRL_EDITOR_MATCHING_BRACKETS_COLOR);
+ super.configureSourceViewerDecorationSupport(support);
+ }
+
+ public void updateFoldingStructure(List positions) {
+ Annotation[] annotations = new Annotation[positions.size()];
+ // this will hold the new annotations along
+ // with their corresponding positions
+ HashMap newAnnotations = new HashMap();
+ for (int i = 0; i < positions.size(); i++) {
+ ProjectionAnnotation annotation = new ProjectionAnnotation();
+ newAnnotations.put(annotation, positions.get(i));
+ annotations[i] = annotation;
+ }
+ annotationModel.modifyAnnotations(oldAnnotations, newAnnotations, null);
+ oldAnnotations = annotations;
+ }
+
+ /** For user triggered content assistance */
+ protected void createActions() {
+ super.createActions();
+
+ IAction a = new TextOperationAction(RuleEditorMessages
+ .getResourceBundle(), "ContentAssistProposal.", this,
+ ISourceViewer.CONTENTASSIST_PROPOSALS);
+ a
+ .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_PROPOSALS);
+ setAction("ContentAssistProposal", a);
+
+ a = new TextOperationAction(
+ RuleEditorMessages.getResourceBundle(),
+ "ContentAssistTip.", this, ISourceViewer.CONTENTASSIST_CONTEXT_INFORMATION); //$NON-NLS-1$
+ a
+ .setActionDefinitionId(ITextEditorActionDefinitionIds.CONTENT_ASSIST_CONTEXT_INFORMATION);
+ setAction("ContentAssistTip", a);
+
+ a = new ToggleBreakpointAction(getSite().getPart() , null, getVerticalRuler());
+ setAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK, a);
+
+ }
+
+ /** Return the DSL adapter if one is present */
+ public DSLAdapter getDSLAdapter() {
+ return dslAdapter;
+ }
+
+ /** Set the DSL adapter, used for content assistance */
+ public void setDSLAdapter(DSLAdapter adapter) {
+ dslAdapter = adapter;
+ }
+
+ public List getImports() {
+ if (imports == null) {
+ loadImportsAndFunctions();
+ }
+ return imports;
+ }
+
+ public String getContent() {
+ return getSourceViewer().getDocument().get();
+ }
+
+ public IResource getResource() {
+ if (getEditorInput() instanceof IFileEditorInput) {
+ return ((IFileEditorInput) getEditorInput()).getFile();
+ }
+ return null;
+ }
+
+ protected abstract void loadImportsAndFunctions();
+
+ public List getFunctions() {
+ if (functions == null) {
+ loadImportsAndFunctions();
+ }
+ return functions;
+ }
+
+ public Set getTemplates() {
+ if (templates == null) {
+ loadImportsAndFunctions();
+ }
+ return templates.keySet();
+ }
+
+ public FactTemplateDescr getTemplate(String name) {
+ if (templates == null) {
+ loadImportsAndFunctions();
+ }
+ return (FactTemplateDescr) templates.get(name);
+ }
+
+ public String getPackage() {
+ if (packageName == null) {
+ loadImportsAndFunctions();
+ }
+ return packageName;
+ }
+
+ public List getClassesInPackage() {
+ if (classesInPackage == null) {
+ classesInPackage = getAllClassesInPackage(getPackage());
+ }
+ return classesInPackage;
+ }
+
+ protected List getAllClassesInPackage(String packageName) {
+ final List list = new ArrayList();
+ if (packageName != null) {
+ IEditorInput input = getEditorInput();
+ if (input instanceof IFileEditorInput) {
+ IProject project = ((IFileEditorInput) input).getFile().getProject();
+ IJavaProject javaProject = JavaCore.create(project);
+
+ CompletionRequestor requestor = new CompletionRequestor() {
+ public void accept(org.eclipse.jdt.core.CompletionProposal proposal) {
+ String className = new String(proposal.getCompletion());
+ if (proposal.getKind() == org.eclipse.jdt.core.CompletionProposal.TYPE_REF) {
+ list.add(className);
+ }
+ // ignore all other proposals
+ }
+ };
+
+ try {
+ javaProject.newEvaluationContext().codeComplete(packageName + ".", packageName.length() + 1, requestor);
+ } catch (Throwable t) {
+ DroolsIDEPlugin.log(t);
+ }
+ }
+ }
+ return list;
+ }
+
+ protected List getAllStaticMethodsInClass(String className) {
+ final List list = new ArrayList();
+ if (className != null) {
+ IEditorInput input = getEditorInput();
+ if (input instanceof IFileEditorInput) {
+ IProject project = ((IFileEditorInput) input).getFile().getProject();
+ IJavaProject javaProject = JavaCore.create(project);
+
+ CompletionRequestor requestor = new CompletionRequestor() {
+ public void accept(org.eclipse.jdt.core.CompletionProposal proposal) {
+ String functionName = new String(proposal.getCompletion());
+ if (proposal.getKind() == org.eclipse.jdt.core.CompletionProposal.METHOD_REF) {
+ list.add(functionName.substring(0, functionName.length() - 2)); // remove the ()
+ }
+ // ignore all other proposals
+ }
+ };
+
+ try {
+ javaProject.newEvaluationContext().codeComplete(className + ".", className.length() + 1, requestor);
+ } catch (Throwable t) {
+ DroolsIDEPlugin.log(t);
+ }
+ }
+ }
+ return list;
+ }
+
+ public Object getAdapter(Class adapter) {
+ if (adapter.equals(IContentOutlinePage.class)) {
+ return getContentOutline();
+ } else if (adapter.equals(IToggleBreakpointsTarget.class)) {
+ return getBreakpointAdapter();
+ }
+ return super.getAdapter(adapter);
+ }
+
+ protected abstract ContentOutlinePage getContentOutline();
+
+ private Object getBreakpointAdapter() {
+ return new DroolsLineBreakpointAdapter();
+ }
+
+ public void doSave(IProgressMonitor monitor) {
+ // invalidate cached parsed rules
+ DroolsIDEPlugin.getDefault().invalidateResource(getResource());
+ // save
+ super.doSave(monitor);
+ // update outline view
+ if (ruleContentOutline != null) {
+ ruleContentOutline.update();
+ }
+ // remove cached content
+ dslAdapter = null;
+ imports = null;
+ functions = null;
+ templates = null;
+ packageName = null;
+ classesInPackage = null;
+ }
+
+ public void gotoMarker(IMarker marker) {
+ try {
+ if (marker.getType().equals(IDroolsDebugConstants.DROOLS_MARKER_TYPE)) {
+ int line = marker.getAttribute(IDroolsDebugConstants.DRL_LINE_NUMBER, -1);
+ if (line > -1)
+ --line;
+ try {
+ IDocument document = getDocumentProvider().getDocument(getEditorInput());
+ selectAndReveal(document.getLineOffset(line), document.getLineLength(line));
+ } catch(BadLocationException exc) {
+ DroolsIDEPlugin.log(exc);
+ }
+ } else {
+ super.gotoMarker(marker);
+ }
+ } catch (CoreException exc) {
+ DroolsIDEPlugin.log(exc);
+ }
+ }
+
+ public void dispose() {
+ super.dispose();
+ if (bracketMatcher != null) {
+ bracketMatcher.dispose();
+ bracketMatcher = null;
+ }
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/BRLSourceViewerConfig.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/BRLSourceViewerConfig.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/BRLSourceViewerConfig.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/BRLSourceViewerConfig.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,127 @@
+package org.drools.eclipse.editors;
+
+import org.drools.eclipse.editors.completion.DefaultCompletionProcessor;
+import org.drools.eclipse.editors.completion.RuleCompletionProcessor;
+import org.drools.eclipse.editors.scanners.DRLPartionScanner;
+import org.drools.eclipse.editors.scanners.DRLScanner;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
+import org.eclipse.jface.text.presentation.IPresentationReconciler;
+import org.eclipse.jface.text.presentation.PresentationReconciler;
+import org.eclipse.jface.text.reconciler.IReconciler;
+import org.eclipse.jface.text.reconciler.MonoReconciler;
+import org.eclipse.jface.text.rules.BufferedRuleBasedScanner;
+import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.source.DefaultAnnotationHover;
+import org.eclipse.jface.text.source.IAnnotationHover;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * Source viewer config wires up the syntax highlighting, partitioning
+ * and content assistance.
+ *
+ * @author Michael Neale
+ *
+ */
+public class BRLSourceViewerConfig extends SourceViewerConfiguration {
+
+ private DRLScanner scanner;
+
+ private static Color DEFAULT_COLOR =
+ ColorManager.getInstance().getColor(ColorManager.DEFAULT);
+
+ private AbstractRuleEditor editor;
+
+ public BRLSourceViewerConfig(AbstractRuleEditor editor) {
+ this.editor = editor;
+ }
+
+ protected DRLScanner getScanner() {
+ if (scanner == null) {
+ scanner = new DRLScanner();
+ scanner.setDefaultReturnToken(new Token(new TextAttribute(DEFAULT_COLOR)));
+ }
+ return scanner;
+ }
+
+ /**
+ * Define reconciler - this has to be done for each partition.
+ * Currently there are 3 partitions, Inside rule, outside rule and inside comment.
+ */
+ public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
+ PresentationReconciler reconciler = new PresentationReconciler();
+
+ //bucket partition... (everything else outside a rule)
+ DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getScanner());
+ reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
+
+ //inside a rule partition
+ dr = new DefaultDamagerRepairer(getScanner());
+ reconciler.setDamager(dr, DRLPartionScanner.RULE_PART_CONTENT);
+ reconciler.setRepairer(dr, DRLPartionScanner.RULE_PART_CONTENT);
+
+ //finally, inside a multi line comment.
+ dr = new DefaultDamagerRepairer(new SingleTokenScanner(
+ new TextAttribute(ColorManager.getInstance().getColor(
+ ColorManager.SINGLE_LINE_COMMENT))));
+ reconciler.setDamager(dr, DRLPartionScanner.RULE_COMMENT);
+ reconciler.setRepairer(dr, DRLPartionScanner.RULE_COMMENT);
+
+ return reconciler;
+ }
+
+ /**
+ * Single token scanner, used for scanning for multiline comments mainly.
+ */
+ static class SingleTokenScanner extends BufferedRuleBasedScanner {
+ public SingleTokenScanner(TextAttribute attribute) {
+ setDefaultReturnToken(new Token(attribute));
+ }
+ }
+
+ /**
+ * Get the appropriate content assistance, for each partition.
+ */
+ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+ ContentAssistant assistant = new ContentAssistant();
+ //setup the content assistance, which is
+ //sensitive to the partition that it is in.
+ assistant.setAutoActivationDelay(1);
+ assistant.setContentAssistProcessor(
+ new DefaultCompletionProcessor(editor), IDocument.DEFAULT_CONTENT_TYPE);
+ assistant.setContentAssistProcessor(
+ new RuleCompletionProcessor(editor), DRLPartionScanner.RULE_PART_CONTENT);
+ assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
+ return assistant;
+ }
+
+ public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
+ return DRLPartionScanner.LEGAL_CONTENT_TYPES;
+ }
+
+ public IReconciler getReconciler(ISourceViewer sourceViewer) {
+ MonoReconciler reconciler = null;
+ if (sourceViewer != null) {
+ reconciler = new MonoReconciler(
+ new DRLReconcilingStrategy(sourceViewer, editor), false);
+ reconciler.setDelay(500);
+ reconciler.setProgressMonitor(new NullProgressMonitor());
+ }
+ return reconciler;
+ }
+
+ public IAnnotationHover getOverviewRulerAnnotationHover(ISourceViewer sourceViewer) {
+ return new DefaultAnnotationHover();
+ }
+
+ public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
+ return new DefaultAnnotationHover();
+ }
+}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/ColorManager.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/ColorManager.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/ColorManager.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/ColorManager.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,47 @@
+package org.drools.eclipse.editors;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.widgets.Display;
+
+public class ColorManager {
+
+
+ private final static ColorManager instance = new ColorManager();
+
+ public static final RGB MULTI_LINE_COMMENT = new RGB(128, 0, 0);
+ public static final RGB SINGLE_LINE_COMMENT = new RGB(128, 128, 0);
+ public static final RGB KEYWORD= new RGB(150, 0, 0);
+ public static final RGB TYPE= new RGB(0, 0, 128);
+ public static final RGB STRING= new RGB(0, 128, 0);
+ public static final RGB DEFAULT= new RGB(0, 0, 0);
+ public static final RGB JAVADOC_KEYWORD= new RGB(0, 128, 0);
+ public static final RGB JAVADOC_TAG= new RGB(128, 128, 128);
+ public static final RGB JAVADOC_LINK= new RGB(128, 128, 128);
+ public static final RGB JAVADOC_DEFAULT= new RGB(0, 128, 128);
+
+ protected Map fColorTable = new HashMap(10);
+
+ void dispose() {
+ Iterator e = fColorTable.values().iterator();
+ while (e.hasNext())
+ ((Color) e.next()).dispose();
+ }
+
+ public static ColorManager getInstance() {
+ return instance;
+ }
+
+ public Color getColor(RGB rgb) {
+ Color color = (Color) fColorTable.get(rgb);
+ if (color == null) {
+ color = new Color(Display.getCurrent(), rgb);
+ fColorTable.put(rgb, color);
+ }
+ return color;
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLAnnotationModel.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/DRLAnnotationModel.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLAnnotationModel.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLAnnotationModel.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,34 @@
+package org.drools.eclipse.editors;
+
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.debug.core.IDroolsDebugConstants;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Position;
+import org.eclipse.ui.texteditor.ResourceMarkerAnnotationModel;
+
+public class DRLAnnotationModel extends ResourceMarkerAnnotationModel {
+
+ public DRLAnnotationModel(IResource resource) {
+ super(resource);
+ }
+
+ protected Position createPositionFromMarker(IMarker marker) {
+ try {
+ if (!marker.getType().equals(IDroolsDebugConstants.DROOLS_MARKER_TYPE)) {
+ return super.createPositionFromMarker(marker);
+ }
+ int line = marker.getAttribute(IDroolsDebugConstants.DRL_LINE_NUMBER, -1);
+ try {
+ return new Position(fDocument.getLineOffset(line - 1));
+ } catch (BadLocationException exc) {
+ return super.createPositionFromMarker(marker);
+ }
+ } catch (CoreException exc) {
+ DroolsIDEPlugin.log(exc);
+ return null;
+ }
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLDocumentProvider.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/DRLDocumentProvider.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLDocumentProvider.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLDocumentProvider.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,35 @@
+package org.drools.eclipse.editors;
+
+import org.drools.eclipse.editors.scanners.DRLPartionScanner;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IDocumentPartitioner;
+import org.eclipse.jface.text.rules.FastPartitioner;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.ui.editors.text.TextFileDocumentProvider;
+
+
+/**
+ * Simple document provider.
+ * @author Michael Neale
+ */
+public class DRLDocumentProvider
+ extends TextFileDocumentProvider {
+
+ public IDocument getDocument(Object element) {
+ IDocument document = super.getDocument(element);
+ if (document != null) {
+ IDocumentPartitioner partitioner =
+ new FastPartitioner(
+ new DRLPartionScanner(),
+ DRLPartionScanner.LEGAL_CONTENT_TYPES);
+ partitioner.connect(document);
+ document.setDocumentPartitioner(partitioner);
+ }
+ return document;
+ }
+
+ protected IAnnotationModel createAnnotationModel(IFile file) {
+ return new DRLAnnotationModel(file);
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLProblemAnnotation.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/DRLProblemAnnotation.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLProblemAnnotation.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLProblemAnnotation.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,13 @@
+package org.drools.eclipse.editors;
+
+import org.eclipse.jface.text.source.Annotation;
+
+public class DRLProblemAnnotation extends Annotation {
+
+ public static final String ERROR = "org.drools.eclipse.editors.error_annotation";
+
+ public DRLProblemAnnotation(String text) {
+ super(ERROR, false, text);
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLReconcilingStrategy.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/DRLReconcilingStrategy.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLReconcilingStrategy.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLReconcilingStrategy.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,150 @@
+package org.drools.eclipse.editors;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.preferences.IDroolsConstants;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.Position;
+import org.eclipse.jface.text.reconciler.DirtyRegion;
+import org.eclipse.jface.text.reconciler.IReconcilingStrategy;
+import org.eclipse.jface.text.source.Annotation;
+import org.eclipse.jface.text.source.IAnnotationModel;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
+import org.eclipse.swt.widgets.Display;
+
+public class DRLReconcilingStrategy implements IReconcilingStrategy {
+
+ private static final Pattern RULE_PATTERN = Pattern.compile("\\n\\s*(rule\\s+.*?\\n\\s*end)", Pattern.DOTALL);
+ private static final Pattern TEMPLATE_PATTERN = Pattern.compile("\\n\\s*(template\\s+.*?\\n\\s*end)", Pattern.DOTALL);
+ private static final Pattern QUERY_PATTERN = Pattern.compile("\\n\\s*(query\\s+.*?\\n\\s*end)", Pattern.DOTALL);
+ private static final Pattern FUNCTION_PATTERN = Pattern.compile("\\n\\s*(function\\s+[^\\{]*\\{)", Pattern.DOTALL);
+ private static final Pattern IMPORT_PATTERN = Pattern.compile("\\n\\s*((\\s*import\\s+[^\\s;]+;?[\\t\\x0B\\f\\r]*\\n)+)", Pattern.DOTALL);
+
+ private ISourceViewer sourceViewer;
+ private AbstractRuleEditor editor;
+ private IDocument document;
+ private boolean folding;
+
+ public DRLReconcilingStrategy(ISourceViewer sourceViewer, final AbstractRuleEditor editor) {
+ this.sourceViewer = sourceViewer;
+ this.editor = editor;
+ IPreferenceStore preferenceStore = DroolsIDEPlugin.getDefault().getPreferenceStore();
+ folding = preferenceStore.getBoolean(IDroolsConstants.EDITOR_FOLDING);
+ preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() {
+ public void propertyChange(PropertyChangeEvent event) {
+ if (IDroolsConstants.EDITOR_FOLDING.equals(event.getProperty())) {
+ folding = ((Boolean) event.getNewValue()).booleanValue();
+ if (folding) {
+ reconcile();
+ } else {
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ editor.updateFoldingStructure(new ArrayList());
+ }
+ });
+ }
+ }
+ }
+ });
+ }
+
+ public void setDocument(IDocument document) {
+ this.document = document;
+ reconcile();
+ }
+
+ public void reconcile(DirtyRegion dirtyRegion, IRegion region) {
+ reconcile();
+ }
+
+ public void reconcile(IRegion region) {
+ reconcile();
+ }
+
+ private void reconcile() {
+ if (document != null) {
+ String s = document.get();
+ if (folding) {
+ calculateFolding(s);
+ }
+
+// IFile file = ((IFileEditorInput) input).getFile();
+// IAnnotationModel annotationModel = sourceViewer.getAnnotationModel();
+// removeAnnotationsFor(annotationModel);
+// DroolsBuildMarker[] markers = DroolsBuilder.parseFile(file, s);
+// for (int i = 0; i < markers.length; i++) {
+// createAnnotation(file, annotationModel, markers[i].getText(), markers[i].getOffset(), markers[i].getLength());
+// }
+ }
+ }
+
+ private static void createAnnotation(IFile file, final IAnnotationModel annotationModel, final String message, final int offset, final int length) {
+ Annotation annotation = new DRLProblemAnnotation(message);
+ Position position = new Position(0, 1);
+// Position position = new Position(offset, length);
+ annotationModel.addAnnotation(annotation, position);
+ }
+
+ public static void removeAnnotationsFor(IAnnotationModel annotationModel) {
+ Iterator iterator = annotationModel.getAnnotationIterator();
+ while (iterator.hasNext()) {
+ Annotation annotation = (Annotation) iterator.next();
+ if (annotation instanceof DRLProblemAnnotation) {
+ annotationModel.removeAnnotation(annotation);
+ }
+ }
+ }
+
+ protected void calculateFolding(String input) {
+ // TODO replace this parsing by getting this input from the parsed rule file
+ final List positions = new ArrayList();
+ Matcher matcher = RULE_PATTERN.matcher(input);
+ while (matcher.find()) {
+ positions.add(new Position(matcher.start(1), matcher.end(1) - matcher.start(1)));
+ }
+ matcher = QUERY_PATTERN.matcher(input);
+ while (matcher.find()) {
+ positions.add(new Position(matcher.start(1), matcher.end(1) - matcher.start(1)));
+ }
+ matcher = TEMPLATE_PATTERN.matcher(input);
+ while (matcher.find()) {
+ positions.add(new Position(matcher.start(1), matcher.end(1) - matcher.start(1)));
+ }
+ matcher = IMPORT_PATTERN.matcher(input);
+ while (matcher.find()) {
+ positions.add(new Position(matcher.start(1), matcher.end(1) - matcher.start(1)));
+ }
+ matcher = FUNCTION_PATTERN.matcher(input);
+ while (matcher.find()) {
+ int start = matcher.start(1);
+ // TODO also take comments, strings etc. in consideration
+ // use JavaPairMatcher or similar
+ int nbOpenBrackets = 1;
+ for (int i = matcher.end(); i < input.length(); i++) {
+ if (input.charAt(i) == '{') {
+ nbOpenBrackets++;
+ } else if (input.charAt(i) == '}') {
+ if (--nbOpenBrackets == 0) {
+ positions.add(new Position(start, i - start + 1));
+ break;
+ }
+ }
+ }
+ }
+ Display.getDefault().asyncExec(new Runnable() {
+ public void run() {
+ editor.updateFoldingStructure(positions);
+ }
+ });
+ }
+}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLRuleEditor.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/DRLRuleEditor.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLRuleEditor.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLRuleEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,97 @@
+package org.drools.eclipse.editors;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.compiler.DroolsParserException;
+import org.drools.eclipse.DRLInfo;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.editors.outline.RuleContentOutlinePage;
+import org.drools.eclipse.preferences.IDroolsConstants;
+import org.drools.lang.descr.FactTemplateDescr;
+import org.drools.lang.descr.FunctionDescr;
+import org.drools.lang.descr.FunctionImportDescr;
+import org.drools.lang.descr.ImportDescr;
+import org.drools.lang.descr.PackageDescr;
+
+import org.eclipse.jface.preference.PreferenceConverter;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
+
+/**
+ * Generic rule editor for drools.
+ * @author Michael Neale
+ */
+public class DRLRuleEditor extends AbstractRuleEditor {
+
+ public DRLRuleEditor() {
+ setSourceViewerConfiguration(new DRLSourceViewerConfig(this));
+ setDocumentProvider(new DRLDocumentProvider());
+ getPreferenceStore().setDefault(IDroolsConstants.DRL_EDITOR_MATCHING_BRACKETS, true);
+ PreferenceConverter.setDefault(getPreferenceStore(), IDroolsConstants.DRL_EDITOR_MATCHING_BRACKETS_COLOR, new RGB(192, 192, 192));
+ }
+
+ protected ContentOutlinePage getContentOutline() {
+ if (ruleContentOutline == null) {
+ ruleContentOutline = new RuleContentOutlinePage(this);
+ ruleContentOutline.update();
+ }
+ return ruleContentOutline;
+ }
+
+ protected void loadImportsAndFunctions() {
+ try {
+ DRLInfo drlInfo = DroolsIDEPlugin.getDefault().parseResource(this, true, false);
+ PackageDescr descr = drlInfo.getPackageDescr();
+ // package
+ this.packageName = drlInfo.getPackageName();
+ // imports
+ List allImports = descr.getImports();
+ this.imports = new ArrayList();
+ Iterator iterator = allImports.iterator();
+ while (iterator.hasNext()) {
+ String importName = ((ImportDescr) iterator.next()).getTarget();
+ if (importName.endsWith(".*")) {
+ String packageName = importName.substring(0, importName.length() - 2);
+ imports.addAll(getAllClassesInPackage(packageName));
+ } else {
+ imports.add(importName);
+ }
+ }
+ // functions
+ List functionDescrs = descr.getFunctions();
+ List functionImports = descr.getFunctionImports();
+ functions = new ArrayList(functionDescrs.size());
+ iterator = functionDescrs.iterator();
+ while (iterator.hasNext()) {
+ functions.add(((FunctionDescr) iterator.next()).getName());
+ }
+ iterator = functionImports.iterator();
+ while (iterator.hasNext()) {
+ String functionImport = ((FunctionImportDescr) iterator.next()).getTarget();
+ if (functionImport.endsWith(".*")) {
+ String className = functionImport.substring(0, functionImport.length() - 2);
+ functions.addAll(getAllStaticMethodsInClass(className));
+ } else {
+ int index = functionImport.lastIndexOf('.');
+ if (index != -1) {
+ functions.add(functionImport.substring(index + 1));
+ }
+ }
+ }
+ // templates
+ List templateDescrs = descr.getFactTemplates();
+ templates = new HashMap(templateDescrs.size());
+ iterator = templateDescrs.iterator();
+ while (iterator.hasNext()) {
+ FactTemplateDescr template = (FactTemplateDescr) iterator.next();
+ templates.put(template.getName(), template);
+ }
+ } catch (DroolsParserException e) {
+ DroolsIDEPlugin.log(e);
+ }
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLRuleEditor2.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/DRLRuleEditor2.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLRuleEditor2.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLRuleEditor2.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,313 @@
+package org.drools.eclipse.editors;
+
+/*
+ * Copyright 2006 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.lang.reflect.InvocationTargetException;
+
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.editors.rete.ReteViewer;
+import org.drools.eclipse.editors.rete.model.ReteGraph;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.gef.ui.actions.ZoomComboContributionItem;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
+import org.eclipse.jface.text.DocumentEvent;
+import org.eclipse.jface.text.IDocumentListener;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorSite;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.forms.editor.FormEditor;
+
+/**
+ * This is a multi table editor wrapper for both the text editor and the RETE
+ * viewer.
+ *
+ * @author Kris
+ * @author Ahti Kitsik
+ */
+public class DRLRuleEditor2 extends FormEditor {
+
+ private DRLRuleEditor textEditor;
+
+ private ReteViewer reteViewer;
+
+ private ZoomComboContributionItem zitem;
+
+ private ZoomInAction2 zoomIn;
+ private ZoomOutAction2 zoomOut;
+
+ protected ReteGraph graph;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.forms.editor.FormEditor#init(org.eclipse.ui.IEditorSite, org.eclipse.ui.IEditorInput)
+ */
+ public void init(IEditorSite site,
+ IEditorInput input) throws PartInitException {
+ super.init( site,
+ input );
+ setPartName( input.getName() );
+ }
+
+ /**
+ * Adds Text Editor for rules and Rete graph viewer
+ *
+ * @see org.eclipse.ui.forms.editor.FormEditor#addPages()
+ */
+ protected void addPages() {
+ try {
+ textEditor = new DRLRuleEditor() {
+ public void close(boolean save) {
+ super.close( save );
+ DRLRuleEditor2.this.close( save );
+ }
+
+ protected void setPartName(String partName) {
+ super.setPartName( partName );
+ DRLRuleEditor2.this.setPartName( partName );
+ }
+ };
+
+ reteViewer = new ReteViewer(textEditor);
+
+ int text = addPage( textEditor,
+ getEditorInput() );
+
+ int rete = addPage( reteViewer,
+ getEditorInput() );
+
+ setPageText( text,
+ "Text Editor" );
+ setPageText( rete,
+ "Rete Tree" );
+
+ textEditor.getDocumentProvider().getDocument( getEditorInput() ).addDocumentListener( new IDocumentListener() {
+
+ public void documentAboutToBeChanged(DocumentEvent event) {
+ }
+
+ public void documentChanged(DocumentEvent event) {
+ reteViewer.fireDocumentChanged();
+ }
+
+ } );
+
+ } catch ( PartInitException e ) {
+ DroolsIDEPlugin.log( e );
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.EditorPart#doSave(org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void doSave(IProgressMonitor monitor) {
+ textEditor.doSave( monitor );
+ setInput( getEditorInput() );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.EditorPart#doSaveAs()
+ */
+ public void doSaveAs() {
+ textEditor.doSaveAs();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.EditorPart#isSaveAsAllowed()
+ */
+ public boolean isSaveAsAllowed() {
+ return textEditor.isSaveAsAllowed();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.MultiPageEditorPart#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class adapter) {
+ if ( adapter == ZoomManager.class ) {
+
+ if ( getActiveEditor() instanceof ReteViewer ) {
+ return reteViewer.getAdapter( adapter );
+ } else if ( getActiveEditor() instanceof DRLRuleEditor ) {
+ return null;
+ }
+
+ } else if ( adapter == ZoomInAction2.class ) {
+ return zoomIn;
+ } else if ( adapter == ZoomOutAction2.class ) {
+ return zoomOut;
+ } else if ( adapter == ZoomComboContributionItem.class ) {
+ return zitem;
+ }
+
+ return textEditor.getAdapter( adapter );
+ }
+
+ /**
+ * Updates ZoomManagers for contributed actions.
+ */
+ private void updateZoomItems() {
+ updateZoomIn();
+
+ updateZoomOut();
+
+ updateZoomCombo();
+
+ }
+
+ private void updateZoomCombo() {
+ if ( zitem != null ) {
+ zitem.setZoomManager( getZoomManager() );
+ }
+ }
+
+ private void updateZoomIn() {
+ boolean zoomActive = getZoomManager() != null;
+ if ( zoomIn != null ) {
+ zoomIn.setZoomManager( getZoomManager() );
+ zoomIn.setEnabled( zoomActive );
+ }
+ }
+
+ private void updateZoomOut() {
+ boolean zoomActive = getZoomManager() != null;
+ if ( zoomOut != null ) {
+ zoomOut.setZoomManager( getZoomManager() );
+ zoomOut.setEnabled( zoomActive );
+ }
+ }
+
+ /**
+ * Sets ZoomComboContributionItem to be used for updating it's
+ * ZoomManager when multipage tab is switched.
+ *
+ * @param zitem contribution item
+ */
+ public void setZoomComboContributionItem(ZoomComboContributionItem zitem) {
+ this.zitem = zitem;
+ updateZoomCombo();
+ }
+
+ private ZoomManager getZoomManager() {
+ return (ZoomManager) getAdapter( ZoomManager.class );
+ }
+
+ /**
+ * Sets ZoomOutAction2 to be used for updating it's
+ * ZoomManager when multipage tab is switched.
+ *
+ * @param zoomOutAction zoom action
+ */
+ public void setZoomOutAction(ZoomOutAction2 zoomOutAction) {
+ this.zoomOut = zoomOutAction;
+ updateZoomOut();
+ }
+
+ /**
+ * Sets ZoomInAction to be used for updating it's
+ * ZoomManager when multipage tab is switched.
+ * @param zoomInAction zoom action
+ */
+ public void setZoomInAction(ZoomInAction2 zoomInAction) {
+ this.zoomIn = zoomInAction;
+ updateZoomIn();
+ }
+
+ public void setFocus() {
+ if ( getActivePage() == 1 ) {
+ boolean reteFailed = false;
+ graph = null;
+ try {
+ final String contents = textEditor.getDocumentProvider().getDocument( getEditorInput() ).get();
+ final IRunnableWithProgress runnable = new IRunnableWithProgress() {
+
+ public void run(IProgressMonitor monitor) throws InvocationTargetException,
+ InterruptedException {
+ try {
+ graph = reteViewer.loadReteModel( monitor,
+ contents );
+ } catch ( Throwable e ) {
+ if ( e instanceof InvocationTargetException ) {
+ throw (InvocationTargetException) e;
+ } else if ( e instanceof InterruptedException ) {
+ throw (InterruptedException) e;
+ }
+ throw new InvocationTargetException( e );
+ }
+
+ }
+
+ };
+
+ getEditorSite().getWorkbenchWindow().getWorkbench().getProgressService().busyCursorWhile( runnable );
+
+ reteViewer.drawGraph( graph );
+
+ } catch ( InvocationTargetException e ) {
+ handleError( e );
+ reteFailed = true;
+ } catch ( InterruptedException e ) {
+ MessageDialog.openError( getSite().getShell(),
+ "Rete Tree Error!",
+ "Rete Tree Calculation Cancelled!" );
+ reteFailed = true;
+ } catch ( Throwable t ) {
+ handleError( t );
+ reteFailed = true;
+ }
+ if ( reteFailed ) {
+ setActivePage( 0 );
+ }
+ }
+
+ super.setFocus();
+ updateZoomItems();
+
+ }
+
+ private void handleError(Throwable t) {
+ DroolsIDEPlugin.log( t );
+ Throwable cause = t.getCause();
+ if ( cause == null ) {
+ cause = t;
+ }
+ String message = cause.getClass().getName()+": "+cause.getMessage();
+ if ( message == null || message.length() == 0 ) {
+ message = "Uncategorized Error!";
+ }
+ IStatus status = new Status( IStatus.ERROR,
+ DroolsIDEPlugin.getUniqueIdentifier(),
+ -1,
+ message,
+ null);
+ ErrorDialog.openError( getSite().getShell(),
+ "Rete Tree Build Error!",
+ "Rete Tree Build Error!",
+ status );
+
+ }
+
+ /**
+ * Increasing visibility to allow switching tabs by page index
+ */
+ public void setActivePage(int pageIndex) {
+ super.setActivePage( pageIndex );
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLRuleEditorActionContributor.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/DRLRuleEditorActionContributor.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLRuleEditorActionContributor.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLRuleEditorActionContributor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,111 @@
+package org.drools.eclipse.editors;
+
+/*
+ * Copyright 2006 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.gef.ui.actions.ZoomComboContributionItem;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.editors.text.TextEditorActionContributor;
+import org.eclipse.ui.part.MultiPageEditorActionBarContributor;
+import org.eclipse.ui.texteditor.ITextEditor;
+
+/**
+ * ActionContributors for DRLRuleEditor2
+ *
+ * Currently implements contributors to zoom feature at rete viewer.
+ *
+ * @author Ahti Kitsik
+ *
+ */
+public class DRLRuleEditorActionContributor extends MultiPageEditorActionBarContributor {
+
+ private TextEditorActionContributor contributor = new TextEditorActionContributor();
+
+ private ZoomComboContributionItem zitem;
+ private ZoomOutAction2 zoomOut;
+ private ZoomInAction2 zoomIn;
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.EditorActionBarContributor#init(org.eclipse.ui.IActionBars, org.eclipse.ui.IWorkbenchPage)
+ */
+ public void init(IActionBars bars,
+ IWorkbenchPage page) {
+ contributor.init( bars );
+ super.init( bars,
+ page );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.part.MultiPageEditorActionBarContributor#setActivePage(org.eclipse.ui.IEditorPart)
+ */
+ public void setActivePage(IEditorPart activeEditor) {
+ IActionBars bars = getActionBars();
+ if ( activeEditor instanceof ITextEditor ) {
+ if ( bars != null ) {
+ contributor.setActiveEditor( activeEditor );
+ }
+ }
+ }
+
+ /**
+ * In addition to @link org.eclipse.ui.part.MultiPageEditorActionBarContributor#setActiveEditor(org.eclipse.ui.IEditorPart)
+ * it sets contribution items to DRLRuleEditor2 for later use when
+ * multipageditor tabs are switched.
+ *
+ */
+ public void setActiveEditor(IEditorPart part) {
+ super.setActiveEditor( part );
+ if ( part instanceof DRLRuleEditor2 ) {
+ DRLRuleEditor2 p = (DRLRuleEditor2) part;
+ p.setZoomComboContributionItem( zitem );
+ p.setZoomInAction( zoomIn );
+ p.setZoomOutAction( zoomOut );
+ }
+ }
+
+ /**
+ * Adds Zoom-related contributions.
+ *
+ * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToToolBar(org.eclipse.jface.action.IToolBarManager)
+ */
+ public void contributeToToolBar(IToolBarManager toolBarManager) {
+ super.contributeToToolBar( toolBarManager );
+ toolBarManager.add( new Separator() );
+ String[] zoomStrings = new String[]{ZoomManager.FIT_ALL, ZoomManager.FIT_HEIGHT, ZoomManager.FIT_WIDTH};
+
+ zitem = new ZoomComboContributionItem( getPage(),
+ zoomStrings );
+ zitem.setZoomManager( null );
+ zitem.setVisible( false );
+
+ zoomIn = new ZoomInAction2();
+ zoomIn.setEnabled( false );
+
+ zoomOut = new ZoomOutAction2();
+ zoomOut.setEnabled( false );
+
+ toolBarManager.add( zitem );
+ toolBarManager.add( zoomIn );
+ toolBarManager.add( zoomOut );
+
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLSourceViewerConfig.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/DRLSourceViewerConfig.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLSourceViewerConfig.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DRLSourceViewerConfig.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,126 @@
+package org.drools.eclipse.editors;
+
+import org.drools.eclipse.editors.completion.DefaultCompletionProcessor;
+import org.drools.eclipse.editors.completion.RuleCompletionProcessor;
+import org.drools.eclipse.editors.scanners.DRLPartionScanner;
+import org.drools.eclipse.editors.scanners.DRLScanner;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.TextAttribute;
+import org.eclipse.jface.text.contentassist.ContentAssistant;
+import org.eclipse.jface.text.contentassist.IContentAssistant;
+import org.eclipse.jface.text.presentation.IPresentationReconciler;
+import org.eclipse.jface.text.presentation.PresentationReconciler;
+import org.eclipse.jface.text.reconciler.IReconciler;
+import org.eclipse.jface.text.reconciler.MonoReconciler;
+import org.eclipse.jface.text.rules.BufferedRuleBasedScanner;
+import org.eclipse.jface.text.rules.DefaultDamagerRepairer;
+import org.eclipse.jface.text.rules.Token;
+import org.eclipse.jface.text.source.DefaultAnnotationHover;
+import org.eclipse.jface.text.source.IAnnotationHover;
+import org.eclipse.jface.text.source.ISourceViewer;
+import org.eclipse.jface.text.source.SourceViewerConfiguration;
+import org.eclipse.swt.graphics.Color;
+
+/**
+ * Source viewer config wires up the syntax highlighting, partitioning
+ * and content assistance.
+ *
+ * @author Michael Neale
+ *
+ */
+public class DRLSourceViewerConfig extends SourceViewerConfiguration {
+
+ private DRLScanner scanner;
+
+ private static Color DEFAULT_COLOR =
+ ColorManager.getInstance().getColor(ColorManager.DEFAULT);
+
+ private AbstractRuleEditor editor;
+
+ public DRLSourceViewerConfig(AbstractRuleEditor editor) {
+ this.editor = editor;
+ }
+
+ protected DRLScanner getScanner() {
+ if (scanner == null) {
+ scanner = new DRLScanner();
+ scanner.setDefaultReturnToken(new Token(new TextAttribute(DEFAULT_COLOR)));
+ }
+ return scanner;
+ }
+
+ /**
+ * Define reconciler - this has to be done for each partition.
+ * Currently there are 3 partitions, Inside rule, outside rule and inside comment.
+ */
+ public IPresentationReconciler getPresentationReconciler(ISourceViewer sourceViewer) {
+ PresentationReconciler reconciler = new PresentationReconciler();
+
+ //bucket partition... (everything else outside a rule)
+ DefaultDamagerRepairer dr = new DefaultDamagerRepairer(getScanner());
+ reconciler.setDamager(dr, IDocument.DEFAULT_CONTENT_TYPE);
+ reconciler.setRepairer(dr, IDocument.DEFAULT_CONTENT_TYPE);
+
+ //inside a rule partition
+ dr = new DefaultDamagerRepairer(getScanner());
+ reconciler.setDamager(dr, DRLPartionScanner.RULE_PART_CONTENT);
+ reconciler.setRepairer(dr, DRLPartionScanner.RULE_PART_CONTENT);
+
+ //finally, inside a multi line comment.
+ dr = new DefaultDamagerRepairer(new SingleTokenScanner(
+ new TextAttribute(ColorManager.getInstance().getColor(
+ ColorManager.SINGLE_LINE_COMMENT))));
+ reconciler.setDamager(dr, DRLPartionScanner.RULE_COMMENT);
+ reconciler.setRepairer(dr, DRLPartionScanner.RULE_COMMENT);
+
+ return reconciler;
+ }
+
+ /**
+ * Single token scanner, used for scanning for multiline comments mainly.
+ */
+ static class SingleTokenScanner extends BufferedRuleBasedScanner {
+ public SingleTokenScanner(TextAttribute attribute) {
+ setDefaultReturnToken(new Token(attribute));
+ }
+ }
+
+ /**
+ * Get the appropriate content assistance, for each partition.
+ */
+ public IContentAssistant getContentAssistant(ISourceViewer sourceViewer) {
+ ContentAssistant assistant = new ContentAssistant();
+ //setup the content assistance, which is
+ //sensitive to the partition that it is in.
+ assistant.setContentAssistProcessor(
+ new DefaultCompletionProcessor(editor), IDocument.DEFAULT_CONTENT_TYPE);
+ assistant.setContentAssistProcessor(
+ new RuleCompletionProcessor(editor), DRLPartionScanner.RULE_PART_CONTENT);
+ assistant.setProposalPopupOrientation(IContentAssistant.PROPOSAL_OVERLAY);
+ return assistant;
+ }
+
+ public String[] getConfiguredContentTypes(ISourceViewer sourceViewer) {
+ return DRLPartionScanner.LEGAL_CONTENT_TYPES;
+ }
+
+ public IReconciler getReconciler(ISourceViewer sourceViewer) {
+ MonoReconciler reconciler = null;
+ if (sourceViewer != null) {
+ reconciler = new MonoReconciler(
+ new DRLReconcilingStrategy(sourceViewer, editor), false);
+ reconciler.setDelay(500);
+ reconciler.setProgressMonitor(new NullProgressMonitor());
+ }
+ return reconciler;
+ }
+
+ public IAnnotationHover getOverviewRulerAnnotationHover(ISourceViewer sourceViewer) {
+ return new DefaultAnnotationHover();
+ }
+
+ public IAnnotationHover getAnnotationHover(ISourceViewer sourceViewer) {
+ return new DefaultAnnotationHover();
+ }
+}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DSLAdapter.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/DSLAdapter.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DSLAdapter.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DSLAdapter.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,172 @@
+package org.drools.eclipse.editors;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.drools.lang.dsl.DSLMapping;
+import org.drools.lang.dsl.DSLMappingEntry;
+import org.drools.lang.dsl.DSLMappingFile;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+
+/**
+ * This holds the DSL configuration for an editor instance.
+ * When loading, it will find the DSL file, and load the applicable lists.
+ *
+ * This provides a link between the editor and the DSL features of the rule language.
+ *
+ * It will look for a DSL configuration, as named in the rule file, in the same directory as the rule file.
+ * Failing this, it will search one directory above the rule file.
+ * Failing that, it will search the root of the project in the workspace.
+ *
+ * @author Michael Neale
+ */
+public class DSLAdapter {
+
+ private String dslConfigName;
+ private boolean valid = false;
+ private List conditionProposals = new ArrayList();
+ private List consequenceProposals = new ArrayList();
+
+
+ //to dig out the expander, without using the parser.
+ private static final Pattern expander = Pattern.compile( "^.*expander\\s*(.*)\\.dsl.*",
+ Pattern.DOTALL | Pattern.MULTILINE );
+ /**
+ * This will sniff out the DSL config file name from the content.
+ * It will then use the IFile input to search around for the file itself.
+ * TODO: provide an alternative that just loads off a stream (for non IDEs workbenches like jlibrary).
+ * @param content Rule source
+ * @param input File from the FileEditorInput
+ */
+ public DSLAdapter(String content, IFile input) {
+
+ dslConfigName = findDSLConfigName( content );
+ if (dslConfigName == null) return;
+ loadConfig( input );
+ }
+
+ /** Get a reader to the DSL contents */
+ public static Reader getDSLContent(String ruleSource, IResource input) throws CoreException {
+ String dslFileName = findDSLConfigName( ruleSource );
+ if (dslFileName == null) return null;
+ IResource res = findDSLResource( input, dslFileName );
+ if (res instanceof IFile) {
+ IFile dslConf = (IFile) res;
+ if (dslConf.exists()) {
+ return new InputStreamReader(dslConf.getContents());
+ }
+ }
+ return null;
+ }
+
+ /**
+ * This does the hunting around the projec to find the .dsl file.
+ */
+ private void loadConfig(IFile input) {
+ IResource res = findDSLResource( input, dslConfigName );
+ if (res instanceof IFile) {
+ IFile dslConf = (IFile) res;
+ if (dslConf.exists()) {
+ InputStream stream = null;
+ try {
+ stream = dslConf.getContents();
+ readConfig( stream );
+ valid = true;
+ } catch ( Exception e ) {
+ throw new IllegalStateException("Unable to open DSL config file. (Exception: " + e.getMessage() + ")");
+ } finally {
+ closeStream( stream );
+ }
+
+ }
+ }
+ }
+
+ private static IResource findDSLResource(IResource input, String dslFileName) {
+ IResource res = input.getParent().findMember( dslFileName );
+ if (res == null) res = input.getParent().getParent().findMember( dslFileName ); //try parent directory
+ if (res == null) res = input.getProject().findMember( dslFileName ); //try root of project.
+ return res;
+ }
+
+
+ /** This will load in the DSL config file, using the DSLMapping from drools-compiler */
+ void readConfig(InputStream stream) throws IOException, CoreException {
+ DSLMappingFile file = new DSLMappingFile();
+ file.parseAndLoad( new InputStreamReader(stream) );
+
+ DSLMapping grammar = file.getMapping();
+ List conditions = grammar.getEntries( DSLMappingEntry.CONDITION );
+ List consequences = grammar.getEntries( DSLMappingEntry.CONSEQUENCE );
+
+ conditionProposals = buildProposals(conditions);
+ consequenceProposals = buildProposals(consequences);
+ }
+
+ private List buildProposals(List suggestions) {
+ List result = new ArrayList(suggestions.size());
+ Iterator iterator = suggestions.iterator();
+ while (iterator.hasNext()) {
+ DSLMappingEntry text = (DSLMappingEntry) iterator.next();
+ result.add(text.getMappingKey());
+ }
+ return result;
+ }
+
+ private void closeStream(InputStream stream) {
+ if (stream != null) try {
+ stream.close();
+ } catch ( IOException e ) {}
+ }
+
+ DSLAdapter() {
+
+ }
+
+ /** Sniffs out the expander/DSL config name as best it can. */
+ static String findDSLConfigName(String content) {
+ String name = null;
+ Matcher matches = expander.matcher( content );
+ if (matches.matches()) {
+ name = matches.group(1) + ".dsl";
+ }
+ return name;
+ }
+
+
+ String getDSLConfigName() {
+ return dslConfigName;
+ }
+
+
+ public boolean isValid() {
+ return valid;
+ }
+
+
+ public boolean hasConditions() {
+ return conditionProposals.size() > 0;
+ }
+
+ public boolean hasConsequences() {
+ return consequenceProposals.size() > 0;
+ }
+
+ public List listConditionItems() {
+ return conditionProposals;
+ }
+
+ public List listConsequenceItems() {
+ return consequenceProposals;
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DroolsLineBreakpointAdapter.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/DroolsLineBreakpointAdapter.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DroolsLineBreakpointAdapter.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DroolsLineBreakpointAdapter.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,89 @@
+package org.drools.eclipse.editors;
+
+import org.drools.eclipse.DRLInfo;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.DRLInfo.FunctionInfo;
+import org.drools.eclipse.DRLInfo.RuleInfo;
+import org.drools.eclipse.debug.core.DroolsLineBreakpoint;
+import org.drools.eclipse.debug.core.IDroolsDebugConstants;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.model.IBreakpoint;
+import org.eclipse.debug.ui.actions.IToggleBreakpointsTarget;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class DroolsLineBreakpointAdapter implements IToggleBreakpointsTarget {
+
+ public boolean canToggleLineBreakpoints(IWorkbenchPart part, ISelection selection) {
+ if (part instanceof IEditorPart && selection instanceof ITextSelection) {
+ IEditorPart editor = (IEditorPart) part;
+ IResource resource = (IResource) editor.getEditorInput().getAdapter(IResource.class);
+ ITextSelection textSelection = (ITextSelection) selection;
+ int lineNumber = textSelection.getStartLine();
+ try {
+ DRLInfo drlInfo = DroolsIDEPlugin.getDefault().parseResource(resource, false);
+ if (drlInfo != null) {
+ RuleInfo ruleInfo = drlInfo.getRuleInfo(lineNumber);
+ if (ruleInfo != null) {
+ if (ruleInfo.getConsequenceDrlLineNumber() <= lineNumber) {
+ return true;
+ }
+ }
+ FunctionInfo functionInfo = drlInfo.getFunctionInfo(lineNumber);
+ if (functionInfo != null) {
+ if (functionInfo.getDrlLineNumber() <= lineNumber) {
+ return true;
+ }
+ }
+ }
+ } catch (Throwable t) {
+ DroolsIDEPlugin.log(t);
+ }
+ }
+ return false;
+ }
+
+ public boolean canToggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) {
+ return false;
+ }
+
+ public boolean canToggleWatchpoints(IWorkbenchPart part, ISelection selection) {
+ return false;
+ }
+
+ public void toggleLineBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
+ if (part instanceof IEditorPart) {
+ IEditorPart editor = (IEditorPart) part;
+ IResource resource = (IResource) editor.getEditorInput().getAdapter(IResource.class);
+ ITextSelection textSelection = (ITextSelection) selection;
+ int lineNumber = textSelection.getStartLine();
+ IBreakpoint[] breakpoints = DebugPlugin.getDefault().getBreakpointManager().getBreakpoints(IDroolsDebugConstants.ID_DROOLS_DEBUG_MODEL);
+ for (int i = 0; i < breakpoints.length; i++) {
+ IBreakpoint breakpoint = breakpoints[i];
+ if (resource.equals(breakpoint.getMarker().getResource())) {
+ if (breakpoint.getMarker().getType().equals(IDroolsDebugConstants.DROOLS_MARKER_TYPE)) {
+ if (((DroolsLineBreakpoint) breakpoint).getDRLLineNumber() == (lineNumber + 1)) {
+ breakpoint.delete();
+ return;
+ }
+ }
+ }
+ }
+ // TODO: drools breakpoints can only be created in functions and consequences
+ DroolsLineBreakpoint lineBreakpoint = new DroolsLineBreakpoint(resource, lineNumber + 1);
+ DebugPlugin.getDefault().getBreakpointManager().addBreakpoint(lineBreakpoint);
+ }
+ }
+
+ public void toggleMethodBreakpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
+ // do nothing
+ }
+
+ public void toggleWatchpoints(IWorkbenchPart part, ISelection selection) throws CoreException {
+ // do nothing
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DroolsPairMatcher.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/DroolsPairMatcher.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DroolsPairMatcher.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/DroolsPairMatcher.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,89 @@
+package org.drools.eclipse.editors;
+
+import java.util.Stack;
+
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.text.IRegion;
+import org.eclipse.jface.text.Region;
+import org.eclipse.jface.text.source.ICharacterPairMatcher;
+
+public final class DroolsPairMatcher implements ICharacterPairMatcher {
+
+ private int anchor;
+ private static final char[] leftChars = new char[] { '(', '{', '[' };
+ private static final char[] rightChars = new char[] { ')', '}', ']' };
+
+ public IRegion match(IDocument document, int offset) {
+ if (offset <= 0) {
+ return null;
+ }
+ try {
+ char c = document.getChar(offset - 1);
+ for (int i = 0; i < rightChars.length; i++) {
+ if (c == rightChars[i]) {
+ return searchLeft(document, offset, rightChars[i], leftChars[i]);
+ }
+ if (c == leftChars[i]) {
+ return searchRight(document, offset, rightChars[i], leftChars[i]);
+ }
+ }
+ } catch (BadLocationException e) {
+ DroolsIDEPlugin.log(e);
+ }
+ return null;
+ }
+
+ private IRegion searchRight(IDocument document, int offset, char rightChar, char leftChar) throws BadLocationException {
+ Stack stack = new Stack();
+ anchor = ICharacterPairMatcher.LEFT;
+ char[] chars = document.get(offset, document.getLength() - offset).toCharArray();
+ for (int i = 0; i < chars.length; i++) {
+ if (chars[i] == leftChar) {
+ stack.push(new Character(chars[i]));
+ continue;
+ }
+ if (chars[i] == rightChar) {
+ if (stack.isEmpty()) {
+ return new Region(offset - 1, i + 2);
+ } else {
+ stack.pop();
+ }
+ }
+ }
+ return null;
+ }
+
+ private IRegion searchLeft(IDocument document, int offset, char rightChar, char leftChar)
+ throws BadLocationException {
+ Stack stack = new Stack();
+ anchor = ICharacterPairMatcher.RIGHT;
+ char[] chars = document.get(0, offset - 1).toCharArray();
+ for (int i = chars.length - 1; i >= 0; i--) {
+ if (chars[i] == rightChar) {
+ stack.push(new Character(chars[i]));
+ continue;
+ }
+ if (chars[i] == leftChar) {
+ if (stack.isEmpty()) {
+ return new Region(i, offset - i);
+ } else {
+ stack.pop();
+ }
+ }
+ }
+ return null;
+ }
+
+ public int getAnchor() {
+ return anchor;
+ }
+
+ public void dispose() {
+ }
+
+ public void clear() {
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/Keywords.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/Keywords.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/Keywords.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/Keywords.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,71 @@
+package org.drools.eclipse.editors;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * This provides a list of keywords for syntax highlighting.
+ * Uses a pseudo properties file format.
+ * @author Michael Neale
+ */
+public class Keywords {
+
+ private String[] allDrools;
+ private String[] allJava;
+ private static Keywords instance;
+
+ public static Keywords getInstance() {
+ if (instance == null) {
+ instance = new Keywords();
+ }
+ return instance;
+ }
+
+
+ public String[] getAllDroolsKeywords() {
+ return allDrools;
+ }
+
+ public String[] getAllJavaKeywords() {
+ return allJava;
+ }
+
+
+ private Keywords() {
+ allDrools = readKeywords("keywords.properties");
+ allJava = readKeywords("java_keywords.properties");
+ }
+
+ private String[] readKeywords(String fileName) {
+ InputStream stream = this.getClass().getResourceAsStream(fileName);
+ try {
+ BufferedReader reader = new BufferedReader(new InputStreamReader(stream));
+
+ List list = new ArrayList();
+
+ String line = null;
+ while ((line = reader.readLine()) != null) {
+ if (!line.startsWith( "#" )) list.add( line );
+ }
+
+ return (String[]) list.toArray( new String[list.size()] );
+ }
+ catch ( IOException e ) {
+ throw new IllegalArgumentException("Could not load keywords for editor.");
+ }
+ finally {
+ try {
+ stream.close();
+ }
+ catch ( IOException e ) {
+ throw new IllegalStateException("Error closing stream.");
+ }
+ }
+ }
+
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/RuleEditorPlugin.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/RuleEditorPlugin.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/RuleEditorPlugin.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/RuleEditorPlugin.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,65 @@
+package org.drools.eclipse.editors;
+
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * The main plugin class to be used in the desktop.
+ */
+public class RuleEditorPlugin extends AbstractUIPlugin {
+ //The shared instance.
+ private static RuleEditorPlugin plugin;
+ //Resource bundle.
+ private ResourceBundle resourceBundle;
+
+ /**
+ * The constructor.
+ */
+ public RuleEditorPlugin() {
+ super();
+ plugin = this;
+ try {
+ resourceBundle= ResourceBundle.getBundle("org.drools.eclipse.editors.DRLEditorResources");
+ } catch (MissingResourceException x) {
+ resourceBundle = null;
+ }
+ }
+
+ /**
+ * Returns the shared instance.
+ */
+ public static RuleEditorPlugin getDefault() {
+ return plugin;
+ }
+
+ /**
+ * Returns the workspace instance.
+ */
+ public static IWorkspace getWorkspace() {
+ return ResourcesPlugin.getWorkspace();
+ }
+
+ /**
+ * Returns the string from the plugin's resource bundle,
+ * or 'key' if not found.
+ */
+ public static String getResourceString(String key) {
+ ResourceBundle bundle= RuleEditorPlugin.getDefault().getResourceBundle();
+ try {
+ return bundle.getString(key);
+ } catch (MissingResourceException e) {
+ return key;
+ }
+ }
+
+ /**
+ * Returns the plugin's resource bundle,
+ */
+ public ResourceBundle getResourceBundle() {
+ return resourceBundle;
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/ZoomInAction2.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/ZoomInAction2.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/ZoomInAction2.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/ZoomInAction2.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,71 @@
+package org.drools.eclipse.editors;
+
+/*
+ * Copyright 2006 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.ScalableFigure;
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.gef.ui.actions.ZoomInAction;
+
+/**
+ * Similar to ZoomInAction but adds setZoomManager(..) functionality.
+ *
+ * ZoomInAction2 provides default constructor for initializing
+ * ZoomInAction without the need for ZoomManager.
+ *
+ * Please note that ZoomInAction2 is not very functional until it has
+ * correct zoomManager set by setZoomManager(ZoomManager manager).<br/>
+ *
+ * setZoomManager(ZoomManager manager) can be used several times.
+ *
+ * @author Ahti Kitsik
+ *
+ */
+public class ZoomInAction2 extends ZoomInAction {
+
+ final private static ZoomManager FAKE_ZOOM_MANAGER = new ZoomManager( (ScalableFigure) null,
+ null );
+
+ /**
+ * Default constructor to allow ZoomInActions without specified
+ * ZoomManager.
+ */
+ public ZoomInAction2() {
+ super( FAKE_ZOOM_MANAGER );
+ }
+
+ /**
+ * Replaces existing zoomManager with the new one.
+ *
+ * Implementation is null-safe.
+ *
+ * @param newManager new zoom manager
+ */
+ public void setZoomManager(ZoomManager newManager) {
+
+ if ( zoomManager != null ) {
+ zoomManager.removeZoomListener( this );
+ }
+
+ zoomManager = newManager;
+
+ if ( zoomManager != null ) {
+ zoomManager.addZoomListener( this );
+ }
+
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/ZoomOutAction2.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/ZoomOutAction2.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/ZoomOutAction2.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/ZoomOutAction2.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,71 @@
+package org.drools.eclipse.editors;
+
+/*
+ * Copyright 2006 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.ScalableFigure;
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.gef.ui.actions.ZoomOutAction;
+
+/**
+ * Similar to ZoomOutAction but adds setZoomManager(..) functionality.
+ *
+ * ZoomOutAction2 provides default constructor for initializing
+ * ZoomOutAction without the need for ZoomManager.
+ *
+ * Please note that ZoomOutAction2 is not very functional until it has
+ * correct zoomManager set by setZoomManager(ZoomManager manager).<br/>
+ *
+ * setZoomManager(ZoomManager manager) can be used several times.
+ *
+ * @author Ahti Kitsik
+ *
+ */
+public class ZoomOutAction2 extends ZoomOutAction {
+
+ final private static ZoomManager FAKE_ZOOM_MANAGER = new ZoomManager( (ScalableFigure) null,
+ null );
+
+ /**
+ * Default constructor to allow ZoomOutActions without specified
+ * ZoomManager.
+ */
+ public ZoomOutAction2() {
+ super( FAKE_ZOOM_MANAGER );
+ }
+
+ /**
+ * Replaces existing zoomManager with the new one.
+ *
+ * Implementation is null-safe.
+ *
+ * @param newManager new zoom manager
+ */
+ public void setZoomManager(ZoomManager manager) {
+
+ if ( zoomManager != null ) {
+ zoomManager.removeZoomListener( this );
+ }
+
+ zoomManager = manager;
+
+ if ( zoomManager != null ) {
+ zoomManager.addZoomListener( this );
+ }
+
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/completion)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/AbstractCompletionProcessor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/completion/AbstractCompletionProcessor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/AbstractCompletionProcessor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.completion;
+package org.drools.eclipse.editors.completion;
import java.util.Collections;
import java.util.Iterator;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/CompletionUtil.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/completion/CompletionUtil.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/CompletionUtil.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.completion;
+package org.drools.eclipse.editors.completion;
public class CompletionUtil {
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/DSLTree.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/completion/DSLTree.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/DSLTree.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.completion;
+package org.drools.eclipse.editors.completion;
import java.io.BufferedReader;
import java.io.FileReader;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/DefaultCompletionProcessor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/completion/DefaultCompletionProcessor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/DefaultCompletionProcessor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.completion;
+package org.drools.eclipse.editors.completion;
import java.util.ArrayList;
import java.util.HashMap;
@@ -8,10 +8,10 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.DroolsPluginImages;
-import org.drools.ide.editors.AbstractRuleEditor;
-import org.drools.ide.editors.DRLRuleEditor;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsPluginImages;
+import org.drools.eclipse.editors.AbstractRuleEditor;
+import org.drools.eclipse.editors.DRLRuleEditor;
import org.drools.util.StringUtils;
import org.eclipse.core.resources.IProject;
import org.eclipse.jdt.core.CompletionProposal;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/LocationDeterminator.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/completion/LocationDeterminator.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/LocationDeterminator.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.completion;
+package org.drools.eclipse.editors.completion;
import java.util.HashMap;
import java.util.List;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/Node.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/completion/Node.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/Node.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.completion;
+package org.drools.eclipse.editors.completion;
import java.util.Collection;
import java.util.HashMap;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/RuleCompletionProcessor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/completion/RuleCompletionProcessor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/RuleCompletionProcessor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.completion;
+package org.drools.eclipse.editors.completion;
import java.io.BufferedReader;
import java.io.IOException;
@@ -16,11 +16,11 @@
import org.codehaus.jfdi.interpreter.ClassTypeResolver;
import org.drools.compiler.DrlParser;
import org.drools.compiler.DroolsParserException;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.DroolsPluginImages;
-import org.drools.ide.editors.AbstractRuleEditor;
-import org.drools.ide.editors.DSLAdapter;
-import org.drools.ide.util.ProjectClassLoader;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsPluginImages;
+import org.drools.eclipse.editors.AbstractRuleEditor;
+import org.drools.eclipse.editors.DSLAdapter;
+import org.drools.eclipse.util.ProjectClassLoader;
import org.drools.lang.descr.AccumulateDescr;
import org.drools.lang.descr.AndDescr;
import org.drools.lang.descr.BaseDescr;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/RuleCompletionProposal.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/completion/RuleCompletionProposal.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/completion/RuleCompletionProposal.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.completion;
+package org.drools.eclipse.editors.completion;
import java.util.Comparator;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/java_keywords.properties (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/java_keywords.properties)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/java_keywords.properties (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/java_keywords.properties 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,43 @@
+# this contains the java keywords for syntax highlighting
+# all java keywords are present, those that are not relevant are commented out
+
+# abstract
+# assert
+break
+case
+catch
+# class
+# const
+continue
+default
+do
+else
+# enum
+# extends
+final
+finally
+for
+goto
+if
+# implements
+# import
+instanceof
+# interface
+# native
+new
+# package
+# private
+# protected
+# public
+return
+# static
+# super
+switch
+# synchronized
+# this
+throw
+# throws
+# transient
+try
+# volatile
+while
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/keywords.properties (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/keywords.properties)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/keywords.properties (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/keywords.properties 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,36 @@
+# This contains the keywords for syntax highlighting.
+when
+then
+rule
+end
+modify
+retract
+assert
+assertLogical
+salience
+import
+expander
+package
+function
+global
+query
+exists
+eval
+agenda-group
+no-loop
+duration
+->
+not
+auto-focus
+activation-group
+new
+contains
+matches
+excludes
+template
+from
+accumulate
+collect
+date-effective
+date-expires
+enabled
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/outline (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/outline)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/outline/RuleContentOutlinePage.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/outline/RuleContentOutlinePage.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/outline/RuleContentOutlinePage.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.outline;
+package org.drools.eclipse.editors.outline;
import java.util.HashMap;
import java.util.Iterator;
@@ -7,18 +7,18 @@
import java.util.regex.Pattern;
import org.drools.compiler.DroolsParserException;
-import org.drools.ide.DRLInfo;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.core.DroolsElement;
-import org.drools.ide.core.DroolsModelBuilder;
-import org.drools.ide.core.Package;
-import org.drools.ide.core.RuleSet;
-import org.drools.ide.core.ui.DroolsContentProvider;
-import org.drools.ide.core.ui.DroolsLabelProvider;
-import org.drools.ide.core.ui.DroolsTreeSorter;
-import org.drools.ide.core.ui.FilterActionGroup;
-import org.drools.ide.editors.AbstractRuleEditor;
-import org.drools.ide.editors.DRLRuleEditor;
+import org.drools.eclipse.DRLInfo;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.core.DroolsElement;
+import org.drools.eclipse.core.DroolsModelBuilder;
+import org.drools.eclipse.core.Package;
+import org.drools.eclipse.core.RuleSet;
+import org.drools.eclipse.core.ui.DroolsContentProvider;
+import org.drools.eclipse.core.ui.DroolsLabelProvider;
+import org.drools.eclipse.core.ui.DroolsTreeSorter;
+import org.drools.eclipse.core.ui.FilterActionGroup;
+import org.drools.eclipse.editors.AbstractRuleEditor;
+import org.drools.eclipse.editors.DRLRuleEditor;
import org.drools.lang.descr.AttributeDescr;
import org.drools.lang.descr.PackageDescr;
import org.drools.lang.descr.RuleDescr;
@@ -89,7 +89,7 @@
viewer.setSorter(new DroolsTreeSorter());
viewer.setInput(ruleSet);
FilterActionGroup filterActionGroup = new FilterActionGroup(
- viewer, "org.drools.ide.editors.outline.RuleContentOutlinePage");
+ viewer, "org.drools.eclipse.editors.outline.RuleContentOutlinePage");
filterActionGroup.fillActionBars(getSite().getActionBars());
update();
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/ReteViewer.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/ReteViewer.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/ReteViewer.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/ReteViewer.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,305 @@
+package org.drools.eclipse.editors.rete;
+
+/*
+ * Copyright 2006 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.RuleBase;
+import org.drools.RuleBaseFactory;
+import org.drools.eclipse.DRLInfo;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.editors.DRLRuleEditor;
+import org.drools.eclipse.editors.rete.model.ReteGraph;
+import org.drools.eclipse.editors.rete.part.VertexEditPartFactory;
+import org.drools.reteoo.BaseVertex;
+import org.drools.reteoo.ReteooRuleBase;
+import org.drools.reteoo.ReteooVisitor;
+import org.drools.rule.Package;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.ConnectionLayer;
+import org.eclipse.draw2d.ConnectionRouter;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ShortestPathConnectionRouter;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.DefaultEditDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.MouseWheelHandler;
+import org.eclipse.gef.MouseWheelZoomHandler;
+import org.eclipse.gef.editparts.LayerManager;
+import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.gef.ui.parts.GraphicalEditor;
+import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler;
+import org.eclipse.swt.SWT;
+
+/**
+ * GEF-based RETE Viewer
+ *
+ * @author Ahti Kitsik
+ *
+ */
+public class ReteViewer extends GraphicalEditor {
+
+ private static final String MSG_PARSE_ERROR = "Unable to parse rules to show RETE view!";
+
+ private static final int SIMPLE_ROUTER_MIN_NODES = 100;
+
+ ScalableFreeformRootEditPart rootEditPart = new ScalableFreeformRootEditPart();
+
+ private ReteGraph diagram = new ReteGraph();
+
+ private boolean relayoutRequired = true;
+
+ private DRLRuleEditor drlEditor;
+
+ /**
+ * Constructor.
+ *
+ * @param documentProvider documentProvider must contain Document with rules.
+ */
+ public ReteViewer(DRLRuleEditor drlEditor) {
+ this.drlEditor = drlEditor;
+ setEditDomain( new DefaultEditDomain( this ) );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gef.ui.parts.GraphicalEditor#configureGraphicalViewer()
+ */
+ protected void configureGraphicalViewer() {
+ super.configureGraphicalViewer();
+ GraphicalViewer viewer = getGraphicalViewer();
+ viewer.getControl().setBackground( ColorConstants.white );
+ viewer.setEditPartFactory( new VertexEditPartFactory() );
+ viewer.setRootEditPart( rootEditPart );
+ viewer.setKeyHandler( new GraphicalViewerKeyHandler( viewer ) );
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.gef.ui.parts.GraphicalEditor#getAdapter(java.lang.Class)
+ */
+ public Object getAdapter(Class type) {
+
+ if ( type == ZoomManager.class ) return ((ScalableFreeformRootEditPart) getGraphicalViewer().getRootEditPart()).getZoomManager();
+ if ( type == GraphicalViewer.class ) return getGraphicalViewer();
+ if ( type == EditPart.class && getGraphicalViewer() != null ) return getGraphicalViewer().getRootEditPart();
+ if ( type == IFigure.class && getGraphicalViewer() != null ) return ((GraphicalEditPart) getGraphicalViewer().getRootEditPart()).getFigure();
+ return super.getAdapter( type );
+ }
+
+ private RuleBase getRuleBase(String contents) {
+ try {
+ DRLInfo drlInfo = DroolsIDEPlugin.getDefault().parseResource(drlEditor, true, true);
+ if (drlInfo != null) {
+ Package pkg = drlInfo.getPackage();
+ ReteooRuleBase ruleBase = (ReteooRuleBase) RuleBaseFactory.newRuleBase(RuleBase.RETEOO);
+ ruleBase.addPackage(pkg);
+ return ruleBase;
+ }
+ } catch ( Throwable t ) {
+ DroolsIDEPlugin.log( t );
+ }
+ return null;
+ }
+
+ /**
+ * Loads model from rule base,
+ * calculates rete view and initializes diagram model.
+ * @param monitor
+ * @param contents
+ * @return
+ */
+ public ReteGraph loadReteModel(IProgressMonitor monitor,
+ String contents) throws Throwable {
+ if ( relayoutRequired == false ) {
+ return diagram;
+ }
+
+ ReteGraph newDiagram = new ReteGraph();
+
+ try {
+
+ monitor.beginTask( "Loading RETE Tree",
+ 100 );
+
+ monitor.subTask( "Loading Rule Base" );
+ RuleBase ruleBase = getRuleBase( contents );
+ if ( ruleBase == null ) {
+ final Exception error = new Exception( MSG_PARSE_ERROR );
+ throw error;
+ }
+ monitor.worked( 50 );
+ if ( monitor.isCanceled() ) {
+ throw new InterruptedException();
+ }
+
+ monitor.subTask( "Building RETE Tree" );
+ final ReteooVisitor visitor = new ReteooVisitor( newDiagram );
+ visitor.visit( ruleBase );
+ monitor.worked( 30 );
+ if ( monitor.isCanceled() ) {
+ throw new InterruptedException();
+ }
+
+ monitor.subTask( "Calculating RETE Tree Layout" );
+ BaseVertex rootVertex = visitor.getRootVertex();
+ RowList rowList = ReteooLayoutFactory.calculateReteRows( rootVertex );
+ ReteooLayoutFactory.layoutRowList( newDiagram,
+ rowList );
+ zeroBaseDiagram( newDiagram );
+ monitor.worked( 20 );
+ if ( monitor.isCanceled() ) {
+ throw new InterruptedException();
+ }
+ monitor.done();
+
+ } catch ( Throwable t ) {
+ if ( !(t instanceof InterruptedException) ) {
+ DroolsIDEPlugin.log( t );
+ }
+ throw t;
+ }
+ relayoutRequired = false;
+ return newDiagram;
+ }
+
+ private ReteGraph getModel() {
+ return diagram;
+ }
+
+ /**
+ * Loads Rete model and initializes zoom manager.
+ *
+ */
+ protected void initializeGraphicalViewer() {
+ ZoomManager zoomManager = rootEditPart.getZoomManager();
+
+ //List<String>
+ List zoomLevels = new ArrayList( 3 );
+
+ zoomLevels.add( ZoomManager.FIT_ALL );
+ zoomLevels.add( ZoomManager.FIT_HEIGHT );
+ zoomLevels.add( ZoomManager.FIT_WIDTH );
+
+ zoomManager.setZoomLevelContributions( zoomLevels );
+
+ // Zoom mousewheel - Ctrl+Mousewheel for zoom in/out
+ getGraphicalViewer().setProperty( MouseWheelHandler.KeyGenerator.getKey( SWT.MOD1 ),
+ MouseWheelZoomHandler.SINGLETON );
+
+ }
+
+ /**
+ * Moves all <code>diagram</code> nodes to upper left corner
+ * and shifting to right if neccessary to get rid of negative XY coordinates.
+ *
+ */
+ private void zeroBaseDiagram(ReteGraph graph) {
+
+ Dimension dim = rootEditPart.getContentPane().getSize();
+
+ int minx = 0, miny = 0, maxx = 0, x = dim.width;
+
+ final Iterator nodeIter = graph.getChildren().iterator();
+ while ( nodeIter.hasNext() ) {
+ Point loc = ((BaseVertex) (nodeIter.next())).getLocation();
+ minx = Math.min( loc.x,
+ minx );
+ maxx = Math.max( loc.x,
+ maxx );
+ miny = Math.min( loc.y,
+ miny );
+ }
+
+ int delta = (x - (maxx - minx + 20)) / 2;
+ minx = minx - (delta);
+
+ final Iterator nodeIter2 = graph.getChildren().iterator();
+ while ( nodeIter2.hasNext() ) {
+ final BaseVertex vertex = (BaseVertex) (nodeIter2.next());
+ Point loc = vertex.getLocation();
+ vertex.setLocation( new Point( loc.x - minx,
+ loc.y - miny ) );
+ }
+ }
+
+ /**
+ * No save operation in ReteViewer
+ */
+ public void doSave(IProgressMonitor monitor) {
+
+ }
+
+ /**
+ * ReteViewer is never dirty.
+ * This prevents editor close mechanism to ask file save confirmation
+ * even after one of the vertices is moved.
+ */
+ public boolean isDirty() {
+ return false;
+ }
+
+ /**
+ * Fired when underlying source is modified.
+ * Marks graph viewer to be relayouted when activated.
+ */
+ public void fireDocumentChanged() {
+ relayoutRequired = true;
+ }
+
+ /**
+ * Draws graph.
+ *
+ * @param newGraph used to replace existing graph. if null then existing graph is simply redrawn.
+ */
+ public void drawGraph(ReteGraph newGraph) {
+
+ LayerManager manager = (LayerManager) getGraphicalViewer().getEditPartRegistry().get( LayerManager.ID );
+ ConnectionLayer connLayer = (ConnectionLayer) manager.getLayer( LayerConstants.CONNECTION_LAYER );
+
+ // Lazy-init model initialization
+ if ( getGraphicalViewer().getContents() == null ) {
+ getGraphicalViewer().setContents( getModel() );
+ }
+
+ final boolean isNewDiagram = newGraph != null && newGraph != diagram;
+
+ if ( isNewDiagram ) {
+ diagram.removeAll();
+ }
+
+ // Update connection router according to new model size
+ ConnectionRouter router;
+ if ( (isNewDiagram && newGraph.getChildren().size() < SIMPLE_ROUTER_MIN_NODES) || (!isNewDiagram && getModel().getChildren().size() < SIMPLE_ROUTER_MIN_NODES) ) {
+ router = new ShortestPathConnectionRouter( (IFigure) rootEditPart.getContentPane().getChildren().get( 0 ) );
+ } else {
+ router = ConnectionRouter.NULL;
+ }
+ connLayer.setConnectionRouter( router );
+
+ if ( newGraph != null && newGraph != diagram ) {
+ diagram.addAll( newGraph.getChildren() );
+ }
+
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/ReteooLayoutFactory.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/ReteooLayoutFactory.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/ReteooLayoutFactory.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/ReteooLayoutFactory.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,155 @@
+package org.drools.eclipse.editors.rete;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.drools.eclipse.editors.rete.model.Connection;
+import org.drools.eclipse.editors.rete.model.ReteGraph;
+import org.drools.reteoo.BaseVertex;
+import org.eclipse.draw2d.geometry.Point;
+
+/**
+ * Factory methods for calculating and layouting reteoo graph
+ *
+ */
+public class ReteooLayoutFactory {
+
+ /**
+ * Calculates layouting for provided graph.
+ *
+ * @param root graph root vertex
+ *
+ * @return Optimally layouted rows from provided graph
+ */
+ public static RowList calculateReteRows(BaseVertex root) {
+ RowList rowList;
+ rowList = new RowList();
+
+ rowList.add( 0,
+ root );
+
+ int curRow = 0;
+
+ final Set seenVertices = new HashSet();
+ seenVertices.add( root );
+
+ while ( curRow < rowList.getDepth() ) {
+ final List rowVertices = rowList.get( curRow ).getVertices();
+
+ for ( final Iterator rowNodeIter = rowVertices.iterator(); rowNodeIter.hasNext(); ) {
+ final BaseVertex rowNode = (BaseVertex) rowNodeIter.next();
+
+ final List edges = rowNode.getSourceConnections();
+
+ for ( final Iterator edgeIter = edges.iterator(); edgeIter.hasNext(); ) {
+
+ final Connection edge = (Connection) edgeIter.next();
+ final BaseVertex destNode = edge.getOpposite( rowNode );
+
+ if ( !seenVertices.contains( destNode ) ) {
+ rowList.add( curRow + 1,
+ destNode );
+ seenVertices.add( destNode );
+ }
+ }
+
+ seenVertices.add( rowNode );
+ }
+
+ ++curRow;
+ }
+
+ rowList.optimize();
+
+ return rowList;
+ }
+
+ /**
+ * Adds all vertices from rowList to the graph.
+ *
+ * @param graph
+ * @param rowList
+ */
+ public static void layoutRowList(ReteGraph graph,
+ RowList rowList) {
+ new LayoutCalculator( graph,
+ rowList );
+ }
+
+ private static class LayoutCalculator {
+
+ public final static String COORDS = "drools.LayoutCalculator.coords";
+
+ private static final int COLUMN_SPACE = 40;
+ private static final int ROW_HEIGHT_MULTIPLIER = 6;
+
+ private RowList rowList;
+
+ private int columnWidth;
+ private int rowHeight;
+
+ private ReteGraph graph;
+
+ private LayoutCalculator(final ReteGraph graph,
+ final RowList rowList) {
+ this.graph = graph;
+ this.rowList = rowList;
+ computeSize();
+
+ List vertices = getGraph().getChildren();
+ Iterator iter = vertices.iterator();
+ while ( iter.hasNext() ) {
+ BaseVertex v = (BaseVertex) iter.next();
+ initialize_local_vertex( v );
+ }
+
+ }
+
+ private void computeSize() {
+ final List vertices = getGraph().getChildren();
+
+ for ( final Iterator vertexIter = vertices.iterator(); vertexIter.hasNext(); ) {
+ final BaseVertex vertex = (BaseVertex) vertexIter.next();
+
+ final int width = vertex.getSize().width;
+ final int height = vertex.getSize().height;
+
+ if ( width > this.columnWidth ) {
+ this.columnWidth = width;
+ }
+
+ if ( height > this.rowHeight ) {
+ this.rowHeight = height;
+ }
+ }
+
+ this.columnWidth = this.columnWidth + LayoutCalculator.COLUMN_SPACE;
+ }
+
+ private void initialize_local_vertex(final BaseVertex vertex) {
+ final int row = this.rowList.getRow( vertex );
+ final int col = this.rowList.getColumn( vertex );
+
+ final int rowWidth = this.rowList.getWidth( row );
+
+ final int columnWidthPx = columnWidth;
+ final int rowHeightPx = rowHeight;
+
+ double x = (col * columnWidthPx);
+ double y = (row * (rowHeightPx * LayoutCalculator.ROW_HEIGHT_MULTIPLIER));
+
+ x = x + (columnWidthPx / 2) - ((rowWidth - 1) * (columnWidthPx / 2));
+ y = y + (rowHeightPx / 2) + 3;
+
+ vertex.setLocation( new Point( x,
+ y ) );
+ }
+
+ private ReteGraph getGraph() {
+ return graph;
+ }
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/Row.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/Row.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/Row.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/Row.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,139 @@
+package org.drools.eclipse.editors.rete;
+
+/*
+ * Copyright 2006 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.drools.reteoo.BaseVertex;
+
+/**
+ * Represents one row in rete graph
+ *
+ */
+public class Row {
+
+ private final int depth;
+
+ //List<BaseVertex>
+ private List vertices;
+
+ /**
+ * Default constructor.
+ *
+ * @param depth row depth
+ */
+ public Row(final int depth) {
+ super();
+ this.vertices = new ArrayList();
+ this.depth = depth;
+ }
+
+ /**
+ * Returns row depth
+ *
+ * @return row depth
+ */
+ public int getDepth() {
+ return this.depth;
+ }
+
+ /**
+ * Adds new vertex to this row.
+ *
+ * @param vertex new vertex to be added
+ */
+ public void add(final BaseVertex vertex) {
+ this.vertices.add( vertex );
+ }
+
+ /**
+ * Returns all vertices from this row.
+ *
+ * @return list of vertices with type BaseVertex
+ */
+ public List getVertices() {
+ return this.vertices;
+ }
+
+ /**
+ * @param vertex
+ * @return <code>true</code> if vertex is found in row. <code>false</code> otherwise.
+ */
+ public boolean contains(final BaseVertex vertex) {
+ return this.vertices.contains( vertex );
+ }
+
+ /**
+ * @return number of vertices in row
+ */
+ public int getWidth() {
+ return this.vertices.size();
+ }
+
+ /**
+ * Optimizing vertices for optimal presentation
+ *
+ */
+ public void optimize() {
+ final List sorted = new ArrayList( this.vertices );
+
+ Collections.sort( sorted,
+ new Comparator() {
+ public int compare(final Object o1,
+ final Object o2) {
+ final BaseVertex v1 = (BaseVertex) o1;
+ final BaseVertex v2 = (BaseVertex) o2;
+
+ int v1OutDegree = v1.getSourceConnections().size();
+ int v2OutDegree = v2.getSourceConnections().size();
+
+ if ( v1OutDegree < v2OutDegree ) {
+ return 1;
+ }
+
+ if ( v1OutDegree > v2OutDegree ) {
+ return -1;
+ }
+
+ return 0;
+ }
+ } );
+
+ final LinkedList optimized = new LinkedList();
+
+ boolean front = false;
+
+ for ( final Iterator vertexIter = sorted.iterator(); vertexIter.hasNext(); ) {
+ final BaseVertex vertex = (BaseVertex) vertexIter.next();
+
+ if ( front ) {
+ optimized.addFirst( vertex );
+ } else {
+ optimized.addLast( vertex );
+ }
+
+ front = !front;
+ }
+
+ this.vertices = optimized;
+ }
+}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/RowList.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/RowList.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/RowList.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/RowList.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,169 @@
+package org.drools.eclipse.editors.rete;
+
+/*
+ * Copyright 2006 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.drools.reteoo.BaseVertex;
+
+/**
+ * Holder for Row elements.
+ *
+ */
+public class RowList {
+
+ // List<Row>
+ private List rows;
+
+ /**
+ * Default constructor.
+ */
+ public RowList() {
+ super();
+ this.rows = new ArrayList();
+ }
+
+ /**
+ * Adds new vertex to specified depth
+ *
+ * @param depth depth for vertex
+ * @param vertex vertex
+ */
+ public void add(final int depth,
+ final BaseVertex vertex) {
+ if ( this.rows.size() < (depth + 1) ) {
+ final int addRows = depth - this.rows.size() + 1;
+
+ for ( int i = 0; i < addRows; ++i ) {
+ this.rows.add( new Row( (depth - addRows) + i ) );
+ }
+ }
+
+ ((Row) this.rows.get( depth )).add( vertex );
+ }
+
+ /**
+ * @return number of rows in RowList
+ */
+ public int getDepth() {
+ return this.rows.size();
+ }
+
+ /**
+ * @param row index of the row to be returned (0..n-1)
+ * @return specified row
+ */
+ public Row get(final int row) {
+ return (Row) this.rows.get( row );
+ }
+
+ /**
+ * Finds specified vertex from the rows.
+ *
+ * @param vertex vertex
+ *
+ * @return row number where vertex was found (0..n-1). <code>-1</code> if not found.
+ */
+ public int getRow(final BaseVertex vertex) {
+ final int numRows = this.rows.size();
+
+ for ( int i = 0; i < numRows; ++i ) {
+ if ( ((Row) this.rows.get( i )).contains( vertex ) ) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ /**
+ * Finds the longest row width.
+ *
+ * @return width of the longest row
+ */
+ public int getWidth() {
+ int width = 0;
+
+ for ( final Iterator rowIter = this.rows.iterator(); rowIter.hasNext(); ) {
+ final Row row = (Row) rowIter.next();
+ final int rowWidth = row.getWidth();
+
+ if ( rowWidth > width ) {
+ width = rowWidth;
+ }
+ }
+
+ return width;
+ }
+
+ /**
+ * Width of the row at specified index.
+ *
+ * @param row
+ * @return width
+ */
+ public int getWidth(final int row) {
+ return ((Row) this.rows.get( row )).getWidth();
+ }
+
+ /**
+ * @param vertex vertex to search
+ * @return column where vertex was found
+ */
+ public int getColumn(final BaseVertex vertex) {
+ final int row = getRow( vertex );
+
+ if ( row < 0 ) {
+ return -1;
+ }
+
+ final List rowVertices = get( row ).getVertices();
+
+ final int numCols = rowVertices.size();
+
+ for ( int i = 0; i < numCols; ++i ) {
+ if ( rowVertices.get( i ).equals( vertex ) ) {
+ return i;
+ }
+ }
+
+ return -1;
+ }
+
+ /**
+ * Dumps all row vertices to System.err
+ */
+ public void dump() {
+ final int numRows = this.rows.size();
+
+ for ( int i = 0; i < numRows; ++i ) {
+ System.err.println( i + ": " + get( i ).getVertices() );
+ }
+ }
+
+ /**
+ * Optimizes all rows for optimal presentation
+ */
+ public void optimize() {
+ final int numRows = this.rows.size();
+
+ for ( int i = 0; i < numRows; ++i ) {
+ get( i ).optimize();
+ }
+ }
+}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/commands (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/commands)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/commands/NodeSetConstraintCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/commands/NodeSetConstraintCommand.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/commands/NodeSetConstraintCommand.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.rete.commands;
+package org.drools.eclipse.editors.rete.commands;
import org.drools.reteoo.BaseVertex;
import org.eclipse.draw2d.geometry.Rectangle;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/figure (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/figure)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/figure/ConnectionFigure.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/figure/ConnectionFigure.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/figure/ConnectionFigure.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.rete.figure;
+package org.drools.eclipse.editors.rete.figure;
import org.eclipse.draw2d.Graphics;
import org.eclipse.draw2d.PolylineConnection;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/figure/VertexFigure.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/figure/VertexFigure.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/figure/VertexFigure.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.rete.figure;
+package org.drools.eclipse.editors.rete.figure;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.Graphics;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/model)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/Connection.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/model/Connection.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/Connection.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.rete.model;
+package org.drools.eclipse.editors.rete.model;
import org.drools.reteoo.BaseVertex;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/GraphicalVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/model/GraphicalVertex.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/GraphicalVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.rete.model;
+package org.drools.eclipse.editors.rete.model;
import java.util.ArrayList;
import java.util.List;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/ModelElement.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/model/ModelElement.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/ModelElement.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.rete.model;
+package org.drools.eclipse.editors.rete.model;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeSupport;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/ReteGraph.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/model/ReteGraph.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/ReteGraph.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.rete.model;
+package org.drools.eclipse.editors.rete.model;
import java.util.ArrayList;
import java.util.Iterator;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/VertexPropertySource.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/model/VertexPropertySource.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/model/VertexPropertySource.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.rete.model;
+package org.drools.eclipse.editors.rete.model;
import java.util.ArrayList;
import java.util.HashMap;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/part (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/part)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/part/ConnectionEditPart.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/part/ConnectionEditPart.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/part/ConnectionEditPart.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.drools.ide.editors.rete.part;
+package org.drools.eclipse.editors.rete.part;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
-import org.drools.ide.editors.rete.figure.ConnectionFigure;
-import org.drools.ide.editors.rete.model.ModelElement;
+import org.drools.eclipse.editors.rete.figure.ConnectionFigure;
+import org.drools.eclipse.editors.rete.model.ModelElement;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.PolylineConnection;
import org.eclipse.draw2d.PolylineDecoration;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/part/DiagramEditPart.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/part/DiagramEditPart.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/part/DiagramEditPart.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.drools.ide.editors.rete.part;
+package org.drools.eclipse.editors.rete.part;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.List;
-import org.drools.ide.editors.rete.commands.NodeSetConstraintCommand;
-import org.drools.ide.editors.rete.model.ModelElement;
-import org.drools.ide.editors.rete.model.ReteGraph;
+import org.drools.eclipse.editors.rete.commands.NodeSetConstraintCommand;
+import org.drools.eclipse.editors.rete.model.ModelElement;
+import org.drools.eclipse.editors.rete.model.ReteGraph;
import org.drools.reteoo.BaseVertex;
import org.eclipse.draw2d.Figure;
import org.eclipse.draw2d.FreeformLayer;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/part/VertexEditPart.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/part/VertexEditPart.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/part/VertexEditPart.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,13 +1,13 @@
-package org.drools.ide.editors.rete.part;
+package org.drools.eclipse.editors.rete.part;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.List;
-import org.drools.ide.editors.rete.figure.VertexFigure;
-import org.drools.ide.editors.rete.model.GraphicalVertex;
-import org.drools.ide.editors.rete.model.ModelElement;
-import org.drools.ide.editors.rete.model.VertexPropertySource;
+import org.drools.eclipse.editors.rete.figure.VertexFigure;
+import org.drools.eclipse.editors.rete.model.GraphicalVertex;
+import org.drools.eclipse.editors.rete.model.ModelElement;
+import org.drools.eclipse.editors.rete.model.VertexPropertySource;
import org.drools.reteoo.BaseVertex;
import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.EllipseAnchor;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/part/VertexEditPartFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/rete/part/VertexEditPartFactory.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/rete/part/VertexEditPartFactory.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,8 +1,8 @@
-package org.drools.ide.editors.rete.part;
+package org.drools.eclipse.editors.rete.part;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.editors.rete.model.Connection;
-import org.drools.ide.editors.rete.model.ReteGraph;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.editors.rete.model.Connection;
+import org.drools.eclipse.editors.rete.model.ReteGraph;
import org.drools.reteoo.BaseVertex;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/scanners)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/DRLPartionScanner.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/scanners/DRLPartionScanner.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/DRLPartionScanner.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.scanners;
+package org.drools.eclipse.editors.scanners;
import java.util.ArrayList;
import java.util.List;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/DRLScanner.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/scanners/DRLScanner.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/DRLScanner.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,10 +1,10 @@
-package org.drools.ide.editors.scanners;
+package org.drools.eclipse.editors.scanners;
import java.util.ArrayList;
import java.util.List;
-import org.drools.ide.editors.ColorManager;
-import org.drools.ide.editors.Keywords;
+import org.drools.eclipse.editors.ColorManager;
+import org.drools.eclipse.editors.Keywords;
import org.eclipse.jface.text.TextAttribute;
import org.eclipse.jface.text.rules.EndOfLineRule;
import org.eclipse.jface.text.rules.IRule;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/RuleEditorMessages.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/scanners/RuleEditorMessages.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/RuleEditorMessages.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.drools.ide.editors.scanners;
+package org.drools.eclipse.editors.scanners;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/RuleWordDetector.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/scanners/RuleWordDetector.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/RuleWordDetector.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.scanners;
+package org.drools.eclipse.editors.scanners;
import org.eclipse.jface.text.rules.IWordDetector;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/WhitespaceDetector.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/editors/scanners/WhitespaceDetector.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/editors/scanners/WhitespaceDetector.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.editors.scanners;
+package org.drools.eclipse.editors.scanners;
import org.eclipse.jface.text.rules.IWhitespaceDetector;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/datatype/DefaultDataTypeRegistry.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/datatype/DefaultDataTypeRegistry.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/datatype/DefaultDataTypeRegistry.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/datatype/DefaultDataTypeRegistry.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,74 @@
+package org.drools.eclipse.flow.common.datatype;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.eclipse.flow.common.datatype.impl.DataTypeRegistry;
+import org.drools.eclipse.flow.common.view.datatype.editor.impl.BooleanEditor;
+import org.drools.eclipse.flow.common.view.datatype.editor.impl.EmptyEditor;
+import org.drools.eclipse.flow.common.view.datatype.editor.impl.IntegerEditor;
+import org.drools.ruleflow.common.datatype.IDataTypeFactory;
+import org.drools.ruleflow.common.datatype.impl.InstanceDataTypeFactory;
+import org.drools.ruleflow.common.datatype.impl.type.BooleanDataType;
+import org.drools.ruleflow.common.datatype.impl.type.FloatDataType;
+import org.drools.ruleflow.common.datatype.impl.type.IntegerDataType;
+import org.drools.ruleflow.common.datatype.impl.type.StringDataType;
+import org.drools.ruleflow.common.datatype.impl.type.UndefinedDataType;
+
+import sun.beans.editors.FloatEditor;
+import sun.beans.editors.StringEditor;
+
+/**
+ * Default datatype registry containing default datatypes.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class DefaultDataTypeRegistry {
+
+ private static final IDataTypeRegistry variableDataTypeRegistry = new DataTypeRegistry();
+
+ private DefaultDataTypeRegistry() {
+ }
+
+ static {
+ registerVariableDataType(UndefinedDataType.class,
+ new InstanceDataTypeFactory(UndefinedDataType.class),
+ "Undefined", EmptyEditor.class, EmptyEditor.class);
+ registerVariableDataType(BooleanDataType.class,
+ new InstanceDataTypeFactory(BooleanDataType.class), "Boolean",
+ BooleanEditor.class, EmptyEditor.class);
+ registerVariableDataType(IntegerDataType.class,
+ new InstanceDataTypeFactory(IntegerDataType.class), "Integer",
+ IntegerEditor.class, EmptyEditor.class);
+ registerVariableDataType(FloatDataType.class,
+ new InstanceDataTypeFactory(FloatDataType.class), "Float",
+ FloatEditor.class, EmptyEditor.class);
+ registerVariableDataType(StringDataType.class,
+ new InstanceDataTypeFactory(StringDataType.class), "String",
+ StringEditor.class, EmptyEditor.class);
+ }
+
+ public static void registerVariableDataType(Class type,
+ IDataTypeFactory dataTypeFactory, String name,
+ Class valueEditorClass, Class dataTypeEditorClass) {
+ variableDataTypeRegistry.registerDataType(type, dataTypeFactory, name,
+ valueEditorClass, dataTypeEditorClass);
+ }
+
+ public static IDataTypeRegistry getInstance() {
+ return variableDataTypeRegistry;
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/datatype/IDataTypeRegistry.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/datatype/IDataTypeRegistry.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/datatype/IDataTypeRegistry.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/datatype/IDataTypeRegistry.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,52 @@
+package org.drools.eclipse.flow.common.datatype;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.Set;
+
+import org.drools.ruleflow.common.datatype.IDataTypeFactory;
+
+/**
+ * A registry of datatypes.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface IDataTypeRegistry {
+
+ /**
+ * Returns all registered data types.
+ */
+ Set getDataTypes();
+
+ void registerDataType(Class type, IDataTypeFactory dataTypeFactory, String name,
+ Class valueEditorClass, Class dataTypeEditorClass);
+
+ /**
+ * Returns the data type info of the data type with the given type
+ * @param type
+ * @return the data type info
+ * @throws IllegalArgumentException if the data type info of this type cannot be found
+ */
+ IDataTypeInfo getDataTypeInfo(Class type);
+
+ interface IDataTypeInfo {
+ Class getType();
+ IDataTypeFactory getDataTypeFactory();
+ String getName();
+ Class getDataTypeEditorClass();
+ Class getValueEditorClass();
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/datatype/impl (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/datatype/impl)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/datatype/impl/DataTypeRegistry.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/datatype/impl/DataTypeRegistry.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/datatype/impl/DataTypeRegistry.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.datatype.impl;
+package org.drools.eclipse.flow.common.datatype.impl;
/*
* Copyright 2005 JBoss Inc
*
@@ -20,7 +20,7 @@
import java.util.Map;
import java.util.Set;
-import org.drools.ide.flow.common.datatype.IDataTypeRegistry;
+import org.drools.eclipse.flow.common.datatype.IDataTypeRegistry;
import org.drools.ruleflow.common.datatype.IDataTypeFactory;
/**
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/GenericActionBarContributor.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericActionBarContributor.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/GenericActionBarContributor.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/GenericActionBarContributor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,74 @@
+package org.drools.eclipse.flow.common.editor;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.gef.ui.actions.ActionBarContributor;
+import org.eclipse.gef.ui.actions.AlignmentRetargetAction;
+import org.eclipse.gef.ui.actions.DeleteRetargetAction;
+import org.eclipse.gef.ui.actions.GEFActionConstants;
+import org.eclipse.gef.ui.actions.RedoRetargetAction;
+import org.eclipse.gef.ui.actions.UndoRetargetAction;
+import org.eclipse.gef.ui.actions.ZoomComboContributionItem;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.ui.actions.ActionFactory;
+
+/**
+ * Common implementation of a ActionBarContributor.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class GenericActionBarContributor extends ActionBarContributor {
+
+ protected void buildActions() {
+ addRetargetAction(new UndoRetargetAction());
+ addRetargetAction(new RedoRetargetAction());
+ addRetargetAction(new DeleteRetargetAction());
+
+ addRetargetAction(new AlignmentRetargetAction(PositionConstants.LEFT));
+ addRetargetAction(new AlignmentRetargetAction(PositionConstants.CENTER));
+ addRetargetAction(new AlignmentRetargetAction(PositionConstants.RIGHT));
+ addRetargetAction(new AlignmentRetargetAction(PositionConstants.TOP));
+ addRetargetAction(new AlignmentRetargetAction(PositionConstants.MIDDLE));
+ addRetargetAction(new AlignmentRetargetAction(PositionConstants.BOTTOM));
+ }
+
+ public void contributeToToolBar(IToolBarManager toolBarManager) {
+ toolBarManager.add(getAction(ActionFactory.UNDO.getId()));
+ toolBarManager.add(getAction(ActionFactory.REDO.getId()));
+ toolBarManager.add(new Separator());
+ toolBarManager.add(new ZoomComboContributionItem(getPage()));
+ toolBarManager.add(new Separator());
+ toolBarManager.add(getActionRegistry().getAction(
+ GEFActionConstants.ALIGN_LEFT));
+ toolBarManager.add(getActionRegistry().getAction(
+ GEFActionConstants.ALIGN_CENTER));
+ toolBarManager.add(getActionRegistry().getAction(
+ GEFActionConstants.ALIGN_RIGHT));
+ toolBarManager.add(new Separator());
+ toolBarManager.add(getActionRegistry().getAction(
+ GEFActionConstants.ALIGN_TOP));
+ toolBarManager.add(getActionRegistry().getAction(
+ GEFActionConstants.ALIGN_MIDDLE));
+ toolBarManager.add(getActionRegistry().getAction(
+ GEFActionConstants.ALIGN_BOTTOM));
+
+ }
+
+ protected void declareGlobalActionKeys() {
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/GenericContextMenuProvider.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericContextMenuProvider.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/GenericContextMenuProvider.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/GenericContextMenuProvider.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,65 @@
+package org.drools.eclipse.flow.common.editor;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.gef.ContextMenuProvider;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.gef.ui.actions.GEFActionConstants;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.ui.actions.ActionFactory;
+
+/**
+ * Common implementation of a ContextMenuProvider.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class GenericContextMenuProvider extends ContextMenuProvider {
+
+ private ActionRegistry actionRegistry;
+
+ public GenericContextMenuProvider(EditPartViewer viewer,
+ ActionRegistry registry) {
+ super(viewer);
+ setActionRegistry(registry);
+ }
+
+ public void buildContextMenu(IMenuManager menu) {
+ GEFActionConstants.addStandardActionGroups(menu);
+
+ IAction action = getActionRegistry().getAction(
+ ActionFactory.UNDO.getId());
+ menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action);
+
+ action = getActionRegistry().getAction(ActionFactory.REDO.getId());
+ menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action);
+
+ action = getActionRegistry().getAction(ActionFactory.DELETE.getId());
+ if (action.isEnabled()) {
+ menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
+ }
+ }
+
+ private ActionRegistry getActionRegistry() {
+ return actionRegistry;
+ }
+
+ public void setActionRegistry(ActionRegistry registry) {
+ actionRegistry = registry;
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/GenericModelEditor.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericModelEditor.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/GenericModelEditor.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/GenericModelEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,304 @@
+package org.drools.eclipse.flow.common.editor;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectOutputStream;
+import java.io.OutputStream;
+import java.util.EventObject;
+
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.gef.ContextMenuProvider;
+import org.eclipse.gef.DefaultEditDomain;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gef.KeyHandler;
+import org.eclipse.gef.KeyStroke;
+import org.eclipse.gef.editparts.ScalableRootEditPart;
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.gef.ui.actions.AlignmentAction;
+import org.eclipse.gef.ui.actions.DirectEditAction;
+import org.eclipse.gef.ui.actions.GEFActionConstants;
+import org.eclipse.gef.ui.parts.GraphicalEditorWithPalette;
+import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.dialogs.SaveAsDialog;
+import org.eclipse.ui.part.FileEditorInput;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+/**
+ * Abstract implementation of a graphical editor.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class GenericModelEditor extends GraphicalEditorWithPalette {
+
+ private Object model;
+ private boolean savePreviouslyNeeded = false;
+ private KeyHandler sharedKeyHandler;
+ private PaletteRoot root;
+ private OverviewOutlinePage overviewOutlinePage;
+
+ public GenericModelEditor() {
+ setEditDomain(new DefaultEditDomain(this));
+ }
+
+ protected void setModel(Object model) {
+ this.model = model;
+ }
+
+ protected Object getModel() {
+ return model;
+ }
+
+ protected void createActions() {
+ super.createActions();
+ ActionRegistry registry = getActionRegistry();
+
+ IAction action = new DirectEditAction((IWorkbenchPart) this);
+ registry.registerAction(action);
+ getSelectionActions().add(action.getId());
+
+ action = new AlignmentAction((IWorkbenchPart) this,
+ PositionConstants.LEFT);
+ registry.registerAction(action);
+ getSelectionActions().add(action.getId());
+
+ action = new AlignmentAction((IWorkbenchPart) this,
+ PositionConstants.CENTER);
+ registry.registerAction(action);
+ getSelectionActions().add(action.getId());
+
+ action = new AlignmentAction((IWorkbenchPart) this,
+ PositionConstants.RIGHT);
+ registry.registerAction(action);
+ getSelectionActions().add(action.getId());
+
+ action = new AlignmentAction((IWorkbenchPart) this,
+ PositionConstants.TOP);
+ registry.registerAction(action);
+ getSelectionActions().add(action.getId());
+
+ action = new AlignmentAction((IWorkbenchPart) this,
+ PositionConstants.MIDDLE);
+ registry.registerAction(action);
+ getSelectionActions().add(action.getId());
+
+ action = new AlignmentAction((IWorkbenchPart) this,
+ PositionConstants.BOTTOM);
+ registry.registerAction(action);
+ getSelectionActions().add(action.getId());
+ }
+
+ public void commandStackChanged(EventObject event) {
+ if (isDirty()) {
+ if (!savePreviouslyNeeded()) {
+ setSavePreviouslyNeeded(true);
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
+ } else {
+ setSavePreviouslyNeeded(false);
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ }
+ super.commandStackChanged(event);
+ }
+
+ protected void createOutputStream(OutputStream os) throws IOException {
+ ObjectOutputStream out = new ObjectOutputStream(os);
+ out.writeObject(model);
+ out.close();
+ }
+
+ protected void configureGraphicalViewer() {
+ super.configureGraphicalViewer();
+ getGraphicalViewer().setRootEditPart(new ScalableRootEditPart());
+ getGraphicalViewer().setEditPartFactory(createEditPartFactory());
+ getGraphicalViewer().setKeyHandler(
+ new GraphicalViewerKeyHandler(getGraphicalViewer())
+ .setParent(getCommonKeyHandler()));
+
+ ContextMenuProvider provider = new GenericContextMenuProvider(
+ getGraphicalViewer(), getActionRegistry());
+ getGraphicalViewer().setContextMenu(provider);
+ getSite().registerContextMenu("org.drools.eclipse.flow.editor.contextmenu",
+ provider, getGraphicalViewer());
+ }
+
+ protected abstract EditPartFactory createEditPartFactory();
+
+ protected void initializeGraphicalViewer() {
+ getGraphicalViewer().setContents(model);
+ }
+
+ public void doSave(IProgressMonitor monitor) {
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ createOutputStream(out);
+ IFile file = ((IFileEditorInput) getEditorInput()).getFile();
+ file.setContents(new ByteArrayInputStream(out.toByteArray()), true,
+ false, monitor);
+ out.close();
+ getCommandStack().markSaveLocation();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void doSaveAs() {
+ SaveAsDialog dialog = new SaveAsDialog(getSite().getWorkbenchWindow()
+ .getShell());
+ dialog.setOriginalFile(((IFileEditorInput) getEditorInput()).getFile());
+ dialog.open();
+ IPath path = dialog.getResult();
+
+ if (path == null) {
+ return;
+ }
+
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ final IFile file = workspace.getRoot().getFile(path);
+
+ WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+ public void execute(final IProgressMonitor monitor)
+ throws CoreException {
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ createOutputStream(out);
+ file.create(new ByteArrayInputStream(out.toByteArray()),
+ true, monitor);
+ out.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ };
+
+ try {
+ new ProgressMonitorDialog(getSite().getWorkbenchWindow().getShell())
+ .run(false, true, op);
+ setInput(new FileEditorInput(file));
+ getCommandStack().markSaveLocation();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ protected KeyHandler getCommonKeyHandler() {
+ if (sharedKeyHandler == null) {
+ sharedKeyHandler = new KeyHandler();
+ sharedKeyHandler
+ .put(KeyStroke.getPressed(SWT.DEL, 127, 0),
+ getActionRegistry().getAction(
+ ActionFactory.DELETE.getId()));
+ sharedKeyHandler.put(KeyStroke.getPressed(SWT.F2, 0),
+ getActionRegistry().getAction(
+ GEFActionConstants.DIRECT_EDIT));
+ }
+ return sharedKeyHandler;
+ }
+
+ public boolean isDirty() {
+ return isSaveOnCloseNeeded();
+ }
+
+ public boolean isSaveAsAllowed() {
+ return true;
+ }
+
+ public boolean isSaveOnCloseNeeded() {
+ return getCommandStack().isDirty();
+ }
+
+ private boolean savePreviouslyNeeded() {
+ return savePreviouslyNeeded;
+ }
+
+ private void setSavePreviouslyNeeded(boolean value) {
+ savePreviouslyNeeded = value;
+ }
+
+ protected PaletteRoot getPaletteRoot() {
+ if (root == null) {
+ root = createPalette();
+ }
+ return root;
+ }
+
+ protected abstract PaletteRoot createPalette();
+
+ protected void setInput(IEditorInput input) {
+ super.setInput(input);
+
+ IFile file = ((IFileEditorInput) input).getFile();
+ setPartName(file.getName());
+ try {
+ InputStream is = file.getContents(false);
+ createInputStream(is);
+ } catch (Exception e) {
+ DroolsIDEPlugin.log(e);
+ model = createModel();
+ }
+ }
+
+ protected void createInputStream(InputStream is) throws Exception {
+ ObjectInputStream ois = new ObjectInputStreamWithLoader(is, getClass()
+ .getClassLoader());
+ model = ois.readObject();
+ ois.close();
+ }
+
+ protected abstract Object createModel();
+
+ public Object getAdapter(Class type) {
+ if (type == IContentOutlinePage.class) {
+ return getOverviewOutlinePage();
+ }
+ if (type == ZoomManager.class) {
+ return ((ScalableRootEditPart) getGraphicalViewer()
+ .getRootEditPart()).getZoomManager();
+ }
+ return super.getAdapter(type);
+ }
+
+ protected OverviewOutlinePage getOverviewOutlinePage() {
+ if (null == overviewOutlinePage && null != getGraphicalViewer()) {
+ ScalableRootEditPart rootEditPart = (ScalableRootEditPart) getGraphicalViewer()
+ .getRootEditPart();
+ overviewOutlinePage = new OverviewOutlinePage(rootEditPart);
+ }
+ return overviewOutlinePage;
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/ObjectInputStreamWithLoader.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/ObjectInputStreamWithLoader.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/ObjectInputStreamWithLoader.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/ObjectInputStreamWithLoader.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,92 @@
+package org.drools.eclipse.flow.common.editor;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+import java.io.StreamCorruptedException;
+import java.lang.reflect.Array;
+
+/**
+ * Implementation of an ObjectInputStream that has a custom classloader.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ObjectInputStreamWithLoader extends ObjectInputStream {
+
+ private ClassLoader loader;
+
+ /**
+ * Loader must be non-null;
+ */
+ public ObjectInputStreamWithLoader(InputStream in, ClassLoader loader)
+ throws IOException, StreamCorruptedException {
+ super(in);
+ if (loader == null) {
+ throw new IllegalArgumentException("Illegal null argument to ObjectInputStreamWithLoader");
+ }
+ this.loader = loader;
+ }
+
+ /**
+ * Make a primitive array class
+ */
+ private Class primitiveType(char type) {
+ switch (type) {
+ case 'B': return byte.class;
+ case 'C': return char.class;
+ case 'D': return double.class;
+ case 'F': return float.class;
+ case 'I': return int.class;
+ case 'J': return long.class;
+ case 'S': return short.class;
+ case 'Z': return boolean.class;
+ default: return null;
+ }
+ }
+
+ /**
+ * Use the given ClassLoader rather than using the system class
+ */
+ protected Class resolveClass(ObjectStreamClass classDesc)
+ throws IOException, ClassNotFoundException {
+ String cname = classDesc.getName();
+ if (cname.startsWith("[")) {
+ // An array
+ Class component = null; // component class
+ int dcount; // dimension
+ for (dcount=1; cname.charAt(dcount)=='['; dcount++);
+ if (cname.charAt(dcount) == 'L') {
+ String className = cname.substring(dcount+1, cname.length()-1);
+ component = loader.loadClass(className);
+ } else {
+ if (cname.length() != dcount + 1) {
+ throw new ClassNotFoundException(cname);// malformed
+ }
+ component = primitiveType(cname.charAt(dcount));
+ }
+ int dim[] = new int[dcount];
+ for (int i = 0; i < dcount; i++) {
+ dim[i]=0;
+ }
+ return Array.newInstance(component, dim).getClass();
+ }
+ return loader.loadClass(cname);
+ }
+}
+
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/OverviewOutlinePage.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/OverviewOutlinePage.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/OverviewOutlinePage.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/OverviewOutlinePage.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,90 @@
+package org.drools.eclipse.flow.common.editor;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.draw2d.LightweightSystem;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.Viewport;
+import org.eclipse.draw2d.parts.ScrollableThumbnail;
+import org.eclipse.draw2d.parts.Thumbnail;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.editparts.ScalableRootEditPart;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.part.Page;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+/**
+ * Common implementation of an outline page.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class OverviewOutlinePage extends Page implements IContentOutlinePage {
+
+ private Canvas overview;
+ private ScalableRootEditPart rootEditPart;
+ private Thumbnail thumbnail;
+
+ public OverviewOutlinePage(ScalableRootEditPart rootEditPart) {
+ this.rootEditPart = rootEditPart;
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+ }
+
+ public void createControl(Composite parent) {
+ overview = new Canvas(parent, SWT.NONE);
+ LightweightSystem lws = new LightweightSystem(overview);
+ thumbnail = new ScrollableThumbnail((Viewport) rootEditPart.getFigure());
+ thumbnail.setBorder(new MarginBorder(3));
+ thumbnail.setSource(rootEditPart
+ .getLayer(LayerConstants.PRINTABLE_LAYERS));
+ lws.setContents(thumbnail);
+ }
+
+ public void dispose() {
+ if (null != thumbnail) {
+ thumbnail.deactivate();
+ }
+ super.dispose();
+ }
+
+ public Control getControl() {
+ return overview;
+ }
+
+ public ISelection getSelection() {
+ return StructuredSelection.EMPTY;
+ }
+
+ public void removeSelectionChangedListener(
+ ISelectionChangedListener listener) {
+ }
+
+ public void setFocus() {
+ if (getControl() != null) {
+ getControl().setFocus();
+ }
+ }
+
+ public void setSelection(ISelection selection) {
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/DefaultElementWrapper.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/DefaultElementWrapper.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/DefaultElementWrapper.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/DefaultElementWrapper.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,205 @@
+package org.drools.eclipse.flow.common.editor.core;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
+
+/**
+ * Default wrapper of a model element.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class DefaultElementWrapper implements IPropertySource, ElementWrapper, Serializable {
+
+ protected static IPropertyDescriptor[] descriptors;
+
+ public static final String NAME = "Name";
+ static {
+ descriptors = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(NAME, "Name"),
+ };
+ }
+
+ private Object element;
+ private Rectangle constraint;
+ private ProcessWrapper parent;
+ private List incomingConnections = new ArrayList();
+ private List outgoingConnections = new ArrayList();
+ private transient List listeners = new ArrayList();
+
+ protected void setElement(Object element) {
+ this.element = element;
+ }
+
+ public Object getElement() {
+ return element;
+ }
+
+ public void setConstraint(Rectangle constraint) {
+ this.constraint = constraint;
+ notifyListeners(CHANGE_CONSTRAINT);
+ }
+
+ public Rectangle getConstraint() {
+ return constraint;
+ }
+
+ public void setParent(ProcessWrapper parent) {
+ this.parent = parent;
+ }
+
+ protected ProcessWrapper getParent() {
+ return parent;
+ }
+
+ public List getOutgoingConnections() {
+ return Collections.unmodifiableList(outgoingConnections);
+ }
+
+ public List getIncomingConnections() {
+ return Collections.unmodifiableList(incomingConnections);
+ }
+
+ public void addIncomingConnection(ElementConnection connection) {
+ incomingConnections.add(connection);
+ internalAddIncomingConnection(connection);
+ notifyListeners(CHANGE_INCOMING_CONNECTIONS);
+ }
+
+ protected void internalAddIncomingConnection(ElementConnection connection) {
+ }
+
+ public void removeIncomingConnection(ElementConnection connection) {
+ incomingConnections.remove(connection);
+ internalRemoveIncomingConnection(connection);
+ notifyListeners(CHANGE_INCOMING_CONNECTIONS);
+ }
+
+ protected void internalRemoveIncomingConnection(ElementConnection connection) {
+ }
+
+ public void addOutgoingConnection(ElementConnection connection) {
+ outgoingConnections.add(connection);
+ internalAddOutgoingConnection(connection);
+ notifyListeners(CHANGE_OUTGOING_CONNECTIONS);
+ }
+
+ protected void internalAddOutgoingConnection(ElementConnection connection) {
+ }
+
+ public void removeOutgoingConnection(ElementConnection connection) {
+ outgoingConnections.remove(connection);
+ internalRemoveOutgoingConnection(connection);
+ notifyListeners(CHANGE_OUTGOING_CONNECTIONS);
+ }
+
+ protected void internalRemoveOutgoingConnection(ElementConnection connection) {
+ }
+
+ public void setName(String name) {
+ internalSetName(name);
+ notifyListeners(CHANGE_NAME);
+ }
+
+ protected void internalSetName(String name) {
+ }
+
+ public List getOutgoingConnections(int type) {
+ List result = new ArrayList();
+ for (Iterator it = outgoingConnections.iterator(); it.hasNext();) {
+ ElementConnection connection = (ElementConnection) it.next();
+ if (connection.getType() == type) {
+ result.add(connection);
+ }
+ }
+ return Collections.unmodifiableList(result);
+ }
+
+ public List getIncomingConnections(int type) {
+ List result = new ArrayList();
+ for (Iterator it = incomingConnections.iterator(); it.hasNext();) {
+ ElementConnection connection = (ElementConnection) it.next();
+ if (connection.getType() == type) {
+ result.add(connection);
+ }
+ }
+ return Collections.unmodifiableList(result);
+ }
+
+ public void addListener(ModelListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeListener(ModelListener listener) {
+ listeners.remove(listener);
+ }
+
+ protected void notifyListeners(int change) {
+ ModelEvent event = new ModelEvent(change);
+ for (Iterator it = listeners.iterator(); it.hasNext();) {
+ ModelListener listener = (ModelListener) it.next();
+ listener.modelChanged(event);
+ }
+ }
+
+ private void readObject(ObjectInputStream aInputStream)
+ throws ClassNotFoundException, IOException {
+ aInputStream.defaultReadObject();
+ listeners = new ArrayList();
+ }
+
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return descriptors;
+ }
+
+ public Object getEditableValue() {
+ return this;
+ }
+
+ public boolean isPropertySet(Object id) {
+ return true;
+ }
+
+ public Object getPropertyValue(Object id) {
+ if (NAME.equals(id)) {
+ return getName();
+ }
+ return null;
+ }
+
+ public void resetPropertyValue(Object id) {
+ if (NAME.equals(id)) {
+ setName("");
+ }
+ }
+
+ public void setPropertyValue(Object id, Object value) {
+ if (NAME.equals(id)) {
+ setName((String) value);
+ }
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ElementConnection.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/ElementConnection.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ElementConnection.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ElementConnection.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,146 @@
+package org.drools.eclipse.flow.common.editor.core;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Point;
+
+/**
+ * A connection between two model elements.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ElementConnection implements Serializable {
+
+ private static final long serialVersionUID = 3690752912666015536L;
+
+ public static final int CHANGE_BENDPOINTS = 1;
+
+ private ElementWrapper source;
+ private ElementWrapper target;
+ private int type;
+ private List bendpoints = new ArrayList();
+ private transient List listeners = new ArrayList();
+
+ public ElementConnection(int type) {
+ this.type = type;
+ }
+
+ public ElementConnection(ElementWrapper source, ElementWrapper target, int type) {
+ this(type);
+ if (source == null) {
+ throw new IllegalArgumentException("source is null");
+ }
+ if (target == null) {
+ throw new IllegalArgumentException("target is null");
+ }
+ this.source = source;
+ this.target = target;
+ }
+
+ public void disconnect() {
+ if (source == null) {
+ throw new IllegalStateException("Can't disconnect, source is null");
+ }
+ if (target == null) {
+ throw new IllegalStateException("Can't disconnect, target is null");
+ }
+ source.removeOutgoingConnection(this);
+ target.removeIncomingConnection(this);
+ source = null;
+ target = null;
+ }
+
+ public void connect(ElementWrapper source, ElementWrapper target) {
+ if (source == null) {
+ throw new IllegalArgumentException("source is null");
+ }
+ if (this.source != null) {
+ throw new IllegalStateException("The source of a connection cannot be changed");
+ }
+ if (target == null) {
+ throw new IllegalArgumentException("target is null");
+ }
+ if (this.target != null) {
+ throw new IllegalStateException("The target of a connection cannot be changed");
+ }
+ this.source = source;
+ this.target = target;
+ source.addOutgoingConnection(this);
+ target.addIncomingConnection(this);
+ }
+
+
+ public ElementWrapper getSource() {
+ return source;
+ }
+
+
+ public ElementWrapper getTarget() {
+ return target;
+ }
+
+ public int getType() {
+ return type;
+ }
+
+ public void addBendpoint(int index, Point point) {
+ bendpoints.add(index, point);
+ notifyListeners(CHANGE_BENDPOINTS);
+ }
+
+ public void removeBendpoint(int index) {
+ bendpoints.remove(index);
+ notifyListeners(CHANGE_BENDPOINTS);
+ }
+
+ public void replaceBendpoint(int index, Point point) {
+ bendpoints.set(index, point);
+ notifyListeners(CHANGE_BENDPOINTS);
+ }
+
+ public List getBendpoints() {
+ return bendpoints;
+ }
+
+ public void addListener(ModelListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeListener(ModelListener listener) {
+ listeners.remove(listener);
+ }
+
+ protected void notifyListeners(int change) {
+ ModelEvent event = new ModelEvent(change);
+ for (Iterator it = listeners.iterator(); it.hasNext(); ) {
+ ModelListener listener = (ModelListener) it.next();
+ listener.modelChanged(event);
+ }
+ }
+
+ private void readObject(ObjectInputStream aInputStream)
+ throws ClassNotFoundException, IOException {
+ aInputStream.defaultReadObject();
+ listeners = new ArrayList();
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ElementConnectionFactory.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/ElementConnectionFactory.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ElementConnectionFactory.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ElementConnectionFactory.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,39 @@
+package org.drools.eclipse.flow.common.editor.core;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Factory for creating element connections.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ElementConnectionFactory {
+
+ private int type;
+
+ public ElementConnectionFactory(int type) {
+ this.type = type;
+ }
+
+ public ElementConnection createElementConnection() {
+ ElementConnection connection = new ElementConnection(type);
+ return connection;
+ }
+
+ protected int getType() {
+ return this.type;
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ElementWrapper.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/ElementWrapper.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ElementWrapper.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ElementWrapper.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,57 @@
+package org.drools.eclipse.flow.common.editor.core;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * Wrapper of a model element.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface ElementWrapper {
+
+ static final int CHANGE_INCOMING_CONNECTIONS = 1;
+ static final int CHANGE_OUTGOING_CONNECTIONS = 2;
+ static final int CHANGE_CONSTRAINT = 3;
+ static final int CHANGE_NAME = 4;
+
+ String getId();
+ String getName();
+ void setName(String name);
+
+ void setConstraint(Rectangle constraint);
+ Rectangle getConstraint();
+
+ void setParent(ProcessWrapper parent);
+
+ List getOutgoingConnections();
+ List getIncomingConnections();
+ void addIncomingConnection(ElementConnection connection);
+ void removeIncomingConnection(ElementConnection connection);
+ void addOutgoingConnection(ElementConnection connection);
+ void removeOutgoingConnection(ElementConnection connection);
+ boolean acceptsIncomingConnection(ElementConnection connection);
+ boolean acceptsOutgoingConnection(ElementConnection connection);
+ List getOutgoingConnections(int type);
+ List getIncomingConnections(int type);
+
+ void addListener(ModelListener listener);
+ void removeListener(ModelListener listener);
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ModelEvent.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/ModelEvent.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ModelEvent.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ModelEvent.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,35 @@
+package org.drools.eclipse.flow.common.editor.core;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Event notifying a change in a model element.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ModelEvent {
+
+ private int change;
+
+ public ModelEvent(int change) {
+ this.change = change;
+ }
+
+ public int getChange() {
+ return change;
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ModelListener.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/ModelListener.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ModelListener.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ModelListener.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,27 @@
+package org.drools.eclipse.flow.common.editor.core;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * A listener for model events.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface ModelListener {
+
+ void modelChanged(ModelEvent event);
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ProcessWrapper.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/ProcessWrapper.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ProcessWrapper.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/ProcessWrapper.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,185 @@
+package org.drools.eclipse.flow.common.editor.core;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.drools.ruleflow.common.core.IProcess;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
+
+/**
+ * A wrapper for process element.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class ProcessWrapper implements IPropertySource, Serializable {
+
+ public static final int CHANGE_ELEMENTS = 1;
+
+ protected static IPropertyDescriptor[] descriptors;
+
+ public static final String NAME = "name";
+ public static final String VERSION = "version";
+ public static final String ID = "id";
+ static {
+ descriptors = new IPropertyDescriptor[] {
+ new TextPropertyDescriptor(NAME, "Name"),
+ new TextPropertyDescriptor(VERSION, "Version"),
+ new TextPropertyDescriptor(ID, "Id"),
+ };
+ }
+
+ private IProcess process;
+ private Map elements = new HashMap();
+ private transient List listeners = new ArrayList();
+
+ public ProcessWrapper() {
+ process = createProcess();
+ }
+
+ protected abstract IProcess createProcess();
+
+ public IProcess getProcess() {
+ return process;
+ }
+
+ public String getName() {
+ return process.getName() == null ? "" : process.getName();
+ }
+
+ public void setName(String name) {
+ process.setName(name);
+ }
+
+ public String getVersion() {
+ return process.getVersion() == null ? "" : process.getVersion();
+ }
+
+ public void setVersion(String version) {
+ process.setVersion(version);
+ }
+
+ public String getId() {
+ return process.getId();
+ }
+
+ public void setId(String id) {
+ process.setId(id);
+ }
+
+ public List getElements() {
+ return Collections.unmodifiableList(new ArrayList(elements.values()));
+ }
+
+ public ElementWrapper getElement(String id) {
+ return (ElementWrapper) elements.get(id);
+ }
+
+ public void addElement(ElementWrapper element) {
+ internalAddElement(element);
+ //id is set in methode above
+ elements.put(element.getId(), element);
+ notifyListeners(CHANGE_ELEMENTS);
+ }
+
+ protected abstract void internalAddElement(ElementWrapper element);
+
+ public void removeElement(ElementWrapper element) {
+ elements.remove(element.getId());
+ notifyListeners(CHANGE_ELEMENTS);
+ internalRemoveElement(element);
+ }
+
+ protected abstract void internalRemoveElement(ElementWrapper element);
+
+ public void addListener(ModelListener listener) {
+ listeners.add(listener);
+ }
+
+ public void removeListener(ModelListener listener) {
+ listeners.remove(listener);
+ }
+
+ public void notifyListeners(int change) {
+ ModelEvent event = new ModelEvent(change);
+ for (Iterator it = listeners.iterator(); it.hasNext(); ) {
+ ModelListener listener = (ModelListener) it.next();
+ listener.modelChanged(event);
+ }
+ }
+
+ private void readObject(ObjectInputStream aInputStream) throws ClassNotFoundException, IOException {
+ aInputStream.defaultReadObject();
+ listeners = new ArrayList();
+ }
+
+ public Object getEditableValue() {
+ return this;
+ }
+
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return descriptors;
+ }
+
+ public Object getPropertyValue(Object id) {
+ if (NAME.equals(id)) {
+ return getName();
+ }
+ if (VERSION.equals(id)) {
+ return getVersion();
+ }
+ if (ID.equals(id)) {
+ return getId() + "";
+ }
+ return null;
+ }
+
+ public boolean isPropertySet(Object id) {
+ return true;
+ }
+
+ public void resetPropertyValue(Object id) {
+ if (NAME.equals(id)) {
+ setName("");
+ }
+ if (VERSION.equals(id)) {
+ setVersion("");
+ }
+ if (ID.equals(id)) {
+ setId("");
+ }
+ }
+
+ public void setPropertyValue(Object id, Object value) {
+ if (NAME.equals(id)) {
+ setName((String) value);
+ } else if (VERSION.equals(id)) {
+ setVersion((String) value);
+ } else if (ID.equals(id)) {
+ setId((String) value);
+ }
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/command)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/AddElementCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/command/AddElementCommand.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/AddElementCommand.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.core.command;
+package org.drools.eclipse.flow.common.editor.core.command;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
-import org.drools.ide.flow.common.editor.core.ProcessWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ProcessWrapper;
import org.eclipse.gef.commands.Command;
/**
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/ChangeConstraintCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/command/ChangeConstraintCommand.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/ChangeConstraintCommand.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.core.command;
+package org.drools.eclipse.flow.common.editor.core.command;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.commands.Command;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/CreateBendpointCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/command/CreateBendpointCommand.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/CreateBendpointCommand.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.core.command;
+package org.drools.eclipse.flow.common.editor.core.command;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.commands.Command;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/DeleteBendpointCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/command/DeleteBendpointCommand.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/DeleteBendpointCommand.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.core.command;
+package org.drools.eclipse.flow.common.editor.core.command;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.commands.Command;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/DeleteConnectionCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/command/DeleteConnectionCommand.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/DeleteConnectionCommand.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.core.command;
+package org.drools.eclipse.flow.common.editor.core.command;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementConnection;
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
import org.eclipse.gef.commands.Command;
/**
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/DeleteElementCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/command/DeleteElementCommand.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/DeleteElementCommand.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.core.command;
+package org.drools.eclipse.flow.common.editor.core.command;
/*
* Copyright 2005 JBoss Inc
*
@@ -19,9 +19,9 @@
import java.util.Iterator;
import java.util.List;
-import org.drools.ide.flow.common.editor.core.ElementConnection;
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
-import org.drools.ide.flow.common.editor.core.ProcessWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ProcessWrapper;
import org.eclipse.gef.commands.Command;
/**
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/ElementConnectionCreateCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/command/ElementConnectionCreateCommand.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/ElementConnectionCreateCommand.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.core.command;
+package org.drools.eclipse.flow.common.editor.core.command;
/*
* Copyright 2005 JBoss Inc
*
@@ -18,8 +18,8 @@
import java.util.Iterator;
import java.util.List;
-import org.drools.ide.flow.common.editor.core.ElementConnection;
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
import org.eclipse.gef.commands.Command;
/**
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/MoveBendpointCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/command/MoveBendpointCommand.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/MoveBendpointCommand.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.core.command;
+package org.drools.eclipse.flow.common.editor.core.command;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.commands.Command;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/ReconnectElementConnectionSourceCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/command/ReconnectElementConnectionSourceCommand.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/ReconnectElementConnectionSourceCommand.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.core.command;
+package org.drools.eclipse.flow.common.editor.core.command;
/*
* Copyright 2005 JBoss Inc
*
@@ -17,8 +17,8 @@
import java.util.List;
-import org.drools.ide.flow.common.editor.core.ElementConnection;
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
import org.eclipse.gef.commands.Command;
/**
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/ReconnectElementConnectionTargetCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/command/ReconnectElementConnectionTargetCommand.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/ReconnectElementConnectionTargetCommand.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.core.command;
+package org.drools.eclipse.flow.common.editor.core.command;
/*
* Copyright 2005 JBoss Inc
*
@@ -18,8 +18,8 @@
import java.util.Iterator;
import java.util.List;
-import org.drools.ide.flow.common.editor.core.ElementConnection;
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
import org.eclipse.gef.commands.Command;
/**
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/RenameElementCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/command/RenameElementCommand.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/RenameElementCommand.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.core.command;
+package org.drools.eclipse.flow.common.editor.core.command;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
import org.eclipse.gef.commands.Command;
/**
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/SplitConnectionCommand.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/core/command/SplitConnectionCommand.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/core/command/SplitConnectionCommand.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.core.command;
+package org.drools.eclipse.flow.common.editor.core.command;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementConnection;
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
-import org.drools.ide.flow.common.editor.core.ProcessWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ProcessWrapper;
import org.eclipse.gef.commands.Command;
/**
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ElementCellEditorLocator.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/editpart/ElementCellEditorLocator.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ElementCellEditorLocator.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ElementCellEditorLocator.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,57 @@
+package org.drools.eclipse.flow.common.editor.editpart;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Text;
+
+import org.eclipse.jface.viewers.CellEditor;
+
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+import org.eclipse.gef.tools.CellEditorLocator;
+
+/**
+ * A CellEditorLocator for elements.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ElementCellEditorLocator implements CellEditorLocator {
+
+ private Label label;
+
+ public ElementCellEditorLocator(Label label) {
+ setLabel(label);
+ }
+
+ public void relocate(CellEditor cellEditor) {
+ Text text = (Text) cellEditor.getControl();
+ Point pref = text.computeSize(-1, -1);
+ Rectangle rect = label.getTextBounds().getCopy();
+ label.translateToAbsolute(rect);
+ text.setBounds(rect.x - 1, rect.y - 1, pref.x + 1, pref.y + 1);
+ }
+
+ protected Label getLabel() {
+ return label;
+ }
+
+ protected void setLabel(Label label) {
+ this.label = label;
+ }
+
+}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ElementConnectionEditPart.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/editpart/ElementConnectionEditPart.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ElementConnectionEditPart.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ElementConnectionEditPart.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,101 @@
+package org.drools.eclipse.flow.common.editor.editpart;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementConnectionFactory;
+import org.drools.eclipse.flow.common.editor.core.ModelEvent;
+import org.drools.eclipse.flow.common.editor.core.ModelListener;
+import org.drools.eclipse.flow.common.editor.policy.ConnectionBendpointEditPolicy;
+import org.drools.eclipse.flow.common.editor.policy.ConnectionEditPolicy;
+import org.eclipse.draw2d.AbsoluteBendpoint;
+import org.eclipse.draw2d.BendpointConnectionRouter;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
+import org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy;
+
+/**
+ * Implementation of a connection EditPart.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ElementConnectionEditPart extends AbstractConnectionEditPart implements ModelListener {
+
+ protected void createEditPolicies() {
+ ConnectionEditPolicy connectionEditPolicy = new ConnectionEditPolicy();
+ connectionEditPolicy.setDefaultElementConnectionFactory(getDefaultElementConnectionFactory());
+ installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new ConnectionEndpointEditPolicy());
+ installEditPolicy(EditPolicy.CONNECTION_ROLE, connectionEditPolicy);
+ installEditPolicy(EditPolicy.CONNECTION_BENDPOINTS_ROLE, new ConnectionBendpointEditPolicy());
+ }
+
+ protected ElementConnectionFactory getDefaultElementConnectionFactory() {
+ return new ElementConnectionFactory(0);
+ }
+
+ protected IFigure createFigure() {
+ PolylineConnection result = new PolylineConnection();
+ result.setConnectionRouter(new BendpointConnectionRouter());
+ result.setTargetDecoration(new PolygonDecoration());
+ return result;
+ }
+
+ public void setSelected(int value) {
+ super.setSelected(value);
+ if (value != EditPart.SELECTED_NONE) {
+ ((PolylineConnection)getFigure()).setLineWidth(2);
+ } else {
+ ((PolylineConnection)getFigure()).setLineWidth(1);
+ }
+ }
+
+ public void modelChanged(ModelEvent event) {
+ if (event.getChange() == ElementConnection.CHANGE_BENDPOINTS) {
+ refreshBendpoints();
+ }
+ }
+
+ public void activate() {
+ super.activate();
+ ((ElementConnection) getModel()).addListener(this);
+ }
+
+ public void deactivate() {
+ ((ElementConnection) getModel()).removeListener(this);
+ super.deactivate();
+ }
+
+ protected void refreshBendpoints() {
+ List bendpoints = ((ElementConnection) getModel()).getBendpoints();
+ List constraint = new ArrayList();
+ for (int i = 0; i < bendpoints.size(); i++) {
+ constraint.add(new AbsoluteBendpoint((Point) bendpoints.get(i)));
+ }
+ getConnectionFigure().setRoutingConstraint(constraint);
+ }
+
+ protected void refreshVisuals() {
+ refreshBendpoints();
+ }
+}
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ElementEditPart.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/editpart/ElementEditPart.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ElementEditPart.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ElementEditPart.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,132 @@
+package org.drools.eclipse.flow.common.editor.editpart;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ModelEvent;
+import org.drools.eclipse.flow.common.editor.core.ModelListener;
+import org.drools.eclipse.flow.common.editor.editpart.figure.ElementFigure;
+import org.drools.eclipse.flow.common.editor.policy.ElementDirectEditManager;
+import org.drools.eclipse.flow.common.editor.policy.ElementDirectEditPolicy;
+import org.drools.eclipse.flow.common.editor.policy.ElementEditPolicy;
+import org.drools.eclipse.flow.common.editor.policy.ElementNodeEditPolicy;
+import org.eclipse.draw2d.ChopboxAnchor;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.NodeEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.jface.viewers.TextCellEditor;
+
+/**
+ * Default implementation of an element EditPart.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public abstract class ElementEditPart extends AbstractGraphicalEditPart implements NodeEditPart, ModelListener {
+
+ private DirectEditManager manager;
+
+ protected void createEditPolicies() {
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new ElementNodeEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ElementEditPolicy());
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, new ElementDirectEditPolicy());
+ }
+
+ protected List getModelSourceConnections() {
+ ElementWrapper task = (ElementWrapper) getModel();
+ return task.getOutgoingConnections();
+ }
+
+ protected List getModelTargetConnections() {
+ ElementWrapper task = (ElementWrapper) getModel();
+ return task.getIncomingConnections();
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connection) {
+ return new ChopboxAnchor(getFigure());
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connection) {
+ return new ChopboxAnchor(getFigure());
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor(Request request) {
+ return new ChopboxAnchor(getFigure());
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor(Request request) {
+ return new ChopboxAnchor(getFigure());
+ }
+
+ protected void refreshVisuals() {
+ ElementWrapper element = (ElementWrapper) getModel();
+ ElementFigure figure = (ElementFigure) getFigure();
+ figure.setText(element.getName());
+ if (element.getConstraint().width == -1) {
+ element.getConstraint().width = figure.getBounds().width;
+ }
+ if (element.getConstraint().height == -1) {
+ element.getConstraint().height = figure.getBounds().height;
+ }
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, figure, element.getConstraint());
+ }
+
+ public void modelChanged(ModelEvent event) {
+ if (event.getChange() == ElementWrapper.CHANGE_INCOMING_CONNECTIONS) {
+ refreshTargetConnections();
+ } else if (event.getChange() == ElementWrapper.CHANGE_OUTGOING_CONNECTIONS) {
+ refreshSourceConnections();
+ } else if (event.getChange() == ElementWrapper.CHANGE_NAME) {
+ refreshVisuals();
+ } else if (event.getChange() == ElementWrapper.CHANGE_CONSTRAINT) {
+ refreshVisuals();
+ }
+ }
+
+ public void activate() {
+ super.activate();
+ ((ElementWrapper) getModel()).addListener(this);
+ }
+
+ public void deactivate() {
+ ((ElementWrapper) getModel()).removeListener(this);
+ super.deactivate();
+ }
+
+ public void performRequest(Request request) {
+ if (request.getType() == RequestConstants.REQ_DIRECT_EDIT) {
+ performDirectEdit();
+ } else {
+ super.performRequest(request);
+ }
+ }
+
+ private void performDirectEdit() {
+ if (manager == null) {
+ manager = new ElementDirectEditManager(this, TextCellEditor.class,
+ new ElementCellEditorLocator(((ElementFigure) getFigure()).getLabel()));
+ }
+ manager.show();
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ProcessEditPart.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/editpart/ProcessEditPart.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ProcessEditPart.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/ProcessEditPart.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,72 @@
+package org.drools.eclipse.flow.common.editor.editpart;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.List;
+
+import org.drools.eclipse.flow.common.editor.core.ModelEvent;
+import org.drools.eclipse.flow.common.editor.core.ModelListener;
+import org.drools.eclipse.flow.common.editor.core.ProcessWrapper;
+import org.drools.eclipse.flow.common.editor.policy.ProcessLayoutEditPolicy;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.XYLayout;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.editpolicies.RootComponentEditPolicy;
+
+/**
+ * Default implementation of a process EditPart.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class ProcessEditPart extends AbstractGraphicalEditPart implements ModelListener {
+
+ protected IFigure createFigure() {
+ Figure f = new Figure();
+ f.setOpaque(true);
+ f.setLayoutManager(new XYLayout());
+ return f;
+ }
+
+ protected void createEditPolicies() {
+ installEditPolicy(EditPolicy.NODE_ROLE, null);
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, null);
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, null);
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new ProcessLayoutEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy());
+ }
+
+ protected List getModelChildren() {
+ return ((ProcessWrapper) getModel()).getElements();
+ }
+
+ public void activate() {
+ super.activate();
+ ((ProcessWrapper) getModel()).addListener(this);
+ }
+
+ public void deactivate() {
+ ((ProcessWrapper) getModel()).removeListener(this);
+ super.deactivate();
+ }
+
+ public void modelChanged(ModelEvent event) {
+ if (event.getChange() == ProcessWrapper.CHANGE_ELEMENTS) {
+ refreshChildren();
+ }
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/figure (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/editpart/figure)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/figure/ElementFigure.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/editpart/figure/ElementFigure.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/editpart/figure/ElementFigure.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.editpart.figure;
+package org.drools.eclipse.flow.common.editor.editpart.figure;
/*
* Copyright 2005 JBoss Inc
*
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/policy)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ConnectionBendpointEditPolicy.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/policy/ConnectionBendpointEditPolicy.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ConnectionBendpointEditPolicy.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.policy;
+package org.drools.eclipse.flow.common.editor.policy;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.command.CreateBendpointCommand;
-import org.drools.ide.flow.common.editor.core.command.DeleteBendpointCommand;
-import org.drools.ide.flow.common.editor.core.command.MoveBendpointCommand;
+import org.drools.eclipse.flow.common.editor.core.command.CreateBendpointCommand;
+import org.drools.eclipse.flow.common.editor.core.command.DeleteBendpointCommand;
+import org.drools.eclipse.flow.common.editor.core.command.MoveBendpointCommand;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.BendpointEditPolicy;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ConnectionEditPolicy.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/policy/ConnectionEditPolicy.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ConnectionEditPolicy.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.policy;
+package org.drools.eclipse.flow.common.editor.policy;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,13 +15,13 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementConnection;
-import org.drools.ide.flow.common.editor.core.ElementConnectionFactory;
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
-import org.drools.ide.flow.common.editor.core.ProcessWrapper;
-import org.drools.ide.flow.common.editor.core.command.DeleteConnectionCommand;
-import org.drools.ide.flow.common.editor.core.command.SplitConnectionCommand;
-import org.drools.ide.flow.common.editor.editpart.ElementConnectionEditPart;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementConnectionFactory;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ProcessWrapper;
+import org.drools.eclipse.flow.common.editor.core.command.DeleteConnectionCommand;
+import org.drools.eclipse.flow.common.editor.core.command.SplitConnectionCommand;
+import org.drools.eclipse.flow.common.editor.editpart.ElementConnectionEditPart;
import org.eclipse.draw2d.PolylineConnection;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.Request;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ElementDirectEditManager.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/policy/ElementDirectEditManager.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ElementDirectEditManager.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.policy;
+package org.drools.eclipse.flow.common.editor.policy;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.tools.CellEditorLocator;
import org.eclipse.gef.tools.DirectEditManager;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ElementDirectEditPolicy.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/policy/ElementDirectEditPolicy.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ElementDirectEditPolicy.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.policy;
+package org.drools.eclipse.flow.common.editor.policy;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
-import org.drools.ide.flow.common.editor.core.command.RenameElementCommand;
-import org.drools.ide.flow.common.editor.editpart.figure.ElementFigure;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.command.RenameElementCommand;
+import org.drools.eclipse.flow.common.editor.editpart.figure.ElementFigure;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.DirectEditPolicy;
import org.eclipse.gef.requests.DirectEditRequest;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ElementEditPolicy.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/policy/ElementEditPolicy.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ElementEditPolicy.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.policy;
+package org.drools.eclipse.flow.common.editor.policy;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
-import org.drools.ide.flow.common.editor.core.ProcessWrapper;
-import org.drools.ide.flow.common.editor.core.command.DeleteElementCommand;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ProcessWrapper;
+import org.drools.eclipse.flow.common.editor.core.command.DeleteElementCommand;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.ComponentEditPolicy;
import org.eclipse.gef.requests.GroupRequest;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ElementNodeEditPolicy.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/policy/ElementNodeEditPolicy.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ElementNodeEditPolicy.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.policy;
+package org.drools.eclipse.flow.common.editor.policy;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,12 +15,12 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementConnection;
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
-import org.drools.ide.flow.common.editor.core.command.ElementConnectionCreateCommand;
-import org.drools.ide.flow.common.editor.core.command.ReconnectElementConnectionSourceCommand;
-import org.drools.ide.flow.common.editor.core.command.ReconnectElementConnectionTargetCommand;
-import org.drools.ide.flow.common.editor.editpart.ElementEditPart;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.command.ElementConnectionCreateCommand;
+import org.drools.eclipse.flow.common.editor.core.command.ReconnectElementConnectionSourceCommand;
+import org.drools.eclipse.flow.common.editor.core.command.ReconnectElementConnectionTargetCommand;
+import org.drools.eclipse.flow.common.editor.editpart.ElementEditPart;
import org.eclipse.gef.commands.Command;
import org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy;
import org.eclipse.gef.requests.CreateConnectionRequest;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ProcessLayoutEditPolicy.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/policy/ProcessLayoutEditPolicy.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/editor/policy/ProcessLayoutEditPolicy.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.editor.policy;
+package org.drools.eclipse.flow.common.editor.policy;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
-import org.drools.ide.flow.common.editor.core.ProcessWrapper;
-import org.drools.ide.flow.common.editor.core.command.AddElementCommand;
-import org.drools.ide.flow.common.editor.core.command.ChangeConstraintCommand;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ProcessWrapper;
+import org.drools.eclipse.flow.common.editor.core.command.AddElementCommand;
+import org.drools.eclipse.flow.common.editor.core.command.ChangeConstraintCommand;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.Request;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/IDataTypeEditor.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/datatype/editor/IDataTypeEditor.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/IDataTypeEditor.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/IDataTypeEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,40 @@
+package org.drools.eclipse.flow.common.view.datatype.editor;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.drools.ruleflow.common.datatype.IDataType;
+
+/**
+ * An editor for a datatype.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface IDataTypeEditor {
+
+ void setDataType(IDataType dataType);
+
+ IDataType getDataType();
+
+ void reset();
+
+ void addListener(DataTypeListener listener);
+
+ void removeListener(DataTypeListener listener);
+
+ public interface DataTypeListener {
+ void dataTypeChanged(IDataType dataType);
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/IEditor.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/datatype/editor/IEditor.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/IEditor.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/IEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,38 @@
+package org.drools.eclipse.flow.common.view.datatype.editor;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.Serializable;
+
+import org.drools.ruleflow.common.datatype.IDataType;
+
+
+/**
+ * An editor for an object with a given datatype.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public interface IEditor {
+
+ void setDataType(IDataType dataType);
+
+ Serializable getValue();
+
+ void setValue(Serializable value);
+
+ void reset();
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/datatype/editor/impl)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/BooleanEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/datatype/editor/impl/BooleanEditor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/BooleanEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.view.datatype.editor.impl;
+package org.drools.eclipse.flow.common.view.datatype.editor.impl;
/*
* Copyright 2005 JBoss Inc
*
@@ -17,7 +17,7 @@
import java.io.Serializable;
-import org.drools.ide.flow.common.view.datatype.editor.IEditor;
+import org.drools.eclipse.flow.common.view.datatype.editor.IEditor;
import org.drools.ruleflow.common.datatype.IDataType;
import org.drools.ruleflow.common.datatype.impl.type.BooleanDataType;
import org.eclipse.swt.SWT;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/DataTypeCombo.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/datatype/editor/impl/DataTypeCombo.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/DataTypeCombo.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.view.datatype.editor.impl;
+package org.drools.eclipse.flow.common.view.datatype.editor.impl;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.flow.common.datatype.IDataTypeRegistry;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.flow.common.datatype.IDataTypeRegistry;
import org.drools.ruleflow.common.datatype.IDataType;
import org.eclipse.jface.viewers.ComboViewer;
import org.eclipse.jface.viewers.ISelection;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/DataTypeEditorComposite.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/datatype/editor/impl/DataTypeEditorComposite.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/DataTypeEditorComposite.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.view.datatype.editor.impl;
+package org.drools.eclipse.flow.common.view.datatype.editor.impl;
/*
* Copyright 2005 JBoss Inc
*
@@ -20,9 +20,9 @@
import java.util.Iterator;
import java.util.List;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.flow.common.datatype.IDataTypeRegistry;
-import org.drools.ide.flow.common.view.datatype.editor.IDataTypeEditor;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.flow.common.datatype.IDataTypeRegistry;
+import org.drools.eclipse.flow.common.view.datatype.editor.IDataTypeEditor;
import org.drools.ruleflow.common.datatype.IDataType;
import org.drools.ruleflow.common.datatype.impl.type.UndefinedDataType;
import org.eclipse.swt.graphics.Color;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/EditorComposite.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/datatype/editor/impl/EditorComposite.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/EditorComposite.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.view.datatype.editor.impl;
+package org.drools.eclipse.flow.common.view.datatype.editor.impl;
/*
* Copyright 2005 JBoss Inc
*
@@ -18,9 +18,9 @@
import java.io.Serializable;
import java.lang.reflect.InvocationTargetException;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.flow.common.datatype.IDataTypeRegistry;
-import org.drools.ide.flow.common.view.datatype.editor.IEditor;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.flow.common.datatype.IDataTypeRegistry;
+import org.drools.eclipse.flow.common.view.datatype.editor.IEditor;
import org.drools.ruleflow.common.datatype.IDataType;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/EmptyEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/datatype/editor/impl/EmptyEditor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/EmptyEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.view.datatype.editor.impl;
+package org.drools.eclipse.flow.common.view.datatype.editor.impl;
/*
* Copyright 2005 JBoss Inc
*
@@ -17,8 +17,8 @@
import java.io.Serializable;
-import org.drools.ide.flow.common.view.datatype.editor.IDataTypeEditor;
-import org.drools.ide.flow.common.view.datatype.editor.IEditor;
+import org.drools.eclipse.flow.common.view.datatype.editor.IDataTypeEditor;
+import org.drools.eclipse.flow.common.view.datatype.editor.IEditor;
import org.drools.ruleflow.common.datatype.IDataType;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Color;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/FloatEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/datatype/editor/impl/FloatEditor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/FloatEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.view.datatype.editor.impl;
+package org.drools.eclipse.flow.common.view.datatype.editor.impl;
/*
* Copyright 2005 JBoss Inc
*
@@ -17,7 +17,7 @@
import java.io.Serializable;
-import org.drools.ide.flow.common.view.datatype.editor.IEditor;
+import org.drools.eclipse.flow.common.view.datatype.editor.IEditor;
import org.drools.ruleflow.common.datatype.IDataType;
import org.drools.ruleflow.common.datatype.impl.type.FloatDataType;
import org.eclipse.swt.SWT;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/IntegerEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/datatype/editor/impl/IntegerEditor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/IntegerEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.view.datatype.editor.impl;
+package org.drools.eclipse.flow.common.view.datatype.editor.impl;
/*
* Copyright 2005 JBoss Inc
*
@@ -17,7 +17,7 @@
import java.io.Serializable;
-import org.drools.ide.flow.common.view.datatype.editor.IEditor;
+import org.drools.eclipse.flow.common.view.datatype.editor.IEditor;
import org.drools.ruleflow.common.datatype.IDataType;
import org.drools.ruleflow.common.datatype.impl.type.IntegerDataType;
import org.eclipse.swt.SWT;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/StringEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/datatype/editor/impl/StringEditor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/datatype/editor/impl/StringEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.view.datatype.editor.impl;
+package org.drools.eclipse.flow.common.view.datatype.editor.impl;
/*
* Copyright 2005 JBoss Inc
*
@@ -17,7 +17,7 @@
import java.io.Serializable;
-import org.drools.ide.flow.common.view.datatype.editor.IEditor;
+import org.drools.eclipse.flow.common.view.datatype.editor.IEditor;
import org.drools.ruleflow.common.datatype.IDataType;
import org.drools.ruleflow.common.datatype.impl.type.StringDataType;
import org.eclipse.swt.SWT;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/property (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/property)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/property/BeanDialogCellEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/property/BeanDialogCellEditor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/property/BeanDialogCellEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.view.property;
+package org.drools.eclipse.flow.common.view.property;
/*
* Copyright 2005 JBoss Inc
*
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/property/EditBeanDialog.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/property/EditBeanDialog.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/property/EditBeanDialog.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.view.property;
+package org.drools.eclipse.flow.common.view.property;
/*
* Copyright 2005 JBoss Inc
*
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/property/EditListDialog.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/property/EditListDialog.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/property/EditListDialog.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.view.property;
+package org.drools.eclipse.flow.common.view.property;
/*
* Copyright 2005 JBoss Inc
*
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/property/ListPropertyDescriptor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/view/property/ListPropertyDescriptor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/common/view/property/ListPropertyDescriptor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.common.view.property;
+package org.drools.eclipse.flow.common.view.property;
/*
* Copyright 2005 JBoss Inc
*
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFilePage.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/NewRuleFlowFilePage.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFilePage.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFilePage.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,73 @@
+package org.drools.eclipse.flow.ruleflow;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.InputStream;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.dialogs.WizardNewFileCreationPage;
+import org.eclipse.ui.ide.IDE;
+
+/**
+ * Page for creating a new RuleFlow file.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class NewRuleFlowFilePage extends WizardNewFileCreationPage {
+
+ private IWorkbench workbench;
+
+ public NewRuleFlowFilePage(IWorkbench workbench, IStructuredSelection selection) {
+ super("createRuleFlowPage", selection);
+ setTitle("Create RuleFlow File");
+ setDescription("Create a new RuleFlow file");
+ this.workbench = workbench;
+ }
+
+ public void createControl(Composite parent) {
+ super.createControl(parent);
+ setPageComplete(true);
+ }
+
+ public boolean finish() {
+ String fileName = getFileName();
+ if (!fileName.endsWith(".rf")) {
+ setFileName(fileName + ".rf");
+ }
+ org.eclipse.core.resources.IFile newFile = createNewFile();
+ if (newFile == null)
+ return false;
+ try {
+ IWorkbenchWindow dwindow = workbench.getActiveWorkbenchWindow();
+ org.eclipse.ui.IWorkbenchPage page = dwindow.getActivePage();
+ if (page != null)
+ IDE.openEditor(page, newFile, true);
+ } catch (PartInitException e) {
+ e.printStackTrace();
+ return false;
+ }
+ return true;
+ }
+
+ protected InputStream getInitialContents() {
+ String s = "org/drools/ide/flow/ruleflow/SampleRuleFlow.rf.template";
+ return getClass().getClassLoader().getResourceAsStream(s);
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFileWizard.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/NewRuleFlowFileWizard.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFileWizard.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/NewRuleFlowFileWizard.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,49 @@
+package org.drools.eclipse.flow.ruleflow;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+/**
+ * Wizard for creating a new RuleFlow file.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class NewRuleFlowFileWizard extends Wizard implements INewWizard {
+
+ private IWorkbench workbench;
+ private IStructuredSelection selection;
+ private NewRuleFlowFilePage mainPage;
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ setWindowTitle("New RuleFlow File");
+ }
+
+ public void addPages() {
+ mainPage = new NewRuleFlowFilePage(workbench, selection);
+ addPage(mainPage);
+ }
+
+ public boolean performFinish() {
+ return mainPage.finish();
+ }
+
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/SampleRuleFlow.rf.template (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/SampleRuleFlow.rf.template)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/SampleRuleFlow.rf.template (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/SampleRuleFlow.rf.template 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,44 @@
+<org.drools.eclipse.flow.ruleflow.core.WorkflowProcessWrapper id="1" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+ <default>
+ <elements id="2">
+ <entry>
+ <string>1-Wrapper</string>
+ <org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper id="3" serialization="custom">
+ <org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ <default>
+ <constraint id="4">
+ <x>100</x>
+ <y>100</y>
+ <width>80</width>
+ <height>40</height>
+ </constraint>
+ <element class="org.drools.ruleflow.core.impl.StartNode" id="5">
+ <id>1</id>
+ <name>Start</name>
+ <incomingConnections id="6"/>
+ <outgoingConnections id="7"/>
+ </element>
+ <incomingConnections id="8"/>
+ <outgoingConnections id="9"/>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper>
+ </org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper>
+ </entry>
+ </elements>
+ <process class="org.drools.ruleflow.core.impl.RuleFlowProcess" id="10">
+ <nodes id="11">
+ <entry>
+ <long>1</long>
+ <org.drools.ruleflow.core.impl.StartNode reference="5"/>
+ </entry>
+ </nodes>
+ <variables id="12"/>
+ <lastNodeId>1</lastNodeId>
+ <id>0</id>
+ <name>flow</name>
+ <type>Workflow</type>
+ </process>
+ </default>
+ </org.drools.eclipse.flow.common.editor.core.ProcessWrapper>
+</org.drools.eclipse.flow.ruleflow.core.WorkflowProcessWrapper>
\ No newline at end of file
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/core)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/ConnectionWrapper.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/core/ConnectionWrapper.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/ConnectionWrapper.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.core;
+package org.drools.eclipse.flow.ruleflow.core;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementConnection;
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
import org.drools.ruleflow.core.IConnection;
import org.drools.ruleflow.core.INode;
import org.drools.ruleflow.core.impl.Connection;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/ConnectionWrapperFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/core/ConnectionWrapperFactory.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/ConnectionWrapperFactory.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.core;
+package org.drools.eclipse.flow.ruleflow.core;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementConnection;
-import org.drools.ide.flow.common.editor.core.ElementConnectionFactory;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementConnectionFactory;
/**
* Factory for creating a connection wrapper.
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/EndNodeWrapper.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/core/EndNodeWrapper.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/EndNodeWrapper.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.core;
+package org.drools.eclipse.flow.ruleflow.core;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
import org.drools.ruleflow.core.IEndNode;
import org.drools.ruleflow.core.impl.EndNode;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/JoinWrapper.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/core/JoinWrapper.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/JoinWrapper.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.core;
+package org.drools.eclipse.flow.ruleflow.core;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.DefaultElementWrapper;
-import org.drools.ide.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
import org.drools.ruleflow.core.IConnection;
import org.drools.ruleflow.core.IJoin;
import org.drools.ruleflow.core.impl.Join;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/NodeWrapper.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/core/NodeWrapper.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/NodeWrapper.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.core;
+package org.drools.eclipse.flow.ruleflow.core;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.DefaultElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper;
import org.drools.ruleflow.core.INode;
/**
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/RuleFlowProcessWrapper.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/core/RuleFlowProcessWrapper.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/RuleFlowProcessWrapper.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.core;
+package org.drools.eclipse.flow.ruleflow.core;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementWrapper;
-import org.drools.ide.flow.common.editor.core.ProcessWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ProcessWrapper;
import org.drools.ruleflow.common.core.IProcess;
import org.drools.ruleflow.core.IRuleFlowProcess;
import org.drools.ruleflow.core.impl.RuleFlowProcess;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/RuleSetNodeWrapper.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/core/RuleSetNodeWrapper.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/RuleSetNodeWrapper.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.core;
+package org.drools.eclipse.flow.ruleflow.core;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.DefaultElementWrapper;
-import org.drools.ide.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
import org.drools.ruleflow.core.IRuleSetNode;
import org.drools.ruleflow.core.impl.RuleSetNode;
import org.eclipse.ui.views.properties.IPropertyDescriptor;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/SplitWrapper.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/core/SplitWrapper.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/SplitWrapper.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.core;
+package org.drools.eclipse.flow.ruleflow.core;
/*
* Copyright 2005 JBoss Inc
*
@@ -21,9 +21,9 @@
import java.util.Iterator;
import java.util.Map;
-import org.drools.ide.flow.common.editor.core.DefaultElementWrapper;
-import org.drools.ide.flow.common.editor.core.ElementConnection;
-import org.drools.ide.flow.ruleflow.view.property.constraint.ConstraintsPropertyDescriptor;
+import org.drools.eclipse.flow.common.editor.core.DefaultElementWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.ruleflow.view.property.constraint.ConstraintsPropertyDescriptor;
import org.drools.ruleflow.core.IConnection;
import org.drools.ruleflow.core.IConstraint;
import org.drools.ruleflow.core.ISplit;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/StartNodeWrapper.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/core/StartNodeWrapper.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/core/StartNodeWrapper.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.core;
+package org.drools.eclipse.flow.ruleflow.core;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
import org.drools.ruleflow.core.IConnection;
import org.drools.ruleflow.core.IStartNode;
import org.drools.ruleflow.core.impl.StartNode;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowModelEditor.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/editor/RuleFlowModelEditor.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowModelEditor.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowModelEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,165 @@
+package org.drools.eclipse.flow.ruleflow.editor;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.OutputStreamWriter;
+
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.flow.common.editor.GenericModelEditor;
+import org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper;
+import org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper;
+import org.drools.eclipse.flow.ruleflow.editor.editpart.RuleFlowEditPartFactory;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.jface.dialogs.ProgressMonitorDialog;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.actions.WorkspaceModifyOperation;
+import org.eclipse.ui.part.FileEditorInput;
+
+import com.thoughtworks.xstream.XStream;
+
+/**
+ * Graphical editor for a RuleFlow.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowModelEditor extends GenericModelEditor {
+
+ protected EditPartFactory createEditPartFactory() {
+ return new RuleFlowEditPartFactory();
+ }
+
+ protected PaletteRoot createPalette() {
+ return RuleFlowPaletteFactory.createPalette();
+ }
+
+ protected Object createModel() {
+ RuleFlowProcessWrapper result = new RuleFlowProcessWrapper();
+ StartNodeWrapper start = new StartNodeWrapper();
+ start.setConstraint(new Rectangle(100, 100, -1, -1));
+ result.addElement(start);
+ IFile file = ((IFileEditorInput)getEditorInput()).getFile();
+ String name = file.getName();
+ result.setName(name.substring(0, name.length() - 3));
+ return result;
+ }
+
+ public RuleFlowProcessWrapper getRuleFlowModel() {
+ return (RuleFlowProcessWrapper) getModel();
+ }
+
+ protected void createOutputStream(OutputStream os) throws IOException {
+ createOutputStream(os, true);
+ }
+
+
+ protected void createOutputStream(OutputStream os, boolean includeGraphics) throws IOException {
+ OutputStreamWriter writer = new OutputStreamWriter(os);
+ try {
+ XStream stream = new XStream();
+ stream.setMode(XStream.ID_REFERENCES);
+ if (includeGraphics) {
+ stream.toXML(getRuleFlowModel(), writer);
+ } else {
+ stream.toXML(getRuleFlowModel().getProcess(), writer);
+ }
+ writer.close();
+ } catch (Throwable t) {
+ DroolsIDEPlugin.log(t);
+ }
+ }
+
+ public void doSave(IProgressMonitor monitor) {
+ super.doSave(monitor);
+ // save process as separate model file as well
+ IFile file = ((IFileEditorInput) getEditorInput()).getFile();
+ final IFile modelFile = getModelFile(file);
+
+ if (!modelFile.exists()) {
+ WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
+ public void execute(final IProgressMonitor monitor)
+ throws CoreException {
+ try {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ createOutputStream(out, false);
+ modelFile.create(new ByteArrayInputStream(out.toByteArray()),
+ true, monitor);
+ out.close();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ };
+
+ try {
+ new ProgressMonitorDialog(getSite().getWorkbenchWindow().getShell())
+ .run(false, true, op);
+ setInput(new FileEditorInput(file));
+ getCommandStack().markSaveLocation();
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else {
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ try {
+ createOutputStream(out, false);
+ modelFile.setContents(
+ new ByteArrayInputStream(out.toByteArray()),
+ true, false, monitor);
+ out.close();
+ } catch (Throwable t) {
+ DroolsIDEPlugin.log(t);
+ }
+ }
+ }
+
+ private IFile getModelFile(IFile file) {
+ IProject project = file.getProject();
+ IPath path = file.getProjectRelativePath();
+ String fileName = file.getName().substring(0, file.getName().length() - 2) + "rfm";
+ IPath modelPath = path.removeLastSegments(1).append(fileName);
+ IFile modelFile = project.getFile(modelPath);
+ return modelFile;
+ }
+
+ protected void createInputStream(InputStream is) throws Exception {
+ InputStreamReader reader = new InputStreamReader(is);
+ XStream stream = new XStream();
+ stream.setMode(XStream.ID_REFERENCES);
+
+ ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
+ ClassLoader newLoader = this.getClass().getClassLoader();
+ try {
+ Thread.currentThread().setContextClassLoader(newLoader);
+ setModel(stream.fromXML(reader));
+ } finally {
+ Thread.currentThread().setContextClassLoader(oldLoader);
+ }
+ reader.close();
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowPaletteFactory.java (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/editor/RuleFlowPaletteFactory.java)
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowPaletteFactory.java (rev 0)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/RuleFlowPaletteFactory.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -0,0 +1,157 @@
+package org.drools.eclipse.flow.ruleflow.editor;
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.flow.common.editor.core.ElementConnectionFactory;
+import org.drools.eclipse.flow.ruleflow.core.ConnectionWrapper;
+import org.drools.eclipse.flow.ruleflow.core.ConnectionWrapperFactory;
+import org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper;
+import org.drools.eclipse.flow.ruleflow.core.JoinWrapper;
+import org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper;
+import org.drools.eclipse.flow.ruleflow.core.SplitWrapper;
+import org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper;
+import org.drools.ruleflow.core.IConnection;
+import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
+import org.eclipse.gef.palette.ConnectionCreationToolEntry;
+import org.eclipse.gef.palette.MarqueeToolEntry;
+import org.eclipse.gef.palette.PaletteContainer;
+import org.eclipse.gef.palette.PaletteDrawer;
+import org.eclipse.gef.palette.PaletteGroup;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.palette.SelectionToolEntry;
+import org.eclipse.gef.palette.ToolEntry;
+import org.eclipse.gef.requests.CreationFactory;
+import org.eclipse.gef.requests.SimpleFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+/**
+ * Factory for creating a RuleFlow palette.
+ *
+ * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
+ */
+public class RuleFlowPaletteFactory {
+
+ public static PaletteRoot createPalette() {
+ PaletteRoot flowPalette = new PaletteRoot();
+ flowPalette.addAll(createCategories(flowPalette));
+ return flowPalette;
+ }
+
+ private static List createCategories(PaletteRoot root) {
+ List categories = new ArrayList();
+ categories.add(createControlGroup(root));
+ categories.add(createComponentsDrawer());
+ return categories;
+ }
+
+ private static PaletteContainer createComponentsDrawer() {
+
+ PaletteDrawer drawer = new PaletteDrawer("Components", null);
+
+ List entries = new ArrayList();
+
+ CombinedTemplateCreationEntry combined = new CombinedTemplateCreationEntry(
+ "Start",
+ "Create a new Start",
+ StartNodeWrapper.class,
+ new SimpleFactory(StartNodeWrapper.class),
+ ImageDescriptor.createFromURL(DroolsIDEPlugin.getDefault().getBundle().getEntry("icons/process_start.gif")),
+ ImageDescriptor.createFromURL(DroolsIDEPlugin.getDefault().getBundle().getEntry("icons/process_start.gif"))
+ );
+ entries.add(combined);
+
+ combined = new CombinedTemplateCreationEntry(
+ "End",
+ "Create a new End",
+ EndNodeWrapper.class,
+ new SimpleFactory(EndNodeWrapper.class),
+ ImageDescriptor.createFromURL(DroolsIDEPlugin.getDefault().getBundle().getEntry("icons/process_stop.gif")),
+ ImageDescriptor.createFromURL(DroolsIDEPlugin.getDefault().getBundle().getEntry("icons/process_stop.gif"))
+ );
+ entries.add(combined);
+
+ combined = new CombinedTemplateCreationEntry(
+ "RuleFlowGroup",
+ "Create a new RuleFlowGroup",
+ RuleSetNodeWrapper.class,
+ new SimpleFactory(RuleSetNodeWrapper.class),
+ ImageDescriptor.createFromURL(DroolsIDEPlugin.getDefault().getBundle().getEntry("icons/activity.gif")),
+ ImageDescriptor.createFromURL(DroolsIDEPlugin.getDefault().getBundle().getEntry("icons/activity.gif"))
+ );
+ entries.add(combined);
+
+ combined = new CombinedTemplateCreationEntry(
+ "Split",
+ "Create a new Split",
+ SplitWrapper.class,
+ new SimpleFactory(SplitWrapper.class),
+ ImageDescriptor.createFromURL(DroolsIDEPlugin.getDefault().getBundle().getEntry("icons/split.gif")),
+ ImageDescriptor.createFromURL(DroolsIDEPlugin.getDefault().getBundle().getEntry("icons/split.gif"))
+ );
+ entries.add(combined);
+
+ combined = new CombinedTemplateCreationEntry(
+ "Join",
+ "Create a new Join",
+ JoinWrapper.class,
+ new SimpleFactory(JoinWrapper.class),
+ ImageDescriptor.createFromURL(DroolsIDEPlugin.getDefault().getBundle().getEntry("icons/join.gif")),
+ ImageDescriptor.createFromURL(DroolsIDEPlugin.getDefault().getBundle().getEntry("icons/join.gif"))
+ );
+ entries.add(combined);
+
+ drawer.addAll(entries);
+ return drawer;
+ }
+
+ private static PaletteContainer createControlGroup(PaletteRoot root) {
+ PaletteGroup controlGroup = new PaletteGroup("Control Group");
+
+ List entries = new ArrayList();
+
+ ToolEntry tool = new SelectionToolEntry();
+ entries.add(tool);
+ root.setDefaultEntry(tool);
+
+ tool = new MarqueeToolEntry();
+ entries.add(tool);
+
+ final ElementConnectionFactory normalConnectionFactory = new ConnectionWrapperFactory(IConnection.TYPE_NORMAL);
+
+ tool = new ConnectionCreationToolEntry(
+ "Connection Creation",
+ "Creating connections",
+ new CreationFactory() {
+ public Object getNewObject() {
+ return normalConnectionFactory.createElementConnection();
+ }
+ public Object getObjectType() {
+ return ConnectionWrapper.class;
+ }
+ },
+ ImageDescriptor.createFromURL(DroolsIDEPlugin.getDefault().getBundle().getEntry("icons/connection.gif")),
+ ImageDescriptor.createFromURL(DroolsIDEPlugin.getDefault().getBundle().getEntry("icons/connection.gif"))
+ );
+ entries.add(tool);
+
+ controlGroup.addAll(entries);
+ return controlGroup;
+ }
+}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/action (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/editor/action)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/action/CheckRuleFlowAction.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/editor/action/CheckRuleFlowAction.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/action/CheckRuleFlowAction.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.editor.action;
+package org.drools.eclipse.flow.ruleflow.editor.action;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.flow.ruleflow.editor.RuleFlowModelEditor;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.flow.ruleflow.editor.RuleFlowModelEditor;
import org.drools.ruleflow.core.IRuleFlowProcessValidationError;
import org.drools.ruleflow.core.impl.RuleFlowProcessValidator;
import org.eclipse.core.runtime.IStatus;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/editor/editpart)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/EndNodeEditPart.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/editor/editpart/EndNodeEditPart.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/EndNodeEditPart.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.editor.editpart;
+package org.drools.eclipse.flow.ruleflow.editor.editpart;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.flow.common.editor.editpart.ElementEditPart;
-import org.drools.ide.flow.common.editor.editpart.figure.ElementFigure;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.flow.common.editor.editpart.ElementEditPart;
+import org.drools.eclipse.flow.common.editor.editpart.figure.ElementFigure;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.LineBorder;
import org.eclipse.jface.resource.ImageDescriptor;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/JoinEditPart.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/editor/editpart/JoinEditPart.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/JoinEditPart.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.editor.editpart;
+package org.drools.eclipse.flow.ruleflow.editor.editpart;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.editpart.ElementEditPart;
-import org.drools.ide.flow.common.editor.editpart.figure.ElementFigure;
+import org.drools.eclipse.flow.common.editor.editpart.ElementEditPart;
+import org.drools.eclipse.flow.common.editor.editpart.figure.ElementFigure;
import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.Ellipse;
import org.eclipse.draw2d.EllipseAnchor;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleFlowConnectionEditPart.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/editor/editpart/RuleFlowConnectionEditPart.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleFlowConnectionEditPart.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.editor.editpart;
+package org.drools.eclipse.flow.ruleflow.editor.editpart;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementConnection;
-import org.drools.ide.flow.common.editor.core.ElementConnectionFactory;
-import org.drools.ide.flow.common.editor.editpart.ElementConnectionEditPart;
-import org.drools.ide.flow.ruleflow.core.ConnectionWrapperFactory;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.core.ElementConnectionFactory;
+import org.drools.eclipse.flow.common.editor.editpart.ElementConnectionEditPart;
+import org.drools.eclipse.flow.ruleflow.core.ConnectionWrapperFactory;
import org.drools.ruleflow.core.IConnection;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.PolygonDecoration;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleFlowEditPartFactory.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/editor/editpart/RuleFlowEditPartFactory.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleFlowEditPartFactory.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.editor.editpart;
+package org.drools.eclipse.flow.ruleflow.editor.editpart;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,14 +15,14 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.core.ElementConnection;
-import org.drools.ide.flow.common.editor.editpart.ProcessEditPart;
-import org.drools.ide.flow.ruleflow.core.EndNodeWrapper;
-import org.drools.ide.flow.ruleflow.core.JoinWrapper;
-import org.drools.ide.flow.ruleflow.core.RuleSetNodeWrapper;
-import org.drools.ide.flow.ruleflow.core.SplitWrapper;
-import org.drools.ide.flow.ruleflow.core.StartNodeWrapper;
-import org.drools.ide.flow.ruleflow.core.RuleFlowProcessWrapper;
+import org.drools.eclipse.flow.common.editor.core.ElementConnection;
+import org.drools.eclipse.flow.common.editor.editpart.ProcessEditPart;
+import org.drools.eclipse.flow.ruleflow.core.EndNodeWrapper;
+import org.drools.eclipse.flow.ruleflow.core.JoinWrapper;
+import org.drools.eclipse.flow.ruleflow.core.RuleFlowProcessWrapper;
+import org.drools.eclipse.flow.ruleflow.core.RuleSetNodeWrapper;
+import org.drools.eclipse.flow.ruleflow.core.SplitWrapper;
+import org.drools.eclipse.flow.ruleflow.core.StartNodeWrapper;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartFactory;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleSetNodeEditPart.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/editor/editpart/RuleSetNodeEditPart.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/RuleSetNodeEditPart.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.editor.editpart;
+package org.drools.eclipse.flow.ruleflow.editor.editpart;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.editpart.ElementEditPart;
-import org.drools.ide.flow.common.editor.editpart.figure.ElementFigure;
+import org.drools.eclipse.flow.common.editor.editpart.ElementEditPart;
+import org.drools.eclipse.flow.common.editor.editpart.figure.ElementFigure;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.RoundedRectangle;
import org.eclipse.draw2d.geometry.Dimension;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/SplitEditPart.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/editor/editpart/SplitEditPart.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/SplitEditPart.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.editor.editpart;
+package org.drools.eclipse.flow.ruleflow.editor.editpart;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.editor.editpart.ElementEditPart;
-import org.drools.ide.flow.common.editor.editpart.figure.ElementFigure;
+import org.drools.eclipse.flow.common.editor.editpart.ElementEditPart;
+import org.drools.eclipse.flow.common.editor.editpart.figure.ElementFigure;
import org.eclipse.draw2d.ConnectionAnchor;
import org.eclipse.draw2d.Ellipse;
import org.eclipse.draw2d.EllipseAnchor;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/StartNodeEditPart.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/editor/editpart/StartNodeEditPart.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/editor/editpart/StartNodeEditPart.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.editor.editpart;
+package org.drools.eclipse.flow.ruleflow.editor.editpart;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,9 +15,9 @@
* limitations under the License.
*/
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.flow.common.editor.editpart.ElementEditPart;
-import org.drools.ide.flow.common.editor.editpart.figure.ElementFigure;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.flow.common.editor.editpart.ElementEditPart;
+import org.drools.eclipse.flow.common.editor.editpart.figure.ElementFigure;
import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.LineBorder;
import org.eclipse.jface.resource.ImageDescriptor;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/constraint (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/view/property/constraint)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/constraint/ConstraintListCellEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/view/property/constraint/ConstraintListCellEditor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/constraint/ConstraintListCellEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.view.property.constraint;
+package org.drools.eclipse.flow.ruleflow.view.property.constraint;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.view.property.BeanDialogCellEditor;
-import org.drools.ide.flow.common.view.property.EditBeanDialog;
+import org.drools.eclipse.flow.common.view.property.BeanDialogCellEditor;
+import org.drools.eclipse.flow.common.view.property.EditBeanDialog;
import org.drools.ruleflow.core.ISplit;
import org.drools.ruleflow.core.IRuleFlowProcess;
import org.eclipse.swt.widgets.Composite;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/constraint/ConstraintListDialog.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/view/property/constraint/ConstraintListDialog.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/constraint/ConstraintListDialog.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.view.property.constraint;
+package org.drools.eclipse.flow.ruleflow.view.property.constraint;
/*
* Copyright 2005 JBoss Inc
*
@@ -20,7 +20,7 @@
import java.util.List;
import java.util.Map;
-import org.drools.ide.flow.common.view.property.EditBeanDialog;
+import org.drools.eclipse.flow.common.view.property.EditBeanDialog;
import org.drools.ruleflow.core.IConnection;
import org.drools.ruleflow.core.IConstraint;
import org.drools.ruleflow.core.ISplit;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/constraint/ConstraintsPropertyDescriptor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/view/property/constraint/ConstraintsPropertyDescriptor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/constraint/ConstraintsPropertyDescriptor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.view.property.constraint;
+package org.drools.eclipse.flow.ruleflow.view.property.constraint;
/*
* Copyright 2005 JBoss Inc
*
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/constraint/RuleFlowConstraintDialog.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/view/property/constraint/RuleFlowConstraintDialog.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/constraint/RuleFlowConstraintDialog.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.view.property.constraint;
+package org.drools.eclipse.flow.ruleflow.view.property.constraint;
/*
* Copyright 2005 JBoss Inc
*
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/variable (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/view/property/variable)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/variable/VariableDialog.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/view/property/variable/VariableDialog.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/variable/VariableDialog.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.view.property.variable;
+package org.drools.eclipse.flow.ruleflow.view.property.variable;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,13 +15,13 @@
* limitations under the License.
*/
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.flow.common.datatype.DefaultDataTypeRegistry;
-import org.drools.ide.flow.common.view.datatype.editor.IDataTypeEditor;
-import org.drools.ide.flow.common.view.datatype.editor.impl.DataTypeCombo;
-import org.drools.ide.flow.common.view.datatype.editor.impl.DataTypeEditorComposite;
-import org.drools.ide.flow.common.view.datatype.editor.impl.EditorComposite;
-import org.drools.ide.flow.common.view.property.EditBeanDialog;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.flow.common.datatype.DefaultDataTypeRegistry;
+import org.drools.eclipse.flow.common.view.datatype.editor.IDataTypeEditor;
+import org.drools.eclipse.flow.common.view.datatype.editor.impl.DataTypeCombo;
+import org.drools.eclipse.flow.common.view.datatype.editor.impl.DataTypeEditorComposite;
+import org.drools.eclipse.flow.common.view.datatype.editor.impl.EditorComposite;
+import org.drools.eclipse.flow.common.view.property.EditBeanDialog;
import org.drools.ruleflow.common.datatype.IDataType;
import org.drools.ruleflow.core.IVariable;
import org.eclipse.core.runtime.IStatus;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/variable/VariableListCellEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/view/property/variable/VariableListCellEditor.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/variable/VariableListCellEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.view.property.variable;
+package org.drools.eclipse.flow.ruleflow.view.property.variable;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,8 +15,8 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.view.property.BeanDialogCellEditor;
-import org.drools.ide.flow.common.view.property.EditBeanDialog;
+import org.drools.eclipse.flow.common.view.property.BeanDialogCellEditor;
+import org.drools.eclipse.flow.common.view.property.EditBeanDialog;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/variable/VariableListDialog.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/ruleflow/view/property/variable/VariableListDialog.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/flow/ruleflow/view/property/variable/VariableListDialog.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.flow.ruleflow.view.property.variable;
+package org.drools.eclipse.flow.ruleflow.view.property.variable;
/*
* Copyright 2005 JBoss Inc
*
@@ -15,7 +15,7 @@
* limitations under the License.
*/
-import org.drools.ide.flow.common.view.property.EditListDialog;
+import org.drools.eclipse.flow.common.view.property.EditListDialog;
import org.drools.ruleflow.core.impl.Variable;
import org.eclipse.swt.widgets.Shell;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/launching)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsApplicationLaunchShortcut.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/launching/DroolsApplicationLaunchShortcut.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsApplicationLaunchShortcut.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,6 +1,6 @@
-package org.drools.ide.launching;
+package org.drools.eclipse.launching;
-import org.drools.ide.debug.core.IDroolsDebugConstants;
+import org.drools.eclipse.debug.core.IDroolsDebugConstants;
import org.eclipse.debug.core.ILaunchConfigurationType;
import org.eclipse.jdt.internal.debug.ui.launcher.JavaApplicationLaunchShortcut;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsLaunchConfigurationDelegate.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/launching/DroolsLaunchConfigurationDelegate.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsLaunchConfigurationDelegate.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,8 +1,8 @@
-package org.drools.ide.launching;
+package org.drools.eclipse.launching;
import java.text.MessageFormat;
-import org.drools.ide.debug.core.IDroolsDebugConstants;
+import org.drools.eclipse.debug.core.IDroolsDebugConstants;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsSourceLookupDirector.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/launching/DroolsSourceLookupDirector.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsSourceLookupDirector.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.launching;
+package org.drools.eclipse.launching;
import org.eclipse.debug.core.sourcelookup.AbstractSourceLookupDirector;
import org.eclipse.debug.core.sourcelookup.ISourceLookupParticipant;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsSourceLookupParticipant.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/launching/DroolsSourceLookupParticipant.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsSourceLookupParticipant.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,8 +1,8 @@
-package org.drools.ide.launching;
+package org.drools.eclipse.launching;
-import org.drools.ide.DRLInfo.FunctionInfo;
-import org.drools.ide.DRLInfo.RuleInfo;
-import org.drools.ide.debug.core.DroolsStackFrame;
+import org.drools.eclipse.DRLInfo.FunctionInfo;
+import org.drools.eclipse.DRLInfo.RuleInfo;
+import org.drools.eclipse.debug.core.DroolsStackFrame;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.jdt.launching.sourcelookup.containers.JavaSourceLookupParticipant;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsSourcePathComputerDelegate.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/launching/DroolsSourcePathComputerDelegate.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsSourcePathComputerDelegate.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.launching;
+package org.drools.eclipse.launching;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsVMDebugger.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/launching/DroolsVMDebugger.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/launching/DroolsVMDebugger.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.launching;
+package org.drools.eclipse.launching;
import java.io.File;
import java.io.IOException;
@@ -7,7 +7,7 @@
import java.util.List;
import java.util.Map;
-import org.drools.ide.debug.core.DroolsDebugModel;
+import org.drools.eclipse.debug.core.DroolsDebugModel;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/menu (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/menu)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/menu/RuleHelperActionDelegate.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/menu/RuleHelperActionDelegate.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/menu/RuleHelperActionDelegate.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,13 +1,13 @@
-package org.drools.ide.menu;
+package org.drools.eclipse.menu;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
-import org.drools.ide.wizard.decisiontable.NewDTFileWizard;
-import org.drools.ide.wizard.dsl.NewDSLFileWizard;
-import org.drools.ide.wizard.project.NewDroolsProjectWizard;
-import org.drools.ide.wizard.rule.NewRulePackageWizard;
+import org.drools.eclipse.wizard.decisiontable.NewDTFileWizard;
+import org.drools.eclipse.wizard.dsl.NewDSLFileWizard;
+import org.drools.eclipse.wizard.project.NewDroolsProjectWizard;
+import org.drools.eclipse.wizard.rule.NewRulePackageWizard;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/preferences (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/preferences)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/preferences/DroolsPreferencePage.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/preferences/DroolsPreferencePage.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/preferences/DroolsPreferencePage.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,6 +1,6 @@
-package org.drools.ide.preferences;
+package org.drools.eclipse.preferences;
-import org.drools.ide.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsIDEPlugin;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.preference.PreferencePage;
import org.eclipse.swt.SWT;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/preferences/IDroolsConstants.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/preferences/IDroolsConstants.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/preferences/IDroolsConstants.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.preferences;
+package org.drools.eclipse.preferences;
public interface IDroolsConstants {
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/util (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/util)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/util/DroolsClasspathContainer.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/util/DroolsClasspathContainer.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/util/DroolsClasspathContainer.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,11 +1,11 @@
-package org.drools.ide.util;
+package org.drools.eclipse.util;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-import org.drools.ide.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsIDEPlugin;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
@@ -92,7 +92,7 @@
private String getDroolsLocation() {
try {
- return FileLocator.toFileURL(Platform.getBundle("org.drools.ide")
+ return FileLocator.toFileURL(Platform.getBundle("org.drools.eclipse")
.getEntry("/")).getFile().toString();
} catch (IOException e) {
DroolsIDEPlugin.log(e);
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/util/DroolsClasspathContainerInitializer.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/util/DroolsClasspathContainerInitializer.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/util/DroolsClasspathContainerInitializer.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.util;
+package org.drools.eclipse.util;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/util/ProjectClassLoader.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/util/ProjectClassLoader.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/util/ProjectClassLoader.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.util;
+package org.drools.eclipse.util;
import java.io.File;
import java.net.MalformedURLException;
@@ -7,7 +7,7 @@
import java.util.ArrayList;
import java.util.List;
-import org.drools.ide.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsIDEPlugin;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.ResourcesPlugin;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/view/rules (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/view/rules)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/view/rules/RulesView.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/view/rules/RulesView.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/view/rules/RulesView.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.view.rules;
+package org.drools.eclipse.view.rules;
import java.util.ArrayList;
import java.util.HashMap;
@@ -6,21 +6,21 @@
import java.util.List;
import java.util.Map;
-import org.drools.ide.DRLInfo;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.core.DroolsElement;
-import org.drools.ide.core.DroolsModelBuilder;
-import org.drools.ide.core.Function;
-import org.drools.ide.core.Global;
-import org.drools.ide.core.Package;
-import org.drools.ide.core.Query;
-import org.drools.ide.core.Rule;
-import org.drools.ide.core.RuleSet;
-import org.drools.ide.core.Template;
-import org.drools.ide.core.ui.DroolsContentProvider;
-import org.drools.ide.core.ui.DroolsLabelProvider;
-import org.drools.ide.core.ui.DroolsTreeSorter;
-import org.drools.ide.core.ui.FilterActionGroup;
+import org.drools.eclipse.DRLInfo;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.core.DroolsElement;
+import org.drools.eclipse.core.DroolsModelBuilder;
+import org.drools.eclipse.core.Function;
+import org.drools.eclipse.core.Global;
+import org.drools.eclipse.core.Package;
+import org.drools.eclipse.core.Query;
+import org.drools.eclipse.core.Rule;
+import org.drools.eclipse.core.RuleSet;
+import org.drools.eclipse.core.Template;
+import org.drools.eclipse.core.ui.DroolsContentProvider;
+import org.drools.eclipse.core.ui.DroolsLabelProvider;
+import org.drools.eclipse.core.ui.DroolsTreeSorter;
+import org.drools.eclipse.core.ui.FilterActionGroup;
import org.drools.lang.descr.FactTemplateDescr;
import org.drools.lang.descr.FunctionDescr;
import org.drools.lang.descr.GlobalDescr;
@@ -71,7 +71,7 @@
treeViewer.setUseHashlookup(true);
treeViewer.setInput(ruleSet);
FilterActionGroup filterActionGroup = new FilterActionGroup(
- treeViewer, "org.drools.ide.view.rules.RulesView");
+ treeViewer, "org.drools.eclipse.view.rules.RulesView");
filterActionGroup.fillActionBars(getViewSite().getActionBars());
}
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/decisiontable (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/decisiontable)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/decisiontable/NewDTFilePage.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/decisiontable/NewDTFilePage.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/decisiontable/NewDTFilePage.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -2,13 +2,13 @@
* Created on 11-jan-2005
*
*/
-package org.drools.ide.wizard.decisiontable;
+package org.drools.eclipse.wizard.decisiontable;
import java.io.IOException;
import java.io.InputStream;
-import org.drools.ide.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsIDEPlugin;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/decisiontable/NewDTFileWizard.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/decisiontable/NewDTFileWizard.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/decisiontable/NewDTFileWizard.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,6 +1,6 @@
-package org.drools.ide.wizard.decisiontable;
+package org.drools.eclipse.wizard.decisiontable;
-import org.drools.ide.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsIDEPlugin;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/dsl (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/dsl)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/dsl/NewDSLFilePage.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/dsl/NewDSLFilePage.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/dsl/NewDSLFilePage.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -2,13 +2,13 @@
* Created on 11-jan-2005
*
*/
-package org.drools.ide.wizard.dsl;
+package org.drools.eclipse.wizard.dsl;
import java.io.IOException;
import java.io.InputStream;
-import org.drools.ide.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsIDEPlugin;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbench;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/dsl/NewDSLFileWizard.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/dsl/NewDSLFileWizard.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/dsl/NewDSLFileWizard.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,6 +1,6 @@
-package org.drools.ide.wizard.dsl;
+package org.drools.eclipse.wizard.dsl;
-import org.drools.ide.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsIDEPlugin;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/project (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/project)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/project/NewDroolsProjectWizard.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/project/NewDroolsProjectWizard.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/project/NewDroolsProjectWizard.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.wizard.project;
+package org.drools.eclipse.wizard.project;
import java.io.IOException;
import java.io.InputStream;
@@ -7,9 +7,9 @@
import java.util.Arrays;
import java.util.List;
-import org.drools.ide.DroolsIDEPlugin;
-import org.drools.ide.builder.DroolsBuilder;
-import org.drools.ide.util.DroolsClasspathContainer;
+import org.drools.eclipse.DroolsIDEPlugin;
+import org.drools.eclipse.builder.DroolsBuilder;
+import org.drools.eclipse.util.DroolsClasspathContainer;
import org.eclipse.core.resources.ICommand;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/project/NewDroolsProjectWizardPage.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/project/NewDroolsProjectWizardPage.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/project/NewDroolsProjectWizardPage.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.wizard.project;
+package org.drools.eclipse.wizard.project;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
Copied: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/rule (from rev 10636, labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/rule)
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/rule/DRLGenerator.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/rule/DRLGenerator.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/rule/DRLGenerator.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,4 +1,4 @@
-package org.drools.ide.wizard.rule;
+package org.drools.eclipse.wizard.rule;
import java.io.BufferedReader;
import java.io.ByteArrayInputStream;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/rule/NewRulePackagePage.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/rule/NewRulePackagePage.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/rule/NewRulePackagePage.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -2,12 +2,12 @@
* Created on 11-jan-2005
*
*/
-package org.drools.ide.wizard.rule;
+package org.drools.eclipse.wizard.rule;
import java.io.IOException;
import java.io.InputStream;
-import org.drools.ide.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsIDEPlugin;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/rule/NewRulePackageWizard.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/wizard/rule/NewRulePackageWizard.java 2007-03-30 11:05:49 UTC (rev 10636)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/eclipse/wizard/rule/NewRulePackageWizard.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,6 +1,6 @@
-package org.drools.ide.wizard.rule;
+package org.drools.eclipse.wizard.rule;
-import org.drools.ide.DroolsIDEPlugin;
+import org.drools.eclipse.DroolsIDEPlugin;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
Deleted: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DRLInfo.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DRLInfo.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DRLInfo.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,246 +0,0 @@
-package org.drools.ide;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.drools.compiler.DroolsError;
-import org.drools.lang.descr.FunctionDescr;
-import org.drools.lang.descr.PackageDescr;
-import org.drools.lang.descr.RuleDescr;
-import org.drools.rule.Package;
-
-public class DRLInfo {
-
- private static final DroolsError[] EMPTY_DROOLS_ERROR_ARRAY = new DroolsError[0];
- private static final List EMPTY_LIST = Collections.unmodifiableList(Collections.EMPTY_LIST);
-
- private String sourcePathName;
- private PackageDescr packageDescr;
- private List parserErrors;
- private Package compiledPackage;
- private DroolsError[] builderErrors;
- // cached entry
- private transient RuleInfo[] ruleInfos;
- private transient FunctionInfo[] functionInfos;
-
- public DRLInfo(String sourcePathName, PackageDescr packageDescr, List parserErrors) {
- if (sourcePathName == null || "".equals(sourcePathName)) {
- throw new IllegalArgumentException("Invalid sourcePathName " + sourcePathName);
- }
- if (packageDescr == null) {
- throw new IllegalArgumentException("Null packageDescr");
- }
- this.sourcePathName = sourcePathName;
- this.packageDescr = packageDescr;
- this.parserErrors =
- parserErrors == null ? EMPTY_LIST : Collections.unmodifiableList(parserErrors);
- this.builderErrors = EMPTY_DROOLS_ERROR_ARRAY;
- }
-
- public DRLInfo(String pathName, PackageDescr packageDescr, List parserErrors, Package compiledPackage, DroolsError[] builderErrors) {
- this(pathName, packageDescr, parserErrors);
- if (compiledPackage == null) {
- throw new IllegalArgumentException("Null package");
- }
- this.compiledPackage = compiledPackage;
- this.builderErrors =
- builderErrors == null ? EMPTY_DROOLS_ERROR_ARRAY : builderErrors;
- }
-
- public String getSourcePathName() {
- return sourcePathName;
- }
-
- public PackageDescr getPackageDescr() {
- return packageDescr;
- }
-
- public List getParserErrors() {
- return parserErrors;
- }
-
- public Package getPackage() {
- return compiledPackage;
- }
-
- public DroolsError[] getBuilderErrors() {
- return builderErrors;
- }
-
- public String getPackageName() {
- return packageDescr.getName();
- }
-
- public boolean isCompiled() {
- return compiledPackage != null;
- }
-
- public RuleInfo[] getRuleInfos() {
- if (ruleInfos == null) {
- List ruleInfosList = new ArrayList();
- for (Iterator rules = packageDescr.getRules().iterator(); rules.hasNext(); ) {
- RuleDescr ruleDescr = (RuleDescr) rules.next();
- RuleInfo ruleInfo = new RuleInfo(ruleDescr);
- ruleInfosList.add(ruleInfo);
- }
- ruleInfos = (RuleInfo[]) ruleInfosList.toArray(new RuleInfo[0]);
- }
- return ruleInfos;
- }
-
- public RuleInfo getRuleInfo(int drlLineNumber) {
- RuleInfo[] ruleInfos = getRuleInfos();
- int ruleLine = -1;
- RuleInfo result = null;
- for (int i = 0; i < ruleInfos.length; i++) {
- int ruleDrlLineNumber = ruleInfos[i].getDrlLineNumber();
- if (ruleDrlLineNumber > ruleLine
- && ruleDrlLineNumber <= drlLineNumber + 1) {
- ruleLine = ruleDrlLineNumber;
- result = ruleInfos[i];
- }
- }
- return result;
- }
-
- public class RuleInfo {
-
- private RuleDescr ruleDescr;
- // cached entries
- private transient String className;
- private transient int consequenceJavaLineNumber = -1;
-
- public RuleInfo(RuleDescr ruleDescr) {
- if (ruleDescr == null) {
- throw new IllegalArgumentException("Null ruleDescr");
- }
- this.ruleDescr = ruleDescr;
- }
-
- public String getSourcePathName() {
- return DRLInfo.this.getSourcePathName();
- }
-
- public String getClassName() {
- // ruleDescr is only filled in during compilation
- if (!isCompiled()) {
- throw new IllegalArgumentException("Package has not been compiled");
- }
- if (className == null) {
- className = getPackageName() + "." + ruleDescr.getClassName();
- }
- return className;
- }
-
- public int getDrlLineNumber() {
- return ruleDescr.getLine();
- }
-
- public int getConsequenceDrlLineNumber() {
- return ruleDescr.getConsequenceLine();
- }
-
- public int getConsequenceJavaLineNumber() {
- if (consequenceJavaLineNumber == -1) {
- if (!isCompiled()) {
- throw new IllegalArgumentException("Package has not been compiled");
- }
- consequenceJavaLineNumber = compiledPackage
- .getPackageCompilationData().getLineMappings(className).getOffset();
- }
- return consequenceJavaLineNumber;
- }
-
- public String getPackageName() {
- return packageDescr.getName();
- }
-
- public String getRuleName() {
- return ruleDescr.getName();
- }
- }
-
- public FunctionInfo[] getFunctionInfos() {
- if (functionInfos == null) {
- List functionInfosList = new ArrayList();
- for (Iterator functions = packageDescr.getFunctions().iterator(); functions.hasNext(); ) {
- FunctionDescr functionDescr = (FunctionDescr) functions.next();
- FunctionInfo functionInfo = new FunctionInfo(functionDescr);
- functionInfosList.add(functionInfo);
- }
- functionInfos = (FunctionInfo[]) functionInfosList.toArray(new FunctionInfo[0]);
- }
- return functionInfos;
- }
-
- public FunctionInfo getFunctionInfo(int drlLineNumber) {
- FunctionInfo[] functionInfos = getFunctionInfos();
- int functionLine = -1;
- FunctionInfo result = null;
- for (int i = 0; i < functionInfos.length; i++) {
- int functionDrlLineNumber = functionInfos[i].getDrlLineNumber();
- if (functionDrlLineNumber > functionLine
- && functionDrlLineNumber <= drlLineNumber + 1) {
- functionLine = functionDrlLineNumber;
- result = functionInfos[i];
- }
- }
- return result;
- }
-
- public class FunctionInfo {
-
- private FunctionDescr functionDescr;
- // cached entries
- private transient String className;
- private transient int javaLineNumber = -1;
-
- public FunctionInfo(FunctionDescr functionDescr) {
- if (functionDescr == null) {
- throw new IllegalArgumentException("Null functionDescr");
- }
- this.functionDescr = functionDescr;
- }
-
- public String getSourcePathName() {
- return DRLInfo.this.getSourcePathName();
- }
-
- public String getClassName() {
- // functionDescr is only filled in during compilation
- if (!isCompiled()) {
- throw new IllegalArgumentException("Package has not been compiled");
- }
- if (className == null) {
- className = functionDescr.getClassName();
- }
- return className;
- }
-
- public int getDrlLineNumber() {
- return functionDescr.getLine();
- }
-
- public int getJavaLineNumber() {
- if (javaLineNumber == -1) {
- if (!isCompiled()) {
- throw new IllegalArgumentException("Package has not been compiled");
- }
- javaLineNumber = compiledPackage
- .getPackageCompilationData().getLineMappings(className).getOffset();
- }
- return javaLineNumber;
- }
-
- public String getPackageName() {
- return packageDescr.getName();
- }
-
- public String getFunctionName() {
- return functionDescr.getName();
- }
- }
-
-}
Deleted: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsIDEPlugin.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsIDEPlugin.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsIDEPlugin.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,365 +0,0 @@
-package org.drools.ide;
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.Reader;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.MissingResourceException;
-import java.util.ResourceBundle;
-
-import org.drools.compiler.DrlParser;
-import org.drools.compiler.DroolsParserException;
-import org.drools.compiler.PackageBuilder;
-import org.drools.compiler.PackageBuilderConfiguration;
-import org.drools.ide.DRLInfo.FunctionInfo;
-import org.drools.ide.DRLInfo.RuleInfo;
-import org.drools.ide.builder.DroolsBuilder;
-import org.drools.ide.builder.Util;
-import org.drools.ide.editors.AbstractRuleEditor;
-import org.drools.ide.editors.DRLRuleEditor;
-import org.drools.ide.editors.DSLAdapter;
-import org.drools.ide.preferences.IDroolsConstants;
-import org.drools.ide.util.ProjectClassLoader;
-import org.drools.lang.descr.PackageDescr;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.jface.util.IPropertyChangeListener;
-import org.eclipse.jface.util.PropertyChangeEvent;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The main plugin class to be used in the desktop.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
- */
-public class DroolsIDEPlugin extends AbstractUIPlugin {
-
- public static final int INTERNAL_ERROR = 120;
- public static final String PLUGIN_ID = "org.drools.ide";
- public static final String BUILD_RESULT_PACKAGE = "Package";
- public static final String BUILD_RESULT_PACKAGE_DESCR = "PackageDescr";
-
- //The shared instance.
- private static DroolsIDEPlugin plugin;
- //Resource bundle.
- private ResourceBundle resourceBundle;
- private Map colors = new HashMap();
- private Map parsedRules = new HashMap();
- private Map compiledRules = new HashMap();
- private Map ruleInfoByClassNameMap = new HashMap();
- private Map functionInfoByClassNameMap = new HashMap();
- private boolean useCachePreference;
-
- /**
- * The constructor.
- */
- public DroolsIDEPlugin() {
- super();
- plugin = this;
- }
-
- /**
- * This method is called upon plug-in activation
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- IPreferenceStore preferenceStore = getPreferenceStore();
- useCachePreference = preferenceStore.getBoolean(IDroolsConstants.CACHE_PARSED_RULES);
- preferenceStore.addPropertyChangeListener(new IPropertyChangeListener() {
- public void propertyChange(PropertyChangeEvent event) {
- if (IDroolsConstants.CACHE_PARSED_RULES.equals(event.getProperty())) {
- useCachePreference = ((Boolean) event.getNewValue()).booleanValue();
- if (!useCachePreference) {
- parsedRules.clear();
- compiledRules.clear();
- ruleInfoByClassNameMap.clear();
- functionInfoByClassNameMap.clear();
- }
- }
- }
- });
-
- }
-
- /**
- * This method is called when the plug-in is stopped
- */
- public void stop(BundleContext context) throws Exception {
- super.stop(context);
- plugin = null;
- resourceBundle = null;
- parsedRules = null;
- compiledRules = null;
- Iterator iterator = colors.values().iterator();
- while (iterator.hasNext()) {
- ((Color) iterator.next()).dispose();
- }
- }
-
- /**
- * Returns the shared instance.
- */
- public static DroolsIDEPlugin getDefault() {
- return plugin;
- }
-
- /**
- * Returns the string from the plugin's resource bundle,
- * or 'key' if not found.
- */
- public static String getResourceString(String key) {
- ResourceBundle bundle = DroolsIDEPlugin.getDefault().getResourceBundle();
- try {
- return (bundle != null) ? bundle.getString(key) : key;
- } catch (MissingResourceException e) {
- return key;
- }
- }
-
- /**
- * Returns the plugin's resource bundle,
- */
- public ResourceBundle getResourceBundle() {
- try {
- if (resourceBundle == null)
- resourceBundle = ResourceBundle.getBundle("droolsIDE.DroolsIDEPluginResources");
- } catch (MissingResourceException x) {
- resourceBundle = null;
- }
- return resourceBundle;
- }
-
- /**
- * Returns an image descriptor for the image file at the given
- * plug-in relative path.
- * Uses the plug ins image registry to "cache" it.
- *
- * @param path the path
- * @return the image descriptor
- */
- public static ImageDescriptor getImageDescriptor(String path) {
-
- DroolsIDEPlugin plugin = getDefault();
- ImageRegistry reg = plugin.getImageRegistry();
- ImageDescriptor des = reg.getDescriptor( path );
- if (des == null) {
- des = AbstractUIPlugin.imageDescriptorFromPlugin("org.drools.ide", path);
- reg.put( path, des );
- }
- return des;
- }
-
- public static String getUniqueIdentifier() {
- if (getDefault() == null) {
- return PLUGIN_ID;
- }
- return getDefault().getBundle().getSymbolicName();
- }
-
- public static void log(Throwable t) {
- Throwable top = t;
- if (t instanceof DebugException) {
- DebugException de = (DebugException) t;
- IStatus status = de.getStatus();
- if (status.getException() != null) {
- top = status.getException();
- }
- }
- log(new Status(IStatus.ERROR, getUniqueIdentifier(),
- INTERNAL_ERROR, "Internal error in Drools Plugin: ", top));
- }
-
- public static void log(IStatus status) {
- getDefault().getLog().log(status);
- }
-
- public Color getColor(String type) {
- return (Color) colors.get(type);
- }
-
- public void setColor(String type, Color color) {
- colors.put(type, color);
- }
-
- protected void initializeDefaultPreferences(IPreferenceStore store) {
- store.setDefault(IDroolsConstants.BUILD_ALL, false);
- store.setDefault(IDroolsConstants.EDITOR_FOLDING, true);
- store.setDefault(IDroolsConstants.CACHE_PARSED_RULES, true);
- }
-
- public DRLInfo parseResource(IResource resource, boolean compile) throws DroolsParserException {
- DRLInfo result = (DRLInfo) compiledRules.get(resource);
- if (result == null && !compile) {
- result = (DRLInfo) parsedRules.get(resource);
- }
- if (result != null) {
- return result;
- }
- return generateParsedResource(resource, compile);
- }
-
- public DRLInfo parseResource(AbstractRuleEditor editor, boolean useUnsavedContent, boolean compile) throws DroolsParserException {
- IResource resource = editor.getResource();
- if (!editor.isDirty() || !useUnsavedContent) {
- DRLInfo result = (DRLInfo) compiledRules.get(resource);
- if (result == null && !compile) {
- result = (DRLInfo) parsedRules.get(resource);
- }
- if (result != null) {
- return result;
- }
- }
- if (!editor.isDirty()) {
- return generateParsedResource(editor.getContent(), resource, true, compile);
- }
- // TODO: can we cache result when using unsaved content as well?
- return generateParsedResource(editor.getContent(), resource, !useUnsavedContent, compile);
- }
-
- public DRLInfo parseXLSResource(String content, IResource resource) throws DroolsParserException {
- DRLInfo result = (DRLInfo) compiledRules.get(resource);
- if (result != null) {
- return result;
- }
- return generateParsedResource(content, resource, false, true);
- }
-
- public void invalidateResource(IResource resource) {
- DRLInfo cached = (DRLInfo) compiledRules.remove(resource);
- if (cached != null) {
- RuleInfo[] ruleInfos = cached.getRuleInfos();
- for (int i = 0; i < ruleInfos.length; i++) {
- ruleInfoByClassNameMap.remove(ruleInfos[i].getClassName());
- }
- FunctionInfo[] functionInfos = cached.getFunctionInfos();
- for (int i = 0; i < functionInfos.length; i++) {
- functionInfoByClassNameMap.remove(functionInfos[i].getClassName());
- }
- }
- parsedRules.remove(resource);
- }
-
- private DRLInfo generateParsedResource(IResource resource, boolean compile) throws DroolsParserException {
- if (resource instanceof IFile) {
- IFile file = (IFile) resource;
- try {
- String content = new String(Util.getResourceContentsAsCharArray(file));
- return generateParsedResource(content, file, true, compile);
- } catch (CoreException e) {
- log(e);
- }
- }
- return null;
- }
-
- private DRLInfo generateParsedResource(String content, IResource resource, boolean useCache, boolean compile) throws DroolsParserException {
- useCache = useCache && useCachePreference;
- DrlParser parser = new DrlParser();
- try {
- Reader dslReader = DSLAdapter.getDSLContent(content, resource);
- ClassLoader oldLoader = Thread.currentThread().getContextClassLoader();
- ClassLoader newLoader = DroolsBuilder.class.getClassLoader();
- PackageBuilderConfiguration builder_configuration = new PackageBuilderConfiguration();
- if (resource.getProject().getNature("org.eclipse.jdt.core.javanature") != null) {
- IJavaProject project = JavaCore.create(resource.getProject());
- newLoader = ProjectClassLoader.getProjectClassLoader(project);
- String level = project.getOption(JavaCore.COMPILER_COMPLIANCE, true);
- builder_configuration.setJavaLanguageLevel(level);
- }
- try {
- builder_configuration.setClassLoader(newLoader);
- Thread.currentThread().setContextClassLoader(newLoader);
-
- // first parse the source
- PackageDescr packageDescr = null;
- if (useCache) {
- DRLInfo cachedDrlInfo = (DRLInfo) parsedRules.get(resource);
- if (cachedDrlInfo != null) {
- packageDescr = cachedDrlInfo.getPackageDescr();
- }
- }
- if (packageDescr == null) {
- if (dslReader != null) {
- packageDescr = parser.parse(content, dslReader);
- } else {
- packageDescr = parser.parse(content);
- }
- }
- PackageBuilder builder = null;
- DRLInfo result = null;
- // compile parsed rules if necessary
- if (compile && !parser.hasErrors()) {
- builder = new PackageBuilder(builder_configuration);
- builder.addPackage(packageDescr);
- result = new DRLInfo(
- resource.getProjectRelativePath().toString(),
- packageDescr, parser.getErrors(),
- builder.getPackage(), builder.getErrors());
- } else {
- result = new DRLInfo(
- resource.getProjectRelativePath().toString(),
- packageDescr, parser.getErrors());
- }
-
- // cache result
- if (useCache) {
- if (compile && !parser.hasErrors()) {
- parsedRules.remove(resource);
- compiledRules.put(resource, result);
- RuleInfo[] ruleInfos = result.getRuleInfos();
- for (int i = 0; i < ruleInfos.length; i++) {
- ruleInfoByClassNameMap.put(ruleInfos[i].getClassName(), ruleInfos[i]);
- }
- FunctionInfo[] functionInfos = result.getFunctionInfos();
- for (int i = 0; i < functionInfos.length; i++) {
- functionInfoByClassNameMap.put(functionInfos[i].getClassName(), functionInfos[i]);
- }
- } else {
- parsedRules.put(resource, result);
- }
- }
- return result;
- } finally {
- Thread.currentThread().setContextClassLoader(oldLoader);
- }
- } catch (CoreException e) {
- log(e);
- }
- return null;
- }
-
- public RuleInfo getRuleInfoByClass(String ruleClassName) {
- return (RuleInfo) ruleInfoByClassNameMap.get(ruleClassName);
- }
-
- public FunctionInfo getFunctionInfoByClass(String functionClassName) {
- return (FunctionInfo) functionInfoByClassNameMap.get(functionClassName);
- }
-
-}
Deleted: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsPerspective.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsPerspective.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsPerspective.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,77 +0,0 @@
-package org.drools.ide;
-
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.ui.IFolderLayout;
-import org.eclipse.ui.IPageLayout;
-import org.eclipse.ui.IPerspectiveFactory;
-import org.eclipse.ui.console.IConsoleConstants;
-import org.eclipse.ui.progress.IProgressConstants;
-
-public class DroolsPerspective implements IPerspectiveFactory {
-
- public void createInitialLayout(IPageLayout layout) {
- String editorArea = layout.getEditorArea();
-
- IFolderLayout folder= layout.createFolder("left", IPageLayout.LEFT, (float)0.25, editorArea); //$NON-NLS-1$
- folder.addView(JavaUI.ID_PACKAGES);
- folder.addPlaceholder(JavaUI.ID_TYPE_HIERARCHY);
- folder.addView(IPageLayout.ID_RES_NAV);
-
- IFolderLayout rulesfolder= layout.createFolder("leftbottom", IPageLayout.BOTTOM, (float)0.5, "left"); //$NON-NLS-1$
- rulesfolder.addView(IDroolsConstants.RULES_VIEW);
-
- IFolderLayout outputfolder= layout.createFolder("bottom", IPageLayout.BOTTOM, (float)0.75, editorArea); //$NON-NLS-1$
- outputfolder.addView(IPageLayout.ID_PROBLEM_VIEW);
- outputfolder.addView(IPageLayout.ID_PROP_SHEET);
- outputfolder.addPlaceholder(JavaUI.ID_JAVADOC_VIEW);
- outputfolder.addPlaceholder(JavaUI.ID_SOURCE_VIEW);
- outputfolder.addPlaceholder(IConsoleConstants.ID_CONSOLE_VIEW);
- outputfolder.addPlaceholder(IPageLayout.ID_BOOKMARKS);
- outputfolder.addPlaceholder(IProgressConstants.PROGRESS_VIEW_ID);
-
- // *** Drools-specific extensions ***
- outputfolder.addView(IDroolsConstants.AUDIT_VIEW);
- layout.addShowViewShortcut(IDroolsConstants.AUDIT_VIEW);
- layout.addNewWizardShortcut("org.drools.ide.new.file");
- layout.addNewWizardShortcut("org.drools.ide.new.dsl");
- layout.addNewWizardShortcut("org.drools.ide.wizards.new.project");
- // **********************************
-
- layout.addView(IPageLayout.ID_OUTLINE, IPageLayout.RIGHT, (float)0.75, editorArea);
-
- layout.addActionSet(IDebugUIConstants.LAUNCH_ACTION_SET);
- layout.addActionSet(JavaUI.ID_ACTION_SET);
- layout.addActionSet(JavaUI.ID_ELEMENT_CREATION_ACTION_SET);
- layout.addActionSet(IPageLayout.ID_NAVIGATE_ACTION_SET);
-
- // views - java
- layout.addShowViewShortcut(JavaUI.ID_PACKAGES);
- layout.addShowViewShortcut(JavaUI.ID_TYPE_HIERARCHY);
- layout.addShowViewShortcut(JavaUI.ID_SOURCE_VIEW);
- layout.addShowViewShortcut(JavaUI.ID_JAVADOC_VIEW);
-
- // views - debugging
- layout.addShowViewShortcut(IConsoleConstants.ID_CONSOLE_VIEW);
-
- // views - standard workbench
- layout.addShowViewShortcut(IPageLayout.ID_OUTLINE);
- layout.addShowViewShortcut(IPageLayout.ID_PROBLEM_VIEW);
- layout.addShowViewShortcut(IPageLayout.ID_RES_NAV);
- layout.addShowViewShortcut(IPageLayout.ID_TASK_LIST);
- layout.addShowViewShortcut(IProgressConstants.PROGRESS_VIEW_ID);
-
- // new actions - Java project creation wizard
- layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewPackageCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewClassCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewInterfaceCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewEnumCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewAnnotationCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSourceFolderCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.jdt.ui.wizards.NewSnippetFileCreationWizard"); //$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.folder");//$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.ui.wizards.new.file");//$NON-NLS-1$
- layout.addNewWizardShortcut("org.eclipse.ui.editors.wizards.UntitledTextFileWizard");//$NON-NLS-1$
- }
-
-}
Deleted: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsPluginImages.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsPluginImages.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/DroolsPluginImages.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,144 +0,0 @@
-package org.drools.ide;
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.net.MalformedURLException;
-import java.net.URL;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.ImageRegistry;
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Handles the images used in this plugin.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">kris verlaenen </a>
- */
-public class DroolsPluginImages {
-
- public static final String IMG_LOGICAL = "ImageLogical";
- public static final String IMG_LOGICAL_DISABLED = "ImageLogicalDisabled";
- public static final String REFRESH_LOG = "RefreshLog";
- public static final String REFRESH_LOG_DISABLED = "RefreshLogDisabled";
- public static final String OPEN_LOG = "OpenLog";
- public static final String DELETE_LOG = "ClearLog";
- public static final String DELETE_LOG_DISABLED = "ClearLogDisabled";
- public static final String ASSERT_OBJECT = "AssertObject";
- public static final String MODIFY_OBJECT = "ModifyObject";
- public static final String RETRACT_OBJECT = "RetractObject";
- public static final String CREATE_ACTIVATION = "CreateActivation";
- public static final String CANCEL_ACTIVATION = "CancelActivation";
- public static final String EXECUTE_ACTIVATION = "ExecuteActivation";
- public static final String CLASS = "Class";
- public static final String PACKAGE = "Package";
- public static final String METHOD = "Method";
- public static final String VARIABLE = "Variable";
- public static final String DROOLS = "Drools";
- public static final String RULE = "DroolsRule";
- public static final String QUERY = "DroolsQuery";
- public static final String DSL_EXPRESSION = "DslExpression";
- public static final String IMPORT = "Import";
- public static final String DSL = "DSL";
- public static final String GLOBAL = "Global";
-
- private static ImageRegistry imageRegistry;
- private static final String PATH_SUFFIX = "/icons/";
- private static final URL ICON_BASE_URL =
- DroolsIDEPlugin.getDefault().getBundle().getEntry(PATH_SUFFIX);
-
- private static void declareImages() {
- declareRegistryImage(IMG_LOGICAL, "logical_structure.gif");
- declareRegistryImage(IMG_LOGICAL_DISABLED, "logical_structure_disabled.gif");
- declareRegistryImage(REFRESH_LOG, "refresh.gif");
- declareRegistryImage(REFRESH_LOG_DISABLED, "refresh_disabled.gif");
- declareRegistryImage(OPEN_LOG, "open.gif");
- declareRegistryImage(DELETE_LOG, "clear.gif");
- declareRegistryImage(DELETE_LOG_DISABLED, "clear_disabled.gif");
- declareRegistryImage(ASSERT_OBJECT, "greensquare.GIF");
- declareRegistryImage(MODIFY_OBJECT, "yellowsquare.GIF");
- declareRegistryImage(RETRACT_OBJECT, "redsquare.GIF");
- declareRegistryImage(CREATE_ACTIVATION, "arrowright.GIF");
- declareRegistryImage(CANCEL_ACTIVATION, "arrowleft.GIF");
- declareRegistryImage(EXECUTE_ACTIVATION, "bluediamond.GIF");
- declareRegistryImage(CLASS, "class_obj.gif");
- declareRegistryImage(PACKAGE, "package_obj.gif");
- declareRegistryImage(METHOD, "methpub_obj.gif");
- declareRegistryImage(VARIABLE, "field_private_obj.gif");
- declareRegistryImage(DROOLS, "drools.gif");
- declareRegistryImage(RULE, "drools-rule.GIF");
- declareRegistryImage(QUERY, "drools-query.GIF");
- declareRegistryImage(DSL_EXPRESSION, "dsl_expression.gif");
- declareRegistryImage(IMPORT, "import.gif");
- declareRegistryImage(DSL, "dsl.GIF");
- declareRegistryImage(GLOBAL, "field_public_obj.gif");
- }
-
- /**
- * Declare an Image in the registry table.
- * @param key The key to use when registering the image
- * @param path The path where the image can be found. This path is relative to where
- * this plugin class is found (i.e. typically the packages directory)
- */
- private final static void declareRegistryImage(String key, String path) {
- ImageDescriptor desc= ImageDescriptor.getMissingImageDescriptor();
- try {
- desc= ImageDescriptor.createFromURL(makeIconFileURL(path));
- } catch (MalformedURLException e) {
- DroolsIDEPlugin.log(e);
- }
- imageRegistry.put(key, desc);
- }
-
- /**
- * Returns the ImageRegistry.
- */
- public static ImageRegistry getImageRegistry() {
- if (imageRegistry == null) {
- initializeImageRegistry();
- }
- return imageRegistry;
- }
-
- public static ImageRegistry initializeImageRegistry() {
- imageRegistry = new ImageRegistry();
- declareImages();
- return imageRegistry;
- }
-
- /**
- * Returns the <code>Image</code> identified by the given key,
- * or <code>null</code> if it does not exist.
- */
- public static Image getImage(String key) {
- return getImageRegistry().get(key);
- }
-
- /**
- * Returns the <code>ImageDescriptor</code> identified by the given key,
- * or <code>null</code> if it does not exist.
- */
- public static ImageDescriptor getImageDescriptor(String key) {
- return getImageRegistry().getDescriptor(key);
- }
-
- private static URL makeIconFileURL(String iconPath) throws MalformedURLException {
- if (ICON_BASE_URL == null) {
- throw new MalformedURLException();
- }
-
- return new URL(ICON_BASE_URL, iconPath);
- }
-}
\ No newline at end of file
Deleted: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/IDroolsConstants.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/IDroolsConstants.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/IDroolsConstants.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,8 +0,0 @@
-package org.drools.ide;
-
-public interface IDroolsConstants {
-
- final String AUDIT_VIEW = "org.drools.ide.debug.AuditView";
- final String RULES_VIEW = "org.drools.ide.view.rules.RulesView";
-
-}
Deleted: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericActionBarContributor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericActionBarContributor.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericActionBarContributor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,74 +0,0 @@
-package org.drools.ide.flow.common.editor;
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.gef.ui.actions.ActionBarContributor;
-import org.eclipse.gef.ui.actions.AlignmentRetargetAction;
-import org.eclipse.gef.ui.actions.DeleteRetargetAction;
-import org.eclipse.gef.ui.actions.GEFActionConstants;
-import org.eclipse.gef.ui.actions.RedoRetargetAction;
-import org.eclipse.gef.ui.actions.UndoRetargetAction;
-import org.eclipse.gef.ui.actions.ZoomComboContributionItem;
-import org.eclipse.jface.action.IToolBarManager;
-import org.eclipse.jface.action.Separator;
-import org.eclipse.ui.actions.ActionFactory;
-
-/**
- * Common implementation of a ActionBarContributor.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class GenericActionBarContributor extends ActionBarContributor {
-
- protected void buildActions() {
- addRetargetAction(new UndoRetargetAction());
- addRetargetAction(new RedoRetargetAction());
- addRetargetAction(new DeleteRetargetAction());
-
- addRetargetAction(new AlignmentRetargetAction(PositionConstants.LEFT));
- addRetargetAction(new AlignmentRetargetAction(PositionConstants.CENTER));
- addRetargetAction(new AlignmentRetargetAction(PositionConstants.RIGHT));
- addRetargetAction(new AlignmentRetargetAction(PositionConstants.TOP));
- addRetargetAction(new AlignmentRetargetAction(PositionConstants.MIDDLE));
- addRetargetAction(new AlignmentRetargetAction(PositionConstants.BOTTOM));
- }
-
- public void contributeToToolBar(IToolBarManager toolBarManager) {
- toolBarManager.add(getAction(ActionFactory.UNDO.getId()));
- toolBarManager.add(getAction(ActionFactory.REDO.getId()));
- toolBarManager.add(new Separator());
- toolBarManager.add(new ZoomComboContributionItem(getPage()));
- toolBarManager.add(new Separator());
- toolBarManager.add(getActionRegistry().getAction(
- GEFActionConstants.ALIGN_LEFT));
- toolBarManager.add(getActionRegistry().getAction(
- GEFActionConstants.ALIGN_CENTER));
- toolBarManager.add(getActionRegistry().getAction(
- GEFActionConstants.ALIGN_RIGHT));
- toolBarManager.add(new Separator());
- toolBarManager.add(getActionRegistry().getAction(
- GEFActionConstants.ALIGN_TOP));
- toolBarManager.add(getActionRegistry().getAction(
- GEFActionConstants.ALIGN_MIDDLE));
- toolBarManager.add(getActionRegistry().getAction(
- GEFActionConstants.ALIGN_BOTTOM));
-
- }
-
- protected void declareGlobalActionKeys() {
- }
-}
Deleted: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericContextMenuProvider.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericContextMenuProvider.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericContextMenuProvider.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,65 +0,0 @@
-package org.drools.ide.flow.common.editor;
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.eclipse.gef.ContextMenuProvider;
-import org.eclipse.gef.EditPartViewer;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.gef.ui.actions.GEFActionConstants;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.action.IMenuManager;
-import org.eclipse.ui.actions.ActionFactory;
-
-/**
- * Common implementation of a ContextMenuProvider.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class GenericContextMenuProvider extends ContextMenuProvider {
-
- private ActionRegistry actionRegistry;
-
- public GenericContextMenuProvider(EditPartViewer viewer,
- ActionRegistry registry) {
- super(viewer);
- setActionRegistry(registry);
- }
-
- public void buildContextMenu(IMenuManager menu) {
- GEFActionConstants.addStandardActionGroups(menu);
-
- IAction action = getActionRegistry().getAction(
- ActionFactory.UNDO.getId());
- menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action);
-
- action = getActionRegistry().getAction(ActionFactory.REDO.getId());
- menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action);
-
- action = getActionRegistry().getAction(ActionFactory.DELETE.getId());
- if (action.isEnabled()) {
- menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
- }
- }
-
- private ActionRegistry getActionRegistry() {
- return actionRegistry;
- }
-
- public void setActionRegistry(ActionRegistry registry) {
- actionRegistry = registry;
- }
-
-}
Deleted: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericModelEditor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericModelEditor.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/GenericModelEditor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,304 +0,0 @@
-package org.drools.ide.flow.common.editor;
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
-import java.io.OutputStream;
-import java.util.EventObject;
-
-import org.drools.ide.DroolsIDEPlugin;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.draw2d.PositionConstants;
-import org.eclipse.gef.ContextMenuProvider;
-import org.eclipse.gef.DefaultEditDomain;
-import org.eclipse.gef.EditPartFactory;
-import org.eclipse.gef.KeyHandler;
-import org.eclipse.gef.KeyStroke;
-import org.eclipse.gef.editparts.ScalableRootEditPart;
-import org.eclipse.gef.editparts.ZoomManager;
-import org.eclipse.gef.palette.PaletteRoot;
-import org.eclipse.gef.ui.actions.ActionRegistry;
-import org.eclipse.gef.ui.actions.AlignmentAction;
-import org.eclipse.gef.ui.actions.DirectEditAction;
-import org.eclipse.gef.ui.actions.GEFActionConstants;
-import org.eclipse.gef.ui.parts.GraphicalEditorWithPalette;
-import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler;
-import org.eclipse.jface.action.IAction;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.ui.IEditorPart;
-import org.eclipse.ui.IFileEditorInput;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.actions.WorkspaceModifyOperation;
-import org.eclipse.ui.dialogs.SaveAsDialog;
-import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-/**
- * Abstract implementation of a graphical editor.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public abstract class GenericModelEditor extends GraphicalEditorWithPalette {
-
- private Object model;
- private boolean savePreviouslyNeeded = false;
- private KeyHandler sharedKeyHandler;
- private PaletteRoot root;
- private OverviewOutlinePage overviewOutlinePage;
-
- public GenericModelEditor() {
- setEditDomain(new DefaultEditDomain(this));
- }
-
- protected void setModel(Object model) {
- this.model = model;
- }
-
- protected Object getModel() {
- return model;
- }
-
- protected void createActions() {
- super.createActions();
- ActionRegistry registry = getActionRegistry();
-
- IAction action = new DirectEditAction((IWorkbenchPart) this);
- registry.registerAction(action);
- getSelectionActions().add(action.getId());
-
- action = new AlignmentAction((IWorkbenchPart) this,
- PositionConstants.LEFT);
- registry.registerAction(action);
- getSelectionActions().add(action.getId());
-
- action = new AlignmentAction((IWorkbenchPart) this,
- PositionConstants.CENTER);
- registry.registerAction(action);
- getSelectionActions().add(action.getId());
-
- action = new AlignmentAction((IWorkbenchPart) this,
- PositionConstants.RIGHT);
- registry.registerAction(action);
- getSelectionActions().add(action.getId());
-
- action = new AlignmentAction((IWorkbenchPart) this,
- PositionConstants.TOP);
- registry.registerAction(action);
- getSelectionActions().add(action.getId());
-
- action = new AlignmentAction((IWorkbenchPart) this,
- PositionConstants.MIDDLE);
- registry.registerAction(action);
- getSelectionActions().add(action.getId());
-
- action = new AlignmentAction((IWorkbenchPart) this,
- PositionConstants.BOTTOM);
- registry.registerAction(action);
- getSelectionActions().add(action.getId());
- }
-
- public void commandStackChanged(EventObject event) {
- if (isDirty()) {
- if (!savePreviouslyNeeded()) {
- setSavePreviouslyNeeded(true);
- firePropertyChange(IEditorPart.PROP_DIRTY);
- }
- } else {
- setSavePreviouslyNeeded(false);
- firePropertyChange(IEditorPart.PROP_DIRTY);
- }
- super.commandStackChanged(event);
- }
-
- protected void createOutputStream(OutputStream os) throws IOException {
- ObjectOutputStream out = new ObjectOutputStream(os);
- out.writeObject(model);
- out.close();
- }
-
- protected void configureGraphicalViewer() {
- super.configureGraphicalViewer();
- getGraphicalViewer().setRootEditPart(new ScalableRootEditPart());
- getGraphicalViewer().setEditPartFactory(createEditPartFactory());
- getGraphicalViewer().setKeyHandler(
- new GraphicalViewerKeyHandler(getGraphicalViewer())
- .setParent(getCommonKeyHandler()));
-
- ContextMenuProvider provider = new GenericContextMenuProvider(
- getGraphicalViewer(), getActionRegistry());
- getGraphicalViewer().setContextMenu(provider);
- getSite().registerContextMenu("org.drools.ide.flow.editor.contextmenu",
- provider, getGraphicalViewer());
- }
-
- protected abstract EditPartFactory createEditPartFactory();
-
- protected void initializeGraphicalViewer() {
- getGraphicalViewer().setContents(model);
- }
-
- public void doSave(IProgressMonitor monitor) {
- try {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- createOutputStream(out);
- IFile file = ((IFileEditorInput) getEditorInput()).getFile();
- file.setContents(new ByteArrayInputStream(out.toByteArray()), true,
- false, monitor);
- out.close();
- getCommandStack().markSaveLocation();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- public void doSaveAs() {
- SaveAsDialog dialog = new SaveAsDialog(getSite().getWorkbenchWindow()
- .getShell());
- dialog.setOriginalFile(((IFileEditorInput) getEditorInput()).getFile());
- dialog.open();
- IPath path = dialog.getResult();
-
- if (path == null) {
- return;
- }
-
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- final IFile file = workspace.getRoot().getFile(path);
-
- WorkspaceModifyOperation op = new WorkspaceModifyOperation() {
- public void execute(final IProgressMonitor monitor)
- throws CoreException {
- try {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- createOutputStream(out);
- file.create(new ByteArrayInputStream(out.toByteArray()),
- true, monitor);
- out.close();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- };
-
- try {
- new ProgressMonitorDialog(getSite().getWorkbenchWindow().getShell())
- .run(false, true, op);
- setInput(new FileEditorInput(file));
- getCommandStack().markSaveLocation();
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- protected KeyHandler getCommonKeyHandler() {
- if (sharedKeyHandler == null) {
- sharedKeyHandler = new KeyHandler();
- sharedKeyHandler
- .put(KeyStroke.getPressed(SWT.DEL, 127, 0),
- getActionRegistry().getAction(
- ActionFactory.DELETE.getId()));
- sharedKeyHandler.put(KeyStroke.getPressed(SWT.F2, 0),
- getActionRegistry().getAction(
- GEFActionConstants.DIRECT_EDIT));
- }
- return sharedKeyHandler;
- }
-
- public boolean isDirty() {
- return isSaveOnCloseNeeded();
- }
-
- public boolean isSaveAsAllowed() {
- return true;
- }
-
- public boolean isSaveOnCloseNeeded() {
- return getCommandStack().isDirty();
- }
-
- private boolean savePreviouslyNeeded() {
- return savePreviouslyNeeded;
- }
-
- private void setSavePreviouslyNeeded(boolean value) {
- savePreviouslyNeeded = value;
- }
-
- protected PaletteRoot getPaletteRoot() {
- if (root == null) {
- root = createPalette();
- }
- return root;
- }
-
- protected abstract PaletteRoot createPalette();
-
- protected void setInput(IEditorInput input) {
- super.setInput(input);
-
- IFile file = ((IFileEditorInput) input).getFile();
- setPartName(file.getName());
- try {
- InputStream is = file.getContents(false);
- createInputStream(is);
- } catch (Exception e) {
- DroolsIDEPlugin.log(e);
- model = createModel();
- }
- }
-
- protected void createInputStream(InputStream is) throws Exception {
- ObjectInputStream ois = new ObjectInputStreamWithLoader(is, getClass()
- .getClassLoader());
- model = ois.readObject();
- ois.close();
- }
-
- protected abstract Object createModel();
-
- public Object getAdapter(Class type) {
- if (type == IContentOutlinePage.class) {
- return getOverviewOutlinePage();
- }
- if (type == ZoomManager.class) {
- return ((ScalableRootEditPart) getGraphicalViewer()
- .getRootEditPart()).getZoomManager();
- }
- return super.getAdapter(type);
- }
-
- protected OverviewOutlinePage getOverviewOutlinePage() {
- if (null == overviewOutlinePage && null != getGraphicalViewer()) {
- ScalableRootEditPart rootEditPart = (ScalableRootEditPart) getGraphicalViewer()
- .getRootEditPart();
- overviewOutlinePage = new OverviewOutlinePage(rootEditPart);
- }
- return overviewOutlinePage;
- }
-}
Deleted: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/ObjectInputStreamWithLoader.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/ObjectInputStreamWithLoader.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/ObjectInputStreamWithLoader.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,92 +0,0 @@
-package org.drools.ide.flow.common.editor;
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.ObjectInputStream;
-import java.io.ObjectStreamClass;
-import java.io.StreamCorruptedException;
-import java.lang.reflect.Array;
-
-/**
- * Implementation of an ObjectInputStream that has a custom classloader.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class ObjectInputStreamWithLoader extends ObjectInputStream {
-
- private ClassLoader loader;
-
- /**
- * Loader must be non-null;
- */
- public ObjectInputStreamWithLoader(InputStream in, ClassLoader loader)
- throws IOException, StreamCorruptedException {
- super(in);
- if (loader == null) {
- throw new IllegalArgumentException("Illegal null argument to ObjectInputStreamWithLoader");
- }
- this.loader = loader;
- }
-
- /**
- * Make a primitive array class
- */
- private Class primitiveType(char type) {
- switch (type) {
- case 'B': return byte.class;
- case 'C': return char.class;
- case 'D': return double.class;
- case 'F': return float.class;
- case 'I': return int.class;
- case 'J': return long.class;
- case 'S': return short.class;
- case 'Z': return boolean.class;
- default: return null;
- }
- }
-
- /**
- * Use the given ClassLoader rather than using the system class
- */
- protected Class resolveClass(ObjectStreamClass classDesc)
- throws IOException, ClassNotFoundException {
- String cname = classDesc.getName();
- if (cname.startsWith("[")) {
- // An array
- Class component = null; // component class
- int dcount; // dimension
- for (dcount=1; cname.charAt(dcount)=='['; dcount++);
- if (cname.charAt(dcount) == 'L') {
- String className = cname.substring(dcount+1, cname.length()-1);
- component = loader.loadClass(className);
- } else {
- if (cname.length() != dcount + 1) {
- throw new ClassNotFoundException(cname);// malformed
- }
- component = primitiveType(cname.charAt(dcount));
- }
- int dim[] = new int[dcount];
- for (int i = 0; i < dcount; i++) {
- dim[i]=0;
- }
- return Array.newInstance(component, dim).getClass();
- }
- return loader.loadClass(cname);
- }
-}
-
Deleted: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/OverviewOutlinePage.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/OverviewOutlinePage.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/ide/flow/common/editor/OverviewOutlinePage.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -1,90 +0,0 @@
-package org.drools.ide.flow.common.editor;
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-import org.eclipse.draw2d.LightweightSystem;
-import org.eclipse.draw2d.MarginBorder;
-import org.eclipse.draw2d.Viewport;
-import org.eclipse.draw2d.parts.ScrollableThumbnail;
-import org.eclipse.draw2d.parts.Thumbnail;
-import org.eclipse.gef.LayerConstants;
-import org.eclipse.gef.editparts.ScalableRootEditPart;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.part.Page;
-import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
-
-/**
- * Common implementation of an outline page.
- *
- * @author <a href="mailto:kris_verlaenen at hotmail.com">Kris Verlaenen</a>
- */
-public class OverviewOutlinePage extends Page implements IContentOutlinePage {
-
- private Canvas overview;
- private ScalableRootEditPart rootEditPart;
- private Thumbnail thumbnail;
-
- public OverviewOutlinePage(ScalableRootEditPart rootEditPart) {
- this.rootEditPart = rootEditPart;
- }
-
- public void addSelectionChangedListener(ISelectionChangedListener listener) {
- }
-
- public void createControl(Composite parent) {
- overview = new Canvas(parent, SWT.NONE);
- LightweightSystem lws = new LightweightSystem(overview);
- thumbnail = new ScrollableThumbnail((Viewport) rootEditPart.getFigure());
- thumbnail.setBorder(new MarginBorder(3));
- thumbnail.setSource(rootEditPart
- .getLayer(LayerConstants.PRINTABLE_LAYERS));
- lws.setContents(thumbnail);
- }
-
- public void dispose() {
- if (null != thumbnail) {
- thumbnail.deactivate();
- }
- super.dispose();
- }
-
- public Control getControl() {
- return overview;
- }
-
- public ISelection getSelection() {
- return StructuredSelection.EMPTY;
- }
-
- public void removeSelectionChangedListener(
- ISelectionChangedListener listener) {
- }
-
- public void setFocus() {
- if (getControl() != null) {
- getControl().setFocus();
- }
- }
-
- public void setSelection(ISelection selection) {
- }
-}
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/AccumulateNodeVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/AccumulateNodeVertex.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/AccumulateNodeVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -34,7 +34,7 @@
}
/* (non-Javadoc)
- * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
+ * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
*/
public String toString() {
return NODE_NAME;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/AlphaNodeVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/AlphaNodeVertex.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/AlphaNodeVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -48,7 +48,7 @@
}
/* (non-Javadoc)
- * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
+ * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
*/
public String toString() {
return this.node.toString();
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/BaseVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/BaseVertex.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/BaseVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -15,7 +15,7 @@
*/
package org.drools.reteoo;
-import org.drools.ide.editors.rete.model.GraphicalVertex;
+import org.drools.eclipse.editors.rete.model.GraphicalVertex;
/**
* Intermediate class to have a workaround for *Node default visibility
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/CollectNodeVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/CollectNodeVertex.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/CollectNodeVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -34,7 +34,7 @@
}
/* (non-Javadoc)
- * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
+ * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
*/
public String toString() {
return NODE_NAME;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/EvalConditionNodeVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/EvalConditionNodeVertex.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/EvalConditionNodeVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -33,7 +33,7 @@
}
/* (non-Javadoc)
- * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
+ * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
*/
public String toString() {
return NODE_NAME;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ExistsNodeVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ExistsNodeVertex.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ExistsNodeVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -34,7 +34,7 @@
}
/* (non-Javadoc)
- * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
+ * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
*/
public String toString() {
return NODE_NAME;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/FromNodeVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/FromNodeVertex.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/FromNodeVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -34,7 +34,7 @@
}
/* (non-Javadoc)
- * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
+ * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
*/
public String toString() {
return NODE_NAME;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/JoinNodeVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/JoinNodeVertex.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/JoinNodeVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -35,7 +35,7 @@
}
/* (non-Javadoc)
- * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
+ * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
*/
public String toString() {
return NODE_NAME;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/LeftInputAdapterNodeVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/LeftInputAdapterNodeVertex.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/LeftInputAdapterNodeVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -34,7 +34,7 @@
}
/* (non-Javadoc)
- * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
+ * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
*/
public String toString() {
return this.node.toString();
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/NotNodeVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/NotNodeVertex.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/NotNodeVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -34,7 +34,7 @@
}
/* (non-Javadoc)
- * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
+ * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
*/
public String toString() {
return NODE_NAME;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ObjectTypeNodeVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ObjectTypeNodeVertex.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ObjectTypeNodeVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -35,7 +35,7 @@
}
/* (non-Javadoc)
- * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
+ * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
*/
public String toString() {
return NODE_NAME;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/QueryTerminalNodeVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/QueryTerminalNodeVertex.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/QueryTerminalNodeVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -34,7 +34,7 @@
}
/* (non-Javadoc)
- * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
+ * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
*/
public String toString() {
return NODE_NAME;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ReteVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ReteVertex.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ReteVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -34,7 +34,7 @@
}
/* (non-Javadoc)
- * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
+ * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
*/
public String toString() {
return NODE_NAME;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ReteooVisitor.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ReteooVisitor.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/ReteooVisitor.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -6,8 +6,8 @@
import java.util.Map;
import org.drools.common.BaseNode;
-import org.drools.ide.editors.rete.model.Connection;
-import org.drools.ide.editors.rete.model.ReteGraph;
+import org.drools.eclipse.editors.rete.model.Connection;
+import org.drools.eclipse.editors.rete.model.ReteGraph;
import org.drools.util.Iterator;
import org.drools.util.ObjectHashMap;
import org.drools.util.ReflectiveVisitor;
Modified: labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/RuleTerminalNodeVertex.java
===================================================================
--- labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/RuleTerminalNodeVertex.java 2007-03-30 12:44:40 UTC (rev 10640)
+++ labs/jbossrules/trunk/drools-eclipse/drools-eclipse-plugin/src/main/java/org/drools/reteoo/RuleTerminalNodeVertex.java 2007-03-30 13:50:45 UTC (rev 10641)
@@ -34,7 +34,7 @@
}
/* (non-Javadoc)
- * @see org.drools.ide.editors.rete.model.BaseVertex#toString()
+ * @see org.drools.eclipse.editors.rete.model.BaseVertex#toString()
*/
public String toString() {
return NODE_NAME;
More information about the jboss-svn-commits
mailing list