Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephan Leicht Vogt2012-09-07 07:58:27 +0000
committerStephan Leicht Vogt2012-09-07 07:58:27 +0000
commit0316f35c4c69512a4e1cc692d0e1b810293aa39d (patch)
tree28f92cc5d9778e1d3531fde52193de7bff2b5444
parentde686a515a2b682ad20fc93c4b7bb1d504987c28 (diff)
downloadorg.eclipse.scout.sdk-0316f35c4c69512a4e1cc692d0e1b810293aa39d.tar.gz
org.eclipse.scout.sdk-0316f35c4c69512a4e1cc692d0e1b810293aa39d.tar.xz
org.eclipse.scout.sdk-0316f35c4c69512a4e1cc692d0e1b810293aa39d.zip
Normalize line endings
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/lookupcall/LookupCallNewWizardPage.java826
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/DesktopMenuNewWizard.java184
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/MenuNewWizard.java104
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/MenuNewWizardPage.java836
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/outline/OutlineNewWizard.java74
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/outline/OutlineNewWizardPage.java610
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageLinkWizard.java104
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageLinkWizardPage.java406
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewAttributesWizardPage.java664
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewTemplatesWizardPage.java464
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewWizard.java124
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/permission/PermissionNewWizard.java64
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/permission/PermissionWizardPage.java390
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/AbstractProjectNewWizardPage.java70
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/IScoutProjectWizard.java68
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/IScoutProjectWizardPage.java98
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/BookmarkStorageServiceNewWizard.java690
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ClientServiceNewWizard.java532
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/CustomServiceNewPackageWizard.java142
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/CustomServiceNewWizard.java690
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/LookupServiceNewWizard.java678
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/OutlineServiceNewWizard.java682
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ProcessServiceNewWizard.java780
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ProcessServiceNewWizardPage.java472
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceNewWizardPage.java364
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceOperationNewWizard.java50
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceOperationNewWizardPage.java388
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/SmtpServiceNewWizard.java512
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/SqlServiceNewWizard.java508
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/DefaultTableColumnNewWizard.java98
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/DefaultTableColumnNewWizardPage.java724
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/SmartTableColumnNewWizard.java104
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/SmartTableColumnNewWizardPage.java916
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/TableColumnNewWizard.java116
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/TableColumnNewWizardPage1.java630
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/OutlineToolbuttonNewWizardPage.java494
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizard.java134
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizardPage1.java374
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizardPage2.java472
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/WizardNewWizard.java78
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/WizardNewWizardPage.java468
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/step/WizardStepNewWizard.java92
-rw-r--r--org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/step/WizardStepNewWizardPage.java624
-rw-r--r--org.eclipse.scout.sdk.util/.classpath14
-rw-r--r--org.eclipse.scout.sdk.util/.project70
-rw-r--r--org.eclipse.scout.sdk.util/build.properties12
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/NamingUtility.java176
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/PropertyMap.java86
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/AstUtility.java136
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/VariableType.java136
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/DefaultAstVisitor.java1052
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/TypeSignatureResolveVisitor.java486
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/VariableResolveVisitor.java604
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/SdkUtilActivator.java134
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/CachedTypeHierarchy.java208
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/CombinedHierarchy.java58
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/HierarchyCache.java572
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/JavaResourceChangedEmitter.java1192
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/JdtEventCollector.java236
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/PrimaryTypeTypeHierarchy.java464
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/TypeCache.java456
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/TypeHierarchy.java960
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/WorkingCopyManager.java236
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/javadoc/JavaDoc.java162
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/ElementChangedListenerEx.java304
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/IJavaResourceChangedListener.java48
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/JdtEvent.java410
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/JdtUtility.java586
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/SourceRange.java96
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedAstAnalyzer.java162
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedAstMatcher.java1040
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedJavaElementDelta.java72
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedJavaElementDeltaManager.java188
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/LogStatus.java188
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/ScoutStatus.java78
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/SdkLogManager.java306
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/LazyPluginModel.java332
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/LazyProductFileModel.java408
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/PluginModelHelper.java1920
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/ProductFileModelHelper.java764
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/IResourceFilter.java50
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/ResourceFilters.java146
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/ResourceUtility.java766
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/FullyQuallifiedValidator.java72
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/IImportValidator.java78
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/SignatureUtility.java1044
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/SimpleImportValidator.java202
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/FieldFilters.java158
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IFieldFilter.java42
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IMethodFilter.java52
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IPropertyBean.java118
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IPropertyBeanFilter.java52
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/ITypeFilter.java44
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/JavaElementComparator.java88
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/MethodComparators.java72
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/MethodFilters.java278
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/PropertyBean.java252
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/PropertyBeanComparators.java94
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeComparators.java104
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeFilters.java686
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeUtility.java1532
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ICachedTypeHierarchy.java72
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IHierarchyCache.java54
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IJavaResourceChangedEmitter.java40
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IPrimaryTypeTypeHierarchy.java58
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeCache.java30
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeHierarchy.java572
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeHierarchyChangedListener.java62
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IWorkingCopyManager.java120
-rw-r--r--org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/TypeCacheAccessor.java68
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/.classpath22
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/.project56
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.jdt.core.prefs706
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.jdt.ui.prefs230
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.pde.core.prefs6
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.wst.validation.prefs20
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/Release Notes.txt50
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/build.properties16
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/plugin.xml404
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/resources/texts/Texts.properties756
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsConstants.java136
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsIcons.java130
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsRuntimeClasses.java112
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsSdk.java644
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsSdkStatus.java134
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/Texts.java82
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/ext/WebServicePageFactory.java90
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/IMarkerCommandListener.java40
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/IMarkerRebuildListener.java36
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/MarkerRebuildUtility.java1314
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/MarkerUtility.java312
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/AbstractExecutableMarkerCommand.java156
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/AbstractNonExecutableMarkerCommand.java166
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptBindingFileCommand.java162
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptBuildJaxWsXmlFileCommand.java72
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptSunJaxWsXmlFileCommand.java72
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptWsdlCommand.java146
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/DiscouragedWsdlFolderCommand.java180
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/ErrorProneWsdlLocatorCommand.java438
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/IMarkerCommand.java74
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/InvalidPortTypeCommand.java292
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/InvalidServiceCommand.java292
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/JaxWsServletRegistrationCommand.java138
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingAnnotationTypePropertyCommand.java88
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingBuildJaxWsEntryCommand.java110
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingClasspathEntryForJarFileCommand.java82
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingEndpointCodeFirstCommand.java132
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingEndpointPropertyCommand.java192
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingPortTypeCommand.java168
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingPortTypeInheritanceCommand.java256
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingScoutWebServiceAnnotationCommand.java80
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingServiceCommand.java38
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingWsdlCommand.java144
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MultipleGlobalBindingsCommand.java38
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/StubRebuildCommand.java248
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/UrlPatternAliasMismatchCommand.java88
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/AnnotationUpdateOperation.java314
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BindingFileCreateOperation.java458
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BuildJaxWsEntryCreateOperation.java280
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BuildJaxWsFileCreateOperation.java90
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/CommandExecutionOperation.java102
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/ExternalFileCopyOperation.java296
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/FileDeleteOperation.java100
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/HandlerNewOperation.java360
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/JaxWsServletRegistrationOperation.java484
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/OverrideUnimplementedMethodsOperation.java120
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SourceFolderCreateOrUpdateOperation.java140
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SourceRangeRemoveOperation.java186
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SunJaxWsEntryCreateOperation.java298
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SunJaxWsFileCreateOperation.java106
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/TypeNewOperation.java214
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsConsumerDeleteOperation.java316
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsConsumerImplNewOperation.java360
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsFilesMoveOperation.java374
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderCodeFirstDeleteOperation.java218
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderDeleteOperation.java328
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderImplNewOperation.java510
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsStubGenerationOperation.java726
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsdlCreateOperation.java796
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsdlStyleEnum.java56
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/IPreferenceConstants.java32
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/JaxWsPreferencePage.java110
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/PreferenceInitializer.java50
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/IResourceListener.java98
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/ManagedResource.java592
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/ResourceFactory.java128
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/WsdlResource.java240
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/XmlResource.java224
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/AbstractLinkAction.java92
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/AuthenticationHandlerNewWizardAction.java268
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/BindingFileNewAction.java194
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/BuildPropertiesEditAction.java100
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/CleanupPhantomJarFileAction.java342
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/ConsumerNewWizardAction.java98
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/CredentialValidationStrategyNewAction.java84
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/FileOpenAction.java180
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerAddAction.java106
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainFilterEditAction.java110
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainNewAction.java122
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainRemoveAction.java124
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerNewWizardAction.java108
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/IPresenterAction.java40
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/JaxWsAliasChangeWizardAction.java102
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/ProviderNewWizardAction.java100
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/RefreshAction.java74
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/RepairAction.java204
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/SessionFactoryNewAction.java84
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/StubRebuildAction.java236
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/TypeNewAction.java356
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/TypeOpenAction.java148
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsConsumerDeleteAction.java106
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsProviderCodeFirstDeleteAction.java96
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsProviderDeleteAction.java106
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/CommandExecutionDialog.java452
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/ScoutWizardDialogEx.java108
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/SelectionDialog.java384
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/SourceFolderSelectionDialog.java330
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeBrowseDialog.java436
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeSelectionDialog.java142
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeSelectionDialogOld.java382
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/model/BuildJaxWsBean.java362
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/model/SunJaxWsBean.java574
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/AuthenticationHandlerNodePage.java370
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/AuthenticationHandlerTablePage.java336
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/ConsumerTablePage.java92
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/CredentialValidationStrategyNodePage.java224
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/CredentialValidationStrategyTablePage.java300
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/HandlerNodePage.java370
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/HandlerTablePage.java340
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/IJaxWsPageConstants.java62
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/ProviderTablePage.java124
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/SessionFactoryNodePage.java224
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/SessionFactoryTablePage.java302
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceConsumerNodePage.java902
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceConsumerTablePage.java278
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderCodeFirstNodePage.java638
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderHandlerNodePage.java440
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderNodePage.java1092
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderTablePage.java388
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServicesTablePage.java100
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AnnotationProperty.java66
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AuthenticationHandlerNodePagePropertyViewPart.java456
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AuthenticationHandlerTablePagePropertyViewPart.java152
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/CredentialValidationStrategyTablePagePropertyViewPart.java134
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/HandlerNodePagePropertyViewPart.java452
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/HandlerTablePagePropertyViewPart.java134
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/ProviderTablePagePropertyViewPart.java118
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/SessionFactoryTablePagePropertyViewPart.java134
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceConsumerNodePagePropertyViewPart.java1382
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceConsumerTablePagePropertyViewPart.java182
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderCodeFirstNodePagePropertyViewPart.java834
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderHandlerNodePagePropertyViewPart.java548
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderNodePagePropertyViewPart.java1736
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderTablePagePropertyViewPart.java284
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServicesTablePagePropertyViewPart.java176
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AbstractPropertyPresenter.java1182
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AbstractStringActionPresenter.java262
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/ActionPresenter.java288
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AnnotationPresenter.java418
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AnnotationPropertyTypePresenter.java130
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/BindingFilePresenter.java258
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/BooleanPresenter.java116
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/FilePresenter.java428
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/FolderPresenter.java558
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/HandlerPresenter.java448
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/InformationPresenter.java172
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/JaxWsLibraryConflictPresenter.java146
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/PackagePresenter.java574
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/ProposalPresenter.java224
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/SeparatorPresenter.java72
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/SourceFolderPresenter.java182
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/StringPresenter.java560
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/TypePresenter.java928
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/UrlPatternPresenter.java188
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/WsdlFilePresenter.java154
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/WsdlFolderPresenter.java212
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/proposal/PathProposal.java66
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/proposal/QNameProposal.java90
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/AdditionalResourcesWizard.java108
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/BuildPropertiesWizard.java198
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/BuildPropertyWizard.java154
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/HandlerChainFilterWizard.java296
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/HandlerNewWizard.java120
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/JaxWsServletRegistrationWizard.java190
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/PhantomJarFilesDeleteWizard.java196
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/SourceFolderNewWizard.java108
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/TypeNewWizard.java324
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsConsumerDeleteWizard.java370
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsConsumerNewWizard.java708
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsFileMoveWizard.java462
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderCodeFirstDeleteWizard.java214
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderDeleteWizard.java368
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderNewWizard.java1082
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsdlLocationWizard.java348
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsdlNewWizard.java234
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/AdditionalResourcesWizardPage.java464
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildPropertiesWizardPage.java538
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildProperty.java86
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildPropertyWizardPage.java288
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/ElementBean.java224
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/HandlerChainFilterWizardPage.java1038
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/HandlerNewWizardPage.java1056
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/JaxWsServletRegistrationWizardPage.java732
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/ResourceSelectionWizardPage.java226
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/SourceFolderNewWizardPage.java296
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/TypeNewWizardPage.java982
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WebserviceEnum.java36
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsConsumerImplClassWizardPage.java1034
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsPropertiesExistingWsdlWizardPage.java1206
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsPropertiesNewWsdlWizardPage.java1490
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsProviderImplClassWizardPage.java1422
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsStubWizardPage.java486
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlFolderViewerFilter.java106
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlLocationWizardPage.java1572
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlSelectionWizardPage.java470
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/technology/JaxWsServerManifestTechnologyHandler.java104
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/technology/JaxWsServerProdTechnologyHandler.java76
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/GlobalBindingRegistrationHelper.java294
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/JaxWsSdkUtility.java3212
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/SchemaUtility.java760
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/ServletRegistrationUtility.java326
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/AbstractTypeChangedListener.java218
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IOperationFinishedListener.java36
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPageLoadedListener.java36
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPageReloadNotification.java60
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPresenterValueChangedListener.java38
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/worker/AbstractQueueManager.java356
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/worker/MarkerQueueManager.java50
-rw-r--r--org.eclipse.scout.sdk.ws.jaxws/translations.nls16
-rw-r--r--org.eclipse.scout.sdk/.classpath14
-rw-r--r--org.eclipse.scout.sdk/.project70
-rw-r--r--org.eclipse.scout.sdk/TODO.txt18
-rw-r--r--org.eclipse.scout.sdk/about_files/cpl1.0.txt428
-rw-r--r--org.eclipse.scout.sdk/build.properties30
-rw-r--r--org.eclipse.scout.sdk/plugin.xml430
335 files changed, 54845 insertions, 54845 deletions
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/lookupcall/LookupCallNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/lookupcall/LookupCallNewWizardPage.java
index 24fdd9c66..61662f41c 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/lookupcall/LookupCallNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/lookupcall/LookupCallNewWizardPage.java
@@ -1,413 +1,413 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.lookupcall;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.MoreElementsProposal;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.AbstractJavaElementContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeComparators;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.ICachedTypeHierarchy;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * <h3>LookupCallNewWizardPage</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 25.08.2010
- */
-public class LookupCallNewWizardPage extends AbstractWorkspaceWizardPage {
-
- public static enum LOOKUP_SERVICE_STRATEGY {
- CREATE_NEW, USE_EXISTING, NO_SERVICE
- }
-
- protected final IType iLookupService = TypeUtility.getType(RuntimeClasses.ILookupService);
- protected final IType abstractSqlLookupService = TypeUtility.getType(RuntimeClasses.AbstractSqlLookupService);
- protected final IType abstractLookupService = TypeUtility.getType(RuntimeClasses.AbstractLookupService);
-
- /** {@link String} **/
- public static final String PROP_TYPE_NAME = "typeName";
- /** {@link ITypeProposal} **/
- public static final String PROP_SERVICE_SUPER_TYPE = "serviceSuperType";
- /** {@link ITypeProposal} **/
- public static final String PROP_LOOKUP_SERVICE = "lookupService";
- /** {@link LOOKUP_SERVICE_STRATEGY} **/
- public static final String PROP_LOOKUP_SERVICE_STRATEGY = "lookupServiceStrategy";
-
- // ui fields
- private StyledTextField m_typeNameField;
- private Button m_createServiceButton;
- private Button m_useServiceButton;
- private Button m_noServiceButton;
- private ProposalTextField m_serviceSuperTypeField;
- private ProposalTextField m_lookupServiceTypeField;
-
- // process members
- private final IScoutBundle m_sharedBundle;
- private final IScoutBundle m_serverBundle;
-
- public LookupCallNewWizardPage(IScoutBundle sharedBundle, IScoutBundle serverBundle) {
- super(LookupCallNewWizardPage.class.getName());
- m_sharedBundle = sharedBundle;
- m_serverBundle = serverBundle;
- setTitle(Texts.get("NewLookupCall"));
- setDescription(Texts.get("CreateANewLookupCall"));
- setLookupServiceStrategy(LOOKUP_SERVICE_STRATEGY.CREATE_NEW);
- setServiceSuperTypeInternal(abstractSqlLookupService);
-
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_LOOKUP_CALL);
- m_typeNameField.setText(getTypeName());
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- setTypeNameInternal(m_typeNameField.getText());
- pingStateChanging();
- }
- });
-
- Control lookupServiceGroup = createLookupServiceGroup(parent);
-
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- lookupServiceGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- protected Control createLookupServiceGroup(Composite parent) {
- Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
- group.setText("Lookup Service");
-
- boolean serverAvailable = getServerBundle() != null;
-
- Composite radioButtons = new Composite(group, SWT.INHERIT_DEFAULT);
- m_createServiceButton = new Button(radioButtons, SWT.RADIO);
- m_createServiceButton.addSelectionListener(new P_LookupServiceStrategyButtonListener(LOOKUP_SERVICE_STRATEGY.CREATE_NEW));
- m_createServiceButton.setText("create new lookup service");
- m_createServiceButton.setSelection(serverAvailable);
- m_useServiceButton = new Button(radioButtons, SWT.RADIO);
- m_useServiceButton.addSelectionListener(new P_LookupServiceStrategyButtonListener(LOOKUP_SERVICE_STRATEGY.USE_EXISTING));
- m_useServiceButton.setText("use existing lookup service");
- m_noServiceButton = new Button(radioButtons, SWT.RADIO);
- m_noServiceButton.addSelectionListener(new P_LookupServiceStrategyButtonListener(LOOKUP_SERVICE_STRATEGY.NO_SERVICE));
- m_noServiceButton.setText("no lookup service");
- m_noServiceButton.setSelection(!serverAvailable);
-
- m_serviceSuperTypeField = getFieldToolkit().createProposalField(group, Texts.get("LookupServiceSuperType"));
- if (serverAvailable) {
- AbstractJavaElementContentProvider contentProvider = new AbstractJavaElementContentProvider() {
- @Override
- protected Object[][] computeProposals() {
- List<Object> proposals = new ArrayList<Object>();
- proposals.add(abstractLookupService);
- proposals.add(abstractSqlLookupService);
- proposals.add(MoreElementsProposal.INSTANCE);
- ICachedTypeHierarchy lookupServiceHierarchy = TypeUtility.getPrimaryTypeHierarchy(iLookupService);
- IType[] abstractLookupServices = lookupServiceHierarchy.getAllClasses(TypeFilters.getAbstractOnClasspath(getServerBundle().getJavaProject()), TypeComparators.getTypeNameComparator());
- for (IType t : abstractLookupServices) {
- if (!proposals.contains(t)) {
- proposals.add(t);
- }
- }
- return new Object[][]{proposals.toArray(new Object[proposals.size()])};
- }
- };
- m_serviceSuperTypeField.setContentProvider(contentProvider);
- m_serviceSuperTypeField.setLabelProvider(contentProvider.getLabelProvider());
- m_serviceSuperTypeField.acceptProposal(getServiceSuperType());
- }
- else {
- m_serviceSuperTypeField.setEnabled(false);
- radioButtons.setEnabled(false);
- }
- m_serviceSuperTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setServiceSuperTypeInternal((IType) event.proposal);
- pingStateChanging();
- }
- });
-
- m_lookupServiceTypeField = getFieldToolkit().createProposalField(group, Texts.get("LookupService"));
- if (getSharedBundle() != null) {
- AbstractJavaElementContentProvider contentProvider = new AbstractJavaElementContentProvider() {
- @Override
- protected Object[][] computeProposals() {
- ICachedTypeHierarchy lookupServiceHierarchy = TypeUtility.getPrimaryTypeHierarchy(iLookupService);
- IType[] lookupServices = lookupServiceHierarchy.getAllInterfaces(TypeFilters.getTypesOnClasspath(getSharedBundle().getJavaProject()), TypeComparators.getTypeNameComparator());
- return new Object[][]{lookupServices};
- }
- };
- m_lookupServiceTypeField.setContentProvider(contentProvider);
- m_lookupServiceTypeField.setLabelProvider(contentProvider.getLabelProvider());
- }
- else {
- m_lookupServiceTypeField.setEnabled(false);
- }
- m_lookupServiceTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setLookupServiceTypeInternal((IType) event.proposal);
- pingStateChanging();
- }
- });
-
- // layout
- group.setLayout(new GridLayout(1, true));
- radioButtons.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- GridLayout radioButtonGroupLayout = new GridLayout(3, true);
- radioButtons.setLayout(radioButtonGroupLayout);
- m_createServiceButton.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_useServiceButton.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_noServiceButton.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
-
- m_serviceSuperTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- GridData lookupServiceData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- lookupServiceData.exclude = true;
- m_lookupServiceTypeField.setLayoutData(lookupServiceData);
-
- return group;
- }
-
- @Override
- public LookupCallNewWizard getWizard() {
- return (LookupCallNewWizard) super.getWizard();
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- multiStatus.add(getStatusLookupService());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_LOOKUP_CALL)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.existsType(getSharedBundle().getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_LOOKUP) + "." + getTypeName())) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
-
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getLookupServiceStrategy() == LOOKUP_SERVICE_STRATEGY.CREATE_NEW && getServiceSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusLookupService() throws JavaModelException {
- if (getLookupServiceStrategy() == LOOKUP_SERVICE_STRATEGY.USE_EXISTING && getLookupServiceType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheLookupCallCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- public IScoutBundle getSharedBundle() {
- return m_sharedBundle;
- }
-
- public IScoutBundle getServerBundle() {
- return m_serverBundle;
- }
-
- public String getTypeName() {
- return getPropertyString(PROP_TYPE_NAME);
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- setTypeNameInternal(typeName);
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setTypeNameInternal(String typeName) {
- setPropertyString(PROP_TYPE_NAME, typeName);
- }
-
- public LOOKUP_SERVICE_STRATEGY getLookupServiceStrategy() {
- Object strategy = getProperty(PROP_LOOKUP_SERVICE_STRATEGY);
- if (!(strategy instanceof LOOKUP_SERVICE_STRATEGY)) {
- strategy = LOOKUP_SERVICE_STRATEGY.NO_SERVICE;
- }
- return (LOOKUP_SERVICE_STRATEGY) strategy;
- }
-
- public void setLookupServiceStrategy(LOOKUP_SERVICE_STRATEGY strategy) {
- try {
- if (strategy == null) {
- strategy = LOOKUP_SERVICE_STRATEGY.NO_SERVICE;
- }
- setStateChanging(true);
- setLookupServiceStrategyInternal(strategy);
- if (isControlCreated()) {
- switch (strategy) {
- case CREATE_NEW:
- m_createServiceButton.setSelection(true);
- break;
- case USE_EXISTING:
- m_useServiceButton.setSelection(true);
- break;
- case NO_SERVICE:
- m_noServiceButton.setSelection(true);
- break;
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setLookupServiceStrategyInternal(LOOKUP_SERVICE_STRATEGY strategy) {
- setProperty(PROP_LOOKUP_SERVICE_STRATEGY, strategy);
- }
-
- public IType getServiceSuperType() {
- return (IType) getProperty(PROP_SERVICE_SUPER_TYPE);
- }
-
- public void setServiceSuperType(IType superType) {
- try {
- setStateChanging(true);
- setServiceSuperTypeInternal(superType);
- if (isControlCreated()) {
- m_serviceSuperTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setServiceSuperTypeInternal(IType superType) {
- setProperty(PROP_SERVICE_SUPER_TYPE, superType);
- }
-
- public IType getLookupServiceType() {
- return (IType) getProperty(PROP_LOOKUP_SERVICE);
- }
-
- public void setLookupServiceType(IType lookupService) {
- try {
- setStateChanging(true);
- setLookupServiceTypeInternal(lookupService);
- if (isControlCreated()) {
- m_lookupServiceTypeField.acceptProposal(lookupService);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setLookupServiceTypeInternal(IType lookupService) {
- setProperty(PROP_LOOKUP_SERVICE, lookupService);
- }
-
- private class P_LookupServiceStrategyButtonListener extends SelectionAdapter {
- private final LOOKUP_SERVICE_STRATEGY m_strategy;
-
- public P_LookupServiceStrategyButtonListener(LOOKUP_SERVICE_STRATEGY strategy) {
- m_strategy = strategy;
-
- }
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- setLookupServiceStrategyInternal(m_strategy);
- switch (m_strategy) {
- case CREATE_NEW:
- m_serviceSuperTypeField.setVisible(true);
- ((GridData) m_serviceSuperTypeField.getLayoutData()).exclude = false;
- m_lookupServiceTypeField.setVisible(false);
- ((GridData) m_lookupServiceTypeField.getLayoutData()).exclude = true;
- break;
- case USE_EXISTING:
- m_serviceSuperTypeField.setVisible(false);
- ((GridData) m_serviceSuperTypeField.getLayoutData()).exclude = true;
- m_lookupServiceTypeField.setVisible(true);
- ((GridData) m_lookupServiceTypeField.getLayoutData()).exclude = false;
- break;
- case NO_SERVICE:
- m_serviceSuperTypeField.setVisible(false);
- ((GridData) m_serviceSuperTypeField.getLayoutData()).exclude = true;
- m_lookupServiceTypeField.setVisible(false);
- ((GridData) m_lookupServiceTypeField.getLayoutData()).exclude = true;
- break;
- }
- m_lookupServiceTypeField.getParent().layout(true);
- pingStateChanging();
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.lookupcall;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.MoreElementsProposal;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.AbstractJavaElementContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeComparators;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.ICachedTypeHierarchy;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+
+/**
+ * <h3>LookupCallNewWizardPage</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 25.08.2010
+ */
+public class LookupCallNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ public static enum LOOKUP_SERVICE_STRATEGY {
+ CREATE_NEW, USE_EXISTING, NO_SERVICE
+ }
+
+ protected final IType iLookupService = TypeUtility.getType(RuntimeClasses.ILookupService);
+ protected final IType abstractSqlLookupService = TypeUtility.getType(RuntimeClasses.AbstractSqlLookupService);
+ protected final IType abstractLookupService = TypeUtility.getType(RuntimeClasses.AbstractLookupService);
+
+ /** {@link String} **/
+ public static final String PROP_TYPE_NAME = "typeName";
+ /** {@link ITypeProposal} **/
+ public static final String PROP_SERVICE_SUPER_TYPE = "serviceSuperType";
+ /** {@link ITypeProposal} **/
+ public static final String PROP_LOOKUP_SERVICE = "lookupService";
+ /** {@link LOOKUP_SERVICE_STRATEGY} **/
+ public static final String PROP_LOOKUP_SERVICE_STRATEGY = "lookupServiceStrategy";
+
+ // ui fields
+ private StyledTextField m_typeNameField;
+ private Button m_createServiceButton;
+ private Button m_useServiceButton;
+ private Button m_noServiceButton;
+ private ProposalTextField m_serviceSuperTypeField;
+ private ProposalTextField m_lookupServiceTypeField;
+
+ // process members
+ private final IScoutBundle m_sharedBundle;
+ private final IScoutBundle m_serverBundle;
+
+ public LookupCallNewWizardPage(IScoutBundle sharedBundle, IScoutBundle serverBundle) {
+ super(LookupCallNewWizardPage.class.getName());
+ m_sharedBundle = sharedBundle;
+ m_serverBundle = serverBundle;
+ setTitle(Texts.get("NewLookupCall"));
+ setDescription(Texts.get("CreateANewLookupCall"));
+ setLookupServiceStrategy(LOOKUP_SERVICE_STRATEGY.CREATE_NEW);
+ setServiceSuperTypeInternal(abstractSqlLookupService);
+
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_LOOKUP_CALL);
+ m_typeNameField.setText(getTypeName());
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setTypeNameInternal(m_typeNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ Control lookupServiceGroup = createLookupServiceGroup(parent);
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ lookupServiceGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ protected Control createLookupServiceGroup(Composite parent) {
+ Group group = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ group.setText("Lookup Service");
+
+ boolean serverAvailable = getServerBundle() != null;
+
+ Composite radioButtons = new Composite(group, SWT.INHERIT_DEFAULT);
+ m_createServiceButton = new Button(radioButtons, SWT.RADIO);
+ m_createServiceButton.addSelectionListener(new P_LookupServiceStrategyButtonListener(LOOKUP_SERVICE_STRATEGY.CREATE_NEW));
+ m_createServiceButton.setText("create new lookup service");
+ m_createServiceButton.setSelection(serverAvailable);
+ m_useServiceButton = new Button(radioButtons, SWT.RADIO);
+ m_useServiceButton.addSelectionListener(new P_LookupServiceStrategyButtonListener(LOOKUP_SERVICE_STRATEGY.USE_EXISTING));
+ m_useServiceButton.setText("use existing lookup service");
+ m_noServiceButton = new Button(radioButtons, SWT.RADIO);
+ m_noServiceButton.addSelectionListener(new P_LookupServiceStrategyButtonListener(LOOKUP_SERVICE_STRATEGY.NO_SERVICE));
+ m_noServiceButton.setText("no lookup service");
+ m_noServiceButton.setSelection(!serverAvailable);
+
+ m_serviceSuperTypeField = getFieldToolkit().createProposalField(group, Texts.get("LookupServiceSuperType"));
+ if (serverAvailable) {
+ AbstractJavaElementContentProvider contentProvider = new AbstractJavaElementContentProvider() {
+ @Override
+ protected Object[][] computeProposals() {
+ List<Object> proposals = new ArrayList<Object>();
+ proposals.add(abstractLookupService);
+ proposals.add(abstractSqlLookupService);
+ proposals.add(MoreElementsProposal.INSTANCE);
+ ICachedTypeHierarchy lookupServiceHierarchy = TypeUtility.getPrimaryTypeHierarchy(iLookupService);
+ IType[] abstractLookupServices = lookupServiceHierarchy.getAllClasses(TypeFilters.getAbstractOnClasspath(getServerBundle().getJavaProject()), TypeComparators.getTypeNameComparator());
+ for (IType t : abstractLookupServices) {
+ if (!proposals.contains(t)) {
+ proposals.add(t);
+ }
+ }
+ return new Object[][]{proposals.toArray(new Object[proposals.size()])};
+ }
+ };
+ m_serviceSuperTypeField.setContentProvider(contentProvider);
+ m_serviceSuperTypeField.setLabelProvider(contentProvider.getLabelProvider());
+ m_serviceSuperTypeField.acceptProposal(getServiceSuperType());
+ }
+ else {
+ m_serviceSuperTypeField.setEnabled(false);
+ radioButtons.setEnabled(false);
+ }
+ m_serviceSuperTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setServiceSuperTypeInternal((IType) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ m_lookupServiceTypeField = getFieldToolkit().createProposalField(group, Texts.get("LookupService"));
+ if (getSharedBundle() != null) {
+ AbstractJavaElementContentProvider contentProvider = new AbstractJavaElementContentProvider() {
+ @Override
+ protected Object[][] computeProposals() {
+ ICachedTypeHierarchy lookupServiceHierarchy = TypeUtility.getPrimaryTypeHierarchy(iLookupService);
+ IType[] lookupServices = lookupServiceHierarchy.getAllInterfaces(TypeFilters.getTypesOnClasspath(getSharedBundle().getJavaProject()), TypeComparators.getTypeNameComparator());
+ return new Object[][]{lookupServices};
+ }
+ };
+ m_lookupServiceTypeField.setContentProvider(contentProvider);
+ m_lookupServiceTypeField.setLabelProvider(contentProvider.getLabelProvider());
+ }
+ else {
+ m_lookupServiceTypeField.setEnabled(false);
+ }
+ m_lookupServiceTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setLookupServiceTypeInternal((IType) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ group.setLayout(new GridLayout(1, true));
+ radioButtons.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ GridLayout radioButtonGroupLayout = new GridLayout(3, true);
+ radioButtons.setLayout(radioButtonGroupLayout);
+ m_createServiceButton.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_useServiceButton.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_noServiceButton.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+
+ m_serviceSuperTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ GridData lookupServiceData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ lookupServiceData.exclude = true;
+ m_lookupServiceTypeField.setLayoutData(lookupServiceData);
+
+ return group;
+ }
+
+ @Override
+ public LookupCallNewWizard getWizard() {
+ return (LookupCallNewWizard) super.getWizard();
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ multiStatus.add(getStatusLookupService());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_LOOKUP_CALL)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.existsType(getSharedBundle().getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_LOOKUP) + "." + getTypeName())) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getLookupServiceStrategy() == LOOKUP_SERVICE_STRATEGY.CREATE_NEW && getServiceSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusLookupService() throws JavaModelException {
+ if (getLookupServiceStrategy() == LOOKUP_SERVICE_STRATEGY.USE_EXISTING && getLookupServiceType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheLookupCallCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ public IScoutBundle getSharedBundle() {
+ return m_sharedBundle;
+ }
+
+ public IScoutBundle getServerBundle() {
+ return m_serverBundle;
+ }
+
+ public String getTypeName() {
+ return getPropertyString(PROP_TYPE_NAME);
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ setTypeNameInternal(typeName);
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setTypeNameInternal(String typeName) {
+ setPropertyString(PROP_TYPE_NAME, typeName);
+ }
+
+ public LOOKUP_SERVICE_STRATEGY getLookupServiceStrategy() {
+ Object strategy = getProperty(PROP_LOOKUP_SERVICE_STRATEGY);
+ if (!(strategy instanceof LOOKUP_SERVICE_STRATEGY)) {
+ strategy = LOOKUP_SERVICE_STRATEGY.NO_SERVICE;
+ }
+ return (LOOKUP_SERVICE_STRATEGY) strategy;
+ }
+
+ public void setLookupServiceStrategy(LOOKUP_SERVICE_STRATEGY strategy) {
+ try {
+ if (strategy == null) {
+ strategy = LOOKUP_SERVICE_STRATEGY.NO_SERVICE;
+ }
+ setStateChanging(true);
+ setLookupServiceStrategyInternal(strategy);
+ if (isControlCreated()) {
+ switch (strategy) {
+ case CREATE_NEW:
+ m_createServiceButton.setSelection(true);
+ break;
+ case USE_EXISTING:
+ m_useServiceButton.setSelection(true);
+ break;
+ case NO_SERVICE:
+ m_noServiceButton.setSelection(true);
+ break;
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setLookupServiceStrategyInternal(LOOKUP_SERVICE_STRATEGY strategy) {
+ setProperty(PROP_LOOKUP_SERVICE_STRATEGY, strategy);
+ }
+
+ public IType getServiceSuperType() {
+ return (IType) getProperty(PROP_SERVICE_SUPER_TYPE);
+ }
+
+ public void setServiceSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ setServiceSuperTypeInternal(superType);
+ if (isControlCreated()) {
+ m_serviceSuperTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setServiceSuperTypeInternal(IType superType) {
+ setProperty(PROP_SERVICE_SUPER_TYPE, superType);
+ }
+
+ public IType getLookupServiceType() {
+ return (IType) getProperty(PROP_LOOKUP_SERVICE);
+ }
+
+ public void setLookupServiceType(IType lookupService) {
+ try {
+ setStateChanging(true);
+ setLookupServiceTypeInternal(lookupService);
+ if (isControlCreated()) {
+ m_lookupServiceTypeField.acceptProposal(lookupService);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setLookupServiceTypeInternal(IType lookupService) {
+ setProperty(PROP_LOOKUP_SERVICE, lookupService);
+ }
+
+ private class P_LookupServiceStrategyButtonListener extends SelectionAdapter {
+ private final LOOKUP_SERVICE_STRATEGY m_strategy;
+
+ public P_LookupServiceStrategyButtonListener(LOOKUP_SERVICE_STRATEGY strategy) {
+ m_strategy = strategy;
+
+ }
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setLookupServiceStrategyInternal(m_strategy);
+ switch (m_strategy) {
+ case CREATE_NEW:
+ m_serviceSuperTypeField.setVisible(true);
+ ((GridData) m_serviceSuperTypeField.getLayoutData()).exclude = false;
+ m_lookupServiceTypeField.setVisible(false);
+ ((GridData) m_lookupServiceTypeField.getLayoutData()).exclude = true;
+ break;
+ case USE_EXISTING:
+ m_serviceSuperTypeField.setVisible(false);
+ ((GridData) m_serviceSuperTypeField.getLayoutData()).exclude = true;
+ m_lookupServiceTypeField.setVisible(true);
+ ((GridData) m_lookupServiceTypeField.getLayoutData()).exclude = false;
+ break;
+ case NO_SERVICE:
+ m_serviceSuperTypeField.setVisible(false);
+ ((GridData) m_serviceSuperTypeField.getLayoutData()).exclude = true;
+ m_lookupServiceTypeField.setVisible(false);
+ ((GridData) m_lookupServiceTypeField.getLayoutData()).exclude = true;
+ break;
+ }
+ m_lookupServiceTypeField.getParent().layout(true);
+ pingStateChanging();
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/DesktopMenuNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/DesktopMenuNewWizard.java
index c727f76d8..9a6efea75 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/DesktopMenuNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/DesktopMenuNewWizard.java
@@ -1,92 +1,92 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.menu;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.MenuNewOperation;
-import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
-import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
-
-/**
- * <h3>DesktopMenuNewWizard</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 30.06.2010
- */
-public class DesktopMenuNewWizard extends AbstractWorkspaceWizard {
-
- private MenuNewWizardPage m_page1;
- private IType m_declaringType;
- private MenuNewOperation m_operation;
-
- public DesktopMenuNewWizard() {
- setWindowTitle(Texts.get("NewDesktopMenu"));
- }
-
- public void initWizard(IType declaringType) {
- m_declaringType = declaringType;
- m_page1 = new MenuNewWizardPage(getDeclaringType());
- addPage(m_page1);
- }
-
- public void setSuperType(IType superType) {
- m_page1.setSuperType(superType);
- }
-
- /**
- * @return the declaringType
- */
- public IType getDeclaringType() {
- return m_declaringType;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- // create menu
- m_operation = new MenuNewOperation(getDeclaringType(), true);
- // write back members
- m_operation.setNlsEntry(m_page1.getNlsName());
- m_operation.setTypeName(m_page1.getTypeName());
- IType superTypeProp = m_page1.getSuperType();
- if (superTypeProp != null) {
- String signature = Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true);
- m_operation.setSuperTypeSignature(signature);
- }
- if (m_page1.getSibling() == SiblingProposal.SIBLING_END) {
- IStructuredType structuredType = ScoutTypeUtility.createStructuredDesktop(m_declaringType);
- m_operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_MENU));
- }
- else {
- m_operation.setSibling(m_page1.getSibling().getElement());
- }
- m_operation.setFormToOpen(m_page1.getFormToOpen());
- m_operation.run(monitor, workingCopyManager);
- return true;
- }
-
- @Override
- protected void postFinishDisplayThread() {
- IType createdField = m_operation.getCreatedMenu();
- if (TypeUtility.exists(createdField)) {
- ScoutSdkUi.showJavaElementInEditor(createdField, false);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.menu;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.MenuNewOperation;
+import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
+
+/**
+ * <h3>DesktopMenuNewWizard</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 30.06.2010
+ */
+public class DesktopMenuNewWizard extends AbstractWorkspaceWizard {
+
+ private MenuNewWizardPage m_page1;
+ private IType m_declaringType;
+ private MenuNewOperation m_operation;
+
+ public DesktopMenuNewWizard() {
+ setWindowTitle(Texts.get("NewDesktopMenu"));
+ }
+
+ public void initWizard(IType declaringType) {
+ m_declaringType = declaringType;
+ m_page1 = new MenuNewWizardPage(getDeclaringType());
+ addPage(m_page1);
+ }
+
+ public void setSuperType(IType superType) {
+ m_page1.setSuperType(superType);
+ }
+
+ /**
+ * @return the declaringType
+ */
+ public IType getDeclaringType() {
+ return m_declaringType;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ // create menu
+ m_operation = new MenuNewOperation(getDeclaringType(), true);
+ // write back members
+ m_operation.setNlsEntry(m_page1.getNlsName());
+ m_operation.setTypeName(m_page1.getTypeName());
+ IType superTypeProp = m_page1.getSuperType();
+ if (superTypeProp != null) {
+ String signature = Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true);
+ m_operation.setSuperTypeSignature(signature);
+ }
+ if (m_page1.getSibling() == SiblingProposal.SIBLING_END) {
+ IStructuredType structuredType = ScoutTypeUtility.createStructuredDesktop(m_declaringType);
+ m_operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_MENU));
+ }
+ else {
+ m_operation.setSibling(m_page1.getSibling().getElement());
+ }
+ m_operation.setFormToOpen(m_page1.getFormToOpen());
+ m_operation.run(monitor, workingCopyManager);
+ return true;
+ }
+
+ @Override
+ protected void postFinishDisplayThread() {
+ IType createdField = m_operation.getCreatedMenu();
+ if (TypeUtility.exists(createdField)) {
+ ScoutSdkUi.showJavaElementInEditor(createdField, false);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/MenuNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/MenuNewWizard.java
index a5568a044..eaaa1b011 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/MenuNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/MenuNewWizard.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.menu;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-
-public class MenuNewWizard extends AbstractWorkspaceWizard {
-
- private MenuNewWizardPage m_page1;
- private IType m_declaringType;
-
- public MenuNewWizard() {
- setWindowTitle(Texts.get("NewMenu"));
- }
-
- public void initWizard(IType declaringType) {
- m_declaringType = declaringType;
- m_page1 = new MenuNewWizardPage(getDeclaringType());
- addPage(m_page1);
- }
-
- public void setSuperType(IType superType) {
- m_page1.setSuperType(superType);
- }
-
- /**
- * @return the declaringType
- */
- public IType getDeclaringType() {
- return m_declaringType;
- }
-
- @Override
- protected void postFinishDisplayThread() {
- IType createdField = m_page1.getCreatedMenu();
- if (TypeUtility.exists(createdField)) {
- ScoutSdkUi.showJavaElementInEditor(createdField, false);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.menu;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+public class MenuNewWizard extends AbstractWorkspaceWizard {
+
+ private MenuNewWizardPage m_page1;
+ private IType m_declaringType;
+
+ public MenuNewWizard() {
+ setWindowTitle(Texts.get("NewMenu"));
+ }
+
+ public void initWizard(IType declaringType) {
+ m_declaringType = declaringType;
+ m_page1 = new MenuNewWizardPage(getDeclaringType());
+ addPage(m_page1);
+ }
+
+ public void setSuperType(IType superType) {
+ m_page1.setSuperType(superType);
+ }
+
+ /**
+ * @return the declaringType
+ */
+ public IType getDeclaringType() {
+ return m_declaringType;
+ }
+
+ @Override
+ protected void postFinishDisplayThread() {
+ IType createdField = m_page1.getCreatedMenu();
+ if (TypeUtility.exists(createdField)) {
+ ScoutSdkUi.showJavaElementInEditor(createdField, false);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/MenuNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/MenuNewWizardPage.java
index c388f34d1..b80cc4414 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/MenuNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/menu/MenuNewWizardPage.java
@@ -1,418 +1,418 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.menu;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.MenuNewOperation;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.AbstractJavaElementContentProvider;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.SimpleJavaElementContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.ITypeFilter;
-import org.eclipse.scout.sdk.util.type.TypeComparators;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.ITypeHierarchy;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
-import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * <h3>BooleanFieldNewWizardPage</h3> ...
- */
-public class MenuNewWizardPage extends AbstractWorkspaceWizardPage {
-
- static final String PROP_SIBLING = "sibling";
- static final String PROP_FORM_TO_OPEN = "formToOpen";
- static final String PROP_FORM_HANDLER = "formHandler";
-
- protected final IType abstractMenuType = TypeUtility.getType(RuntimeClasses.AbstractMenu);
- protected final IType iMenuType = TypeUtility.getType(RuntimeClasses.IMenu);
- protected final IType iformType = TypeUtility.getType(RuntimeClasses.IForm);
-
- private INlsEntry m_nlsName;
- private String m_typeName;
- private IType m_superType;
-
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
- private ProposalTextField m_siblingField;
- private ProposalTextField m_formToOpenField;
- private ProposalTextField m_formHandlerField;
-
- // process members
- private final IType m_declaringType;
- private IType m_createdMenu;
-
- public MenuNewWizardPage(IType declaringType) {
- super(MenuNewWizardPage.class.getName());
- setTitle(Texts.get("NewMenu"));
- setDescription(Texts.get("CreateANewMenu"));
- m_declaringType = declaringType;
- m_superType = abstractMenuType;
- setSiblingInternal(SiblingProposal.SIBLING_END);
-
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, ScoutTypeUtility.findNlsProject(m_declaringType), Texts.get("Name"));
- m_nlsNameField.acceptProposal(m_nlsName);
- m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- INlsEntry oldEntry = null;
- oldEntry = getNlsName();
- m_nlsName = (INlsEntry) event.proposal;
- if (m_nlsName != null) {
- if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
- m_typeNameField.setText(m_nlsName.getKey());
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_MENU);
- m_typeNameField.setText(m_typeName);
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_typeName = m_typeNameField.getText();
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new JavaElementAbstractTypeContentProvider(iMenuType, getDeclaringType().getJavaProject(), abstractMenuType));
- m_superTypeField.acceptProposal(m_superType);
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_superType = (IType) event.proposal;
- pingStateChanging();
- }
- });
-
- m_siblingField = getFieldToolkit().createSiblingProposalField(parent, getDeclaringType(), iMenuType);
- m_siblingField.acceptProposal(getSibling());
- m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setSiblingInternal((SiblingProposal) event.proposal);
- pingStateChanging();
- }
- });
-
- Control formGroup = createFormGroup(parent);
-
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_siblingField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- formGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- protected Control createFormGroup(Composite parent) {
- Group groupBox = new Group(parent, SWT.SHADOW_ETCHED_IN);
-
- m_formToOpenField = getFieldToolkit().createJavaElementProposalField(groupBox, Texts.get("FormToStart"), new AbstractJavaElementContentProvider() {
- @Override
- protected Object[][] computeProposals() {
- ITypeHierarchy cachedFormHierarchy = TypeUtility.getPrimaryTypeHierarchy(iformType);
- ITypeFilter formsFilter = TypeFilters.getMultiTypeFilter(
- TypeFilters.getTypesOnClasspath(getDeclaringType().getJavaProject()),
- TypeFilters.getClassFilter());
- IType[] formCandidates = cachedFormHierarchy.getAllSubtypes(iformType, formsFilter, TypeComparators.getTypeNameComparator());
- return new Object[][]{formCandidates};
- }
- });
- m_formToOpenField.acceptProposal(getFormToOpen());
- m_formToOpenField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- setFormToOpenInternal((IType) event.proposal);
-
- AbstractJavaElementContentProvider formHandlerProvider = null;
- IType formHandlerSelection = (IType) m_formHandlerField.getSelectedProposal();
- if (getFormToOpen() != null) {
- IType[] formHandlers = ScoutTypeUtility.getFormHandlers(getFormToOpen());
- if (formHandlers != null) {
- formHandlerProvider = new SimpleJavaElementContentProvider(formHandlers);
- }
- // assign null selection if the current selected form is not the declaring type of the form hanlder selection.
- if (formHandlerSelection != null && !getFormToOpen().equals(formHandlerSelection.getDeclaringType())) {
- formHandlerSelection = null;
- }
- m_formHandlerField.setEnabled(true);
- }
- else {
- m_formHandlerField.setEnabled(false);
- }
- // backup
- m_formHandlerField.setContentProvider(formHandlerProvider);
- m_formHandlerField.setLabelProvider(formHandlerProvider == null ? null : formHandlerProvider.getLabelProvider());
- m_formHandlerField.acceptProposal(formHandlerSelection);
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_formHandlerField = getFieldToolkit().createProposalField(groupBox, Texts.get("FormHandler"));
- m_formHandlerField.setEnabled(false);
- m_formHandlerField.acceptProposal(getFormToOpen());
- m_formHandlerField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setFormHandlerInternal((IType) event.proposal);
- pingStateChanging();
- }
- });
-
- //layout
- groupBox.setLayout(new GridLayout(1, true));
-
- m_formToOpenField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_formHandlerField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- return groupBox;
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager manager) throws CoreException {
- // create menu
- MenuNewOperation operation = new MenuNewOperation(getDeclaringType(), true);
- // write back members
- operation.setNlsEntry(getNlsName());
- operation.setTypeName(getTypeName());
- IType superType = getSuperType();
- if (superType != null) {
- String signature = Signature.createTypeSignature(superType.getFullyQualifiedName(), true);
- operation.setSuperTypeSignature(signature);
- }
- if (getSibling() == SiblingProposal.SIBLING_END) {
- IStructuredType structuredType = ScoutTypeUtility.createStructuredType(m_declaringType);
- operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_MENU));
- }
- else {
- operation.setSibling(getSibling().getElement());
- }
- operation.setFormToOpen(getFormToOpen());
- operation.setFormHandler(getHandler());
- operation.run(monitor, manager);
- m_createdMenu = operation.getCreatedMenu();
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_MENU)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.hasInnerType(m_declaringType, getTypeName())) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- public IType getDeclaringType() {
- return m_declaringType;
- }
-
- /**
- * @return the createdMenu
- */
- public IType getCreatedMenu() {
- return m_createdMenu;
- }
-
- public INlsEntry getNlsName() {
- return m_nlsName;
- }
-
- public void setNlsName(INlsEntry nlsName) {
- try {
- setStateChanging(true);
- m_nlsName = nlsName;
- if (isControlCreated()) {
- m_nlsNameField.acceptProposal(nlsName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getTypeName() {
- return m_typeName;
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- m_typeName = typeName;
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public IType getSuperType() {
- return m_superType;
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- m_superType = superType;
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public SiblingProposal getSibling() {
- return (SiblingProposal) getProperty(PROP_SIBLING);
- }
-
- public void setSibling(SiblingProposal sibling) {
- try {
- setStateChanging(true);
- setSiblingInternal(sibling);
- if (isControlCreated()) {
- m_siblingField.acceptProposal(sibling);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setSiblingInternal(SiblingProposal sibling) {
- setProperty(PROP_SIBLING, sibling);
- }
-
- public IType getFormToOpen() {
- return (IType) getProperty(PROP_FORM_TO_OPEN);
- }
-
- public void setFormToOpen(IType formToOpen) {
- try {
- setStateChanging(true);
- setFormToOpenInternal(formToOpen);
- if (isControlCreated()) {
- m_formToOpenField.acceptProposal(formToOpen);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setFormToOpenInternal(IType formToOpen) {
- setProperty(PROP_FORM_TO_OPEN, formToOpen);
- }
-
- public IType getHandler() {
- return (IType) getProperty(PROP_FORM_HANDLER);
- }
-
- public void setFormHandler(IType formHandler) {
- try {
- setStateChanging(true);
- setFormHandlerInternal(formHandler);
- if (isControlCreated()) {
- m_formHandlerField.acceptProposal(formHandler);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setFormHandlerInternal(IType formHandler) {
- setProperty(PROP_FORM_HANDLER, formHandler);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.menu;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.MenuNewOperation;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.AbstractJavaElementContentProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.SimpleJavaElementContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.ITypeFilter;
+import org.eclipse.scout.sdk.util.type.TypeComparators;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.ITypeHierarchy;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+
+/**
+ * <h3>BooleanFieldNewWizardPage</h3> ...
+ */
+public class MenuNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ static final String PROP_SIBLING = "sibling";
+ static final String PROP_FORM_TO_OPEN = "formToOpen";
+ static final String PROP_FORM_HANDLER = "formHandler";
+
+ protected final IType abstractMenuType = TypeUtility.getType(RuntimeClasses.AbstractMenu);
+ protected final IType iMenuType = TypeUtility.getType(RuntimeClasses.IMenu);
+ protected final IType iformType = TypeUtility.getType(RuntimeClasses.IForm);
+
+ private INlsEntry m_nlsName;
+ private String m_typeName;
+ private IType m_superType;
+
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+ private ProposalTextField m_siblingField;
+ private ProposalTextField m_formToOpenField;
+ private ProposalTextField m_formHandlerField;
+
+ // process members
+ private final IType m_declaringType;
+ private IType m_createdMenu;
+
+ public MenuNewWizardPage(IType declaringType) {
+ super(MenuNewWizardPage.class.getName());
+ setTitle(Texts.get("NewMenu"));
+ setDescription(Texts.get("CreateANewMenu"));
+ m_declaringType = declaringType;
+ m_superType = abstractMenuType;
+ setSiblingInternal(SiblingProposal.SIBLING_END);
+
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, ScoutTypeUtility.findNlsProject(m_declaringType), Texts.get("Name"));
+ m_nlsNameField.acceptProposal(m_nlsName);
+ m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ INlsEntry oldEntry = null;
+ oldEntry = getNlsName();
+ m_nlsName = (INlsEntry) event.proposal;
+ if (m_nlsName != null) {
+ if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
+ m_typeNameField.setText(m_nlsName.getKey());
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_MENU);
+ m_typeNameField.setText(m_typeName);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_typeName = m_typeNameField.getText();
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new JavaElementAbstractTypeContentProvider(iMenuType, getDeclaringType().getJavaProject(), abstractMenuType));
+ m_superTypeField.acceptProposal(m_superType);
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_superType = (IType) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ m_siblingField = getFieldToolkit().createSiblingProposalField(parent, getDeclaringType(), iMenuType);
+ m_siblingField.acceptProposal(getSibling());
+ m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setSiblingInternal((SiblingProposal) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ Control formGroup = createFormGroup(parent);
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_siblingField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ formGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ protected Control createFormGroup(Composite parent) {
+ Group groupBox = new Group(parent, SWT.SHADOW_ETCHED_IN);
+
+ m_formToOpenField = getFieldToolkit().createJavaElementProposalField(groupBox, Texts.get("FormToStart"), new AbstractJavaElementContentProvider() {
+ @Override
+ protected Object[][] computeProposals() {
+ ITypeHierarchy cachedFormHierarchy = TypeUtility.getPrimaryTypeHierarchy(iformType);
+ ITypeFilter formsFilter = TypeFilters.getMultiTypeFilter(
+ TypeFilters.getTypesOnClasspath(getDeclaringType().getJavaProject()),
+ TypeFilters.getClassFilter());
+ IType[] formCandidates = cachedFormHierarchy.getAllSubtypes(iformType, formsFilter, TypeComparators.getTypeNameComparator());
+ return new Object[][]{formCandidates};
+ }
+ });
+ m_formToOpenField.acceptProposal(getFormToOpen());
+ m_formToOpenField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ setFormToOpenInternal((IType) event.proposal);
+
+ AbstractJavaElementContentProvider formHandlerProvider = null;
+ IType formHandlerSelection = (IType) m_formHandlerField.getSelectedProposal();
+ if (getFormToOpen() != null) {
+ IType[] formHandlers = ScoutTypeUtility.getFormHandlers(getFormToOpen());
+ if (formHandlers != null) {
+ formHandlerProvider = new SimpleJavaElementContentProvider(formHandlers);
+ }
+ // assign null selection if the current selected form is not the declaring type of the form hanlder selection.
+ if (formHandlerSelection != null && !getFormToOpen().equals(formHandlerSelection.getDeclaringType())) {
+ formHandlerSelection = null;
+ }
+ m_formHandlerField.setEnabled(true);
+ }
+ else {
+ m_formHandlerField.setEnabled(false);
+ }
+ // backup
+ m_formHandlerField.setContentProvider(formHandlerProvider);
+ m_formHandlerField.setLabelProvider(formHandlerProvider == null ? null : formHandlerProvider.getLabelProvider());
+ m_formHandlerField.acceptProposal(formHandlerSelection);
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_formHandlerField = getFieldToolkit().createProposalField(groupBox, Texts.get("FormHandler"));
+ m_formHandlerField.setEnabled(false);
+ m_formHandlerField.acceptProposal(getFormToOpen());
+ m_formHandlerField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setFormHandlerInternal((IType) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ //layout
+ groupBox.setLayout(new GridLayout(1, true));
+
+ m_formToOpenField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_formHandlerField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ return groupBox;
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager manager) throws CoreException {
+ // create menu
+ MenuNewOperation operation = new MenuNewOperation(getDeclaringType(), true);
+ // write back members
+ operation.setNlsEntry(getNlsName());
+ operation.setTypeName(getTypeName());
+ IType superType = getSuperType();
+ if (superType != null) {
+ String signature = Signature.createTypeSignature(superType.getFullyQualifiedName(), true);
+ operation.setSuperTypeSignature(signature);
+ }
+ if (getSibling() == SiblingProposal.SIBLING_END) {
+ IStructuredType structuredType = ScoutTypeUtility.createStructuredType(m_declaringType);
+ operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_MENU));
+ }
+ else {
+ operation.setSibling(getSibling().getElement());
+ }
+ operation.setFormToOpen(getFormToOpen());
+ operation.setFormHandler(getHandler());
+ operation.run(monitor, manager);
+ m_createdMenu = operation.getCreatedMenu();
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_MENU)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.hasInnerType(m_declaringType, getTypeName())) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ public IType getDeclaringType() {
+ return m_declaringType;
+ }
+
+ /**
+ * @return the createdMenu
+ */
+ public IType getCreatedMenu() {
+ return m_createdMenu;
+ }
+
+ public INlsEntry getNlsName() {
+ return m_nlsName;
+ }
+
+ public void setNlsName(INlsEntry nlsName) {
+ try {
+ setStateChanging(true);
+ m_nlsName = nlsName;
+ if (isControlCreated()) {
+ m_nlsNameField.acceptProposal(nlsName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getTypeName() {
+ return m_typeName;
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ m_typeName = typeName;
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getSuperType() {
+ return m_superType;
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ m_superType = superType;
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public SiblingProposal getSibling() {
+ return (SiblingProposal) getProperty(PROP_SIBLING);
+ }
+
+ public void setSibling(SiblingProposal sibling) {
+ try {
+ setStateChanging(true);
+ setSiblingInternal(sibling);
+ if (isControlCreated()) {
+ m_siblingField.acceptProposal(sibling);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setSiblingInternal(SiblingProposal sibling) {
+ setProperty(PROP_SIBLING, sibling);
+ }
+
+ public IType getFormToOpen() {
+ return (IType) getProperty(PROP_FORM_TO_OPEN);
+ }
+
+ public void setFormToOpen(IType formToOpen) {
+ try {
+ setStateChanging(true);
+ setFormToOpenInternal(formToOpen);
+ if (isControlCreated()) {
+ m_formToOpenField.acceptProposal(formToOpen);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setFormToOpenInternal(IType formToOpen) {
+ setProperty(PROP_FORM_TO_OPEN, formToOpen);
+ }
+
+ public IType getHandler() {
+ return (IType) getProperty(PROP_FORM_HANDLER);
+ }
+
+ public void setFormHandler(IType formHandler) {
+ try {
+ setStateChanging(true);
+ setFormHandlerInternal(formHandler);
+ if (isControlCreated()) {
+ m_formHandlerField.acceptProposal(formHandler);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setFormHandlerInternal(IType formHandler) {
+ setProperty(PROP_FORM_HANDLER, formHandler);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/outline/OutlineNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/outline/OutlineNewWizard.java
index 4b2281c8d..19aa417af 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/outline/OutlineNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/outline/OutlineNewWizard.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.outline;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.outline.OutlineNewOperation;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-
-public class OutlineNewWizard extends AbstractWorkspaceWizard {
-
- private OutlineNewWizardPage m_page1;
-
- public OutlineNewWizard(IScoutBundle clientBundle) {
- this(clientBundle, null);
- }
-
- public OutlineNewWizard(IScoutBundle clientBunldle, IType desktopType) {
- setWindowTitle(Texts.get("NewOutline"));
- OutlineNewOperation op = new OutlineNewOperation();
- op.setDesktopType(desktopType);
- m_page1 = new OutlineNewWizardPage(clientBunldle);
- m_page1.setAddToDesktopEnabled(desktopType != null);
- m_page1.setAddToDesktop(desktopType != null);
- m_page1.setOperation(op);
- addPage(m_page1);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.outline;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.outline.OutlineNewOperation;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+
+public class OutlineNewWizard extends AbstractWorkspaceWizard {
+
+ private OutlineNewWizardPage m_page1;
+
+ public OutlineNewWizard(IScoutBundle clientBundle) {
+ this(clientBundle, null);
+ }
+
+ public OutlineNewWizard(IScoutBundle clientBunldle, IType desktopType) {
+ setWindowTitle(Texts.get("NewOutline"));
+ OutlineNewOperation op = new OutlineNewOperation();
+ op.setDesktopType(desktopType);
+ m_page1 = new OutlineNewWizardPage(clientBunldle);
+ m_page1.setAddToDesktopEnabled(desktopType != null);
+ m_page1.setAddToDesktop(desktopType != null);
+ m_page1.setOperation(op);
+ addPage(m_page1);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/outline/OutlineNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/outline/OutlineNewWizardPage.java
index c5a565277..80288fc19 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/outline/OutlineNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/outline/OutlineNewWizardPage.java
@@ -1,305 +1,305 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.outline;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.outline.OutlineNewOperation;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>OutlineNewWizardPage</h3> ...
- */
-public class OutlineNewWizardPage extends AbstractWorkspaceWizardPage {
- final IType iOutline = TypeUtility.getType(RuntimeClasses.IOutline);
- final IType abstractOutline = TypeUtility.getType(RuntimeClasses.AbstractOutline);
-
- private INlsEntry m_nlsName;
- private String m_typeName;
- private IType m_superType;
- private boolean m_addToDesktop;
- private boolean m_addToDesktopEnabled;
-
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
- private Button m_addToDesktopField;
-
- // process members
- private OutlineNewOperation m_operation;
- private final IScoutBundle m_clientBundle;
-
- public OutlineNewWizardPage(IScoutBundle clientBundle) {
- super(OutlineNewWizardPage.class.getName());
- m_clientBundle = clientBundle;
- setTitle(Texts.get("New Outline"));
- setDescription(Texts.get("CreateANewOutline"));
- // default values
- m_superType = abstractOutline;
- setAddToDesktopEnabled(false);
- setOperation(new OutlineNewOperation());
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, getClientBundle().findBestMatchNlsProject(), Texts.get("Name"));
- m_nlsNameField.acceptProposal(m_nlsName);
- m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- INlsEntry oldEntry = getNlsName();
- m_nlsName = (INlsEntry) event.proposal;
- if (m_nlsName != null) {
- if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
- m_typeNameField.setText(m_nlsName.getKey());
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_OUTLINE);
- m_typeNameField.setText(m_typeName);
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_typeName = m_typeNameField.getText();
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new JavaElementAbstractTypeContentProvider(iOutline, getClientBundle().getJavaProject(), abstractOutline));
- m_superTypeField.acceptProposal(m_superType);
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_superType = (IType) event.proposal;
- pingStateChanging();
- }
- });
-
- m_addToDesktopField = new Button(parent, SWT.CHECK);
- m_addToDesktopField.setSelection(isAddToDesktop());
- m_addToDesktopField.setText("Add to Desktop");
- m_addToDesktopField.setEnabled(isAddToDesktopEnabled());
- m_addToDesktopField.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- m_addToDesktop = m_addToDesktopField.getSelection();
- pingStateChanging();
- }
- });
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_addToDesktopField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
-
- getOperation().setClientBundle(getClientBundle());
- getOperation().setFormatSource(true);
-
- // write back members
- if (getNlsName() != null) {
- getOperation().setNlsEntry(getNlsName());
- }
- getOperation().setTypeName(getTypeName());
- IType superTypeProp = getSuperType();
- if (superTypeProp != null) {
- getOperation().setSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
- }
- getOperation().setAddToDesktop(isAddToDesktop());
-
- getOperation().run(monitor, workingCopyManager);
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- public IScoutBundle getClientBundle() {
- return m_clientBundle;
- }
-
- public void setOperation(OutlineNewOperation operation) {
- m_operation = operation;
- }
-
- public OutlineNewOperation getOperation() {
- return m_operation;
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_OUTLINE)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.existsType(getClientBundle().getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_UI_SEARCHFORMS) + "." + getTypeName())) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- public INlsEntry getNlsName() {
- return m_nlsName;
- }
-
- public void setNlsName(INlsEntry nlsName) {
- try {
- setStateChanging(true);
- m_nlsName = nlsName;
- if (isControlCreated()) {
- m_nlsNameField.acceptProposal(nlsName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getTypeName() {
- return m_typeName;
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- m_typeName = typeName;
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public IType getSuperType() {
- return m_superType;
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- m_superType = superType;
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public void setAddToDesktop(boolean addToDesktop) {
- try {
- setStateChanging(true);
- m_addToDesktop = addToDesktop;
- if (isControlCreated()) {
- m_addToDesktopField.setSelection(addToDesktop);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public boolean isAddToDesktop() {
- return m_addToDesktop;
- }
-
- public void setAddToDesktopEnabled(boolean addToDesktopEnabled) {
- try {
- setStateChanging(true);
- m_addToDesktopEnabled = addToDesktopEnabled;
- if (isControlCreated()) {
- if (!addToDesktopEnabled) {
- setAddToDesktop(false);
- }
- m_addToDesktopField.setEnabled(addToDesktopEnabled);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public boolean isAddToDesktopEnabled() {
- return m_addToDesktopEnabled;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.outline;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.outline.OutlineNewOperation;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>OutlineNewWizardPage</h3> ...
+ */
+public class OutlineNewWizardPage extends AbstractWorkspaceWizardPage {
+ final IType iOutline = TypeUtility.getType(RuntimeClasses.IOutline);
+ final IType abstractOutline = TypeUtility.getType(RuntimeClasses.AbstractOutline);
+
+ private INlsEntry m_nlsName;
+ private String m_typeName;
+ private IType m_superType;
+ private boolean m_addToDesktop;
+ private boolean m_addToDesktopEnabled;
+
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+ private Button m_addToDesktopField;
+
+ // process members
+ private OutlineNewOperation m_operation;
+ private final IScoutBundle m_clientBundle;
+
+ public OutlineNewWizardPage(IScoutBundle clientBundle) {
+ super(OutlineNewWizardPage.class.getName());
+ m_clientBundle = clientBundle;
+ setTitle(Texts.get("New Outline"));
+ setDescription(Texts.get("CreateANewOutline"));
+ // default values
+ m_superType = abstractOutline;
+ setAddToDesktopEnabled(false);
+ setOperation(new OutlineNewOperation());
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, getClientBundle().findBestMatchNlsProject(), Texts.get("Name"));
+ m_nlsNameField.acceptProposal(m_nlsName);
+ m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ INlsEntry oldEntry = getNlsName();
+ m_nlsName = (INlsEntry) event.proposal;
+ if (m_nlsName != null) {
+ if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
+ m_typeNameField.setText(m_nlsName.getKey());
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_OUTLINE);
+ m_typeNameField.setText(m_typeName);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_typeName = m_typeNameField.getText();
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new JavaElementAbstractTypeContentProvider(iOutline, getClientBundle().getJavaProject(), abstractOutline));
+ m_superTypeField.acceptProposal(m_superType);
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_superType = (IType) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ m_addToDesktopField = new Button(parent, SWT.CHECK);
+ m_addToDesktopField.setSelection(isAddToDesktop());
+ m_addToDesktopField.setText("Add to Desktop");
+ m_addToDesktopField.setEnabled(isAddToDesktopEnabled());
+ m_addToDesktopField.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ m_addToDesktop = m_addToDesktopField.getSelection();
+ pingStateChanging();
+ }
+ });
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_addToDesktopField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+
+ getOperation().setClientBundle(getClientBundle());
+ getOperation().setFormatSource(true);
+
+ // write back members
+ if (getNlsName() != null) {
+ getOperation().setNlsEntry(getNlsName());
+ }
+ getOperation().setTypeName(getTypeName());
+ IType superTypeProp = getSuperType();
+ if (superTypeProp != null) {
+ getOperation().setSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
+ }
+ getOperation().setAddToDesktop(isAddToDesktop());
+
+ getOperation().run(monitor, workingCopyManager);
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ public IScoutBundle getClientBundle() {
+ return m_clientBundle;
+ }
+
+ public void setOperation(OutlineNewOperation operation) {
+ m_operation = operation;
+ }
+
+ public OutlineNewOperation getOperation() {
+ return m_operation;
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_OUTLINE)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.existsType(getClientBundle().getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_UI_SEARCHFORMS) + "." + getTypeName())) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ public INlsEntry getNlsName() {
+ return m_nlsName;
+ }
+
+ public void setNlsName(INlsEntry nlsName) {
+ try {
+ setStateChanging(true);
+ m_nlsName = nlsName;
+ if (isControlCreated()) {
+ m_nlsNameField.acceptProposal(nlsName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getTypeName() {
+ return m_typeName;
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ m_typeName = typeName;
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getSuperType() {
+ return m_superType;
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ m_superType = superType;
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public void setAddToDesktop(boolean addToDesktop) {
+ try {
+ setStateChanging(true);
+ m_addToDesktop = addToDesktop;
+ if (isControlCreated()) {
+ m_addToDesktopField.setSelection(addToDesktop);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public boolean isAddToDesktop() {
+ return m_addToDesktop;
+ }
+
+ public void setAddToDesktopEnabled(boolean addToDesktopEnabled) {
+ try {
+ setStateChanging(true);
+ m_addToDesktopEnabled = addToDesktopEnabled;
+ if (isControlCreated()) {
+ if (!addToDesktopEnabled) {
+ setAddToDesktop(false);
+ }
+ m_addToDesktopField.setEnabled(addToDesktopEnabled);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public boolean isAddToDesktopEnabled() {
+ return m_addToDesktopEnabled;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageLinkWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageLinkWizard.java
index d84a91ce6..e5915dcbd 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageLinkWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageLinkWizard.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.page;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-
-public class PageLinkWizard extends AbstractWorkspaceWizard {
-
- private PageLinkWizardPage m_linkPageWizardPage;
-
- public PageLinkWizard(IScoutBundle clientBunlde) {
- setWindowTitle(Texts.get("LinkPage"));
- setLinkPageWizardPage(new PageLinkWizardPage(clientBunlde));
- addPage(getLinkPageWizardPage());
- }
-
- public void setLinkPageWizardPage(PageLinkWizardPage linkPageWizardPage) {
- m_linkPageWizardPage = linkPageWizardPage;
- }
-
- public PageLinkWizardPage getLinkPageWizardPage() {
- return m_linkPageWizardPage;
- }
-
- public void setHolderType(IType type) {
- getLinkPageWizardPage().setHolderType(type);
- }
-
- public void setHolderEnabled(boolean enabled) {
- getLinkPageWizardPage().setHolderTypeEnabled(enabled);
- }
-
- public void setPageType(IType type) {
- getLinkPageWizardPage().setPageType(type);
- }
-
- public void setPageEnabled(boolean enabled) {
- getLinkPageWizardPage().setPageTypeFieldEnabled(enabled);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.page;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+
+public class PageLinkWizard extends AbstractWorkspaceWizard {
+
+ private PageLinkWizardPage m_linkPageWizardPage;
+
+ public PageLinkWizard(IScoutBundle clientBunlde) {
+ setWindowTitle(Texts.get("LinkPage"));
+ setLinkPageWizardPage(new PageLinkWizardPage(clientBunlde));
+ addPage(getLinkPageWizardPage());
+ }
+
+ public void setLinkPageWizardPage(PageLinkWizardPage linkPageWizardPage) {
+ m_linkPageWizardPage = linkPageWizardPage;
+ }
+
+ public PageLinkWizardPage getLinkPageWizardPage() {
+ return m_linkPageWizardPage;
+ }
+
+ public void setHolderType(IType type) {
+ getLinkPageWizardPage().setHolderType(type);
+ }
+
+ public void setHolderEnabled(boolean enabled) {
+ getLinkPageWizardPage().setHolderTypeEnabled(enabled);
+ }
+
+ public void setPageType(IType type) {
+ getLinkPageWizardPage().setPageType(type);
+ }
+
+ public void setPageEnabled(boolean enabled) {
+ getLinkPageWizardPage().setPageTypeFieldEnabled(enabled);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageLinkWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageLinkWizardPage.java
index e9efd0148..1433f45f3 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageLinkWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageLinkWizardPage.java
@@ -1,203 +1,203 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.page;
-
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.page.LinkPageOperation;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.AbstractJavaElementContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.type.TypeComparators;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>PageNewWizardPage2</h3> ...
- */
-public class PageLinkWizardPage extends AbstractWorkspaceWizardPage {
-
- private IType iPage = TypeUtility.getType(RuntimeClasses.IPage);
- private IType iOutline = TypeUtility.getType(RuntimeClasses.IOutline);
-
- private IType m_holderType;
- private IType m_pageType;
-
- private ProposalTextField m_holderTypeField;
- private ProposalTextField m_pageTypeField;
-
- // process members
- private LinkPageOperation m_operation;
-
- private boolean m_holderTypeEnabled = true;
- private boolean m_pageTypeFieldEnabled = true;
-
- private IScoutBundle m_clientBundle;
-
- public PageLinkWizardPage(IScoutBundle clientBundle) {
- super(PageLinkWizardPage.class.getName());
- m_clientBundle = clientBundle;
- setTitle(Texts.get("LinkPage"));
- setDescription(Texts.get("LinkPageToAPageHolder"));
- setOperation(new LinkPageOperation());
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_pageTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("Page"), new AbstractJavaElementContentProvider() {
- @Override
- protected Object[][] computeProposals() {
- IType[] pages = ScoutTypeUtility.getClassesOnClasspath(iPage, getClientBundle().getJavaProject());
- return new Object[][]{pages};
- }
- });
- m_pageTypeField.acceptProposal(getPageType());
- m_pageTypeField.setEnabled(isPageTypeFieldEnabled());
- m_pageTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setPageType((IType) event.proposal);
- pingStateChanging();
- }
- });
-
- m_holderTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("HolderPageOutline"), new AbstractJavaElementContentProvider() {
- @Override
- protected Object[][] computeProposals() {
- IType[] pages = ScoutTypeUtility.getClassesOnClasspath(iPage, getClientBundle().getJavaProject());
- IType[] outlines = ScoutTypeUtility.getClassesOnClasspath(iOutline, getClientBundle().getJavaProject());
- IType[] propTypes = new IType[pages.length + outlines.length];
- System.arraycopy(pages, 0, propTypes, 0, pages.length);
- System.arraycopy(outlines, 0, propTypes, pages.length, outlines.length);
- Arrays.sort(propTypes, TypeComparators.getTypeNameComparator());
- return new Object[][]{propTypes};
- }
- });
- m_holderTypeField.acceptProposal(getHolderType());
- m_holderTypeField.setEnabled(isHolderTypeEnabled());
- m_holderTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_holderType = (IType) event.proposal;
- pingStateChanging();
- }
- });
-
- // layout
- parent.setLayout(new GridLayout(1, true));
- m_pageTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_holderTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- // write back members
- getOperation().setHolderType(getHolderType());
- getOperation().setPage(getPageType());
- getOperation().run(monitor, workingCopyManager);
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- if (getHolderType() == null) {
- multiStatus.add(new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("HolderTypeIsMissing")));
- }
- else if (getPageType() == null) {
- multiStatus.add(new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("PageTypeIsMissing")));
- }
- else {
- multiStatus.add(Status.OK_STATUS);
- }
- }
-
- public void setOperation(LinkPageOperation operation) {
- m_operation = operation;
- }
-
- public LinkPageOperation getOperation() {
- return m_operation;
- }
-
- public IScoutBundle getClientBundle() {
- return m_clientBundle;
- }
-
- public void setHolderType(IType holderPage) {
- try {
- setStateChanging(true);
- m_holderType = holderPage;
- if (isControlCreated()) {
- m_holderTypeField.acceptProposal(holderPage);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public IType getHolderType() {
- return m_holderType;
- }
-
- public void setHolderTypeEnabled(boolean hoderTypeEnabled) {
- if (isControlCreated()) {
- throw new IllegalStateException("control already created.");
- }
- m_holderTypeEnabled = hoderTypeEnabled;
- }
-
- public boolean isHolderTypeEnabled() {
- return m_holderTypeEnabled;
- }
-
- public void setPageType(IType pageType) {
- try {
- setStateChanging(true);
- m_pageType = pageType;
- if (isControlCreated()) {
- m_pageTypeField.acceptProposal(pageType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public IType getPageType() {
- return m_pageType;
- }
-
- public void setPageTypeFieldEnabled(boolean pageTypeFieldEnabled) {
- m_pageTypeFieldEnabled = pageTypeFieldEnabled;
- }
-
- public boolean isPageTypeFieldEnabled() {
- return m_pageTypeFieldEnabled;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.page;
+
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.page.LinkPageOperation;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.AbstractJavaElementContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.type.TypeComparators;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>PageNewWizardPage2</h3> ...
+ */
+public class PageLinkWizardPage extends AbstractWorkspaceWizardPage {
+
+ private IType iPage = TypeUtility.getType(RuntimeClasses.IPage);
+ private IType iOutline = TypeUtility.getType(RuntimeClasses.IOutline);
+
+ private IType m_holderType;
+ private IType m_pageType;
+
+ private ProposalTextField m_holderTypeField;
+ private ProposalTextField m_pageTypeField;
+
+ // process members
+ private LinkPageOperation m_operation;
+
+ private boolean m_holderTypeEnabled = true;
+ private boolean m_pageTypeFieldEnabled = true;
+
+ private IScoutBundle m_clientBundle;
+
+ public PageLinkWizardPage(IScoutBundle clientBundle) {
+ super(PageLinkWizardPage.class.getName());
+ m_clientBundle = clientBundle;
+ setTitle(Texts.get("LinkPage"));
+ setDescription(Texts.get("LinkPageToAPageHolder"));
+ setOperation(new LinkPageOperation());
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_pageTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("Page"), new AbstractJavaElementContentProvider() {
+ @Override
+ protected Object[][] computeProposals() {
+ IType[] pages = ScoutTypeUtility.getClassesOnClasspath(iPage, getClientBundle().getJavaProject());
+ return new Object[][]{pages};
+ }
+ });
+ m_pageTypeField.acceptProposal(getPageType());
+ m_pageTypeField.setEnabled(isPageTypeFieldEnabled());
+ m_pageTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setPageType((IType) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ m_holderTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("HolderPageOutline"), new AbstractJavaElementContentProvider() {
+ @Override
+ protected Object[][] computeProposals() {
+ IType[] pages = ScoutTypeUtility.getClassesOnClasspath(iPage, getClientBundle().getJavaProject());
+ IType[] outlines = ScoutTypeUtility.getClassesOnClasspath(iOutline, getClientBundle().getJavaProject());
+ IType[] propTypes = new IType[pages.length + outlines.length];
+ System.arraycopy(pages, 0, propTypes, 0, pages.length);
+ System.arraycopy(outlines, 0, propTypes, pages.length, outlines.length);
+ Arrays.sort(propTypes, TypeComparators.getTypeNameComparator());
+ return new Object[][]{propTypes};
+ }
+ });
+ m_holderTypeField.acceptProposal(getHolderType());
+ m_holderTypeField.setEnabled(isHolderTypeEnabled());
+ m_holderTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_holderType = (IType) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+ m_pageTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_holderTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ // write back members
+ getOperation().setHolderType(getHolderType());
+ getOperation().setPage(getPageType());
+ getOperation().run(monitor, workingCopyManager);
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ if (getHolderType() == null) {
+ multiStatus.add(new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("HolderTypeIsMissing")));
+ }
+ else if (getPageType() == null) {
+ multiStatus.add(new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("PageTypeIsMissing")));
+ }
+ else {
+ multiStatus.add(Status.OK_STATUS);
+ }
+ }
+
+ public void setOperation(LinkPageOperation operation) {
+ m_operation = operation;
+ }
+
+ public LinkPageOperation getOperation() {
+ return m_operation;
+ }
+
+ public IScoutBundle getClientBundle() {
+ return m_clientBundle;
+ }
+
+ public void setHolderType(IType holderPage) {
+ try {
+ setStateChanging(true);
+ m_holderType = holderPage;
+ if (isControlCreated()) {
+ m_holderTypeField.acceptProposal(holderPage);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getHolderType() {
+ return m_holderType;
+ }
+
+ public void setHolderTypeEnabled(boolean hoderTypeEnabled) {
+ if (isControlCreated()) {
+ throw new IllegalStateException("control already created.");
+ }
+ m_holderTypeEnabled = hoderTypeEnabled;
+ }
+
+ public boolean isHolderTypeEnabled() {
+ return m_holderTypeEnabled;
+ }
+
+ public void setPageType(IType pageType) {
+ try {
+ setStateChanging(true);
+ m_pageType = pageType;
+ if (isControlCreated()) {
+ m_pageTypeField.acceptProposal(pageType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getPageType() {
+ return m_pageType;
+ }
+
+ public void setPageTypeFieldEnabled(boolean pageTypeFieldEnabled) {
+ m_pageTypeFieldEnabled = pageTypeFieldEnabled;
+ }
+
+ public boolean isPageTypeFieldEnabled() {
+ return m_pageTypeFieldEnabled;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewAttributesWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewAttributesWizardPage.java
index f60c1a96f..a2384ae41 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewAttributesWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewAttributesWizardPage.java
@@ -1,332 +1,332 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.page;
-
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.page.PageNewOperation;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.AbstractJavaElementContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.ITypeFilter;
-import org.eclipse.scout.sdk.util.type.TypeComparators;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.type.ScoutTypeFilters;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * <h3>PageNewWizardPage2</h3> ...
- */
-public class PageNewAttributesWizardPage extends AbstractWorkspaceWizardPage {
-
- private IType iPage = TypeUtility.getType(RuntimeClasses.IPage);
- private IType iPageWithNodes = TypeUtility.getType(RuntimeClasses.IPageWithNodes);
- private IType iPageWithTable = TypeUtility.getType(RuntimeClasses.IPageWithTable);
- private IType iOutline = TypeUtility.getType(RuntimeClasses.IOutline);
-
- private INlsEntry m_nlsName;
- private String m_typeName;
- private IType m_superType;
- private IType m_holderType;
- private String m_nameSuffix;
-
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_holderTypeField;
-
- // process members
- private PageNewOperation m_operation;
-
- private boolean m_hoderTypeEnabled = true;
-
- private final IScoutBundle m_clientBundle;
-
- public PageNewAttributesWizardPage(IScoutBundle clientBundle) {
- super(PageNewAttributesWizardPage.class.getName());
- m_clientBundle = clientBundle;
- setTitle(Texts.get("NewPage"));
- setDescription(Texts.get("CreateANewPage"));
- m_nameSuffix = "";
- setSuperType(TypeUtility.getType(RuntimeClasses.AbstractPageWithNodes));
- setOperation(new PageNewOperation(true));
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, getClientBundle().findBestMatchNlsProject(), Texts.get("Name"));
- m_nlsNameField.acceptProposal(m_nlsName);
- m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- INlsEntry oldEntry = getNlsName();
- m_nlsName = (INlsEntry) event.proposal;
- if (m_nlsName != null) {
- if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
- m_typeNameField.setText(m_nlsName.getKey());
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(m_nameSuffix);
- m_typeNameField.setText(m_typeName);
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_typeName = m_typeNameField.getText();
- pingStateChanging();
- }
- });
-
- Control parentPageControl = createParentPageGroup(parent);
- // layout
- parent.setLayout(new GridLayout(1, true));
- m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- parentPageControl.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- protected Control createParentPageGroup(Composite parent) {
- Group group = new Group(parent, SWT.SHADOW_ETCHED_OUT);
- group.setText(Texts.get("AddTo"));
-
- m_holderTypeField = getFieldToolkit().createJavaElementProposalField(group, Texts.get("PageOutline"), new AbstractJavaElementContentProvider() {
- @Override
- protected Object[][] computeProposals() {
- ITypeFilter filter = TypeFilters.getMultiTypeFilter(
- ScoutTypeFilters.getInScoutBundles(getClientBundle()),
- TypeFilters.getClassFilter());
-
- IType[] pages = TypeUtility.getPrimaryTypeHierarchy(iPage).getAllSubtypes(iPageWithNodes, filter);
- IType[] outlines = TypeUtility.getPrimaryTypeHierarchy(iOutline).getAllSubtypes(iOutline, filter);
- IType[] propTypes = new IType[pages.length + outlines.length];
- System.arraycopy(pages, 0, propTypes, 0, pages.length);
- System.arraycopy(outlines, 0, propTypes, pages.length, outlines.length);
- Arrays.sort(propTypes, TypeComparators.getTypeNameComparator());
- return new Object[][]{propTypes};
- }
- });
- m_holderTypeField.acceptProposal(getHolderType());
- m_holderTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_holderType = (IType) event.proposal;
- pingStateChanging();
- }
- });
-
- // layout
- group.setLayout(new GridLayout(1, true));
- m_holderTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- return group;
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- // write back members
- getOperation().setClientBundle(getClientBundle());
- getOperation().setNlsEntry(getNlsName());
- getOperation().setTypeName(getTypeName());
- IType superType = getSuperType();
- if (superType != null) {
- getOperation().setSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
- }
- getOperation().setHolderType(getHolderType());
-
- getOperation().run(monitor, workingCopyManager);
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusClientBundle());
- if (!multiStatus.matches(IStatus.ERROR)) {
- multiStatus.add(getStatusNameField());
- }
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusClientBundle() throws JavaModelException {
- if (getClientBundle() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("ClientBundleMissing"));
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(m_nameSuffix)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.existsType(getClientBundle().getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_UI_DESKTOP_OUTLINES_PAGES) + "." + getTypeName())) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- public void setOperation(PageNewOperation operation) {
- m_operation = operation;
- }
-
- public PageNewOperation getOperation() {
- return m_operation;
- }
-
- public IScoutBundle getClientBundle() {
- return m_clientBundle;
- }
-
- public INlsEntry getNlsName() {
- return m_nlsName;
- }
-
- public void setNlsName(INlsEntry nlsName) {
- try {
- setStateChanging(true);
- m_nlsName = nlsName;
- if (isControlCreated()) {
- m_nlsNameField.acceptProposal(nlsName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getTypeName() {
- return m_typeName;
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- m_typeName = typeName;
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public IType getSuperType() {
- return m_superType;
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- m_superType = superType;
- if (TypeUtility.exists(superType)) {
- try {
- ITypeHierarchy superTypeHierarchy = superType.newSupertypeHierarchy(null);
- if (superTypeHierarchy.contains(iPageWithNodes)) {
- m_nameSuffix = SdkProperties.SUFFIX_OUTLINE_NODE_PAGE;
- }
- else if (superTypeHierarchy.contains(iPageWithTable)) {
- m_nameSuffix = SdkProperties.SUFFIX_OUTLINE_TABLE_PAGE;
- }
- else {
- m_nameSuffix = SdkProperties.SUFFIX_OUTLINE_PAGE;
- }
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not create superTypeHierarchy of '" + getSuperType().getFullyQualifiedName() + "'.");
- }
- }
- if (isControlCreated()) {
- m_typeNameField.setReadOnlySuffix(m_nameSuffix);
- }
-
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public void setHolderType(IType holderPage) {
- try {
- setStateChanging(true);
- m_holderType = holderPage;
- if (isControlCreated()) {
- m_holderTypeField.acceptProposal(holderPage);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public IType getHolderType() {
- return m_holderType;
- }
-
- public void setHoderTypeEnabled(boolean hoderTypeEnabled) {
- if (isControlCreated()) {
- throw new IllegalStateException("control already created.");
- }
- m_hoderTypeEnabled = hoderTypeEnabled;
- }
-
- public boolean isHoderTypeEnabled() {
- return m_hoderTypeEnabled;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.page;
+
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.page.PageNewOperation;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.AbstractJavaElementContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.ITypeFilter;
+import org.eclipse.scout.sdk.util.type.TypeComparators;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeFilters;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+
+/**
+ * <h3>PageNewWizardPage2</h3> ...
+ */
+public class PageNewAttributesWizardPage extends AbstractWorkspaceWizardPage {
+
+ private IType iPage = TypeUtility.getType(RuntimeClasses.IPage);
+ private IType iPageWithNodes = TypeUtility.getType(RuntimeClasses.IPageWithNodes);
+ private IType iPageWithTable = TypeUtility.getType(RuntimeClasses.IPageWithTable);
+ private IType iOutline = TypeUtility.getType(RuntimeClasses.IOutline);
+
+ private INlsEntry m_nlsName;
+ private String m_typeName;
+ private IType m_superType;
+ private IType m_holderType;
+ private String m_nameSuffix;
+
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_holderTypeField;
+
+ // process members
+ private PageNewOperation m_operation;
+
+ private boolean m_hoderTypeEnabled = true;
+
+ private final IScoutBundle m_clientBundle;
+
+ public PageNewAttributesWizardPage(IScoutBundle clientBundle) {
+ super(PageNewAttributesWizardPage.class.getName());
+ m_clientBundle = clientBundle;
+ setTitle(Texts.get("NewPage"));
+ setDescription(Texts.get("CreateANewPage"));
+ m_nameSuffix = "";
+ setSuperType(TypeUtility.getType(RuntimeClasses.AbstractPageWithNodes));
+ setOperation(new PageNewOperation(true));
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, getClientBundle().findBestMatchNlsProject(), Texts.get("Name"));
+ m_nlsNameField.acceptProposal(m_nlsName);
+ m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ INlsEntry oldEntry = getNlsName();
+ m_nlsName = (INlsEntry) event.proposal;
+ if (m_nlsName != null) {
+ if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
+ m_typeNameField.setText(m_nlsName.getKey());
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(m_nameSuffix);
+ m_typeNameField.setText(m_typeName);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_typeName = m_typeNameField.getText();
+ pingStateChanging();
+ }
+ });
+
+ Control parentPageControl = createParentPageGroup(parent);
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+ m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ parentPageControl.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ protected Control createParentPageGroup(Composite parent) {
+ Group group = new Group(parent, SWT.SHADOW_ETCHED_OUT);
+ group.setText(Texts.get("AddTo"));
+
+ m_holderTypeField = getFieldToolkit().createJavaElementProposalField(group, Texts.get("PageOutline"), new AbstractJavaElementContentProvider() {
+ @Override
+ protected Object[][] computeProposals() {
+ ITypeFilter filter = TypeFilters.getMultiTypeFilter(
+ ScoutTypeFilters.getInScoutBundles(getClientBundle()),
+ TypeFilters.getClassFilter());
+
+ IType[] pages = TypeUtility.getPrimaryTypeHierarchy(iPage).getAllSubtypes(iPageWithNodes, filter);
+ IType[] outlines = TypeUtility.getPrimaryTypeHierarchy(iOutline).getAllSubtypes(iOutline, filter);
+ IType[] propTypes = new IType[pages.length + outlines.length];
+ System.arraycopy(pages, 0, propTypes, 0, pages.length);
+ System.arraycopy(outlines, 0, propTypes, pages.length, outlines.length);
+ Arrays.sort(propTypes, TypeComparators.getTypeNameComparator());
+ return new Object[][]{propTypes};
+ }
+ });
+ m_holderTypeField.acceptProposal(getHolderType());
+ m_holderTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_holderType = (IType) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ group.setLayout(new GridLayout(1, true));
+ m_holderTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ return group;
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ // write back members
+ getOperation().setClientBundle(getClientBundle());
+ getOperation().setNlsEntry(getNlsName());
+ getOperation().setTypeName(getTypeName());
+ IType superType = getSuperType();
+ if (superType != null) {
+ getOperation().setSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
+ }
+ getOperation().setHolderType(getHolderType());
+
+ getOperation().run(monitor, workingCopyManager);
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusClientBundle());
+ if (!multiStatus.matches(IStatus.ERROR)) {
+ multiStatus.add(getStatusNameField());
+ }
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusClientBundle() throws JavaModelException {
+ if (getClientBundle() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("ClientBundleMissing"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(m_nameSuffix)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.existsType(getClientBundle().getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_UI_DESKTOP_OUTLINES_PAGES) + "." + getTypeName())) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ public void setOperation(PageNewOperation operation) {
+ m_operation = operation;
+ }
+
+ public PageNewOperation getOperation() {
+ return m_operation;
+ }
+
+ public IScoutBundle getClientBundle() {
+ return m_clientBundle;
+ }
+
+ public INlsEntry getNlsName() {
+ return m_nlsName;
+ }
+
+ public void setNlsName(INlsEntry nlsName) {
+ try {
+ setStateChanging(true);
+ m_nlsName = nlsName;
+ if (isControlCreated()) {
+ m_nlsNameField.acceptProposal(nlsName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getTypeName() {
+ return m_typeName;
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ m_typeName = typeName;
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getSuperType() {
+ return m_superType;
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ m_superType = superType;
+ if (TypeUtility.exists(superType)) {
+ try {
+ ITypeHierarchy superTypeHierarchy = superType.newSupertypeHierarchy(null);
+ if (superTypeHierarchy.contains(iPageWithNodes)) {
+ m_nameSuffix = SdkProperties.SUFFIX_OUTLINE_NODE_PAGE;
+ }
+ else if (superTypeHierarchy.contains(iPageWithTable)) {
+ m_nameSuffix = SdkProperties.SUFFIX_OUTLINE_TABLE_PAGE;
+ }
+ else {
+ m_nameSuffix = SdkProperties.SUFFIX_OUTLINE_PAGE;
+ }
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not create superTypeHierarchy of '" + getSuperType().getFullyQualifiedName() + "'.");
+ }
+ }
+ if (isControlCreated()) {
+ m_typeNameField.setReadOnlySuffix(m_nameSuffix);
+ }
+
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public void setHolderType(IType holderPage) {
+ try {
+ setStateChanging(true);
+ m_holderType = holderPage;
+ if (isControlCreated()) {
+ m_holderTypeField.acceptProposal(holderPage);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getHolderType() {
+ return m_holderType;
+ }
+
+ public void setHoderTypeEnabled(boolean hoderTypeEnabled) {
+ if (isControlCreated()) {
+ throw new IllegalStateException("control already created.");
+ }
+ m_hoderTypeEnabled = hoderTypeEnabled;
+ }
+
+ public boolean isHoderTypeEnabled() {
+ return m_hoderTypeEnabled;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewTemplatesWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewTemplatesWizardPage.java
index 48aec5f85..09277b17f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewTemplatesWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewTemplatesWizardPage.java
@@ -1,232 +1,232 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.page;
-
-import java.util.HashSet;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.fields.table.FilteredTable;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.type.ITypeFilter;
-import org.eclipse.scout.sdk.util.type.TypeComparators;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.ICachedTypeHierarchy;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>PageNewWizardPage1</h3> ...
- */
-public class PageNewTemplatesWizardPage extends AbstractWorkspaceWizardPage {
- final IType iPage = TypeUtility.getType(RuntimeClasses.IPage);
- private FilteredTable m_filteredTable;
- private IType m_selectedType;
- private IScoutBundle m_clientBundle;
-
- public PageNewTemplatesWizardPage(IScoutBundle clientBundle) {
- super(PageNewTemplatesWizardPage.class.getName());
- setTitle(Texts.get("PageTemplates"));
- setDescription(Texts.get("ChooseATemplateForYourPage"));
- m_clientBundle = clientBundle;
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_filteredTable = new FilteredTable(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL);
- m_filteredTable.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- if (!event.getSelection().isEmpty()) {
- StructuredSelection selection = (StructuredSelection) event.getSelection();
- m_selectedType = (IType) selection.getFirstElement();
- pingStateChanging();
- }
-
- }
- });
- m_filteredTable.getViewer().addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- if (!event.getSelection().isEmpty()) {
- StructuredSelection selection = (StructuredSelection) event.getSelection();
- m_selectedType = (IType) selection.getFirstElement();
- pingStateChanging();
- IWizardPage page = getNextPage();
- if (page == null) {
- // something must have happened getting the next page
- return;
- }
-
- // show the next page
- IWizardContainer container = getWizard().getContainer();
- if (container != null) {
- container.showPage(page);
- }
- }
- }
- });
- ICachedTypeHierarchy hierarchy = TypeUtility.getPrimaryTypeHierarchy(iPage);
- ITypeFilter filter = TypeFilters.getMultiTypeFilter(
- TypeFilters.getTypesOnClasspath(getClientBundle().getJavaProject()),
- TypeFilters.getFlagsFilter(Flags.AccAbstract));
- IType[] abstractPages = hierarchy.getAllSubtypes(iPage, filter, TypeComparators.getTypeNameComparator());
-
- P_TableContentProvider provider = new P_TableContentProvider(abstractPages);
- m_filteredTable.getViewer().setLabelProvider(provider);
- m_filteredTable.getViewer().setContentProvider(provider);
- m_filteredTable.getViewer().setInput(provider);
-
- updateUi();
- // layout
- parent.setLayout(new GridLayout(1, true));
- m_filteredTable.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH | GridData.GRAB_VERTICAL));
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- if (getSelectedType() != null) {
- multiStatus.add(Status.OK_STATUS);
- }
- else {
- multiStatus.add(new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("ATemplateMustBeSelected")));
- }
- PageNewAttributesWizardPage page = (PageNewAttributesWizardPage) getWizard().getPage(PageNewAttributesWizardPage.class.getName());
- if (page != null) {
- page.setSuperType(getSelectedType());
- }
- }
-
- protected void updateUi() {
- if (getClientBundle() != null) {
- HashSet<IType> templates = new HashSet<IType>();
- for (IType t : ScoutTypeUtility.getAbstractTypesOnClasspath(iPage, getClientBundle().getJavaProject())) {
- if (!templates.contains(t)) {
- templates.add(t);
- }
- }
- P_TableContentProvider provider = new P_TableContentProvider(templates.toArray(new IType[templates.size()]));
- m_filteredTable.getViewer().setLabelProvider(provider);
- m_filteredTable.getViewer().setContentProvider(provider);
- m_filteredTable.getViewer().setInput(provider);
- m_filteredTable.getViewer().refresh();
- }
- else {
- P_TableContentProvider provider = new P_TableContentProvider(new IType[0]);
- m_filteredTable.getViewer().setLabelProvider(provider);
- m_filteredTable.getViewer().setContentProvider(provider);
- m_filteredTable.getViewer().setInput(provider);
- m_filteredTable.getViewer().refresh();
- }
- }
-
- public IScoutBundle getClientBundle() {
- return m_clientBundle;
- }
-
- public void setClientBundle(IScoutBundle clientBundle) {
- try {
- setStateChanging(true);
- m_clientBundle = clientBundle;
- if (isControlCreated()) {
- updateUi();
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public void setSuperType(IType selectedType) {
- IStructuredContentProvider prov = (IStructuredContentProvider) m_filteredTable.getViewer().getContentProvider();
- for (Object row : prov.getElements(null)) {
- if (((IType) row).equals(selectedType)) {
- m_filteredTable.getViewer().setSelection(new StructuredSelection(selectedType));
- }
- }
- pingStateChanging();
- }
-
- public IType getSelectedType() {
- return m_selectedType;
- }
-
- private class P_TableContentProvider implements IStructuredContentProvider, ITableLabelProvider {
- IType[] m_templates;
-
- private P_TableContentProvider(IType[] templates) {
- m_templates = templates;
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- return m_templates;
- }
-
- @Override
- public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex == 0) {
- return ScoutSdkUi.getImage(ScoutSdkUi.Class);
- }
- return null;
- }
-
- @Override
- public String getColumnText(Object element, int columnIndex) {
- return ((IType) element).getElementName();
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- @Override
- public void addListener(ILabelProviderListener listener) {
- }
-
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- @Override
- public void removeListener(ILabelProviderListener listener) {
- }
- } // end class P_TableContentProvider
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.page;
+
+import java.util.HashSet;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.fields.table.FilteredTable;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.type.ITypeFilter;
+import org.eclipse.scout.sdk.util.type.TypeComparators;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.ICachedTypeHierarchy;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>PageNewWizardPage1</h3> ...
+ */
+public class PageNewTemplatesWizardPage extends AbstractWorkspaceWizardPage {
+ final IType iPage = TypeUtility.getType(RuntimeClasses.IPage);
+ private FilteredTable m_filteredTable;
+ private IType m_selectedType;
+ private IScoutBundle m_clientBundle;
+
+ public PageNewTemplatesWizardPage(IScoutBundle clientBundle) {
+ super(PageNewTemplatesWizardPage.class.getName());
+ setTitle(Texts.get("PageTemplates"));
+ setDescription(Texts.get("ChooseATemplateForYourPage"));
+ m_clientBundle = clientBundle;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_filteredTable = new FilteredTable(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL);
+ m_filteredTable.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (!event.getSelection().isEmpty()) {
+ StructuredSelection selection = (StructuredSelection) event.getSelection();
+ m_selectedType = (IType) selection.getFirstElement();
+ pingStateChanging();
+ }
+
+ }
+ });
+ m_filteredTable.getViewer().addDoubleClickListener(new IDoubleClickListener() {
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ if (!event.getSelection().isEmpty()) {
+ StructuredSelection selection = (StructuredSelection) event.getSelection();
+ m_selectedType = (IType) selection.getFirstElement();
+ pingStateChanging();
+ IWizardPage page = getNextPage();
+ if (page == null) {
+ // something must have happened getting the next page
+ return;
+ }
+
+ // show the next page
+ IWizardContainer container = getWizard().getContainer();
+ if (container != null) {
+ container.showPage(page);
+ }
+ }
+ }
+ });
+ ICachedTypeHierarchy hierarchy = TypeUtility.getPrimaryTypeHierarchy(iPage);
+ ITypeFilter filter = TypeFilters.getMultiTypeFilter(
+ TypeFilters.getTypesOnClasspath(getClientBundle().getJavaProject()),
+ TypeFilters.getFlagsFilter(Flags.AccAbstract));
+ IType[] abstractPages = hierarchy.getAllSubtypes(iPage, filter, TypeComparators.getTypeNameComparator());
+
+ P_TableContentProvider provider = new P_TableContentProvider(abstractPages);
+ m_filteredTable.getViewer().setLabelProvider(provider);
+ m_filteredTable.getViewer().setContentProvider(provider);
+ m_filteredTable.getViewer().setInput(provider);
+
+ updateUi();
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+ m_filteredTable.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH | GridData.GRAB_VERTICAL));
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ if (getSelectedType() != null) {
+ multiStatus.add(Status.OK_STATUS);
+ }
+ else {
+ multiStatus.add(new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("ATemplateMustBeSelected")));
+ }
+ PageNewAttributesWizardPage page = (PageNewAttributesWizardPage) getWizard().getPage(PageNewAttributesWizardPage.class.getName());
+ if (page != null) {
+ page.setSuperType(getSelectedType());
+ }
+ }
+
+ protected void updateUi() {
+ if (getClientBundle() != null) {
+ HashSet<IType> templates = new HashSet<IType>();
+ for (IType t : ScoutTypeUtility.getAbstractTypesOnClasspath(iPage, getClientBundle().getJavaProject())) {
+ if (!templates.contains(t)) {
+ templates.add(t);
+ }
+ }
+ P_TableContentProvider provider = new P_TableContentProvider(templates.toArray(new IType[templates.size()]));
+ m_filteredTable.getViewer().setLabelProvider(provider);
+ m_filteredTable.getViewer().setContentProvider(provider);
+ m_filteredTable.getViewer().setInput(provider);
+ m_filteredTable.getViewer().refresh();
+ }
+ else {
+ P_TableContentProvider provider = new P_TableContentProvider(new IType[0]);
+ m_filteredTable.getViewer().setLabelProvider(provider);
+ m_filteredTable.getViewer().setContentProvider(provider);
+ m_filteredTable.getViewer().setInput(provider);
+ m_filteredTable.getViewer().refresh();
+ }
+ }
+
+ public IScoutBundle getClientBundle() {
+ return m_clientBundle;
+ }
+
+ public void setClientBundle(IScoutBundle clientBundle) {
+ try {
+ setStateChanging(true);
+ m_clientBundle = clientBundle;
+ if (isControlCreated()) {
+ updateUi();
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public void setSuperType(IType selectedType) {
+ IStructuredContentProvider prov = (IStructuredContentProvider) m_filteredTable.getViewer().getContentProvider();
+ for (Object row : prov.getElements(null)) {
+ if (((IType) row).equals(selectedType)) {
+ m_filteredTable.getViewer().setSelection(new StructuredSelection(selectedType));
+ }
+ }
+ pingStateChanging();
+ }
+
+ public IType getSelectedType() {
+ return m_selectedType;
+ }
+
+ private class P_TableContentProvider implements IStructuredContentProvider, ITableLabelProvider {
+ IType[] m_templates;
+
+ private P_TableContentProvider(IType[] templates) {
+ m_templates = templates;
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return m_templates;
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ return ScoutSdkUi.getImage(ScoutSdkUi.Class);
+ }
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ return ((IType) element).getElementName();
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ }
+ } // end class P_TableContentProvider
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewWizard.java
index 41f800dee..df7799273 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/page/PageNewWizard.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.page;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-
-public class PageNewWizard extends AbstractWorkspaceWizard {
-
- // members
- private final IScoutBundle m_clientBundle;
- private IType m_holderType;
- private IType m_superType;
- // pages
- private PageNewTemplatesWizardPage m_templatePage;
- private PageNewAttributesWizardPage m_pageAttributePage;
-
- // private ClientBundleLocationWizardPage m_clientLocationPage;
-
- public PageNewWizard(IScoutBundle clientBundle) {
- m_clientBundle = clientBundle;
- setWindowTitle(Texts.get("NewPage"));
- m_templatePage = new PageNewTemplatesWizardPage(clientBundle);
- addPage(m_templatePage);
- m_pageAttributePage = new PageNewAttributesWizardPage(clientBundle);
- addPage(m_pageAttributePage);
- }
-
- public IScoutBundle getClientBundle() {
- return m_clientBundle;
- }
-
- public void setHolderType(IType holderType) {
- m_holderType = holderType;
- m_pageAttributePage.setHolderType(holderType);
- }
-
- public IType getHolderType() {
- return m_holderType;
- }
-
- public void setSuperType(IType superType) {
- m_superType = superType;
- m_templatePage.setExcludePage(superType != null);
- m_pageAttributePage.setSuperType(superType);
- }
-
- public IType getSuperType() {
- return m_superType;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.page;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+
+public class PageNewWizard extends AbstractWorkspaceWizard {
+
+ // members
+ private final IScoutBundle m_clientBundle;
+ private IType m_holderType;
+ private IType m_superType;
+ // pages
+ private PageNewTemplatesWizardPage m_templatePage;
+ private PageNewAttributesWizardPage m_pageAttributePage;
+
+ // private ClientBundleLocationWizardPage m_clientLocationPage;
+
+ public PageNewWizard(IScoutBundle clientBundle) {
+ m_clientBundle = clientBundle;
+ setWindowTitle(Texts.get("NewPage"));
+ m_templatePage = new PageNewTemplatesWizardPage(clientBundle);
+ addPage(m_templatePage);
+ m_pageAttributePage = new PageNewAttributesWizardPage(clientBundle);
+ addPage(m_pageAttributePage);
+ }
+
+ public IScoutBundle getClientBundle() {
+ return m_clientBundle;
+ }
+
+ public void setHolderType(IType holderType) {
+ m_holderType = holderType;
+ m_pageAttributePage.setHolderType(holderType);
+ }
+
+ public IType getHolderType() {
+ return m_holderType;
+ }
+
+ public void setSuperType(IType superType) {
+ m_superType = superType;
+ m_templatePage.setExcludePage(superType != null);
+ m_pageAttributePage.setSuperType(superType);
+ }
+
+ public IType getSuperType() {
+ return m_superType;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/permission/PermissionNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/permission/PermissionNewWizard.java
index ea206daa2..e869679ea 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/permission/PermissionNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/permission/PermissionNewWizard.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.permission;
-
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-
-public class PermissionNewWizard extends AbstractWorkspaceWizard {
-
- private PermissionWizardPage m_page1;
- private final IScoutBundle m_sharedBundle;
-
- public PermissionNewWizard(IScoutBundle sharedBundle) {
- m_sharedBundle = sharedBundle;
- setWindowTitle(Texts.get("NewPermission"));
- m_page1 = new PermissionWizardPage(getSharedBundle());
- addPage(m_page1);
- }
-
- public IScoutBundle getSharedBundle() {
- return m_sharedBundle;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.permission;
+
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+
+public class PermissionNewWizard extends AbstractWorkspaceWizard {
+
+ private PermissionWizardPage m_page1;
+ private final IScoutBundle m_sharedBundle;
+
+ public PermissionNewWizard(IScoutBundle sharedBundle) {
+ m_sharedBundle = sharedBundle;
+ setWindowTitle(Texts.get("NewPermission"));
+ m_page1 = new PermissionWizardPage(getSharedBundle());
+ addPage(m_page1);
+ }
+
+ public IScoutBundle getSharedBundle() {
+ return m_sharedBundle;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/permission/PermissionWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/permission/PermissionWizardPage.java
index 4a788a52d..29ff4788f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/permission/PermissionWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/permission/PermissionWizardPage.java
@@ -1,195 +1,195 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.permission;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.PermissionNewOperation;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>CodeTypeWizardPage</h3> ...
- */
-public class PermissionWizardPage extends AbstractWorkspaceWizardPage {
- IType basicPermission = TypeUtility.getType(RuntimeClasses.BasicPermission);
- final IType basicHierarchyPermission = TypeUtility.getType(RuntimeClasses.BasicHierarchyPermission);
-
- private String m_typeName;
- private IType m_superType;
-
- // ui fields
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
-
- // process members
- private final IScoutBundle m_sharedBundle;
-
- public PermissionWizardPage(IScoutBundle sharedBundle) {
- super(PermissionWizardPage.class.getName());
- m_sharedBundle = sharedBundle;
- setTitle(Texts.get("NewPermission"));
- setDescription(Texts.get("CreateANewPermission"));
- m_superType = basicHierarchyPermission;
- }
-
- @Override
- public void postActivate() {
- m_typeNameField.setFocus();
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_PERMISSION);
- m_typeNameField.setText(m_typeName);
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_typeName = m_typeNameField.getText();
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new JavaElementAbstractTypeContentProvider(basicHierarchyPermission, getSharedBundle().getJavaProject(), basicPermission));
- m_superTypeField.acceptProposal(m_superType);
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_superType = (IType) event.proposal;
- pingStateChanging();
- }
- });
-
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- PermissionNewOperation op = new PermissionNewOperation();
- // write back members
- op.setSharedBundle(getSharedBundle());
- op.setTypeName(getTypeName());
-
- IType superTypeProp = getSuperType();
- if (superTypeProp != null) {
- op.setSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
- }
- op.run(monitor, workingCopyManager);
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- public IScoutBundle getSharedBundle() {
- return m_sharedBundle;
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_PERMISSION)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.existsType(getSharedBundle().getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SECURITY) + "." + getTypeName())) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- public String getTypeName() {
- return m_typeName;
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- m_typeName = typeName;
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public IType getSuperType() {
- return m_superType;
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- m_superType = superType;
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.permission;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.PermissionNewOperation;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>CodeTypeWizardPage</h3> ...
+ */
+public class PermissionWizardPage extends AbstractWorkspaceWizardPage {
+ IType basicPermission = TypeUtility.getType(RuntimeClasses.BasicPermission);
+ final IType basicHierarchyPermission = TypeUtility.getType(RuntimeClasses.BasicHierarchyPermission);
+
+ private String m_typeName;
+ private IType m_superType;
+
+ // ui fields
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+
+ // process members
+ private final IScoutBundle m_sharedBundle;
+
+ public PermissionWizardPage(IScoutBundle sharedBundle) {
+ super(PermissionWizardPage.class.getName());
+ m_sharedBundle = sharedBundle;
+ setTitle(Texts.get("NewPermission"));
+ setDescription(Texts.get("CreateANewPermission"));
+ m_superType = basicHierarchyPermission;
+ }
+
+ @Override
+ public void postActivate() {
+ m_typeNameField.setFocus();
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_PERMISSION);
+ m_typeNameField.setText(m_typeName);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_typeName = m_typeNameField.getText();
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new JavaElementAbstractTypeContentProvider(basicHierarchyPermission, getSharedBundle().getJavaProject(), basicPermission));
+ m_superTypeField.acceptProposal(m_superType);
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_superType = (IType) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ PermissionNewOperation op = new PermissionNewOperation();
+ // write back members
+ op.setSharedBundle(getSharedBundle());
+ op.setTypeName(getTypeName());
+
+ IType superTypeProp = getSuperType();
+ if (superTypeProp != null) {
+ op.setSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
+ }
+ op.run(monitor, workingCopyManager);
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ public IScoutBundle getSharedBundle() {
+ return m_sharedBundle;
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_PERMISSION)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.existsType(getSharedBundle().getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SECURITY) + "." + getTypeName())) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ public String getTypeName() {
+ return m_typeName;
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ m_typeName = typeName;
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getSuperType() {
+ return m_superType;
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ m_superType = superType;
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/AbstractProjectNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/AbstractProjectNewWizardPage.java
index d95411e4b..285c84a19 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/AbstractProjectNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/AbstractProjectNewWizardPage.java
@@ -1,35 +1,35 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.project;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.PropertyMap;
-
-/**
- * <h3>AbstractProjectNewWizardPage</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 06.03.2010
- */
-public abstract class AbstractProjectNewWizardPage extends AbstractWorkspaceWizardPage {
-
- public AbstractProjectNewWizardPage(String pageName, String title, ImageDescriptor titleImage) {
- super(pageName, title, titleImage);
- }
-
- public AbstractProjectNewWizardPage(String pageName) {
- this(pageName, null, (ImageDescriptor) null);
-
- }
-
- public abstract void putProperties(PropertyMap properties);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.project;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.PropertyMap;
+
+/**
+ * <h3>AbstractProjectNewWizardPage</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 06.03.2010
+ */
+public abstract class AbstractProjectNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ public AbstractProjectNewWizardPage(String pageName, String title, ImageDescriptor titleImage) {
+ super(pageName, title, titleImage);
+ }
+
+ public AbstractProjectNewWizardPage(String pageName) {
+ this(pageName, null, (ImageDescriptor) null);
+
+ }
+
+ public abstract void putProperties(PropertyMap properties);
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/IScoutProjectWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/IScoutProjectWizard.java
index 38e439829..722d8daff 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/IScoutProjectWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/IScoutProjectWizard.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.project;
-
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.AbstractScoutWizardPage;
-
-/**
- *
- */
-public interface IScoutProjectWizard {
-
- public IScoutProjectWizardPage getProjectWizardPage();
-
- /**
- * @param name
- * @return
- */
- AbstractScoutWizardPage getPage(String name);
-
- /**
- * @param page
- */
- void addPage(IWizardPage page);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.project;
+
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.AbstractScoutWizardPage;
+
+/**
+ *
+ */
+public interface IScoutProjectWizard {
+
+ public IScoutProjectWizardPage getProjectWizardPage();
+
+ /**
+ * @param name
+ * @return
+ */
+ AbstractScoutWizardPage getPage(String name);
+
+ /**
+ * @param page
+ */
+ void addPage(IWizardPage page);
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/IScoutProjectWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/IScoutProjectWizardPage.java
index 495388e53..3a5801e2d 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/IScoutProjectWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/project/IScoutProjectWizardPage.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.project;
-
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.scout.sdk.ui.extensions.project.IScoutBundleExtension.BundleTypes;
-
-/**
- *
- */
-public interface IScoutProjectWizardPage {
- public static final String PROP_PROJECT_NAME = "projectName";
- public static final String PROP_PROJECT_ALIAS = "projectAlias";
- public static final String PROP_PROJECT_NAME_POSTFIX = "projectNamePostfix";
- public static final String PROP_SELECTED_BUNDLES = "selectedBundles";
-
- void addPropertyChangeListener(PropertyChangeListener listener);
-
- void removePropertyChangeListener(PropertyChangeListener listener);
-
- /**
- * @param extensionIds
- * @return
- */
- boolean isBundleNodesSelected(String... extensionIds);
-
- boolean hasSelectedBundle(BundleTypes... types);
-
- String getProjectName();
-
- String getProjectAlias();
-
- String getProjectNamePostfix();
-
- /**
- * @param available
- * @param extensionIds
- */
- void setBundleNodeAvailable(boolean available, String... extensionIds);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.project;
+
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.scout.sdk.ui.extensions.project.IScoutBundleExtension.BundleTypes;
+
+/**
+ *
+ */
+public interface IScoutProjectWizardPage {
+ public static final String PROP_PROJECT_NAME = "projectName";
+ public static final String PROP_PROJECT_ALIAS = "projectAlias";
+ public static final String PROP_PROJECT_NAME_POSTFIX = "projectNamePostfix";
+ public static final String PROP_SELECTED_BUNDLES = "selectedBundles";
+
+ void addPropertyChangeListener(PropertyChangeListener listener);
+
+ void removePropertyChangeListener(PropertyChangeListener listener);
+
+ /**
+ * @param extensionIds
+ * @return
+ */
+ boolean isBundleNodesSelected(String... extensionIds);
+
+ boolean hasSelectedBundle(BundleTypes... types);
+
+ String getProjectName();
+
+ String getProjectAlias();
+
+ String getProjectNamePostfix();
+
+ /**
+ * @param available
+ * @param extensionIds
+ */
+ void setBundleNodeAvailable(boolean available, String... extensionIds);
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/BookmarkStorageServiceNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/BookmarkStorageServiceNewWizard.java
index 771a94ac6..f4f4c126e 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/BookmarkStorageServiceNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/BookmarkStorageServiceNewWizard.java
@@ -1,345 +1,345 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.services;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.service.ServiceNewOperation;
-import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
-import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
-import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.IScoutProject;
-import org.eclipse.swt.dnd.DND;
-
-public class BookmarkStorageServiceNewWizard extends AbstractWorkspaceWizard {
- public static final int TYPE_SERVICE_INTERFACE = 107;
- public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
- public static final int TYPE_SERVICE_REG_CLIENT = 109;
- public static final int TYPE_SERVICE_REG_SERVER = 110;
-
- private ServiceNewWizardPage m_serviceNewWizardPage;
- private BundleTreeWizardPage m_locationWizardPage;
- private ITreeNode m_locationWizardPageRoot;
- private ServiceNewOperation m_operation = new ServiceNewOperation();
-
- public BookmarkStorageServiceNewWizard(IScoutBundle serverBundle) {
- setWindowTitle(Texts.get("NewBookmarkService"));
- P_StatusRevalidator statusProvider = new P_StatusRevalidator();
- m_serviceNewWizardPage = new ServiceNewWizardPage(Texts.get("NewBookmarkStorageService"), Texts.get("CreateANewBookmarkStorageService"), TypeUtility.getType(RuntimeClasses.IBookmarkStorageService), SdkProperties.SUFFIX_BOOKMARK_STORAGE_SERVICE);
- m_serviceNewWizardPage.setLocationBundle(serverBundle);
- m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.IBookmarkStorageService));
- m_serviceNewWizardPage.addStatusProvider(statusProvider);
- m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
- addPage(m_serviceNewWizardPage);
-
- m_locationWizardPageRoot = createTree(serverBundle);
- m_locationWizardPage = new BundleTreeWizardPage(Texts.get("BookmarkStorageServiceLocation"), Texts.get("OrganiseLocations"), m_locationWizardPageRoot, new P_InitialCheckerFilter());
- m_locationWizardPage.addStatusProvider(statusProvider);
- m_locationWizardPage.addDndListener(new P_TreeDndListener());
- addPage(m_locationWizardPage);
-
- // init
- m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractBookmarkStorageService));
- }
-
- private ITreeNode createTree(IScoutBundle serverBundle) {
- IScoutBundle sharedBundle = null;
- IScoutBundle clientBundle = null;
- IScoutProject scoutProject = serverBundle.getScoutProject();
- while ((sharedBundle == null || clientBundle == null) && scoutProject != null) {
- sharedBundle = scoutProject.getSharedBundle();
- clientBundle = scoutProject.getClientBundle();
- scoutProject = scoutProject.getParentProject();
- }
-
- ITreeNode rootNode = TreeUtility.createBundleTree(serverBundle.getScoutProject(), NodeFilters.getAcceptAll());
-
- if (clientBundle != null) {
- ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(clientBundle));
- // service client reg
- TreeUtility.createNode(clientNode, TYPE_SERVICE_REG_CLIENT, Texts.get("ServiceProxyRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_CLIENT);
- }
- if (sharedBundle != null) {
- ITreeNode sharedNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(sharedBundle));
- // service interface
- TreeUtility.createNode(sharedNode, TYPE_SERVICE_INTERFACE, Texts.get("IService"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface), TYPE_SERVICE_INTERFACE);
- }
- if (serverBundle != null) {
- ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
- }
- return rootNode;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- IType superType = m_serviceNewWizardPage.getSuperType();
- if (superType != null) {
- m_operation.setServiceSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
- }
- IScoutBundle implementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (implementationBundle != null) {
- m_operation.setImplementationBundle(implementationBundle);
- m_operation.setServicePackageName(implementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_COMMON_BOOKMARK));
- m_operation.setServiceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
- }
-
- m_operation.setServiceInterfaceSuperTypeSignature(Signature.createTypeSignature(RuntimeClasses.IBookmarkStorageService, true));
-
- IScoutBundle[] regProxyLocations = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_CLIENT, true, true);
- for (IScoutBundle cb : regProxyLocations) {
- m_operation.addProxyRegistrationBundle(cb);
- }
- IScoutBundle[] serverRegBundles = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true);
- for (IScoutBundle sb : serverRegBundles) {
- m_operation.addServiceRegistrationBundle(sb);
- }
- IScoutBundle interfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (interfaceBundle != null) {
- m_operation.setInterfaceBundle(interfaceBundle);
- m_operation.setServiceInterfacePackageName(interfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_COMMON_BOOKMARK));
- }
- m_operation.setServiceInterfaceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE, true, true));
-
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
- try {
- m_operation.validate();
- m_operation.run(monitor, workingCopyManager);
- return true;
- }
- catch (IllegalArgumentException e) {
- ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
- return false;
- }
- catch (CoreException e) {
- ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
- return false;
- }
- }
-
- private class P_LocationPropertyListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
- String typeName = m_serviceNewWizardPage.getTypeName();
- if (!StringUtility.isNullOrEmpty(typeName)) {
- String prefix = typeName.replaceAll(SdkProperties.SUFFIX_BOOKMARK_STORAGE_SERVICE + "$", "");
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_BOOKMARK_STORAGE_SERVICE);
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_INTERFACE)).setText("I" + prefix + SdkProperties.SUFFIX_BOOKMARK_STORAGE_SERVICE);
- m_locationWizardPage.refreshTree();
- }
- m_locationWizardPage.pingStateChanging();
- }
- }
- } // end class P_LocationPropertyListener
-
- private class P_InitialCheckerFilter implements ITreeNodeFilter {
- @Override
- public boolean accept(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_INTERFACE:
- case TYPE_SERVICE_REG_CLIENT:
- case TYPE_SERVICE_REG_SERVER:
- return true;
-
- case IScoutBundle.BUNDLE_CLIENT:
- case IScoutBundle.BUNDLE_SHARED:
- case IScoutBundle.BUNDLE_SERVER:
- default:
- return false;
- }
- }
- } // end class P_InitialCheckerFilter
-
- private class P_TreeDndListener implements ITreeDndListener {
- @Override
- public boolean isDragableNode(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_INTERFACE:
- case TYPE_SERVICE_REG_CLIENT:
- case TYPE_SERVICE_REG_SERVER:
- return true;
- default:
- return false;
- }
- }
-
- @Override
- public void validateTarget(DndEvent dndEvent) {
- if (dndEvent.targetParent == null) {
- dndEvent.doit = false;
- return;
- }
- if (dndEvent.operation == DND.DROP_COPY) {
- validateDropCopy(dndEvent);
- }
- else if (dndEvent.operation == DND.DROP_MOVE) {
- validateDropMove(dndEvent);
- }
- }
-
- @Override
- public void dndPerformed(DndEvent dndEvent) {
-
- m_serviceNewWizardPage.pingStateChanging();
- }
-
- private void validateDropCopy(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REG_CLIENT:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
- }
-
- private void validateDropMove(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REG_CLIENT:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- case TYPE_SERVICE_INTERFACE:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SHARED;
- break;
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
-
- }
- } // end class P_TreeDndListener
-
- private class P_StatusRevalidator implements IStatusProvider {
-
- @Override
- public void validate(Object source, MultiStatus multiStatus) {
- multiStatus.add(getStatusService());
- multiStatus.add(getStatusServiceRegistrationClient());
- multiStatus.add(getStatusServiceRegistrationServer());
- multiStatus.add(getStatusTypeNames());
- }
-
- protected IStatus getStatusTypeNames() {
-
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplNode != null) {
- String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_COMMON_BOOKMARK) + "." + serviceImplNode.getText();
- if (serviceImplementationBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceBundle != null) {
- ITreeNode serviceInterfaceNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceNode != null) {
- String fqn = serviceInterfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_COMMON_BOOKMARK) + "." + serviceInterfaceNode.getText();
- if (serviceInterfaceBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceInterfaceNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusService() {
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceBundle != null) {
- if (!serviceImplementationBundle.isOnClasspath(serviceInterfaceBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistrationClient() {
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- ITreeNode[] serviceRegistrationClientNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_CLIENT, true, true);
- for (ITreeNode serviceRegNode : serviceRegistrationClientNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceInterfaceBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceInterfaceBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistrationServer() {
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- ITreeNode[] serviceRegistrationServerNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
- for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
-
- return Status.OK_STATUS;
- }
-
- } // end class P_StatusRevalidator
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.services;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.service.ServiceNewOperation;
+import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
+import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
+import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.IScoutProject;
+import org.eclipse.swt.dnd.DND;
+
+public class BookmarkStorageServiceNewWizard extends AbstractWorkspaceWizard {
+ public static final int TYPE_SERVICE_INTERFACE = 107;
+ public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
+ public static final int TYPE_SERVICE_REG_CLIENT = 109;
+ public static final int TYPE_SERVICE_REG_SERVER = 110;
+
+ private ServiceNewWizardPage m_serviceNewWizardPage;
+ private BundleTreeWizardPage m_locationWizardPage;
+ private ITreeNode m_locationWizardPageRoot;
+ private ServiceNewOperation m_operation = new ServiceNewOperation();
+
+ public BookmarkStorageServiceNewWizard(IScoutBundle serverBundle) {
+ setWindowTitle(Texts.get("NewBookmarkService"));
+ P_StatusRevalidator statusProvider = new P_StatusRevalidator();
+ m_serviceNewWizardPage = new ServiceNewWizardPage(Texts.get("NewBookmarkStorageService"), Texts.get("CreateANewBookmarkStorageService"), TypeUtility.getType(RuntimeClasses.IBookmarkStorageService), SdkProperties.SUFFIX_BOOKMARK_STORAGE_SERVICE);
+ m_serviceNewWizardPage.setLocationBundle(serverBundle);
+ m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.IBookmarkStorageService));
+ m_serviceNewWizardPage.addStatusProvider(statusProvider);
+ m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
+ addPage(m_serviceNewWizardPage);
+
+ m_locationWizardPageRoot = createTree(serverBundle);
+ m_locationWizardPage = new BundleTreeWizardPage(Texts.get("BookmarkStorageServiceLocation"), Texts.get("OrganiseLocations"), m_locationWizardPageRoot, new P_InitialCheckerFilter());
+ m_locationWizardPage.addStatusProvider(statusProvider);
+ m_locationWizardPage.addDndListener(new P_TreeDndListener());
+ addPage(m_locationWizardPage);
+
+ // init
+ m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractBookmarkStorageService));
+ }
+
+ private ITreeNode createTree(IScoutBundle serverBundle) {
+ IScoutBundle sharedBundle = null;
+ IScoutBundle clientBundle = null;
+ IScoutProject scoutProject = serverBundle.getScoutProject();
+ while ((sharedBundle == null || clientBundle == null) && scoutProject != null) {
+ sharedBundle = scoutProject.getSharedBundle();
+ clientBundle = scoutProject.getClientBundle();
+ scoutProject = scoutProject.getParentProject();
+ }
+
+ ITreeNode rootNode = TreeUtility.createBundleTree(serverBundle.getScoutProject(), NodeFilters.getAcceptAll());
+
+ if (clientBundle != null) {
+ ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(clientBundle));
+ // service client reg
+ TreeUtility.createNode(clientNode, TYPE_SERVICE_REG_CLIENT, Texts.get("ServiceProxyRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_CLIENT);
+ }
+ if (sharedBundle != null) {
+ ITreeNode sharedNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(sharedBundle));
+ // service interface
+ TreeUtility.createNode(sharedNode, TYPE_SERVICE_INTERFACE, Texts.get("IService"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface), TYPE_SERVICE_INTERFACE);
+ }
+ if (serverBundle != null) {
+ ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
+ }
+ return rootNode;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ IType superType = m_serviceNewWizardPage.getSuperType();
+ if (superType != null) {
+ m_operation.setServiceSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
+ }
+ IScoutBundle implementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (implementationBundle != null) {
+ m_operation.setImplementationBundle(implementationBundle);
+ m_operation.setServicePackageName(implementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_COMMON_BOOKMARK));
+ m_operation.setServiceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
+ }
+
+ m_operation.setServiceInterfaceSuperTypeSignature(Signature.createTypeSignature(RuntimeClasses.IBookmarkStorageService, true));
+
+ IScoutBundle[] regProxyLocations = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_CLIENT, true, true);
+ for (IScoutBundle cb : regProxyLocations) {
+ m_operation.addProxyRegistrationBundle(cb);
+ }
+ IScoutBundle[] serverRegBundles = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true);
+ for (IScoutBundle sb : serverRegBundles) {
+ m_operation.addServiceRegistrationBundle(sb);
+ }
+ IScoutBundle interfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (interfaceBundle != null) {
+ m_operation.setInterfaceBundle(interfaceBundle);
+ m_operation.setServiceInterfacePackageName(interfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_COMMON_BOOKMARK));
+ }
+ m_operation.setServiceInterfaceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE, true, true));
+
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
+ try {
+ m_operation.validate();
+ m_operation.run(monitor, workingCopyManager);
+ return true;
+ }
+ catch (IllegalArgumentException e) {
+ ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
+ return false;
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
+ return false;
+ }
+ }
+
+ private class P_LocationPropertyListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
+ String typeName = m_serviceNewWizardPage.getTypeName();
+ if (!StringUtility.isNullOrEmpty(typeName)) {
+ String prefix = typeName.replaceAll(SdkProperties.SUFFIX_BOOKMARK_STORAGE_SERVICE + "$", "");
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_BOOKMARK_STORAGE_SERVICE);
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_INTERFACE)).setText("I" + prefix + SdkProperties.SUFFIX_BOOKMARK_STORAGE_SERVICE);
+ m_locationWizardPage.refreshTree();
+ }
+ m_locationWizardPage.pingStateChanging();
+ }
+ }
+ } // end class P_LocationPropertyListener
+
+ private class P_InitialCheckerFilter implements ITreeNodeFilter {
+ @Override
+ public boolean accept(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_INTERFACE:
+ case TYPE_SERVICE_REG_CLIENT:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+
+ case IScoutBundle.BUNDLE_CLIENT:
+ case IScoutBundle.BUNDLE_SHARED:
+ case IScoutBundle.BUNDLE_SERVER:
+ default:
+ return false;
+ }
+ }
+ } // end class P_InitialCheckerFilter
+
+ private class P_TreeDndListener implements ITreeDndListener {
+ @Override
+ public boolean isDragableNode(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_INTERFACE:
+ case TYPE_SERVICE_REG_CLIENT:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public void validateTarget(DndEvent dndEvent) {
+ if (dndEvent.targetParent == null) {
+ dndEvent.doit = false;
+ return;
+ }
+ if (dndEvent.operation == DND.DROP_COPY) {
+ validateDropCopy(dndEvent);
+ }
+ else if (dndEvent.operation == DND.DROP_MOVE) {
+ validateDropMove(dndEvent);
+ }
+ }
+
+ @Override
+ public void dndPerformed(DndEvent dndEvent) {
+
+ m_serviceNewWizardPage.pingStateChanging();
+ }
+
+ private void validateDropCopy(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REG_CLIENT:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+ }
+
+ private void validateDropMove(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REG_CLIENT:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ case TYPE_SERVICE_INTERFACE:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SHARED;
+ break;
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+
+ }
+ } // end class P_TreeDndListener
+
+ private class P_StatusRevalidator implements IStatusProvider {
+
+ @Override
+ public void validate(Object source, MultiStatus multiStatus) {
+ multiStatus.add(getStatusService());
+ multiStatus.add(getStatusServiceRegistrationClient());
+ multiStatus.add(getStatusServiceRegistrationServer());
+ multiStatus.add(getStatusTypeNames());
+ }
+
+ protected IStatus getStatusTypeNames() {
+
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplNode != null) {
+ String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_COMMON_BOOKMARK) + "." + serviceImplNode.getText();
+ if (serviceImplementationBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceBundle != null) {
+ ITreeNode serviceInterfaceNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceNode != null) {
+ String fqn = serviceInterfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_COMMON_BOOKMARK) + "." + serviceInterfaceNode.getText();
+ if (serviceInterfaceBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceInterfaceNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusService() {
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceBundle != null) {
+ if (!serviceImplementationBundle.isOnClasspath(serviceInterfaceBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistrationClient() {
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ ITreeNode[] serviceRegistrationClientNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_CLIENT, true, true);
+ for (ITreeNode serviceRegNode : serviceRegistrationClientNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceInterfaceBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceInterfaceBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistrationServer() {
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ ITreeNode[] serviceRegistrationServerNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
+ for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ } // end class P_StatusRevalidator
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ClientServiceNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ClientServiceNewWizard.java
index caa63b263..5789efe0d 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ClientServiceNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ClientServiceNewWizard.java
@@ -1,266 +1,266 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.services;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.service.ServiceNewOperation;
-import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
-import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
-import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.dnd.DND;
-
-public class ClientServiceNewWizard extends AbstractWorkspaceWizard {
-
- public static final int TYPE_SERVICE_INTERFACE = 107;
- public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
- public static final int TYPE_SERVICE_REGISTRATION = 109;
-
- private BundleTreeWizardPage m_locationWizardPage;
- private ServiceNewWizardPage m_serviceNewWizardPage;
- private ServiceNewOperation m_operation = new ServiceNewOperation();
- private ITreeNode m_locationPageRoot;
-
- public ClientServiceNewWizard(IScoutBundle clientBundle) {
- setWindowTitle(Texts.get("NewClientService"));
- P_StatusRevalidator statusProvider = new P_StatusRevalidator();
- m_serviceNewWizardPage = new ServiceNewWizardPage(Texts.get("NewClientService"), Texts.get("CreateANewClientService"), TypeUtility.getType(RuntimeClasses.IService), SdkProperties.SUFFIX_SERVICE);
- m_serviceNewWizardPage.setLocationBundle(clientBundle);
- m_serviceNewWizardPage.addStatusProvider(statusProvider);
- m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
- addPage(m_serviceNewWizardPage);
- m_locationPageRoot = createTree(clientBundle);
- m_locationWizardPage = new BundleTreeWizardPage(Texts.get("ServiceLocation"), Texts.get("OrganiseLocations"), m_locationPageRoot, NodeFilters.getByData((Object[]) null));
- m_locationWizardPage.addStatusProvider(statusProvider);
- m_locationWizardPage.addDndListener(new P_TreeDndListener());
- addPage(m_locationWizardPage);
- // init
- m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractService));
- }
-
- private ITreeNode createTree(IScoutBundle clientBundle) {
- ITreeNode rootNode = TreeUtility.createBundleTree(clientBundle.getScoutProject(), NodeFilters.getByType(IScoutBundle.BUNDLE_CLIENT));
- ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(clientBundle));
- // service client reg
- TreeUtility.createNode(clientNode, TYPE_SERVICE_REGISTRATION, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_IMPLEMENTATION);
- TreeUtility.createNode(clientNode, TYPE_SERVICE_INTERFACE, Texts.get("IService"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface), TYPE_SERVICE_INTERFACE);
- TreeUtility.createNode(clientNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
- return rootNode;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- IScoutBundle implementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (implementationBundle != null) {
- m_operation.setImplementationBundle(implementationBundle);
- m_operation.setServicePackageName(implementationBundle.getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_SERVICES));
- }
- IScoutBundle interfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (interfaceBundle != null) {
- m_operation.setInterfaceBundle(interfaceBundle);
- m_operation.setServiceInterfacePackageName(interfaceBundle.getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_SERVICES));
- }
- m_operation.setServiceInterfaceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE, true, true));
- m_operation.setServiceInterfaceSuperTypeSignature(Signature.createTypeSignature(RuntimeClasses.IService, true));
- IType superType = m_serviceNewWizardPage.getSuperType();
- if (superType != null) {
- m_operation.setServiceSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
- }
- m_operation.setServiceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
- for (IScoutBundle sb : m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REGISTRATION, true, true)) {
- m_operation.addServiceRegistrationBundle(sb);
- }
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
- try {
- m_operation.validate();
- m_operation.run(monitor, workingCopyManager);
- return true;
- }
- catch (IllegalArgumentException e) {
- ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
- return false;
- }
- catch (CoreException e) {
- ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
- return false;
- }
- }
-
- private class P_LocationPropertyListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
- String typeName = m_serviceNewWizardPage.getTypeName();
- if (!StringUtility.isNullOrEmpty(typeName)) {
- String prefix = typeName.replaceAll(SdkProperties.SUFFIX_SERVICE + "$", "");
- TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_SERVICE);
- TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_SERVICE_INTERFACE)).setText("I" + prefix + SdkProperties.SUFFIX_SERVICE);
- m_locationWizardPage.refreshTree();
- }
- m_locationWizardPage.pingStateChanging();
- m_serviceNewWizardPage.pingStateChanging();
- }
- }
- } // end class P_LocationPropertyListener
-
- private class P_TreeDndListener implements ITreeDndListener {
- @Override
- public boolean isDragableNode(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_INTERFACE:
- case TYPE_SERVICE_REGISTRATION:
- return true;
- default:
- return false;
- }
- }
-
- @Override
- public void validateTarget(DndEvent dndEvent) {
- if (dndEvent.targetParent == null) {
- dndEvent.doit = false;
- return;
- }
- if (dndEvent.operation == DND.DROP_COPY) {
- validateDropCopy(dndEvent);
- }
- else if (dndEvent.operation == DND.DROP_MOVE) {
- validateDropMove(dndEvent);
- }
- }
-
- private void validateDropCopy(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REGISTRATION:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
- }
-
- private void validateDropMove(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REGISTRATION:
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_INTERFACE:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
-
- }
-
- @Override
- public void dndPerformed(DndEvent dndEvent) {
- m_serviceNewWizardPage.pingStateChanging();
- }
- } // end class P_TreeDndListener
-
- private class P_StatusRevalidator implements IStatusProvider {
- @Override
- public void validate(Object source, MultiStatus multiStatus) {
- multiStatus.add(getStatusTypeNames());
- multiStatus.add(getStatusServiceRegistration());
- multiStatus.add(getStatusService());
- }
-
- protected IStatus getStatusTypeNames() {
- // client
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplNode != null) {
- String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_SERVICES) + "." + serviceImplNode.getText();
- if (serviceImplementationBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- // client
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceBundle != null) {
- ITreeNode serviceInterfaceNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceNode != null) {
- String fqn = serviceInterfaceBundle.getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_SERVICES) + "." + serviceInterfaceNode.getText();
- if (serviceInterfaceBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceInterfaceNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusService() {
- // client
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- // client
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceBundle != null) {
- if (!serviceImplementationBundle.isOnClasspath(serviceInterfaceBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistration() {
- // client bundle
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- ITreeNode[] registrationNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REGISTRATION, true, true);
- for (ITreeNode serviceRegNode : registrationNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceInterfaceBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceInterfaceBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- } // end class P_StatusRevalidator
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.services;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.service.ServiceNewOperation;
+import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
+import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
+import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.dnd.DND;
+
+public class ClientServiceNewWizard extends AbstractWorkspaceWizard {
+
+ public static final int TYPE_SERVICE_INTERFACE = 107;
+ public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
+ public static final int TYPE_SERVICE_REGISTRATION = 109;
+
+ private BundleTreeWizardPage m_locationWizardPage;
+ private ServiceNewWizardPage m_serviceNewWizardPage;
+ private ServiceNewOperation m_operation = new ServiceNewOperation();
+ private ITreeNode m_locationPageRoot;
+
+ public ClientServiceNewWizard(IScoutBundle clientBundle) {
+ setWindowTitle(Texts.get("NewClientService"));
+ P_StatusRevalidator statusProvider = new P_StatusRevalidator();
+ m_serviceNewWizardPage = new ServiceNewWizardPage(Texts.get("NewClientService"), Texts.get("CreateANewClientService"), TypeUtility.getType(RuntimeClasses.IService), SdkProperties.SUFFIX_SERVICE);
+ m_serviceNewWizardPage.setLocationBundle(clientBundle);
+ m_serviceNewWizardPage.addStatusProvider(statusProvider);
+ m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
+ addPage(m_serviceNewWizardPage);
+ m_locationPageRoot = createTree(clientBundle);
+ m_locationWizardPage = new BundleTreeWizardPage(Texts.get("ServiceLocation"), Texts.get("OrganiseLocations"), m_locationPageRoot, NodeFilters.getByData((Object[]) null));
+ m_locationWizardPage.addStatusProvider(statusProvider);
+ m_locationWizardPage.addDndListener(new P_TreeDndListener());
+ addPage(m_locationWizardPage);
+ // init
+ m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractService));
+ }
+
+ private ITreeNode createTree(IScoutBundle clientBundle) {
+ ITreeNode rootNode = TreeUtility.createBundleTree(clientBundle.getScoutProject(), NodeFilters.getByType(IScoutBundle.BUNDLE_CLIENT));
+ ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(clientBundle));
+ // service client reg
+ TreeUtility.createNode(clientNode, TYPE_SERVICE_REGISTRATION, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_IMPLEMENTATION);
+ TreeUtility.createNode(clientNode, TYPE_SERVICE_INTERFACE, Texts.get("IService"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface), TYPE_SERVICE_INTERFACE);
+ TreeUtility.createNode(clientNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
+ return rootNode;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ IScoutBundle implementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (implementationBundle != null) {
+ m_operation.setImplementationBundle(implementationBundle);
+ m_operation.setServicePackageName(implementationBundle.getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_SERVICES));
+ }
+ IScoutBundle interfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (interfaceBundle != null) {
+ m_operation.setInterfaceBundle(interfaceBundle);
+ m_operation.setServiceInterfacePackageName(interfaceBundle.getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_SERVICES));
+ }
+ m_operation.setServiceInterfaceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE, true, true));
+ m_operation.setServiceInterfaceSuperTypeSignature(Signature.createTypeSignature(RuntimeClasses.IService, true));
+ IType superType = m_serviceNewWizardPage.getSuperType();
+ if (superType != null) {
+ m_operation.setServiceSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
+ }
+ m_operation.setServiceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
+ for (IScoutBundle sb : m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REGISTRATION, true, true)) {
+ m_operation.addServiceRegistrationBundle(sb);
+ }
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
+ try {
+ m_operation.validate();
+ m_operation.run(monitor, workingCopyManager);
+ return true;
+ }
+ catch (IllegalArgumentException e) {
+ ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
+ return false;
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
+ return false;
+ }
+ }
+
+ private class P_LocationPropertyListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
+ String typeName = m_serviceNewWizardPage.getTypeName();
+ if (!StringUtility.isNullOrEmpty(typeName)) {
+ String prefix = typeName.replaceAll(SdkProperties.SUFFIX_SERVICE + "$", "");
+ TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_SERVICE);
+ TreeUtility.findNode(m_locationPageRoot, NodeFilters.getByType(TYPE_SERVICE_INTERFACE)).setText("I" + prefix + SdkProperties.SUFFIX_SERVICE);
+ m_locationWizardPage.refreshTree();
+ }
+ m_locationWizardPage.pingStateChanging();
+ m_serviceNewWizardPage.pingStateChanging();
+ }
+ }
+ } // end class P_LocationPropertyListener
+
+ private class P_TreeDndListener implements ITreeDndListener {
+ @Override
+ public boolean isDragableNode(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_INTERFACE:
+ case TYPE_SERVICE_REGISTRATION:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public void validateTarget(DndEvent dndEvent) {
+ if (dndEvent.targetParent == null) {
+ dndEvent.doit = false;
+ return;
+ }
+ if (dndEvent.operation == DND.DROP_COPY) {
+ validateDropCopy(dndEvent);
+ }
+ else if (dndEvent.operation == DND.DROP_MOVE) {
+ validateDropMove(dndEvent);
+ }
+ }
+
+ private void validateDropCopy(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REGISTRATION:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+ }
+
+ private void validateDropMove(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REGISTRATION:
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_INTERFACE:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+
+ }
+
+ @Override
+ public void dndPerformed(DndEvent dndEvent) {
+ m_serviceNewWizardPage.pingStateChanging();
+ }
+ } // end class P_TreeDndListener
+
+ private class P_StatusRevalidator implements IStatusProvider {
+ @Override
+ public void validate(Object source, MultiStatus multiStatus) {
+ multiStatus.add(getStatusTypeNames());
+ multiStatus.add(getStatusServiceRegistration());
+ multiStatus.add(getStatusService());
+ }
+
+ protected IStatus getStatusTypeNames() {
+ // client
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplNode != null) {
+ String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_SERVICES) + "." + serviceImplNode.getText();
+ if (serviceImplementationBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ // client
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceBundle != null) {
+ ITreeNode serviceInterfaceNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceNode != null) {
+ String fqn = serviceInterfaceBundle.getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_SERVICES) + "." + serviceInterfaceNode.getText();
+ if (serviceInterfaceBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceInterfaceNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusService() {
+ // client
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ // client
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceBundle != null) {
+ if (!serviceImplementationBundle.isOnClasspath(serviceInterfaceBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistration() {
+ // client bundle
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ ITreeNode[] registrationNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REGISTRATION, true, true);
+ for (ITreeNode serviceRegNode : registrationNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceInterfaceBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceInterfaceBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ } // end class P_StatusRevalidator
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/CustomServiceNewPackageWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/CustomServiceNewPackageWizard.java
index 1dc961b55..6b067f0a0 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/CustomServiceNewPackageWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/CustomServiceNewPackageWizard.java
@@ -1,71 +1,71 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.services;
-
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.ui.wizards.NewPackageCreationWizard;
-import org.eclipse.jdt.ui.wizards.NewPackageWizardPage;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.operation.util.PackageNewOperation;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-
-@SuppressWarnings("restriction")
-public class CustomServiceNewPackageWizard extends NewPackageCreationWizard {
-
- private NewPackageWizardPage m_page1;
- private IJavaProject m_javaProject;
- private final IScoutBundle m_serverBundle;
-
- public CustomServiceNewPackageWizard(IScoutBundle serverBundle) throws JavaModelException {
- m_serverBundle = serverBundle;
- m_javaProject = getServerBundle().getJavaProject();
- }
-
- @Override
- public void addPages() {
- super.addPages();
- try {
- String srcPath = "/" + m_javaProject.getElementName() + "/" + SdkProperties.DEFAULT_SOURCE_FOLDER_NAME;
- m_page1 = (NewPackageWizardPage) getPages()[0];
-
- m_page1.setPackageFragmentRoot(m_javaProject.findPackageFragmentRoot(new Path(srcPath)), false);
- m_page1.setPackageText(getServerBundle().getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_CUSTOM), true);
- }
- catch (Exception e) {
- ScoutSdkUi.logError(e);
- performCancel();
- }
-
- }
-
- @Override
- public boolean performFinish() {
- String packageName = m_page1.getPackageText();
- PackageNewOperation packageNewOperation = new PackageNewOperation(m_javaProject, SdkProperties.DEFAULT_SOURCE_FOLDER_NAME, packageName);
- OperationJob job = new OperationJob(packageNewOperation);
- job.schedule();
- try {
- job.join();
- }
- catch (InterruptedException e) {
- ScoutSdkUi.logWarning(e);
- }
- return true;
- }
-
- public IScoutBundle getServerBundle() {
- return m_serverBundle;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.services;
+
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.ui.wizards.NewPackageCreationWizard;
+import org.eclipse.jdt.ui.wizards.NewPackageWizardPage;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.operation.util.PackageNewOperation;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+
+@SuppressWarnings("restriction")
+public class CustomServiceNewPackageWizard extends NewPackageCreationWizard {
+
+ private NewPackageWizardPage m_page1;
+ private IJavaProject m_javaProject;
+ private final IScoutBundle m_serverBundle;
+
+ public CustomServiceNewPackageWizard(IScoutBundle serverBundle) throws JavaModelException {
+ m_serverBundle = serverBundle;
+ m_javaProject = getServerBundle().getJavaProject();
+ }
+
+ @Override
+ public void addPages() {
+ super.addPages();
+ try {
+ String srcPath = "/" + m_javaProject.getElementName() + "/" + SdkProperties.DEFAULT_SOURCE_FOLDER_NAME;
+ m_page1 = (NewPackageWizardPage) getPages()[0];
+
+ m_page1.setPackageFragmentRoot(m_javaProject.findPackageFragmentRoot(new Path(srcPath)), false);
+ m_page1.setPackageText(getServerBundle().getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_CUSTOM), true);
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError(e);
+ performCancel();
+ }
+
+ }
+
+ @Override
+ public boolean performFinish() {
+ String packageName = m_page1.getPackageText();
+ PackageNewOperation packageNewOperation = new PackageNewOperation(m_javaProject, SdkProperties.DEFAULT_SOURCE_FOLDER_NAME, packageName);
+ OperationJob job = new OperationJob(packageNewOperation);
+ job.schedule();
+ try {
+ job.join();
+ }
+ catch (InterruptedException e) {
+ ScoutSdkUi.logWarning(e);
+ }
+ return true;
+ }
+
+ public IScoutBundle getServerBundle() {
+ return m_serverBundle;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/CustomServiceNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/CustomServiceNewWizard.java
index c43466ad4..c4a655aec 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/CustomServiceNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/CustomServiceNewWizard.java
@@ -1,345 +1,345 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.services;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.service.ServiceNewOperation;
-import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
-import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
-import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.IScoutProject;
-import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
-import org.eclipse.swt.dnd.DND;
-
-public class CustomServiceNewWizard extends AbstractWorkspaceWizard {
- public static final int TYPE_SERVICE_INTERFACE = 107;
- public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
- public static final int TYPE_SERVICE_REG_CLIENT = 109;
- public static final int TYPE_SERVICE_REG_SERVER = 110;
-
- private ServiceNewWizardPage m_serviceNewWizardPage;
- private BundleTreeWizardPage m_locationWizardPage;
- private ITreeNode m_locationWizardPageRoot;
- private ServiceNewOperation m_operation = new ServiceNewOperation();
- private final String m_customAppendix;
-
- public CustomServiceNewWizard(IScoutBundle serverBundle, IPackageFragment implPackage) {
- setWindowTitle(Texts.get("NewCustomService"));
- IScoutBundle bundle = ScoutTypeUtility.getScoutBundle(implPackage);
- m_customAppendix = implPackage.getElementName().replaceFirst(bundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_CUSTOM) + ".", "");
- P_StatusRevalidator statusProvider = new P_StatusRevalidator();
- m_serviceNewWizardPage = new ServiceNewWizardPage(Texts.get("NewCustomService"), Texts.get("CreateANewCustomService"), TypeUtility.getType(RuntimeClasses.IService), SdkProperties.SUFFIX_SERVICE);
- m_serviceNewWizardPage.setLocationBundle(serverBundle);
- m_serviceNewWizardPage.addStatusProvider(statusProvider);
- m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
- addPage(m_serviceNewWizardPage);
-
- m_locationWizardPageRoot = createTree(serverBundle);
- m_locationWizardPage = new BundleTreeWizardPage(Texts.get("CustomServiceLocation"), Texts.get("OrganiseLocations"), m_locationWizardPageRoot, new P_InitialCheckerFilter());
- m_locationWizardPage.addStatusProvider(statusProvider);
- m_locationWizardPage.addDndListener(new P_TreeDndListener());
- addPage(m_locationWizardPage);
-
- // init
- m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractService));
- }
-
- private ITreeNode createTree(IScoutBundle serverBundle) {
- IScoutBundle sharedBundle = null;
- IScoutBundle clientBundle = null;
- IScoutProject scoutProject = serverBundle.getScoutProject();
- while ((sharedBundle == null || clientBundle == null) && scoutProject != null) {
- sharedBundle = scoutProject.getSharedBundle();
- clientBundle = scoutProject.getClientBundle();
- scoutProject = scoutProject.getParentProject();
- }
- ITreeNode rootNode = TreeUtility.createBundleTree(serverBundle.getScoutProject(), NodeFilters.getAcceptAll());
- if (clientBundle != null) {
- ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(clientBundle));
- // service client reg
- TreeUtility.createNode(clientNode, TYPE_SERVICE_REG_CLIENT, Texts.get("ServiceProxyRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_CLIENT);
- }
- if (sharedBundle != null) {
- ITreeNode sharedNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(sharedBundle));
- // service interface
- TreeUtility.createNode(sharedNode, TYPE_SERVICE_INTERFACE, Texts.get("IService"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface), TYPE_SERVICE_INTERFACE);
- }
- if (serverBundle != null) {
- ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
- }
- return rootNode;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- IType superType = m_serviceNewWizardPage.getSuperType();
- if (superType != null) {
- m_operation.setServiceSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
- }
- IScoutBundle implementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (implementationBundle != null) {
- m_operation.setImplementationBundle(implementationBundle);
- m_operation.setServicePackageName(implementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_CUSTOM) + "." + m_customAppendix);
- m_operation.setServiceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
- }
- IScoutBundle[] regProxyLocations = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_CLIENT, true, true);
- for (IScoutBundle cb : regProxyLocations) {
- m_operation.addProxyRegistrationBundle(cb);
- }
- IScoutBundle[] serverRegBundles = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true);
- for (IScoutBundle sb : serverRegBundles) {
- m_operation.addServiceRegistrationBundle(sb);
- }
- IScoutBundle interfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (interfaceBundle != null) {
- m_operation.setInterfaceBundle(interfaceBundle);
- m_operation.setServiceInterfacePackageName(interfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_CUSTOM) + "." + m_customAppendix);
- }
- m_operation.setServiceInterfaceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE, true, true));
- m_operation.setServiceInterfaceSuperTypeSignature(Signature.createTypeSignature(RuntimeClasses.IService, true));
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
- try {
- m_operation.validate();
- m_operation.run(monitor, workingCopyManager);
- return true;
- }
- catch (IllegalArgumentException e) {
- ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
- return false;
- }
- catch (CoreException e) {
- ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
- return false;
- }
- }
-
- private class P_LocationPropertyListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
- String typeName = m_serviceNewWizardPage.getTypeName();
- if (!StringUtility.isNullOrEmpty(typeName)) {
- String prefix = typeName.replaceAll(SdkProperties.SUFFIX_SERVICE + "$", "");
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_SERVICE);
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_INTERFACE)).setText("I" + prefix + SdkProperties.SUFFIX_SERVICE);
- m_locationWizardPage.refreshTree();
- }
- m_locationWizardPage.pingStateChanging();
- }
- }
- } // end class P_LocationPropertyListener
-
- private class P_InitialCheckerFilter implements ITreeNodeFilter {
- @Override
- public boolean accept(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_INTERFACE:
- case TYPE_SERVICE_REG_CLIENT:
- case TYPE_SERVICE_REG_SERVER:
- return true;
-
- case IScoutBundle.BUNDLE_CLIENT:
- case IScoutBundle.BUNDLE_SHARED:
- case IScoutBundle.BUNDLE_SERVER:
- default:
- return false;
- }
- }
- } // end class P_InitialCheckerFilter
-
- private class P_TreeDndListener implements ITreeDndListener {
- @Override
- public boolean isDragableNode(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_INTERFACE:
- case TYPE_SERVICE_REG_CLIENT:
- case TYPE_SERVICE_REG_SERVER:
- return true;
- default:
- return false;
- }
- }
-
- @Override
- public void validateTarget(DndEvent dndEvent) {
- if (dndEvent.targetParent == null) {
- dndEvent.doit = false;
- return;
- }
- if (dndEvent.operation == DND.DROP_COPY) {
- validateDropCopy(dndEvent);
- }
- else if (dndEvent.operation == DND.DROP_MOVE) {
- validateDropMove(dndEvent);
- }
- }
-
- @Override
- public void dndPerformed(DndEvent dndEvent) {
-
- m_serviceNewWizardPage.pingStateChanging();
- }
-
- private void validateDropCopy(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REG_CLIENT:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
- }
-
- private void validateDropMove(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REG_CLIENT:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- case TYPE_SERVICE_INTERFACE:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SHARED;
- break;
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
-
- }
- } // end class P_TreeDndListener
-
- private class P_StatusRevalidator implements IStatusProvider {
-
- @Override
- public void validate(Object source, MultiStatus multiStatus) {
- multiStatus.add(getStatusService());
- multiStatus.add(getStatusServiceRegistrationClient());
- multiStatus.add(getStatusServiceRegistrationServer());
- multiStatus.add(getStatusTypeNames());
- }
-
- protected IStatus getStatusTypeNames() {
-
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplNode != null) {
- String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_CUSTOM) + "." + m_customAppendix + "." + serviceImplNode.getText();
- if (serviceImplementationBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceBundle != null) {
- ITreeNode serviceInterfaceNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceNode != null) {
-
- String fqn = serviceInterfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_CUSTOM) + "." + m_customAppendix + "." + serviceInterfaceNode.getText();
- if (serviceInterfaceBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceInterfaceNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusService() {
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceBundle != null) {
- if (!serviceImplementationBundle.isOnClasspath(serviceInterfaceBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistrationClient() {
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- ITreeNode[] serviceRegistrationClientNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_CLIENT, true, true);
- for (ITreeNode serviceRegNode : serviceRegistrationClientNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceInterfaceBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceInterfaceBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistrationServer() {
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- ITreeNode[] serviceRegistrationServerNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
- for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
-
- return Status.OK_STATUS;
- }
-
- } // end class P_StatusRevalidator
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.services;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.service.ServiceNewOperation;
+import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
+import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
+import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.IScoutProject;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
+import org.eclipse.swt.dnd.DND;
+
+public class CustomServiceNewWizard extends AbstractWorkspaceWizard {
+ public static final int TYPE_SERVICE_INTERFACE = 107;
+ public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
+ public static final int TYPE_SERVICE_REG_CLIENT = 109;
+ public static final int TYPE_SERVICE_REG_SERVER = 110;
+
+ private ServiceNewWizardPage m_serviceNewWizardPage;
+ private BundleTreeWizardPage m_locationWizardPage;
+ private ITreeNode m_locationWizardPageRoot;
+ private ServiceNewOperation m_operation = new ServiceNewOperation();
+ private final String m_customAppendix;
+
+ public CustomServiceNewWizard(IScoutBundle serverBundle, IPackageFragment implPackage) {
+ setWindowTitle(Texts.get("NewCustomService"));
+ IScoutBundle bundle = ScoutTypeUtility.getScoutBundle(implPackage);
+ m_customAppendix = implPackage.getElementName().replaceFirst(bundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_CUSTOM) + ".", "");
+ P_StatusRevalidator statusProvider = new P_StatusRevalidator();
+ m_serviceNewWizardPage = new ServiceNewWizardPage(Texts.get("NewCustomService"), Texts.get("CreateANewCustomService"), TypeUtility.getType(RuntimeClasses.IService), SdkProperties.SUFFIX_SERVICE);
+ m_serviceNewWizardPage.setLocationBundle(serverBundle);
+ m_serviceNewWizardPage.addStatusProvider(statusProvider);
+ m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
+ addPage(m_serviceNewWizardPage);
+
+ m_locationWizardPageRoot = createTree(serverBundle);
+ m_locationWizardPage = new BundleTreeWizardPage(Texts.get("CustomServiceLocation"), Texts.get("OrganiseLocations"), m_locationWizardPageRoot, new P_InitialCheckerFilter());
+ m_locationWizardPage.addStatusProvider(statusProvider);
+ m_locationWizardPage.addDndListener(new P_TreeDndListener());
+ addPage(m_locationWizardPage);
+
+ // init
+ m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractService));
+ }
+
+ private ITreeNode createTree(IScoutBundle serverBundle) {
+ IScoutBundle sharedBundle = null;
+ IScoutBundle clientBundle = null;
+ IScoutProject scoutProject = serverBundle.getScoutProject();
+ while ((sharedBundle == null || clientBundle == null) && scoutProject != null) {
+ sharedBundle = scoutProject.getSharedBundle();
+ clientBundle = scoutProject.getClientBundle();
+ scoutProject = scoutProject.getParentProject();
+ }
+ ITreeNode rootNode = TreeUtility.createBundleTree(serverBundle.getScoutProject(), NodeFilters.getAcceptAll());
+ if (clientBundle != null) {
+ ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(clientBundle));
+ // service client reg
+ TreeUtility.createNode(clientNode, TYPE_SERVICE_REG_CLIENT, Texts.get("ServiceProxyRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_CLIENT);
+ }
+ if (sharedBundle != null) {
+ ITreeNode sharedNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(sharedBundle));
+ // service interface
+ TreeUtility.createNode(sharedNode, TYPE_SERVICE_INTERFACE, Texts.get("IService"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface), TYPE_SERVICE_INTERFACE);
+ }
+ if (serverBundle != null) {
+ ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
+ }
+ return rootNode;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ IType superType = m_serviceNewWizardPage.getSuperType();
+ if (superType != null) {
+ m_operation.setServiceSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
+ }
+ IScoutBundle implementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (implementationBundle != null) {
+ m_operation.setImplementationBundle(implementationBundle);
+ m_operation.setServicePackageName(implementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_CUSTOM) + "." + m_customAppendix);
+ m_operation.setServiceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
+ }
+ IScoutBundle[] regProxyLocations = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_CLIENT, true, true);
+ for (IScoutBundle cb : regProxyLocations) {
+ m_operation.addProxyRegistrationBundle(cb);
+ }
+ IScoutBundle[] serverRegBundles = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true);
+ for (IScoutBundle sb : serverRegBundles) {
+ m_operation.addServiceRegistrationBundle(sb);
+ }
+ IScoutBundle interfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (interfaceBundle != null) {
+ m_operation.setInterfaceBundle(interfaceBundle);
+ m_operation.setServiceInterfacePackageName(interfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_CUSTOM) + "." + m_customAppendix);
+ }
+ m_operation.setServiceInterfaceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE, true, true));
+ m_operation.setServiceInterfaceSuperTypeSignature(Signature.createTypeSignature(RuntimeClasses.IService, true));
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
+ try {
+ m_operation.validate();
+ m_operation.run(monitor, workingCopyManager);
+ return true;
+ }
+ catch (IllegalArgumentException e) {
+ ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
+ return false;
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
+ return false;
+ }
+ }
+
+ private class P_LocationPropertyListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
+ String typeName = m_serviceNewWizardPage.getTypeName();
+ if (!StringUtility.isNullOrEmpty(typeName)) {
+ String prefix = typeName.replaceAll(SdkProperties.SUFFIX_SERVICE + "$", "");
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_SERVICE);
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_INTERFACE)).setText("I" + prefix + SdkProperties.SUFFIX_SERVICE);
+ m_locationWizardPage.refreshTree();
+ }
+ m_locationWizardPage.pingStateChanging();
+ }
+ }
+ } // end class P_LocationPropertyListener
+
+ private class P_InitialCheckerFilter implements ITreeNodeFilter {
+ @Override
+ public boolean accept(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_INTERFACE:
+ case TYPE_SERVICE_REG_CLIENT:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+
+ case IScoutBundle.BUNDLE_CLIENT:
+ case IScoutBundle.BUNDLE_SHARED:
+ case IScoutBundle.BUNDLE_SERVER:
+ default:
+ return false;
+ }
+ }
+ } // end class P_InitialCheckerFilter
+
+ private class P_TreeDndListener implements ITreeDndListener {
+ @Override
+ public boolean isDragableNode(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_INTERFACE:
+ case TYPE_SERVICE_REG_CLIENT:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public void validateTarget(DndEvent dndEvent) {
+ if (dndEvent.targetParent == null) {
+ dndEvent.doit = false;
+ return;
+ }
+ if (dndEvent.operation == DND.DROP_COPY) {
+ validateDropCopy(dndEvent);
+ }
+ else if (dndEvent.operation == DND.DROP_MOVE) {
+ validateDropMove(dndEvent);
+ }
+ }
+
+ @Override
+ public void dndPerformed(DndEvent dndEvent) {
+
+ m_serviceNewWizardPage.pingStateChanging();
+ }
+
+ private void validateDropCopy(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REG_CLIENT:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+ }
+
+ private void validateDropMove(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REG_CLIENT:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ case TYPE_SERVICE_INTERFACE:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SHARED;
+ break;
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+
+ }
+ } // end class P_TreeDndListener
+
+ private class P_StatusRevalidator implements IStatusProvider {
+
+ @Override
+ public void validate(Object source, MultiStatus multiStatus) {
+ multiStatus.add(getStatusService());
+ multiStatus.add(getStatusServiceRegistrationClient());
+ multiStatus.add(getStatusServiceRegistrationServer());
+ multiStatus.add(getStatusTypeNames());
+ }
+
+ protected IStatus getStatusTypeNames() {
+
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplNode != null) {
+ String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_CUSTOM) + "." + m_customAppendix + "." + serviceImplNode.getText();
+ if (serviceImplementationBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceBundle != null) {
+ ITreeNode serviceInterfaceNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceNode != null) {
+
+ String fqn = serviceInterfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_CUSTOM) + "." + m_customAppendix + "." + serviceInterfaceNode.getText();
+ if (serviceInterfaceBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceInterfaceNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusService() {
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceBundle != null) {
+ if (!serviceImplementationBundle.isOnClasspath(serviceInterfaceBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistrationClient() {
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ ITreeNode[] serviceRegistrationClientNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_CLIENT, true, true);
+ for (ITreeNode serviceRegNode : serviceRegistrationClientNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceInterfaceBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceInterfaceBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistrationServer() {
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ ITreeNode[] serviceRegistrationServerNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
+ for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ } // end class P_StatusRevalidator
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/LookupServiceNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/LookupServiceNewWizard.java
index 931fe9e9b..eeaa5596c 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/LookupServiceNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/LookupServiceNewWizard.java
@@ -1,339 +1,339 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.services;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.service.LookupServiceNewOperation;
-import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
-import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
-import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.IScoutProject;
-import org.eclipse.swt.dnd.DND;
-
-public class LookupServiceNewWizard extends AbstractWorkspaceWizard {
- public static final int TYPE_SERVICE_INTERFACE = 107;
- public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
- public static final int TYPE_SERVICE_REG_CLIENT = 109;
- public static final int TYPE_SERVICE_REG_SERVER = 110;
-
- private ServiceNewWizardPage m_serviceNewWizardPage;
- private BundleTreeWizardPage m_locationWizardPage;
- private ITreeNode m_locationWizardPageRoot;
- private LookupServiceNewOperation m_operation = new LookupServiceNewOperation();
-
- public LookupServiceNewWizard(IScoutBundle serverBundle) {
- setWindowTitle(Texts.get("NewLookupService"));
- P_StatusRevalidator statusProvider = new P_StatusRevalidator();
-
- m_serviceNewWizardPage = new ServiceNewWizardPage(Texts.get("NewLookupService"), Texts.get("CreateANewLookupService"), TypeUtility.getType(RuntimeClasses.ILookupService), SdkProperties.SUFFIX_LOOKUP_SERVICE);
- m_serviceNewWizardPage.setLocationBundle(serverBundle);
- m_serviceNewWizardPage.addStatusProvider(statusProvider);
- m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
- addPage(m_serviceNewWizardPage);
-
- m_locationWizardPageRoot = createTree(serverBundle);
- m_locationWizardPage = new BundleTreeWizardPage(Texts.get("LookupServiceLocation"), Texts.get("OrganiseLocations"), m_locationWizardPageRoot, new P_InitialCheckerFilter());
- m_locationWizardPage.addStatusProvider(statusProvider);
- m_locationWizardPage.addDndListener(new P_TreeDndListener());
- addPage(m_locationWizardPage);
-
- // init
- m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractSqlLookupService));
- }
-
- private ITreeNode createTree(IScoutBundle serverBundle) {
- IScoutBundle sharedBundle = null;
- IScoutBundle clientBundle = null;
- IScoutProject scoutProject = serverBundle.getScoutProject();
- while ((sharedBundle == null || clientBundle == null) && scoutProject != null) {
- sharedBundle = scoutProject.getSharedBundle();
- clientBundle = scoutProject.getClientBundle();
- scoutProject = scoutProject.getParentProject();
- }
- ITreeNode rootNode = TreeUtility.createBundleTree(serverBundle.getScoutProject(), NodeFilters.getAcceptAll());
- if (clientBundle != null) {
- ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(clientBundle));
- // service client reg
- TreeUtility.createNode(clientNode, TYPE_SERVICE_REG_CLIENT, Texts.get("ServiceProxyRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_CLIENT);
- }
-
- if (sharedBundle != null) {
- ITreeNode sharedNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(sharedBundle));
- // service interface
- TreeUtility.createNode(sharedNode, TYPE_SERVICE_INTERFACE, Texts.get("IService"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface), TYPE_SERVICE_INTERFACE);
- }
- if (serverBundle != null) {
- ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
- }
- return rootNode;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- IType superType = m_serviceNewWizardPage.getSuperType();
- if (superType != null) {
- m_operation.setServiceSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
- }
- IScoutBundle implementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (implementationBundle != null) {
- m_operation.setImplementationBundle(implementationBundle);
- m_operation.setServiceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
- }
- IScoutBundle[] regProxyLocations = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_CLIENT, true, true);
- for (IScoutBundle cb : regProxyLocations) {
- m_operation.addProxyRegistrationBundle(cb);
- }
- IScoutBundle[] serverRegBundles = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true);
- for (IScoutBundle sb : serverRegBundles) {
- m_operation.addServiceRegistrationBundle(sb);
- }
- IScoutBundle interfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (interfaceBundle != null) {
- m_operation.setInterfaceBundle(interfaceBundle);
- }
- m_operation.setServiceInterfaceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE, true, true));
- m_operation.setServiceInterfaceSuperTypeSignature(Signature.createTypeSignature(RuntimeClasses.ILookupService, true));
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
- try {
- m_operation.validate();
- m_operation.run(monitor, workingCopyManager);
- return true;
- }
- catch (IllegalArgumentException e) {
- ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
- return false;
- }
- catch (CoreException e) {
- ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
- return false;
- }
- }
-
- private class P_LocationPropertyListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
- String typeName = m_serviceNewWizardPage.getTypeName();
- if (!StringUtility.isNullOrEmpty(typeName)) {
- String prefix = typeName.replaceAll(SdkProperties.SUFFIX_LOOKUP_SERVICE + "$", "");
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_LOOKUP_SERVICE);
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_INTERFACE)).setText("I" + prefix + SdkProperties.SUFFIX_LOOKUP_SERVICE);
- m_locationWizardPage.refreshTree();
- }
- m_locationWizardPage.pingStateChanging();
- }
- }
- } // end class P_LocationPropertyListener
-
- private class P_InitialCheckerFilter implements ITreeNodeFilter {
- @Override
- public boolean accept(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_INTERFACE:
- case TYPE_SERVICE_REG_CLIENT:
- case TYPE_SERVICE_REG_SERVER:
- return true;
-
- case IScoutBundle.BUNDLE_CLIENT:
- case IScoutBundle.BUNDLE_SHARED:
- case IScoutBundle.BUNDLE_SERVER:
- default:
- return false;
- }
- }
- } // end class P_InitialCheckerFilter
-
- private class P_TreeDndListener implements ITreeDndListener {
- @Override
- public boolean isDragableNode(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_INTERFACE:
- case TYPE_SERVICE_REG_CLIENT:
- case TYPE_SERVICE_REG_SERVER:
- return true;
- default:
- return false;
- }
- }
-
- @Override
- public void validateTarget(DndEvent dndEvent) {
- if (dndEvent.targetParent == null) {
- dndEvent.doit = false;
- return;
- }
- if (dndEvent.operation == DND.DROP_COPY) {
- validateDropCopy(dndEvent);
- }
- else if (dndEvent.operation == DND.DROP_MOVE) {
- validateDropMove(dndEvent);
- }
- }
-
- @Override
- public void dndPerformed(DndEvent dndEvent) {
-
- m_serviceNewWizardPage.pingStateChanging();
- }
-
- private void validateDropCopy(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REG_CLIENT:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
- }
-
- private void validateDropMove(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REG_CLIENT:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- case TYPE_SERVICE_INTERFACE:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SHARED;
- break;
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
-
- }
- } // end class P_TreeDndListener
-
- private class P_StatusRevalidator implements IStatusProvider {
-
- @Override
- public void validate(Object source, MultiStatus multiStatus) {
- multiStatus.add(getStatusService());
- multiStatus.add(getStatusServiceRegistrationClient());
- multiStatus.add(getStatusServiceRegistrationServer());
- multiStatus.add(getStatusTypeNames());
- }
-
- protected IStatus getStatusTypeNames() {
-
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplNode != null) {
- String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_LOOKUP) + "." + serviceImplNode.getText();
- if (serviceImplementationBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceBundle != null) {
- ITreeNode serviceInterfaceNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceNode != null) {
- String fqn = serviceInterfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_LOOKUP) + "." + serviceInterfaceNode.getText();
- if (serviceInterfaceBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceInterfaceNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusService() {
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceBundle != null) {
- if (!serviceImplementationBundle.isOnClasspath(serviceInterfaceBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistrationClient() {
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- ITreeNode[] serviceRegistrationClientNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_CLIENT, true, true);
- for (ITreeNode serviceRegNode : serviceRegistrationClientNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceInterfaceBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceInterfaceBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistrationServer() {
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- ITreeNode[] serviceRegistrationServerNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
- for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
-
- return Status.OK_STATUS;
- }
-
- } // end class P_StatusRevalidator
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.services;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.service.LookupServiceNewOperation;
+import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
+import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
+import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.IScoutProject;
+import org.eclipse.swt.dnd.DND;
+
+public class LookupServiceNewWizard extends AbstractWorkspaceWizard {
+ public static final int TYPE_SERVICE_INTERFACE = 107;
+ public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
+ public static final int TYPE_SERVICE_REG_CLIENT = 109;
+ public static final int TYPE_SERVICE_REG_SERVER = 110;
+
+ private ServiceNewWizardPage m_serviceNewWizardPage;
+ private BundleTreeWizardPage m_locationWizardPage;
+ private ITreeNode m_locationWizardPageRoot;
+ private LookupServiceNewOperation m_operation = new LookupServiceNewOperation();
+
+ public LookupServiceNewWizard(IScoutBundle serverBundle) {
+ setWindowTitle(Texts.get("NewLookupService"));
+ P_StatusRevalidator statusProvider = new P_StatusRevalidator();
+
+ m_serviceNewWizardPage = new ServiceNewWizardPage(Texts.get("NewLookupService"), Texts.get("CreateANewLookupService"), TypeUtility.getType(RuntimeClasses.ILookupService), SdkProperties.SUFFIX_LOOKUP_SERVICE);
+ m_serviceNewWizardPage.setLocationBundle(serverBundle);
+ m_serviceNewWizardPage.addStatusProvider(statusProvider);
+ m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
+ addPage(m_serviceNewWizardPage);
+
+ m_locationWizardPageRoot = createTree(serverBundle);
+ m_locationWizardPage = new BundleTreeWizardPage(Texts.get("LookupServiceLocation"), Texts.get("OrganiseLocations"), m_locationWizardPageRoot, new P_InitialCheckerFilter());
+ m_locationWizardPage.addStatusProvider(statusProvider);
+ m_locationWizardPage.addDndListener(new P_TreeDndListener());
+ addPage(m_locationWizardPage);
+
+ // init
+ m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractSqlLookupService));
+ }
+
+ private ITreeNode createTree(IScoutBundle serverBundle) {
+ IScoutBundle sharedBundle = null;
+ IScoutBundle clientBundle = null;
+ IScoutProject scoutProject = serverBundle.getScoutProject();
+ while ((sharedBundle == null || clientBundle == null) && scoutProject != null) {
+ sharedBundle = scoutProject.getSharedBundle();
+ clientBundle = scoutProject.getClientBundle();
+ scoutProject = scoutProject.getParentProject();
+ }
+ ITreeNode rootNode = TreeUtility.createBundleTree(serverBundle.getScoutProject(), NodeFilters.getAcceptAll());
+ if (clientBundle != null) {
+ ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(clientBundle));
+ // service client reg
+ TreeUtility.createNode(clientNode, TYPE_SERVICE_REG_CLIENT, Texts.get("ServiceProxyRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_CLIENT);
+ }
+
+ if (sharedBundle != null) {
+ ITreeNode sharedNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(sharedBundle));
+ // service interface
+ TreeUtility.createNode(sharedNode, TYPE_SERVICE_INTERFACE, Texts.get("IService"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface), TYPE_SERVICE_INTERFACE);
+ }
+ if (serverBundle != null) {
+ ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
+ }
+ return rootNode;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ IType superType = m_serviceNewWizardPage.getSuperType();
+ if (superType != null) {
+ m_operation.setServiceSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
+ }
+ IScoutBundle implementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (implementationBundle != null) {
+ m_operation.setImplementationBundle(implementationBundle);
+ m_operation.setServiceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
+ }
+ IScoutBundle[] regProxyLocations = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_CLIENT, true, true);
+ for (IScoutBundle cb : regProxyLocations) {
+ m_operation.addProxyRegistrationBundle(cb);
+ }
+ IScoutBundle[] serverRegBundles = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true);
+ for (IScoutBundle sb : serverRegBundles) {
+ m_operation.addServiceRegistrationBundle(sb);
+ }
+ IScoutBundle interfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (interfaceBundle != null) {
+ m_operation.setInterfaceBundle(interfaceBundle);
+ }
+ m_operation.setServiceInterfaceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE, true, true));
+ m_operation.setServiceInterfaceSuperTypeSignature(Signature.createTypeSignature(RuntimeClasses.ILookupService, true));
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
+ try {
+ m_operation.validate();
+ m_operation.run(monitor, workingCopyManager);
+ return true;
+ }
+ catch (IllegalArgumentException e) {
+ ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
+ return false;
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
+ return false;
+ }
+ }
+
+ private class P_LocationPropertyListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
+ String typeName = m_serviceNewWizardPage.getTypeName();
+ if (!StringUtility.isNullOrEmpty(typeName)) {
+ String prefix = typeName.replaceAll(SdkProperties.SUFFIX_LOOKUP_SERVICE + "$", "");
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_LOOKUP_SERVICE);
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_INTERFACE)).setText("I" + prefix + SdkProperties.SUFFIX_LOOKUP_SERVICE);
+ m_locationWizardPage.refreshTree();
+ }
+ m_locationWizardPage.pingStateChanging();
+ }
+ }
+ } // end class P_LocationPropertyListener
+
+ private class P_InitialCheckerFilter implements ITreeNodeFilter {
+ @Override
+ public boolean accept(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_INTERFACE:
+ case TYPE_SERVICE_REG_CLIENT:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+
+ case IScoutBundle.BUNDLE_CLIENT:
+ case IScoutBundle.BUNDLE_SHARED:
+ case IScoutBundle.BUNDLE_SERVER:
+ default:
+ return false;
+ }
+ }
+ } // end class P_InitialCheckerFilter
+
+ private class P_TreeDndListener implements ITreeDndListener {
+ @Override
+ public boolean isDragableNode(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_INTERFACE:
+ case TYPE_SERVICE_REG_CLIENT:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public void validateTarget(DndEvent dndEvent) {
+ if (dndEvent.targetParent == null) {
+ dndEvent.doit = false;
+ return;
+ }
+ if (dndEvent.operation == DND.DROP_COPY) {
+ validateDropCopy(dndEvent);
+ }
+ else if (dndEvent.operation == DND.DROP_MOVE) {
+ validateDropMove(dndEvent);
+ }
+ }
+
+ @Override
+ public void dndPerformed(DndEvent dndEvent) {
+
+ m_serviceNewWizardPage.pingStateChanging();
+ }
+
+ private void validateDropCopy(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REG_CLIENT:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+ }
+
+ private void validateDropMove(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REG_CLIENT:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ case TYPE_SERVICE_INTERFACE:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SHARED;
+ break;
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+
+ }
+ } // end class P_TreeDndListener
+
+ private class P_StatusRevalidator implements IStatusProvider {
+
+ @Override
+ public void validate(Object source, MultiStatus multiStatus) {
+ multiStatus.add(getStatusService());
+ multiStatus.add(getStatusServiceRegistrationClient());
+ multiStatus.add(getStatusServiceRegistrationServer());
+ multiStatus.add(getStatusTypeNames());
+ }
+
+ protected IStatus getStatusTypeNames() {
+
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplNode != null) {
+ String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_LOOKUP) + "." + serviceImplNode.getText();
+ if (serviceImplementationBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceBundle != null) {
+ ITreeNode serviceInterfaceNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceNode != null) {
+ String fqn = serviceInterfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_LOOKUP) + "." + serviceInterfaceNode.getText();
+ if (serviceInterfaceBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceInterfaceNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusService() {
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceBundle != null) {
+ if (!serviceImplementationBundle.isOnClasspath(serviceInterfaceBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistrationClient() {
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ ITreeNode[] serviceRegistrationClientNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_CLIENT, true, true);
+ for (ITreeNode serviceRegNode : serviceRegistrationClientNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceInterfaceBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceInterfaceBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistrationServer() {
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ ITreeNode[] serviceRegistrationServerNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
+ for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ } // end class P_StatusRevalidator
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/OutlineServiceNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/OutlineServiceNewWizard.java
index be981d414..6069f47c9 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/OutlineServiceNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/OutlineServiceNewWizard.java
@@ -1,341 +1,341 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.services;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.service.ServiceNewOperation;
-import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
-import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
-import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.IScoutProject;
-import org.eclipse.swt.dnd.DND;
-
-public class OutlineServiceNewWizard extends AbstractWorkspaceWizard {
- public static final int TYPE_SERVICE_INTERFACE = 107;
- public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
- public static final int TYPE_SERVICE_REG_CLIENT = 109;
- public static final int TYPE_SERVICE_REG_SERVER = 110;
-
- private ServiceNewWizardPage m_serviceNewWizardPage;
- private BundleTreeWizardPage m_locationWizardPage;
- private ITreeNode m_locationWizardPageRoot;
- private ServiceNewOperation m_operation = new ServiceNewOperation();
-
- public OutlineServiceNewWizard(IScoutBundle serverBundle) {
- setWindowTitle(Texts.get("NewOutlineService"));
- P_StatusRevalidator statusProvider = new P_StatusRevalidator();
-
- m_serviceNewWizardPage = new ServiceNewWizardPage(Texts.get("NewOutlineService"), Texts.get("CreateANewOutlineService"), TypeUtility.getType(RuntimeClasses.IService), SdkProperties.SUFFIX_OUTLINE_SERVICE);
- m_serviceNewWizardPage.setLocationBundle(serverBundle);
- m_serviceNewWizardPage.addStatusProvider(statusProvider);
- m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
- addPage(m_serviceNewWizardPage);
-
- m_locationWizardPageRoot = createTree(serverBundle);
- m_locationWizardPage = new BundleTreeWizardPage(Texts.get("OutlineServiceLocation"), Texts.get("OrganiseLocations"), m_locationWizardPageRoot, new P_InitialCheckerFilter());
- m_locationWizardPage.addStatusProvider(statusProvider);
- m_locationWizardPage.addDndListener(new P_TreeDndListener());
- addPage(m_locationWizardPage);
-
- // init
- m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractService));
- }
-
- private ITreeNode createTree(IScoutBundle serverBundle) {
- IScoutBundle sharedBundle = null;
- IScoutBundle clientBundle = null;
- IScoutProject scoutProject = serverBundle.getScoutProject();
- while ((sharedBundle == null || clientBundle == null) && scoutProject != null) {
- sharedBundle = scoutProject.getSharedBundle();
- clientBundle = scoutProject.getClientBundle();
- scoutProject = scoutProject.getParentProject();
- }
- ITreeNode rootNode = TreeUtility.createBundleTree(serverBundle.getScoutProject(), NodeFilters.getAcceptAll());
- if (clientBundle != null) {
- ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(clientBundle));
- // service client reg
- TreeUtility.createNode(clientNode, TYPE_SERVICE_REG_CLIENT, Texts.get("ServiceProxyRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_CLIENT);
- }
-
- if (sharedBundle != null) {
- ITreeNode sharedNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(sharedBundle));
- // service interface
- TreeUtility.createNode(sharedNode, TYPE_SERVICE_INTERFACE, Texts.get("IService"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface), TYPE_SERVICE_INTERFACE);
- }
- if (serverBundle != null) {
- ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
- }
- return rootNode;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- IType superType = m_serviceNewWizardPage.getSuperType();
- if (superType != null) {
- m_operation.setServiceSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
- }
- IScoutBundle implementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (implementationBundle != null) {
- m_operation.setImplementationBundle(implementationBundle);
- m_operation.setServicePackageName(implementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_OUTLINE));
- m_operation.setServiceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
- }
- IScoutBundle[] regProxyLocations = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_CLIENT, true, true);
- for (IScoutBundle cb : regProxyLocations) {
- m_operation.addProxyRegistrationBundle(cb);
- }
- IScoutBundle[] serverRegBundles = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true);
- for (IScoutBundle sb : serverRegBundles) {
- m_operation.addServiceRegistrationBundle(sb);
- }
- IScoutBundle interfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (interfaceBundle != null) {
- m_operation.setInterfaceBundle(interfaceBundle);
- m_operation.setServiceInterfacePackageName(interfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_OUTLINE));
- }
- m_operation.setServiceInterfaceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE, true, true));
- m_operation.setServiceInterfaceSuperTypeSignature(Signature.createTypeSignature(RuntimeClasses.IService, true));
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
- try {
- m_operation.validate();
- m_operation.run(monitor, workingCopyManager);
- return true;
- }
- catch (IllegalArgumentException e) {
- ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
- return false;
- }
- catch (CoreException e) {
- ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
- return false;
- }
- }
-
- private class P_LocationPropertyListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
- String typeName = m_serviceNewWizardPage.getTypeName();
- if (!StringUtility.isNullOrEmpty(typeName)) {
- String prefix = typeName.replaceAll(SdkProperties.SUFFIX_OUTLINE_SERVICE + "$", "");
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_OUTLINE_SERVICE);
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_INTERFACE)).setText("I" + prefix + SdkProperties.SUFFIX_OUTLINE_SERVICE);
- m_locationWizardPage.refreshTree();
- }
- m_locationWizardPage.pingStateChanging();
- }
- }
- } // end class P_LocationPropertyListener
-
- private class P_InitialCheckerFilter implements ITreeNodeFilter {
- @Override
- public boolean accept(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_INTERFACE:
- case TYPE_SERVICE_REG_CLIENT:
- case TYPE_SERVICE_REG_SERVER:
- return true;
-
- case IScoutBundle.BUNDLE_CLIENT:
- case IScoutBundle.BUNDLE_SHARED:
- case IScoutBundle.BUNDLE_SERVER:
- default:
- return false;
- }
- }
- } // end class P_InitialCheckerFilter
-
- private class P_TreeDndListener implements ITreeDndListener {
- @Override
- public boolean isDragableNode(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_INTERFACE:
- case TYPE_SERVICE_REG_CLIENT:
- case TYPE_SERVICE_REG_SERVER:
- return true;
- default:
- return false;
- }
- }
-
- @Override
- public void validateTarget(DndEvent dndEvent) {
- if (dndEvent.targetParent == null) {
- dndEvent.doit = false;
- return;
- }
- if (dndEvent.operation == DND.DROP_COPY) {
- validateDropCopy(dndEvent);
- }
- else if (dndEvent.operation == DND.DROP_MOVE) {
- validateDropMove(dndEvent);
- }
- }
-
- @Override
- public void dndPerformed(DndEvent dndEvent) {
-
- m_serviceNewWizardPage.pingStateChanging();
- }
-
- private void validateDropCopy(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REG_CLIENT:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
- }
-
- private void validateDropMove(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REG_CLIENT:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- case TYPE_SERVICE_INTERFACE:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SHARED;
- break;
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
-
- }
- } // end class P_TreeDndListener
-
- private class P_StatusRevalidator implements IStatusProvider {
-
- @Override
- public void validate(Object source, MultiStatus multiStatus) {
- multiStatus.add(getStatusService());
- multiStatus.add(getStatusServiceRegistrationClient());
- multiStatus.add(getStatusServiceRegistrationServer());
- multiStatus.add(getStatusTypeNames());
- }
-
- protected IStatus getStatusTypeNames() {
-
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplNode != null) {
- String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_OUTLINE) + "." + serviceImplNode.getText();
- if (serviceImplementationBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceBundle != null) {
- ITreeNode serviceInterfaceNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceNode != null) {
- String fqn = serviceInterfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_OUTLINE) + "." + serviceInterfaceNode.getText();
- if (serviceInterfaceBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceInterfaceNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusService() {
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceBundle != null) {
- if (!serviceImplementationBundle.isOnClasspath(serviceInterfaceBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistrationClient() {
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- ITreeNode[] serviceRegistrationClientNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_CLIENT, true, true);
- for (ITreeNode serviceRegNode : serviceRegistrationClientNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceInterfaceBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceInterfaceBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistrationServer() {
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- ITreeNode[] serviceRegistrationServerNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
- for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
-
- return Status.OK_STATUS;
- }
-
- } // end class P_StatusRevalidator
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.services;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.service.ServiceNewOperation;
+import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
+import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
+import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.IScoutProject;
+import org.eclipse.swt.dnd.DND;
+
+public class OutlineServiceNewWizard extends AbstractWorkspaceWizard {
+ public static final int TYPE_SERVICE_INTERFACE = 107;
+ public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
+ public static final int TYPE_SERVICE_REG_CLIENT = 109;
+ public static final int TYPE_SERVICE_REG_SERVER = 110;
+
+ private ServiceNewWizardPage m_serviceNewWizardPage;
+ private BundleTreeWizardPage m_locationWizardPage;
+ private ITreeNode m_locationWizardPageRoot;
+ private ServiceNewOperation m_operation = new ServiceNewOperation();
+
+ public OutlineServiceNewWizard(IScoutBundle serverBundle) {
+ setWindowTitle(Texts.get("NewOutlineService"));
+ P_StatusRevalidator statusProvider = new P_StatusRevalidator();
+
+ m_serviceNewWizardPage = new ServiceNewWizardPage(Texts.get("NewOutlineService"), Texts.get("CreateANewOutlineService"), TypeUtility.getType(RuntimeClasses.IService), SdkProperties.SUFFIX_OUTLINE_SERVICE);
+ m_serviceNewWizardPage.setLocationBundle(serverBundle);
+ m_serviceNewWizardPage.addStatusProvider(statusProvider);
+ m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
+ addPage(m_serviceNewWizardPage);
+
+ m_locationWizardPageRoot = createTree(serverBundle);
+ m_locationWizardPage = new BundleTreeWizardPage(Texts.get("OutlineServiceLocation"), Texts.get("OrganiseLocations"), m_locationWizardPageRoot, new P_InitialCheckerFilter());
+ m_locationWizardPage.addStatusProvider(statusProvider);
+ m_locationWizardPage.addDndListener(new P_TreeDndListener());
+ addPage(m_locationWizardPage);
+
+ // init
+ m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractService));
+ }
+
+ private ITreeNode createTree(IScoutBundle serverBundle) {
+ IScoutBundle sharedBundle = null;
+ IScoutBundle clientBundle = null;
+ IScoutProject scoutProject = serverBundle.getScoutProject();
+ while ((sharedBundle == null || clientBundle == null) && scoutProject != null) {
+ sharedBundle = scoutProject.getSharedBundle();
+ clientBundle = scoutProject.getClientBundle();
+ scoutProject = scoutProject.getParentProject();
+ }
+ ITreeNode rootNode = TreeUtility.createBundleTree(serverBundle.getScoutProject(), NodeFilters.getAcceptAll());
+ if (clientBundle != null) {
+ ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(clientBundle));
+ // service client reg
+ TreeUtility.createNode(clientNode, TYPE_SERVICE_REG_CLIENT, Texts.get("ServiceProxyRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_CLIENT);
+ }
+
+ if (sharedBundle != null) {
+ ITreeNode sharedNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(sharedBundle));
+ // service interface
+ TreeUtility.createNode(sharedNode, TYPE_SERVICE_INTERFACE, Texts.get("IService"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface), TYPE_SERVICE_INTERFACE);
+ }
+ if (serverBundle != null) {
+ ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
+ }
+ return rootNode;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ IType superType = m_serviceNewWizardPage.getSuperType();
+ if (superType != null) {
+ m_operation.setServiceSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
+ }
+ IScoutBundle implementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (implementationBundle != null) {
+ m_operation.setImplementationBundle(implementationBundle);
+ m_operation.setServicePackageName(implementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_OUTLINE));
+ m_operation.setServiceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
+ }
+ IScoutBundle[] regProxyLocations = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_CLIENT, true, true);
+ for (IScoutBundle cb : regProxyLocations) {
+ m_operation.addProxyRegistrationBundle(cb);
+ }
+ IScoutBundle[] serverRegBundles = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true);
+ for (IScoutBundle sb : serverRegBundles) {
+ m_operation.addServiceRegistrationBundle(sb);
+ }
+ IScoutBundle interfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (interfaceBundle != null) {
+ m_operation.setInterfaceBundle(interfaceBundle);
+ m_operation.setServiceInterfacePackageName(interfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_OUTLINE));
+ }
+ m_operation.setServiceInterfaceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE, true, true));
+ m_operation.setServiceInterfaceSuperTypeSignature(Signature.createTypeSignature(RuntimeClasses.IService, true));
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
+ try {
+ m_operation.validate();
+ m_operation.run(monitor, workingCopyManager);
+ return true;
+ }
+ catch (IllegalArgumentException e) {
+ ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
+ return false;
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
+ return false;
+ }
+ }
+
+ private class P_LocationPropertyListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
+ String typeName = m_serviceNewWizardPage.getTypeName();
+ if (!StringUtility.isNullOrEmpty(typeName)) {
+ String prefix = typeName.replaceAll(SdkProperties.SUFFIX_OUTLINE_SERVICE + "$", "");
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_OUTLINE_SERVICE);
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_INTERFACE)).setText("I" + prefix + SdkProperties.SUFFIX_OUTLINE_SERVICE);
+ m_locationWizardPage.refreshTree();
+ }
+ m_locationWizardPage.pingStateChanging();
+ }
+ }
+ } // end class P_LocationPropertyListener
+
+ private class P_InitialCheckerFilter implements ITreeNodeFilter {
+ @Override
+ public boolean accept(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_INTERFACE:
+ case TYPE_SERVICE_REG_CLIENT:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+
+ case IScoutBundle.BUNDLE_CLIENT:
+ case IScoutBundle.BUNDLE_SHARED:
+ case IScoutBundle.BUNDLE_SERVER:
+ default:
+ return false;
+ }
+ }
+ } // end class P_InitialCheckerFilter
+
+ private class P_TreeDndListener implements ITreeDndListener {
+ @Override
+ public boolean isDragableNode(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_INTERFACE:
+ case TYPE_SERVICE_REG_CLIENT:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public void validateTarget(DndEvent dndEvent) {
+ if (dndEvent.targetParent == null) {
+ dndEvent.doit = false;
+ return;
+ }
+ if (dndEvent.operation == DND.DROP_COPY) {
+ validateDropCopy(dndEvent);
+ }
+ else if (dndEvent.operation == DND.DROP_MOVE) {
+ validateDropMove(dndEvent);
+ }
+ }
+
+ @Override
+ public void dndPerformed(DndEvent dndEvent) {
+
+ m_serviceNewWizardPage.pingStateChanging();
+ }
+
+ private void validateDropCopy(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REG_CLIENT:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+ }
+
+ private void validateDropMove(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REG_CLIENT:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ case TYPE_SERVICE_INTERFACE:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SHARED;
+ break;
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+
+ }
+ } // end class P_TreeDndListener
+
+ private class P_StatusRevalidator implements IStatusProvider {
+
+ @Override
+ public void validate(Object source, MultiStatus multiStatus) {
+ multiStatus.add(getStatusService());
+ multiStatus.add(getStatusServiceRegistrationClient());
+ multiStatus.add(getStatusServiceRegistrationServer());
+ multiStatus.add(getStatusTypeNames());
+ }
+
+ protected IStatus getStatusTypeNames() {
+
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplNode != null) {
+ String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_OUTLINE) + "." + serviceImplNode.getText();
+ if (serviceImplementationBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceBundle != null) {
+ ITreeNode serviceInterfaceNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceNode != null) {
+ String fqn = serviceInterfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_OUTLINE) + "." + serviceInterfaceNode.getText();
+ if (serviceInterfaceBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceInterfaceNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusService() {
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceBundle != null) {
+ if (!serviceImplementationBundle.isOnClasspath(serviceInterfaceBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistrationClient() {
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ ITreeNode[] serviceRegistrationClientNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_CLIENT, true, true);
+ for (ITreeNode serviceRegNode : serviceRegistrationClientNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceInterfaceBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceInterfaceBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistrationServer() {
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ ITreeNode[] serviceRegistrationServerNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
+ for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ } // end class P_StatusRevalidator
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ProcessServiceNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ProcessServiceNewWizard.java
index 67c185e15..a0d56000e 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ProcessServiceNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ProcessServiceNewWizard.java
@@ -1,390 +1,390 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.services;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.service.ProcessServiceNewOperation;
-import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
-import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
-import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.IScoutProject;
-import org.eclipse.swt.dnd.DND;
-
-public class ProcessServiceNewWizard extends AbstractWorkspaceWizard {
- public static final int TYPE_PERMISSION_CREATE = 104;
- public static final int TYPE_PERMISSION_READ = 105;
- public static final int TYPE_PERMISSION_UPDATE = 106;
- public static final int TYPE_SERVICE_INTERFACE = 107;
- public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
- public static final int TYPE_SERVICE_REG_CLIENT = 109;
- public static final int TYPE_SERVICE_REG_SERVER = 110;
-
- final IType abstractService = TypeUtility.getType(RuntimeClasses.AbstractService);
-
- private BundleTreeWizardPage m_locationWizardPage;
- private ProcessServiceNewWizardPage m_serviceNewWizardPage;
- private ProcessServiceNewOperation m_operation = new ProcessServiceNewOperation();
- private ITreeNode m_locationWizardPageRoot;
-
- public ProcessServiceNewWizard(IScoutBundle serverBundle) {
- setWindowTitle(Texts.get("NewProcessService"));
- P_StatusRevalidator statusProvider = new P_StatusRevalidator();
- m_serviceNewWizardPage = new ProcessServiceNewWizardPage();
- m_serviceNewWizardPage.setServerBundle(serverBundle);
- m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
- addPage(m_serviceNewWizardPage);
- m_locationWizardPageRoot = createTree(serverBundle);
- m_locationWizardPage = new BundleTreeWizardPage(Texts.get("ProcessServiceLocation"), Texts.get("OrganiseLocations"), m_locationWizardPageRoot, new P_InitialCheckerFilter());
- m_locationWizardPage.addStatusProvider(statusProvider);
- m_locationWizardPage.addDndListener(new P_TreeDndListener());
- addPage(m_locationWizardPage);
- // init
- m_serviceNewWizardPage.setSuperType(abstractService);
- }
-
- private ITreeNode createTree(IScoutBundle serverBundle) {
- IScoutBundle sharedBundle = null;
- IScoutBundle clientBundle = null;
- IScoutProject scoutProject = serverBundle.getScoutProject();
- while ((sharedBundle == null || clientBundle == null) && scoutProject != null) {
- sharedBundle = scoutProject.getSharedBundle();
- clientBundle = scoutProject.getClientBundle();
- scoutProject = scoutProject.getParentProject();
- }
- ITreeNode rootNode = TreeUtility.createBundleTree(serverBundle.getScoutProject(), NodeFilters.getAcceptAll());
- if (clientBundle != null) {
- ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(clientBundle));
- // service client reg
- TreeUtility.createNode(clientNode, TYPE_SERVICE_REG_CLIENT, Texts.get("ServiceProxyRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_CLIENT);
- }
- if (sharedBundle != null) {
- ITreeNode sharedNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(sharedBundle));
- // permission create
- TreeUtility.createNode(sharedNode, TYPE_PERMISSION_CREATE, Texts.get("CreatePermission"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_PERMISSION_CREATE);
- // permission read
- TreeUtility.createNode(sharedNode, TYPE_PERMISSION_READ, Texts.get("ReadPermission"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_PERMISSION_READ);
- // permission update
- TreeUtility.createNode(sharedNode, TYPE_PERMISSION_UPDATE, Texts.get("UpdatePermission"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_PERMISSION_UPDATE);
- // service interface
- TreeUtility.createNode(sharedNode, TYPE_SERVICE_INTERFACE, Texts.get("IService"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface), TYPE_SERVICE_INTERFACE);
- }
- if (serverBundle != null) {
- ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
- }
- return rootNode;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_serviceNewWizardPage.fillProcessServiceNewOperation(m_operation);
- m_operation.setClientServiceRegistryBundles(m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_CLIENT, true, true));
- m_operation.setPermissionCreateBundle(m_locationWizardPage.getLocationBundle(TYPE_PERMISSION_CREATE, true, true));
- m_operation.setPermissionCreateName(m_locationWizardPage.getTextOfNode(TYPE_PERMISSION_CREATE, true, true));
- m_operation.setPermissionReadBundle(m_locationWizardPage.getLocationBundle(TYPE_PERMISSION_READ, true, true));
- m_operation.setPermissionReadName(m_locationWizardPage.getTextOfNode(TYPE_PERMISSION_READ, true, true));
- m_operation.setPermissionUpdateBundle(m_locationWizardPage.getLocationBundle(TYPE_PERMISSION_UPDATE, true, true));
- m_operation.setPermissionUpdateName(m_locationWizardPage.getTextOfNode(TYPE_PERMISSION_UPDATE, true, true));
- m_operation.setServerServiceRegistryBundles(m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true));
- m_operation.setServiceImplementationBundle(m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true));
- m_operation.setServiceImplementationName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
- m_operation.setServiceInterfaceBundle(m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true));
- m_operation.setServiceInterfaceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE, true, true));
-
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
- try {
- m_operation.validate();
- m_operation.run(monitor, workingCopyManager);
- return true;
- }
- catch (IllegalArgumentException e) {
- ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
- return false;
- }
- catch (CoreException e) {
- ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
- return false;
- }
- }
-
- private class P_LocationPropertyListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
- String typeName = m_serviceNewWizardPage.getTypeName();
- if (!StringUtility.isNullOrEmpty(typeName)) {
- String prefix = typeName.replaceAll(SdkProperties.SUFFIX_PROCESS_SERVICE + "$", "");
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_PERMISSION_CREATE)).setText("Create" + prefix + SdkProperties.SUFFIX_PERMISSION);
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_PERMISSION_READ)).setText("Read" + prefix + SdkProperties.SUFFIX_PERMISSION);
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_PERMISSION_UPDATE)).setText("Update" + prefix + SdkProperties.SUFFIX_PERMISSION);
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_PROCESS_SERVICE);
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_INTERFACE)).setText("I" + prefix + SdkProperties.SUFFIX_PROCESS_SERVICE);
- m_locationWizardPage.refreshTree();
- }
- m_locationWizardPage.pingStateChanging();
- }
- }
- } // end class P_LocationPropertyListener
-
- private class P_InitialCheckerFilter implements ITreeNodeFilter {
- @Override
- public boolean accept(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_PERMISSION_CREATE:
- case TYPE_PERMISSION_READ:
- case TYPE_PERMISSION_UPDATE:
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_INTERFACE:
- case TYPE_SERVICE_REG_CLIENT:
- case TYPE_SERVICE_REG_SERVER:
- return true;
- case IScoutBundle.BUNDLE_CLIENT:
- case IScoutBundle.BUNDLE_SHARED:
- case IScoutBundle.BUNDLE_SERVER:
- default:
- return false;
- }
- }
- } // end class P_InitialCheckerFilter
-
- private class P_TreeDndListener implements ITreeDndListener {
- @Override
- public boolean isDragableNode(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_PERMISSION_CREATE:
- case TYPE_PERMISSION_READ:
- case TYPE_PERMISSION_UPDATE:
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_INTERFACE:
- case TYPE_SERVICE_REG_CLIENT:
- case TYPE_SERVICE_REG_SERVER:
- return true;
- default:
- return false;
- }
- }
-
- @Override
- public void validateTarget(DndEvent dndEvent) {
- if (dndEvent.targetParent == null) {
- dndEvent.doit = false;
- return;
- }
- if (dndEvent.operation == DND.DROP_COPY) {
- validateDropCopy(dndEvent);
- }
- else if (dndEvent.operation == DND.DROP_MOVE) {
- validateDropMove(dndEvent);
- }
- }
-
- @Override
- public void dndPerformed(DndEvent dndEvent) {
-
- m_serviceNewWizardPage.pingStateChanging();
- }
-
- private void validateDropCopy(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REG_CLIENT:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
- }
-
- private void validateDropMove(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REG_CLIENT:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
- break;
- case TYPE_PERMISSION_CREATE:
- case TYPE_PERMISSION_READ:
- case TYPE_PERMISSION_UPDATE:
- case TYPE_SERVICE_INTERFACE:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SHARED;
- break;
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
-
- }
- } // end class P_TreeDndListener
-
- private class P_StatusRevalidator implements IStatusProvider {
-
- @Override
- public void validate(Object source, MultiStatus multiStatus) {
- multiStatus.add(getStatusTypeNames());
- multiStatus.add(getStatusService());
- multiStatus.add(getStatusServiceRegistrationClient());
- multiStatus.add(getStatusServiceRegistrationServer());
- }
-
- protected IStatus getStatusTypeNames() {
-
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplNode != null) {
- String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_PROCESS) + "." + serviceImplNode.getText();
- if (serviceImplementationBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceBundle != null) {
- ITreeNode serviceInterfaceNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceNode != null) {
- String fqn = serviceInterfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_PROCESS) + "." + serviceInterfaceNode.getText();
- if (serviceInterfaceBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceInterfaceNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- // permission read
- IStatus createStatus = getStatusPermission(TYPE_PERMISSION_CREATE);
- if (createStatus != Status.OK_STATUS) {
- return createStatus;
- }
- IStatus readStatus = getStatusPermission(TYPE_PERMISSION_READ);
- if (readStatus != Status.OK_STATUS) {
- return readStatus;
- }
- IStatus updateStatus = getStatusPermission(TYPE_PERMISSION_UPDATE);
- if (updateStatus != Status.OK_STATUS) {
- return updateStatus;
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusPermission(int permissionType) {
- IScoutBundle permissionBundle = m_locationWizardPage.getLocationBundle(permissionType, true, true);
- if (permissionBundle != null) {
- ITreeNode permissionNode = m_locationWizardPage.getTreeNode(permissionType, true, true);
- if (permissionNode != null) {
- String fqn = permissionBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SECURITY) + "." + permissionNode.getText();
- if (permissionBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + permissionNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusService() {
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- if (serviceInterfaceBundle != null) {
- if (!serviceImplementationBundle.isOnClasspath(serviceInterfaceBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
- }
- }
- IScoutBundle permissionCreateBundle = m_locationWizardPage.getLocationBundle(TYPE_PERMISSION_CREATE, true, true);
- if (permissionCreateBundle != null) {
- if (!serviceImplementationBundle.isOnClasspath(permissionCreateBundle)) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_PERMISSION_CREATE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
- }
- }
- IScoutBundle permissionReadBundle = m_locationWizardPage.getLocationBundle(TYPE_PERMISSION_READ, true, true);
- if (permissionReadBundle != null) {
- if (!serviceImplementationBundle.isOnClasspath(permissionReadBundle)) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_PERMISSION_READ), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
- }
- }
- IScoutBundle permissionUpdateBundle = m_locationWizardPage.getLocationBundle(TYPE_PERMISSION_UPDATE, true, true);
- if (permissionUpdateBundle != null) {
- if (!serviceImplementationBundle.isOnClasspath(permissionUpdateBundle)) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_PERMISSION_UPDATE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistrationClient() {
- IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
- ITreeNode[] serviceRegistrationClientNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_CLIENT, true, true);
- for (ITreeNode serviceRegNode : serviceRegistrationClientNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceInterfaceBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceInterfaceBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistrationServer() {
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- ITreeNode[] serviceRegistrationServerNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
- for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
-
- return Status.OK_STATUS;
- }
-
- } // end class P_StatusRevalidator
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.services;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.service.ProcessServiceNewOperation;
+import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
+import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
+import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.IScoutProject;
+import org.eclipse.swt.dnd.DND;
+
+public class ProcessServiceNewWizard extends AbstractWorkspaceWizard {
+ public static final int TYPE_PERMISSION_CREATE = 104;
+ public static final int TYPE_PERMISSION_READ = 105;
+ public static final int TYPE_PERMISSION_UPDATE = 106;
+ public static final int TYPE_SERVICE_INTERFACE = 107;
+ public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
+ public static final int TYPE_SERVICE_REG_CLIENT = 109;
+ public static final int TYPE_SERVICE_REG_SERVER = 110;
+
+ final IType abstractService = TypeUtility.getType(RuntimeClasses.AbstractService);
+
+ private BundleTreeWizardPage m_locationWizardPage;
+ private ProcessServiceNewWizardPage m_serviceNewWizardPage;
+ private ProcessServiceNewOperation m_operation = new ProcessServiceNewOperation();
+ private ITreeNode m_locationWizardPageRoot;
+
+ public ProcessServiceNewWizard(IScoutBundle serverBundle) {
+ setWindowTitle(Texts.get("NewProcessService"));
+ P_StatusRevalidator statusProvider = new P_StatusRevalidator();
+ m_serviceNewWizardPage = new ProcessServiceNewWizardPage();
+ m_serviceNewWizardPage.setServerBundle(serverBundle);
+ m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
+ addPage(m_serviceNewWizardPage);
+ m_locationWizardPageRoot = createTree(serverBundle);
+ m_locationWizardPage = new BundleTreeWizardPage(Texts.get("ProcessServiceLocation"), Texts.get("OrganiseLocations"), m_locationWizardPageRoot, new P_InitialCheckerFilter());
+ m_locationWizardPage.addStatusProvider(statusProvider);
+ m_locationWizardPage.addDndListener(new P_TreeDndListener());
+ addPage(m_locationWizardPage);
+ // init
+ m_serviceNewWizardPage.setSuperType(abstractService);
+ }
+
+ private ITreeNode createTree(IScoutBundle serverBundle) {
+ IScoutBundle sharedBundle = null;
+ IScoutBundle clientBundle = null;
+ IScoutProject scoutProject = serverBundle.getScoutProject();
+ while ((sharedBundle == null || clientBundle == null) && scoutProject != null) {
+ sharedBundle = scoutProject.getSharedBundle();
+ clientBundle = scoutProject.getClientBundle();
+ scoutProject = scoutProject.getParentProject();
+ }
+ ITreeNode rootNode = TreeUtility.createBundleTree(serverBundle.getScoutProject(), NodeFilters.getAcceptAll());
+ if (clientBundle != null) {
+ ITreeNode clientNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(clientBundle));
+ // service client reg
+ TreeUtility.createNode(clientNode, TYPE_SERVICE_REG_CLIENT, Texts.get("ServiceProxyRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_CLIENT);
+ }
+ if (sharedBundle != null) {
+ ITreeNode sharedNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(sharedBundle));
+ // permission create
+ TreeUtility.createNode(sharedNode, TYPE_PERMISSION_CREATE, Texts.get("CreatePermission"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_PERMISSION_CREATE);
+ // permission read
+ TreeUtility.createNode(sharedNode, TYPE_PERMISSION_READ, Texts.get("ReadPermission"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_PERMISSION_READ);
+ // permission update
+ TreeUtility.createNode(sharedNode, TYPE_PERMISSION_UPDATE, Texts.get("UpdatePermission"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_PERMISSION_UPDATE);
+ // service interface
+ TreeUtility.createNode(sharedNode, TYPE_SERVICE_INTERFACE, Texts.get("IService"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface), TYPE_SERVICE_INTERFACE);
+ }
+ if (serverBundle != null) {
+ ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
+ }
+ return rootNode;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_serviceNewWizardPage.fillProcessServiceNewOperation(m_operation);
+ m_operation.setClientServiceRegistryBundles(m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_CLIENT, true, true));
+ m_operation.setPermissionCreateBundle(m_locationWizardPage.getLocationBundle(TYPE_PERMISSION_CREATE, true, true));
+ m_operation.setPermissionCreateName(m_locationWizardPage.getTextOfNode(TYPE_PERMISSION_CREATE, true, true));
+ m_operation.setPermissionReadBundle(m_locationWizardPage.getLocationBundle(TYPE_PERMISSION_READ, true, true));
+ m_operation.setPermissionReadName(m_locationWizardPage.getTextOfNode(TYPE_PERMISSION_READ, true, true));
+ m_operation.setPermissionUpdateBundle(m_locationWizardPage.getLocationBundle(TYPE_PERMISSION_UPDATE, true, true));
+ m_operation.setPermissionUpdateName(m_locationWizardPage.getTextOfNode(TYPE_PERMISSION_UPDATE, true, true));
+ m_operation.setServerServiceRegistryBundles(m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true));
+ m_operation.setServiceImplementationBundle(m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true));
+ m_operation.setServiceImplementationName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
+ m_operation.setServiceInterfaceBundle(m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true));
+ m_operation.setServiceInterfaceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE, true, true));
+
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
+ try {
+ m_operation.validate();
+ m_operation.run(monitor, workingCopyManager);
+ return true;
+ }
+ catch (IllegalArgumentException e) {
+ ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
+ return false;
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
+ return false;
+ }
+ }
+
+ private class P_LocationPropertyListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
+ String typeName = m_serviceNewWizardPage.getTypeName();
+ if (!StringUtility.isNullOrEmpty(typeName)) {
+ String prefix = typeName.replaceAll(SdkProperties.SUFFIX_PROCESS_SERVICE + "$", "");
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_PERMISSION_CREATE)).setText("Create" + prefix + SdkProperties.SUFFIX_PERMISSION);
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_PERMISSION_READ)).setText("Read" + prefix + SdkProperties.SUFFIX_PERMISSION);
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_PERMISSION_UPDATE)).setText("Update" + prefix + SdkProperties.SUFFIX_PERMISSION);
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_PROCESS_SERVICE);
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_INTERFACE)).setText("I" + prefix + SdkProperties.SUFFIX_PROCESS_SERVICE);
+ m_locationWizardPage.refreshTree();
+ }
+ m_locationWizardPage.pingStateChanging();
+ }
+ }
+ } // end class P_LocationPropertyListener
+
+ private class P_InitialCheckerFilter implements ITreeNodeFilter {
+ @Override
+ public boolean accept(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_PERMISSION_CREATE:
+ case TYPE_PERMISSION_READ:
+ case TYPE_PERMISSION_UPDATE:
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_INTERFACE:
+ case TYPE_SERVICE_REG_CLIENT:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+ case IScoutBundle.BUNDLE_CLIENT:
+ case IScoutBundle.BUNDLE_SHARED:
+ case IScoutBundle.BUNDLE_SERVER:
+ default:
+ return false;
+ }
+ }
+ } // end class P_InitialCheckerFilter
+
+ private class P_TreeDndListener implements ITreeDndListener {
+ @Override
+ public boolean isDragableNode(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_PERMISSION_CREATE:
+ case TYPE_PERMISSION_READ:
+ case TYPE_PERMISSION_UPDATE:
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_INTERFACE:
+ case TYPE_SERVICE_REG_CLIENT:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public void validateTarget(DndEvent dndEvent) {
+ if (dndEvent.targetParent == null) {
+ dndEvent.doit = false;
+ return;
+ }
+ if (dndEvent.operation == DND.DROP_COPY) {
+ validateDropCopy(dndEvent);
+ }
+ else if (dndEvent.operation == DND.DROP_MOVE) {
+ validateDropMove(dndEvent);
+ }
+ }
+
+ @Override
+ public void dndPerformed(DndEvent dndEvent) {
+
+ m_serviceNewWizardPage.pingStateChanging();
+ }
+
+ private void validateDropCopy(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REG_CLIENT:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+ }
+
+ private void validateDropMove(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REG_CLIENT:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_CLIENT;
+ break;
+ case TYPE_PERMISSION_CREATE:
+ case TYPE_PERMISSION_READ:
+ case TYPE_PERMISSION_UPDATE:
+ case TYPE_SERVICE_INTERFACE:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SHARED;
+ break;
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+
+ }
+ } // end class P_TreeDndListener
+
+ private class P_StatusRevalidator implements IStatusProvider {
+
+ @Override
+ public void validate(Object source, MultiStatus multiStatus) {
+ multiStatus.add(getStatusTypeNames());
+ multiStatus.add(getStatusService());
+ multiStatus.add(getStatusServiceRegistrationClient());
+ multiStatus.add(getStatusServiceRegistrationServer());
+ }
+
+ protected IStatus getStatusTypeNames() {
+
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplNode != null) {
+ String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_PROCESS) + "." + serviceImplNode.getText();
+ if (serviceImplementationBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceBundle != null) {
+ ITreeNode serviceInterfaceNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceNode != null) {
+ String fqn = serviceInterfaceBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SERVICES_PROCESS) + "." + serviceInterfaceNode.getText();
+ if (serviceInterfaceBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceInterfaceNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ // permission read
+ IStatus createStatus = getStatusPermission(TYPE_PERMISSION_CREATE);
+ if (createStatus != Status.OK_STATUS) {
+ return createStatus;
+ }
+ IStatus readStatus = getStatusPermission(TYPE_PERMISSION_READ);
+ if (readStatus != Status.OK_STATUS) {
+ return readStatus;
+ }
+ IStatus updateStatus = getStatusPermission(TYPE_PERMISSION_UPDATE);
+ if (updateStatus != Status.OK_STATUS) {
+ return updateStatus;
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusPermission(int permissionType) {
+ IScoutBundle permissionBundle = m_locationWizardPage.getLocationBundle(permissionType, true, true);
+ if (permissionBundle != null) {
+ ITreeNode permissionNode = m_locationWizardPage.getTreeNode(permissionType, true, true);
+ if (permissionNode != null) {
+ String fqn = permissionBundle.getPackageName(IScoutBundle.SHARED_PACKAGE_APPENDIX_SECURITY) + "." + permissionNode.getText();
+ if (permissionBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + permissionNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusService() {
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ if (serviceInterfaceBundle != null) {
+ if (!serviceImplementationBundle.isOnClasspath(serviceInterfaceBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
+ }
+ }
+ IScoutBundle permissionCreateBundle = m_locationWizardPage.getLocationBundle(TYPE_PERMISSION_CREATE, true, true);
+ if (permissionCreateBundle != null) {
+ if (!serviceImplementationBundle.isOnClasspath(permissionCreateBundle)) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_PERMISSION_CREATE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
+ }
+ }
+ IScoutBundle permissionReadBundle = m_locationWizardPage.getLocationBundle(TYPE_PERMISSION_READ, true, true);
+ if (permissionReadBundle != null) {
+ if (!serviceImplementationBundle.isOnClasspath(permissionReadBundle)) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_PERMISSION_READ), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
+ }
+ }
+ IScoutBundle permissionUpdateBundle = m_locationWizardPage.getLocationBundle(TYPE_PERMISSION_UPDATE, true, true);
+ if (permissionUpdateBundle != null) {
+ if (!serviceImplementationBundle.isOnClasspath(permissionUpdateBundle)) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotAClasspathOfY", m_locationWizardPage.getTextOfNode(TYPE_PERMISSION_UPDATE), m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION)));
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistrationClient() {
+ IScoutBundle serviceInterfaceBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_INTERFACE, true, true);
+ ITreeNode[] serviceRegistrationClientNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_CLIENT, true, true);
+ for (ITreeNode serviceRegNode : serviceRegistrationClientNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceInterfaceBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceInterfaceBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_INTERFACE), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistrationServer() {
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ ITreeNode[] serviceRegistrationServerNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
+ for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ } // end class P_StatusRevalidator
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ProcessServiceNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ProcessServiceNewWizardPage.java
index 138391ad0..72392e04f 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ProcessServiceNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ProcessServiceNewWizardPage.java
@@ -1,236 +1,236 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.services;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.service.ProcessServiceNewOperation;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.AbstractJavaElementContentProvider;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeComparators;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.ICachedTypeHierarchy;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>ProcessServiceNewWizardPage</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 31.07.2009
- */
-public class ProcessServiceNewWizardPage extends AbstractWorkspaceWizardPage {
-
- /** {@link String} **/
- public static final String PROP_TYPE_NAME = "typeName";
- /** {@link ITypeProposal} **/
- public static final String PROP_SUPER_TYPE = "superType";
- /** {@link ITypeProposal} **/
- public static final String PROP_FORM_DATA_TYPE = "formDataType";
-
- final IType abstractService = TypeUtility.getType(RuntimeClasses.AbstractService);
- final IType iService = TypeUtility.getType(RuntimeClasses.IService);
- final IType abstractFormData = TypeUtility.getType(RuntimeClasses.AbstractFormData);
-
- // ui fields
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
- private ProposalTextField m_formDataTypeField;
-
- // process members
- private IScoutBundle m_serverBundle;
-
- public ProcessServiceNewWizardPage() {
- super(ProcessServiceNewWizardPage.class.getName());
- setTitle(Texts.get("NewProcessService"));
- setDescription(Texts.get("CreateANewProcessService"));
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_PROCESS_SERVICE);
- m_typeNameField.setText(getTypeName());
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- setTypeNameInternal(m_typeNameField.getText());
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new JavaElementAbstractTypeContentProvider(iService, getServerBundle().getJavaProject(), abstractService));
- m_superTypeField.acceptProposal(getSuperType());
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setSuperTypeInternal((IType) event.proposal);
- pingStateChanging();
- }
- });
-
- m_formDataTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("FormData"), new AbstractJavaElementContentProvider() {
- @Override
- protected Object[][] computeProposals() {
- ICachedTypeHierarchy formDataHierarchy = TypeUtility.getPrimaryTypeHierarchy(abstractFormData);
- IType[] formDataTypes = formDataHierarchy.getAllSubtypes(abstractFormData, TypeFilters.getTypesOnClasspath(getServerBundle().getJavaProject()), TypeComparators.getTypeNameComparator());
- return new Object[][]{formDataTypes};
- }
- });
- m_formDataTypeField.acceptProposal(getFormDataType());
- m_formDataTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setFormDataTypeInternal((IType) event.proposal);
- pingStateChanging();
- }
- });
-
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- GridData formDataTypeFieldData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- m_formDataTypeField.setLayoutData(formDataTypeFieldData);
- }
-
- void fillProcessServiceNewOperation(ProcessServiceNewOperation op) {
- op.setServiceImplementationName(getTypeName());
- op.setServiceInterfaceName("I" + getTypeName());
- op.setFormData(getFormDataType());
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_PROCESS_SERVICE)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- public IScoutBundle getServerBundle() {
- return m_serverBundle;
- }
-
- public void setServerBundle(IScoutBundle serverBundle) {
- m_serverBundle = serverBundle;
- }
-
- public String getTypeName() {
- return getPropertyString(PROP_TYPE_NAME);
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- setTypeNameInternal(typeName);
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- protected void setTypeNameInternal(String typeName) {
- setPropertyString(PROP_TYPE_NAME, typeName);
- }
-
- public IType getSuperType() {
- return (IType) getProperty(PROP_SUPER_TYPE);
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- setSuperTypeInternal(superType);
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- protected void setSuperTypeInternal(IType superType) {
- setProperty(PROP_SUPER_TYPE, superType);
- }
-
- public void setFormDataType(IType formDataType) {
- try {
- setStateChanging(true);
- setFormDataTypeInternal(formDataType);
- if (isControlCreated()) {
- m_formDataTypeField.acceptProposal(formDataType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- protected void setFormDataTypeInternal(IType formDatatype) {
- setProperty(PROP_FORM_DATA_TYPE, formDatatype);
- }
-
- public IType getFormDataType() {
- return (IType) getProperty(PROP_FORM_DATA_TYPE);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.services;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.service.ProcessServiceNewOperation;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.AbstractJavaElementContentProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeComparators;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.ICachedTypeHierarchy;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>ProcessServiceNewWizardPage</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 31.07.2009
+ */
+public class ProcessServiceNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ /** {@link String} **/
+ public static final String PROP_TYPE_NAME = "typeName";
+ /** {@link ITypeProposal} **/
+ public static final String PROP_SUPER_TYPE = "superType";
+ /** {@link ITypeProposal} **/
+ public static final String PROP_FORM_DATA_TYPE = "formDataType";
+
+ final IType abstractService = TypeUtility.getType(RuntimeClasses.AbstractService);
+ final IType iService = TypeUtility.getType(RuntimeClasses.IService);
+ final IType abstractFormData = TypeUtility.getType(RuntimeClasses.AbstractFormData);
+
+ // ui fields
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+ private ProposalTextField m_formDataTypeField;
+
+ // process members
+ private IScoutBundle m_serverBundle;
+
+ public ProcessServiceNewWizardPage() {
+ super(ProcessServiceNewWizardPage.class.getName());
+ setTitle(Texts.get("NewProcessService"));
+ setDescription(Texts.get("CreateANewProcessService"));
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_PROCESS_SERVICE);
+ m_typeNameField.setText(getTypeName());
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setTypeNameInternal(m_typeNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new JavaElementAbstractTypeContentProvider(iService, getServerBundle().getJavaProject(), abstractService));
+ m_superTypeField.acceptProposal(getSuperType());
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setSuperTypeInternal((IType) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ m_formDataTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("FormData"), new AbstractJavaElementContentProvider() {
+ @Override
+ protected Object[][] computeProposals() {
+ ICachedTypeHierarchy formDataHierarchy = TypeUtility.getPrimaryTypeHierarchy(abstractFormData);
+ IType[] formDataTypes = formDataHierarchy.getAllSubtypes(abstractFormData, TypeFilters.getTypesOnClasspath(getServerBundle().getJavaProject()), TypeComparators.getTypeNameComparator());
+ return new Object[][]{formDataTypes};
+ }
+ });
+ m_formDataTypeField.acceptProposal(getFormDataType());
+ m_formDataTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setFormDataTypeInternal((IType) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ GridData formDataTypeFieldData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ m_formDataTypeField.setLayoutData(formDataTypeFieldData);
+ }
+
+ void fillProcessServiceNewOperation(ProcessServiceNewOperation op) {
+ op.setServiceImplementationName(getTypeName());
+ op.setServiceInterfaceName("I" + getTypeName());
+ op.setFormData(getFormDataType());
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_PROCESS_SERVICE)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ public IScoutBundle getServerBundle() {
+ return m_serverBundle;
+ }
+
+ public void setServerBundle(IScoutBundle serverBundle) {
+ m_serverBundle = serverBundle;
+ }
+
+ public String getTypeName() {
+ return getPropertyString(PROP_TYPE_NAME);
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ setTypeNameInternal(typeName);
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ protected void setTypeNameInternal(String typeName) {
+ setPropertyString(PROP_TYPE_NAME, typeName);
+ }
+
+ public IType getSuperType() {
+ return (IType) getProperty(PROP_SUPER_TYPE);
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ setSuperTypeInternal(superType);
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ protected void setSuperTypeInternal(IType superType) {
+ setProperty(PROP_SUPER_TYPE, superType);
+ }
+
+ public void setFormDataType(IType formDataType) {
+ try {
+ setStateChanging(true);
+ setFormDataTypeInternal(formDataType);
+ if (isControlCreated()) {
+ m_formDataTypeField.acceptProposal(formDataType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ protected void setFormDataTypeInternal(IType formDatatype) {
+ setProperty(PROP_FORM_DATA_TYPE, formDatatype);
+ }
+
+ public IType getFormDataType() {
+ return (IType) getProperty(PROP_FORM_DATA_TYPE);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceNewWizardPage.java
index 1d65e78dc..6411cd847 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceNewWizardPage.java
@@ -1,182 +1,182 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.services;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>ServiceNewWizardPage</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 29.07.2009
- */
-public class ServiceNewWizardPage extends AbstractWorkspaceWizardPage {
-
- /** {@link String} **/
- public static final String PROP_TYPE_NAME = "typeName";
- /** {@link ITypeProposal} **/
- public static final String PROP_SUPER_TYPE = "superType";
-
- // ui fields
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
-
- // process members
- private final IType m_definitionType;
- private final String m_typeNameSuffix;
-
- private IScoutBundle m_locationBundle;
-
- public ServiceNewWizardPage(String title, String message, IType definitionType, String typeNameSuffix) {
- super(ServiceNewWizardPage.class.getName());
- m_typeNameSuffix = typeNameSuffix;
- m_definitionType = definitionType;
- setTitle(title);
- setDescription(message);
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(getTypeNameSuffix());
- m_typeNameField.setText(getTypeName());
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- setTypeNameInternal(m_typeNameField.getText());
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new JavaElementAbstractTypeContentProvider(m_definitionType, getLocationBundle().getJavaProject(), getSuperType()));
- m_superTypeField.acceptProposal(getSuperType());
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setSuperTypeInternal((IType) event.proposal);
- pingStateChanging();
- }
- });
-
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(getTypeNameSuffix())) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- /**
- * @param locationBundle
- * the locationBundle to set
- */
- public void setLocationBundle(IScoutBundle locationBundle) {
- m_locationBundle = locationBundle;
- }
-
- /**
- * @return the locationBundle
- */
- public IScoutBundle getLocationBundle() {
- return m_locationBundle;
- }
-
- public String getTypeNameSuffix() {
- return m_typeNameSuffix;
- }
-
- public String getTypeName() {
- return getPropertyString(PROP_TYPE_NAME);
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- setTypeNameInternal(typeName);
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- protected void setTypeNameInternal(String typeName) {
- setPropertyString(PROP_TYPE_NAME, typeName);
- }
-
- public IType getSuperType() {
- return (IType) getProperty(PROP_SUPER_TYPE);
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- setSuperTypeInternal(superType);
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- protected void setSuperTypeInternal(IType superType) {
- setProperty(PROP_SUPER_TYPE, superType);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.services;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>ServiceNewWizardPage</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 29.07.2009
+ */
+public class ServiceNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ /** {@link String} **/
+ public static final String PROP_TYPE_NAME = "typeName";
+ /** {@link ITypeProposal} **/
+ public static final String PROP_SUPER_TYPE = "superType";
+
+ // ui fields
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+
+ // process members
+ private final IType m_definitionType;
+ private final String m_typeNameSuffix;
+
+ private IScoutBundle m_locationBundle;
+
+ public ServiceNewWizardPage(String title, String message, IType definitionType, String typeNameSuffix) {
+ super(ServiceNewWizardPage.class.getName());
+ m_typeNameSuffix = typeNameSuffix;
+ m_definitionType = definitionType;
+ setTitle(title);
+ setDescription(message);
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(getTypeNameSuffix());
+ m_typeNameField.setText(getTypeName());
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setTypeNameInternal(m_typeNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new JavaElementAbstractTypeContentProvider(m_definitionType, getLocationBundle().getJavaProject(), getSuperType()));
+ m_superTypeField.acceptProposal(getSuperType());
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setSuperTypeInternal((IType) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(getTypeNameSuffix())) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @param locationBundle
+ * the locationBundle to set
+ */
+ public void setLocationBundle(IScoutBundle locationBundle) {
+ m_locationBundle = locationBundle;
+ }
+
+ /**
+ * @return the locationBundle
+ */
+ public IScoutBundle getLocationBundle() {
+ return m_locationBundle;
+ }
+
+ public String getTypeNameSuffix() {
+ return m_typeNameSuffix;
+ }
+
+ public String getTypeName() {
+ return getPropertyString(PROP_TYPE_NAME);
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ setTypeNameInternal(typeName);
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ protected void setTypeNameInternal(String typeName) {
+ setPropertyString(PROP_TYPE_NAME, typeName);
+ }
+
+ public IType getSuperType() {
+ return (IType) getProperty(PROP_SUPER_TYPE);
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ setSuperTypeInternal(superType);
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ protected void setSuperTypeInternal(IType superType) {
+ setProperty(PROP_SUPER_TYPE, superType);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceOperationNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceOperationNewWizard.java
index 69a1d46b6..caf079c03 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceOperationNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceOperationNewWizard.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.services;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-
-public class ServiceOperationNewWizard extends AbstractWorkspaceWizard {
-
- public ServiceOperationNewWizard(IType serviceInterface, IType[] serviceImpls) {
- setWindowTitle(Texts.get("NewServiceOperationNoPopup"));
- ServiceOperationNewWizardPage page1 = new ServiceOperationNewWizardPage(serviceInterface, serviceImpls);
- addPage(page1);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.services;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+
+public class ServiceOperationNewWizard extends AbstractWorkspaceWizard {
+
+ public ServiceOperationNewWizard(IType serviceInterface, IType[] serviceImpls) {
+ setWindowTitle(Texts.get("NewServiceOperationNoPopup"));
+ ServiceOperationNewWizardPage page1 = new ServiceOperationNewWizardPage(serviceInterface, serviceImpls);
+ addPage(page1);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceOperationNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceOperationNewWizardPage.java
index 071219452..b669cc551 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceOperationNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/ServiceOperationNewWizardPage.java
@@ -1,194 +1,194 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.services;
-
-import java.util.ArrayList;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ScoutSdkCore;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.service.ParameterArgument;
-import org.eclipse.scout.sdk.operation.service.ServiceOperationNewOperation;
-import org.eclipse.scout.sdk.ui.fields.TextField;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.internal.fields.code.IParameterFieldListener;
-import org.eclipse.scout.sdk.ui.internal.fields.code.ParameterField;
-import org.eclipse.scout.sdk.ui.internal.fields.code.ReturnParameterField;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-public class ServiceOperationNewWizardPage extends AbstractWorkspaceWizardPage {
-
- // ui fields
- private TextField m_operationNameField;
- private ReturnParameterField m_returnParameterField;
-
- // fields
- private String m_operationName;
- private ParameterArgument m_returnParameter;
- private ParameterArgument m_parameterArg1;
- private ParameterArgument m_parameterArg2;
- private ParameterArgument m_parameterArg3;
- private ParameterArgument m_parameterArg4;
- private ParameterArgument m_parameterArg5;
-
- // local fields
- private final IType[] m_serviceImplementations;
- private final IType m_serviceInterface;
- private ParameterField m_parameterArg1Field;
- private ParameterField m_parameterArg2Field;
-
- public ServiceOperationNewWizardPage(IType serviceInterface, IType[] serviceImplementations) {
- super(ServiceOperationNewWizardPage.class.getName());
- m_serviceInterface = serviceInterface;
- m_serviceImplementations = serviceImplementations;
- setTitle(Texts.get("NewServiceOperationNoPopup"));
- setDescription(Texts.get("CreateANewServiceOperation"));
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_operationNameField = new TextField(parent, 20);
- m_operationNameField.setLabelText(Texts.get("OperationName"));
- m_operationNameField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- m_operationName = m_operationNameField.getText();
- pingStateChanging();
- }
- });
- IScoutBundle interfaceBundle = ScoutSdkCore.getScoutWorkspace().getScoutBundle(m_serviceInterface.getJavaProject().getProject());
-
- m_returnParameterField = new ReturnParameterField(parent, 20, m_returnParameter, interfaceBundle.getSearchScope());
- m_returnParameterField.setLabel(Texts.get("ReturnType"));
- m_returnParameterField.addParameterFieldListener(new IParameterFieldListener() {
- @Override
- public void parameterChanged(ParameterArgument argument) {
- m_returnParameter = argument;
- pingStateChanging();
- }
- });
-
- m_parameterArg1Field = new ParameterField(parent, m_parameterArg1, interfaceBundle.getSearchScope());
- m_parameterArg1Field.setLabelParameterName(Texts.get("NameArg") + " 1");
- m_parameterArg1Field.setLabelParameterType(Texts.get("Type"));
- m_parameterArg1Field.addParameterFieldListener(new IParameterFieldListener() {
- @Override
- public void parameterChanged(ParameterArgument argument) {
- m_parameterArg1 = argument;
- pingStateChanging();
- }
- });
-
- m_parameterArg2Field = new ParameterField(parent, m_parameterArg1, interfaceBundle.getSearchScope());
- m_parameterArg2Field.setLabelParameterName(Texts.get("NameArg") + "2");
- m_parameterArg2Field.setLabelParameterType(Texts.get("Type"));
- m_parameterArg2Field.addParameterFieldListener(new IParameterFieldListener() {
- @Override
- public void parameterChanged(ParameterArgument argument) {
- m_parameterArg2 = argument;
- pingStateChanging();
- }
- });
-
- parent.setLayout(new GridLayout(1, true));
- m_operationNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_returnParameterField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_parameterArg1Field.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_parameterArg2Field.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
-
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager manager) throws CoreException {
- ServiceOperationNewOperation op = new ServiceOperationNewOperation();
- ArrayList<ParameterArgument> args = new ArrayList<ParameterArgument>();
- if (m_parameterArg1 != null && !StringUtility.isNullOrEmpty(m_parameterArg1.getName()) && !StringUtility.isNullOrEmpty(m_parameterArg1.getType())) {
- args.add(m_parameterArg1);
- }
- if (m_parameterArg2 != null && !StringUtility.isNullOrEmpty(m_parameterArg2.getName()) && !StringUtility.isNullOrEmpty(m_parameterArg2.getType())) {
- args.add(m_parameterArg2);
- }
- if (m_parameterArg3 != null && !StringUtility.isNullOrEmpty(m_parameterArg3.getName()) && !StringUtility.isNullOrEmpty(m_parameterArg3.getType())) {
- args.add(m_parameterArg3);
- }
- if (m_parameterArg4 != null && !StringUtility.isNullOrEmpty(m_parameterArg4.getName()) && !StringUtility.isNullOrEmpty(m_parameterArg4.getType())) {
- args.add(m_parameterArg4);
- }
- if (m_parameterArg5 != null && !StringUtility.isNullOrEmpty(m_parameterArg5.getName()) && !StringUtility.isNullOrEmpty(m_parameterArg5.getType())) {
- args.add(m_parameterArg5);
- }
- op.setArguments(args.toArray(new ParameterArgument[args.size()]));
- op.setMethodName(m_operationName);
- op.setReturnType(m_returnParameter);
- op.setServiceImplementations(m_serviceImplementations);
- op.setServiceInterface(m_serviceInterface);
- op.run(monitor, manager);
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- multiStatus.add(getOperationNameStatus());
- multiStatus.add(getReturnParameterStatus());
- if (m_parameterArg1 != null) {
- multiStatus.add(getParameterStatus(m_parameterArg1, m_parameterArg1Field.getLabel()));
- }
- if (m_parameterArg2 != null) {
- multiStatus.add(getParameterStatus(m_parameterArg1, m_parameterArg2Field.getLabel()));
- }
- // if(m_parameterArg3 != null){
- // multiStatus.add(getParameterStatus(m_parameterArg1, m_parameterArg3Field.getLabel()));
- // }
- super.validatePage(multiStatus);
- }
-
- protected IStatus getOperationNameStatus() {
- if (m_operationName == null || m_operationName.length() == 0) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("OperationNameMissing"));
- }
- else {
- return Status.OK_STATUS;
- }
- }
-
- protected IStatus getReturnParameterStatus() {
- if (m_returnParameter == null || StringUtility.isNullOrEmpty(m_returnParameter.getType())) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("ReturnTypeMissing"));
- }
- else {
- return Status.OK_STATUS;
- }
- }
-
- protected IStatus getParameterStatus(ParameterArgument arg, String fieldName) {
- if (StringUtility.isNullOrEmpty(arg.getName()) && !StringUtility.isNullOrEmpty(arg.getType())) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("ParameterXIsNotValid", fieldName));
- }
- else if (!StringUtility.isNullOrEmpty(arg.getName()) && StringUtility.isNullOrEmpty(arg.getType())) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("ParameterXIsNotValid", fieldName));
- }
- return Status.OK_STATUS;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.services;
+
+import java.util.ArrayList;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ScoutSdkCore;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.service.ParameterArgument;
+import org.eclipse.scout.sdk.operation.service.ServiceOperationNewOperation;
+import org.eclipse.scout.sdk.ui.fields.TextField;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.internal.fields.code.IParameterFieldListener;
+import org.eclipse.scout.sdk.ui.internal.fields.code.ParameterField;
+import org.eclipse.scout.sdk.ui.internal.fields.code.ReturnParameterField;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+public class ServiceOperationNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ // ui fields
+ private TextField m_operationNameField;
+ private ReturnParameterField m_returnParameterField;
+
+ // fields
+ private String m_operationName;
+ private ParameterArgument m_returnParameter;
+ private ParameterArgument m_parameterArg1;
+ private ParameterArgument m_parameterArg2;
+ private ParameterArgument m_parameterArg3;
+ private ParameterArgument m_parameterArg4;
+ private ParameterArgument m_parameterArg5;
+
+ // local fields
+ private final IType[] m_serviceImplementations;
+ private final IType m_serviceInterface;
+ private ParameterField m_parameterArg1Field;
+ private ParameterField m_parameterArg2Field;
+
+ public ServiceOperationNewWizardPage(IType serviceInterface, IType[] serviceImplementations) {
+ super(ServiceOperationNewWizardPage.class.getName());
+ m_serviceInterface = serviceInterface;
+ m_serviceImplementations = serviceImplementations;
+ setTitle(Texts.get("NewServiceOperationNoPopup"));
+ setDescription(Texts.get("CreateANewServiceOperation"));
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_operationNameField = new TextField(parent, 20);
+ m_operationNameField.setLabelText(Texts.get("OperationName"));
+ m_operationNameField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_operationName = m_operationNameField.getText();
+ pingStateChanging();
+ }
+ });
+ IScoutBundle interfaceBundle = ScoutSdkCore.getScoutWorkspace().getScoutBundle(m_serviceInterface.getJavaProject().getProject());
+
+ m_returnParameterField = new ReturnParameterField(parent, 20, m_returnParameter, interfaceBundle.getSearchScope());
+ m_returnParameterField.setLabel(Texts.get("ReturnType"));
+ m_returnParameterField.addParameterFieldListener(new IParameterFieldListener() {
+ @Override
+ public void parameterChanged(ParameterArgument argument) {
+ m_returnParameter = argument;
+ pingStateChanging();
+ }
+ });
+
+ m_parameterArg1Field = new ParameterField(parent, m_parameterArg1, interfaceBundle.getSearchScope());
+ m_parameterArg1Field.setLabelParameterName(Texts.get("NameArg") + " 1");
+ m_parameterArg1Field.setLabelParameterType(Texts.get("Type"));
+ m_parameterArg1Field.addParameterFieldListener(new IParameterFieldListener() {
+ @Override
+ public void parameterChanged(ParameterArgument argument) {
+ m_parameterArg1 = argument;
+ pingStateChanging();
+ }
+ });
+
+ m_parameterArg2Field = new ParameterField(parent, m_parameterArg1, interfaceBundle.getSearchScope());
+ m_parameterArg2Field.setLabelParameterName(Texts.get("NameArg") + "2");
+ m_parameterArg2Field.setLabelParameterType(Texts.get("Type"));
+ m_parameterArg2Field.addParameterFieldListener(new IParameterFieldListener() {
+ @Override
+ public void parameterChanged(ParameterArgument argument) {
+ m_parameterArg2 = argument;
+ pingStateChanging();
+ }
+ });
+
+ parent.setLayout(new GridLayout(1, true));
+ m_operationNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_returnParameterField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_parameterArg1Field.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_parameterArg2Field.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager manager) throws CoreException {
+ ServiceOperationNewOperation op = new ServiceOperationNewOperation();
+ ArrayList<ParameterArgument> args = new ArrayList<ParameterArgument>();
+ if (m_parameterArg1 != null && !StringUtility.isNullOrEmpty(m_parameterArg1.getName()) && !StringUtility.isNullOrEmpty(m_parameterArg1.getType())) {
+ args.add(m_parameterArg1);
+ }
+ if (m_parameterArg2 != null && !StringUtility.isNullOrEmpty(m_parameterArg2.getName()) && !StringUtility.isNullOrEmpty(m_parameterArg2.getType())) {
+ args.add(m_parameterArg2);
+ }
+ if (m_parameterArg3 != null && !StringUtility.isNullOrEmpty(m_parameterArg3.getName()) && !StringUtility.isNullOrEmpty(m_parameterArg3.getType())) {
+ args.add(m_parameterArg3);
+ }
+ if (m_parameterArg4 != null && !StringUtility.isNullOrEmpty(m_parameterArg4.getName()) && !StringUtility.isNullOrEmpty(m_parameterArg4.getType())) {
+ args.add(m_parameterArg4);
+ }
+ if (m_parameterArg5 != null && !StringUtility.isNullOrEmpty(m_parameterArg5.getName()) && !StringUtility.isNullOrEmpty(m_parameterArg5.getType())) {
+ args.add(m_parameterArg5);
+ }
+ op.setArguments(args.toArray(new ParameterArgument[args.size()]));
+ op.setMethodName(m_operationName);
+ op.setReturnType(m_returnParameter);
+ op.setServiceImplementations(m_serviceImplementations);
+ op.setServiceInterface(m_serviceInterface);
+ op.run(monitor, manager);
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ multiStatus.add(getOperationNameStatus());
+ multiStatus.add(getReturnParameterStatus());
+ if (m_parameterArg1 != null) {
+ multiStatus.add(getParameterStatus(m_parameterArg1, m_parameterArg1Field.getLabel()));
+ }
+ if (m_parameterArg2 != null) {
+ multiStatus.add(getParameterStatus(m_parameterArg1, m_parameterArg2Field.getLabel()));
+ }
+ // if(m_parameterArg3 != null){
+ // multiStatus.add(getParameterStatus(m_parameterArg1, m_parameterArg3Field.getLabel()));
+ // }
+ super.validatePage(multiStatus);
+ }
+
+ protected IStatus getOperationNameStatus() {
+ if (m_operationName == null || m_operationName.length() == 0) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("OperationNameMissing"));
+ }
+ else {
+ return Status.OK_STATUS;
+ }
+ }
+
+ protected IStatus getReturnParameterStatus() {
+ if (m_returnParameter == null || StringUtility.isNullOrEmpty(m_returnParameter.getType())) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("ReturnTypeMissing"));
+ }
+ else {
+ return Status.OK_STATUS;
+ }
+ }
+
+ protected IStatus getParameterStatus(ParameterArgument arg, String fieldName) {
+ if (StringUtility.isNullOrEmpty(arg.getName()) && !StringUtility.isNullOrEmpty(arg.getType())) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("ParameterXIsNotValid", fieldName));
+ }
+ else if (!StringUtility.isNullOrEmpty(arg.getName()) && StringUtility.isNullOrEmpty(arg.getType())) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("ParameterXIsNotValid", fieldName));
+ }
+ return Status.OK_STATUS;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/SmtpServiceNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/SmtpServiceNewWizard.java
index fcea21593..ec93bf638 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/SmtpServiceNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/SmtpServiceNewWizard.java
@@ -1,256 +1,256 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.services;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.service.ServiceNewOperation;
-import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
-import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
-import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.dnd.DND;
-
-public class SmtpServiceNewWizard extends AbstractWorkspaceWizard {
- public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
- public static final int TYPE_SERVICE_REG_SERVER = 110;
-
- private ServiceNewWizardPage m_serviceNewWizardPage;
- private BundleTreeWizardPage m_locationWizardPage;
- private ITreeNode m_locationWizardPageRoot;
- private ServiceNewOperation m_operation = new ServiceNewOperation();
-
- public SmtpServiceNewWizard(IScoutBundle serverBundle) {
- setWindowTitle(Texts.get("NewSmtpService"));
- P_StatusRevalidator statusProvider = new P_StatusRevalidator();
- m_serviceNewWizardPage = new ServiceNewWizardPage(Texts.get("NewSmtpService"), Texts.get("CreateANewSMTPService"), TypeUtility.getType(RuntimeClasses.ISMTPService), SdkProperties.SUFFIX_SMTP_SERVICE);
- m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractSMTPService));
- m_serviceNewWizardPage.setLocationBundle(serverBundle);
- m_serviceNewWizardPage.addStatusProvider(statusProvider);
- m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
- addPage(m_serviceNewWizardPage);
-
- m_locationWizardPageRoot = createTree(serverBundle);
- m_locationWizardPage = new BundleTreeWizardPage(Texts.get("SMTPServiceLocation"), Texts.get("OrganiseLocations"), m_locationWizardPageRoot, new P_InitialCheckerFilter());
- m_locationWizardPage.addStatusProvider(statusProvider);
- m_locationWizardPage.addDndListener(new P_TreeDndListener());
- addPage(m_locationWizardPage);
-
- // init
- m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractSMTPService));
- }
-
- private ITreeNode createTree(IScoutBundle serverBundle) {
-
- ITreeNode rootNode = TreeUtility.createBundleTree(serverBundle.getScoutProject(), NodeFilters.getAcceptAll());
-
- if (serverBundle != null) {
- ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
- }
- return rootNode;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_operation.setServiceInterfaceSuperTypeSignature(Signature.createTypeSignature(RuntimeClasses.ISMTPService, true));
- IType superType = m_serviceNewWizardPage.getSuperType();
- if (superType != null) {
- m_operation.setServiceSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
- }
- IScoutBundle implementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (implementationBundle != null) {
- m_operation.setImplementationBundle(implementationBundle);
- m_operation.setServicePackageName(implementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_COMMON));
- m_operation.setServiceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
- }
- IScoutBundle[] serverRegBundles = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true);
- for (IScoutBundle sb : serverRegBundles) {
- m_operation.addServiceRegistrationBundle(sb);
- }
- m_operation.setServiceInterfaceSuperTypeSignature(Signature.createTypeSignature(RuntimeClasses.ISMTPService, true));
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
- try {
- m_operation.validate();
- m_operation.run(monitor, workingCopyManager);
- return true;
- }
- catch (IllegalArgumentException e) {
- ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
- return false;
- }
- catch (CoreException e) {
- ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
- return false;
- }
- }
-
- private class P_LocationPropertyListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
- String typeName = m_serviceNewWizardPage.getTypeName();
- if (!StringUtility.isNullOrEmpty(typeName)) {
- String prefix = typeName.replaceAll(SdkProperties.SUFFIX_SMTP_SERVICE + "$", "");
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_SMTP_SERVICE);
- m_locationWizardPage.refreshTree();
- }
- m_locationWizardPage.pingStateChanging();
- }
- }
- } // end class P_LocationPropertyListener
-
- private class P_InitialCheckerFilter implements ITreeNodeFilter {
- @Override
- public boolean accept(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_REG_SERVER:
- return true;
-
- case IScoutBundle.BUNDLE_CLIENT:
- case IScoutBundle.BUNDLE_SHARED:
- case IScoutBundle.BUNDLE_SERVER:
- default:
- return false;
- }
- }
- } // end class P_InitialCheckerFilter
-
- private class P_TreeDndListener implements ITreeDndListener {
- @Override
- public boolean isDragableNode(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_REG_SERVER:
- return true;
- default:
- return false;
- }
- }
-
- @Override
- public void validateTarget(DndEvent dndEvent) {
- if (dndEvent.targetParent == null) {
- dndEvent.doit = false;
- return;
- }
- if (dndEvent.operation == DND.DROP_COPY) {
- validateDropCopy(dndEvent);
- }
- else if (dndEvent.operation == DND.DROP_MOVE) {
- validateDropMove(dndEvent);
- }
- }
-
- @Override
- public void dndPerformed(DndEvent dndEvent) {
-
- m_serviceNewWizardPage.pingStateChanging();
- }
-
- private void validateDropCopy(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
- }
-
- private void validateDropMove(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
-
- }
- } // end class P_TreeDndListener
-
- private class P_StatusRevalidator implements IStatusProvider {
-
- @Override
- public void validate(Object source, MultiStatus multiStatus) {
- multiStatus.add(getStatusServiceRegistrationServer());
- multiStatus.add(getStatusTypeNames());
- }
-
- protected IStatus getStatusTypeNames() {
-
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplNode != null) {
- String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_COMMON) + "." + serviceImplNode.getText();
- if (serviceImplementationBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistrationServer() {
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- ITreeNode[] serviceRegistrationServerNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
- for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
-
- return Status.OK_STATUS;
- }
-
- } // end class P_StatusRevalidator
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.services;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.service.ServiceNewOperation;
+import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
+import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
+import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.dnd.DND;
+
+public class SmtpServiceNewWizard extends AbstractWorkspaceWizard {
+ public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
+ public static final int TYPE_SERVICE_REG_SERVER = 110;
+
+ private ServiceNewWizardPage m_serviceNewWizardPage;
+ private BundleTreeWizardPage m_locationWizardPage;
+ private ITreeNode m_locationWizardPageRoot;
+ private ServiceNewOperation m_operation = new ServiceNewOperation();
+
+ public SmtpServiceNewWizard(IScoutBundle serverBundle) {
+ setWindowTitle(Texts.get("NewSmtpService"));
+ P_StatusRevalidator statusProvider = new P_StatusRevalidator();
+ m_serviceNewWizardPage = new ServiceNewWizardPage(Texts.get("NewSmtpService"), Texts.get("CreateANewSMTPService"), TypeUtility.getType(RuntimeClasses.ISMTPService), SdkProperties.SUFFIX_SMTP_SERVICE);
+ m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractSMTPService));
+ m_serviceNewWizardPage.setLocationBundle(serverBundle);
+ m_serviceNewWizardPage.addStatusProvider(statusProvider);
+ m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
+ addPage(m_serviceNewWizardPage);
+
+ m_locationWizardPageRoot = createTree(serverBundle);
+ m_locationWizardPage = new BundleTreeWizardPage(Texts.get("SMTPServiceLocation"), Texts.get("OrganiseLocations"), m_locationWizardPageRoot, new P_InitialCheckerFilter());
+ m_locationWizardPage.addStatusProvider(statusProvider);
+ m_locationWizardPage.addDndListener(new P_TreeDndListener());
+ addPage(m_locationWizardPage);
+
+ // init
+ m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractSMTPService));
+ }
+
+ private ITreeNode createTree(IScoutBundle serverBundle) {
+
+ ITreeNode rootNode = TreeUtility.createBundleTree(serverBundle.getScoutProject(), NodeFilters.getAcceptAll());
+
+ if (serverBundle != null) {
+ ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
+ }
+ return rootNode;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_operation.setServiceInterfaceSuperTypeSignature(Signature.createTypeSignature(RuntimeClasses.ISMTPService, true));
+ IType superType = m_serviceNewWizardPage.getSuperType();
+ if (superType != null) {
+ m_operation.setServiceSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
+ }
+ IScoutBundle implementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (implementationBundle != null) {
+ m_operation.setImplementationBundle(implementationBundle);
+ m_operation.setServicePackageName(implementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_COMMON));
+ m_operation.setServiceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
+ }
+ IScoutBundle[] serverRegBundles = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true);
+ for (IScoutBundle sb : serverRegBundles) {
+ m_operation.addServiceRegistrationBundle(sb);
+ }
+ m_operation.setServiceInterfaceSuperTypeSignature(Signature.createTypeSignature(RuntimeClasses.ISMTPService, true));
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
+ try {
+ m_operation.validate();
+ m_operation.run(monitor, workingCopyManager);
+ return true;
+ }
+ catch (IllegalArgumentException e) {
+ ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
+ return false;
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
+ return false;
+ }
+ }
+
+ private class P_LocationPropertyListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
+ String typeName = m_serviceNewWizardPage.getTypeName();
+ if (!StringUtility.isNullOrEmpty(typeName)) {
+ String prefix = typeName.replaceAll(SdkProperties.SUFFIX_SMTP_SERVICE + "$", "");
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_SMTP_SERVICE);
+ m_locationWizardPage.refreshTree();
+ }
+ m_locationWizardPage.pingStateChanging();
+ }
+ }
+ } // end class P_LocationPropertyListener
+
+ private class P_InitialCheckerFilter implements ITreeNodeFilter {
+ @Override
+ public boolean accept(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+
+ case IScoutBundle.BUNDLE_CLIENT:
+ case IScoutBundle.BUNDLE_SHARED:
+ case IScoutBundle.BUNDLE_SERVER:
+ default:
+ return false;
+ }
+ }
+ } // end class P_InitialCheckerFilter
+
+ private class P_TreeDndListener implements ITreeDndListener {
+ @Override
+ public boolean isDragableNode(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public void validateTarget(DndEvent dndEvent) {
+ if (dndEvent.targetParent == null) {
+ dndEvent.doit = false;
+ return;
+ }
+ if (dndEvent.operation == DND.DROP_COPY) {
+ validateDropCopy(dndEvent);
+ }
+ else if (dndEvent.operation == DND.DROP_MOVE) {
+ validateDropMove(dndEvent);
+ }
+ }
+
+ @Override
+ public void dndPerformed(DndEvent dndEvent) {
+
+ m_serviceNewWizardPage.pingStateChanging();
+ }
+
+ private void validateDropCopy(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+ }
+
+ private void validateDropMove(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+
+ }
+ } // end class P_TreeDndListener
+
+ private class P_StatusRevalidator implements IStatusProvider {
+
+ @Override
+ public void validate(Object source, MultiStatus multiStatus) {
+ multiStatus.add(getStatusServiceRegistrationServer());
+ multiStatus.add(getStatusTypeNames());
+ }
+
+ protected IStatus getStatusTypeNames() {
+
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplNode != null) {
+ String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_COMMON) + "." + serviceImplNode.getText();
+ if (serviceImplementationBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistrationServer() {
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ ITreeNode[] serviceRegistrationServerNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
+ for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ } // end class P_StatusRevalidator
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/SqlServiceNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/SqlServiceNewWizard.java
index 49b672815..92d3c9d78 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/SqlServiceNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/services/SqlServiceNewWizard.java
@@ -1,254 +1,254 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.services;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.service.ServiceNewOperation;
-import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
-import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
-import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
-import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.dnd.DND;
-
-public class SqlServiceNewWizard extends AbstractWorkspaceWizard {
- public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
- public static final int TYPE_SERVICE_REG_SERVER = 110;
-
- private ServiceNewWizardPage m_serviceNewWizardPage;
- private BundleTreeWizardPage m_locationWizardPage;
- private ITreeNode m_locationWizardPageRoot;
- private ServiceNewOperation m_operation = new ServiceNewOperation();
-
- public SqlServiceNewWizard(IScoutBundle serverBundle) {
- setWindowTitle(Texts.get("NewSQLService"));
- P_StatusRevalidator statusProvider = new P_StatusRevalidator();
-
- m_locationWizardPageRoot = createTree(serverBundle);
- m_locationWizardPage = new BundleTreeWizardPage(Texts.get("SQLServiceLocation"), Texts.get("OrganiseLocations"), m_locationWizardPageRoot, new P_InitialCheckerFilter());
- m_locationWizardPage.addStatusProvider(statusProvider);
- m_locationWizardPage.addDndListener(new P_TreeDndListener());
-
- m_serviceNewWizardPage = new ServiceNewWizardPage(Texts.get("NewSQLService"), Texts.get("CreateANewSQLService"), TypeUtility.getType(RuntimeClasses.ISqlService), SdkProperties.SUFFIX_SQL_SERVICE);
- m_serviceNewWizardPage.setLocationBundle(serverBundle);
- m_serviceNewWizardPage.addStatusProvider(statusProvider);
- m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractSqlService));
- m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
-
- addPage(m_serviceNewWizardPage);
- addPage(m_locationWizardPage);
-
- // init
- m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractSqlService));
- }
-
- private ITreeNode createTree(IScoutBundle serverBundle) {
- ITreeNode rootNode = TreeUtility.createBundleTree(serverBundle.getScoutProject(), NodeFilters.getByType(IScoutBundle.BUNDLE_SERVER));
-
- if (serverBundle != null) {
- ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
- // service implementation
- TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
- }
- return rootNode;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- IType superType = m_serviceNewWizardPage.getSuperType();
- if (superType != null) {
- m_operation.setServiceSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
- }
- IScoutBundle implementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (implementationBundle != null) {
- m_operation.setImplementationBundle(implementationBundle);
- m_operation.setServicePackageName(implementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_COMMON_SQL));
- m_operation.setServiceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
- }
- IScoutBundle[] serverRegBundles = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true);
- for (IScoutBundle sb : serverRegBundles) {
- m_operation.addServiceRegistrationBundle(sb);
- }
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
- try {
- m_operation.validate();
- m_operation.run(monitor, workingCopyManager);
- return true;
- }
- catch (IllegalArgumentException e) {
- ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
- return false;
- }
- catch (CoreException e) {
- ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
- return false;
- }
- }
-
- private class P_LocationPropertyListener implements PropertyChangeListener {
- @Override
- public void propertyChange(PropertyChangeEvent evt) {
- if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
- String typeName = m_serviceNewWizardPage.getTypeName();
- if (!StringUtility.isNullOrEmpty(typeName)) {
- String prefix = typeName.replaceAll(SdkProperties.SUFFIX_SQL_SERVICE + "$", "");
- TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_SQL_SERVICE);
- m_locationWizardPage.refreshTree();
- }
- m_locationWizardPage.pingStateChanging();
- }
- }
- } // end class P_LocationPropertyListener
-
- private class P_InitialCheckerFilter implements ITreeNodeFilter {
- @Override
- public boolean accept(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_REG_SERVER:
- return true;
-
- case IScoutBundle.BUNDLE_CLIENT:
- case IScoutBundle.BUNDLE_SHARED:
- case IScoutBundle.BUNDLE_SERVER:
- default:
- return false;
- }
- }
- } // end class P_InitialCheckerFilter
-
- private class P_TreeDndListener implements ITreeDndListener {
- @Override
- public boolean isDragableNode(ITreeNode node) {
- switch (node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_REG_SERVER:
- return true;
- default:
- return false;
- }
- }
-
- @Override
- public void validateTarget(DndEvent dndEvent) {
- if (dndEvent.targetParent == null) {
- dndEvent.doit = false;
- return;
- }
- if (dndEvent.operation == DND.DROP_COPY) {
- validateDropCopy(dndEvent);
- }
- else if (dndEvent.operation == DND.DROP_MOVE) {
- validateDropMove(dndEvent);
- }
- }
-
- @Override
- public void dndPerformed(DndEvent dndEvent) {
-
- m_serviceNewWizardPage.pingStateChanging();
- }
-
- private void validateDropCopy(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
- }
-
- private void validateDropMove(DndEvent dndEvent) {
- switch (dndEvent.node.getType()) {
- case TYPE_SERVICE_IMPLEMENTATION:
- case TYPE_SERVICE_REG_SERVER:
- dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
- break;
- default:
- dndEvent.doit = false;
- break;
- }
-
- }
- } // end class P_TreeDndListener
-
- private class P_StatusRevalidator implements IStatusProvider {
-
- @Override
- public void validate(Object source, MultiStatus multiStatus) {
- multiStatus.add(getStatusServiceRegistrationServer());
- multiStatus.add(getStatusTypeNames());
- }
-
- protected IStatus getStatusTypeNames() {
-
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplementationBundle != null) {
- ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
- if (serviceImplNode != null) {
- String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_COMMON_SQL) + "." + serviceImplNode.getText();
- if (serviceImplementationBundle.findType(fqn) != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
- }
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusServiceRegistrationServer() {
- IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
- ITreeNode[] serviceRegistrationServerNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
- for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
- Object data = serviceRegNode.getParent().getData();
- if (data instanceof IScoutBundle) {
- IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
- if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
- if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
- }
- }
- }
- }
-
- return Status.OK_STATUS;
- }
-
- } // end class P_StatusRevalidator
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.services;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.service.ServiceNewOperation;
+import org.eclipse.scout.sdk.ui.fields.bundletree.DndEvent;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeDndListener;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNode;
+import org.eclipse.scout.sdk.ui.fields.bundletree.ITreeNodeFilter;
+import org.eclipse.scout.sdk.ui.fields.bundletree.NodeFilters;
+import org.eclipse.scout.sdk.ui.fields.bundletree.TreeUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.ui.wizard.BundleTreeWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.IStatusProvider;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.dnd.DND;
+
+public class SqlServiceNewWizard extends AbstractWorkspaceWizard {
+ public static final int TYPE_SERVICE_IMPLEMENTATION = 108;
+ public static final int TYPE_SERVICE_REG_SERVER = 110;
+
+ private ServiceNewWizardPage m_serviceNewWizardPage;
+ private BundleTreeWizardPage m_locationWizardPage;
+ private ITreeNode m_locationWizardPageRoot;
+ private ServiceNewOperation m_operation = new ServiceNewOperation();
+
+ public SqlServiceNewWizard(IScoutBundle serverBundle) {
+ setWindowTitle(Texts.get("NewSQLService"));
+ P_StatusRevalidator statusProvider = new P_StatusRevalidator();
+
+ m_locationWizardPageRoot = createTree(serverBundle);
+ m_locationWizardPage = new BundleTreeWizardPage(Texts.get("SQLServiceLocation"), Texts.get("OrganiseLocations"), m_locationWizardPageRoot, new P_InitialCheckerFilter());
+ m_locationWizardPage.addStatusProvider(statusProvider);
+ m_locationWizardPage.addDndListener(new P_TreeDndListener());
+
+ m_serviceNewWizardPage = new ServiceNewWizardPage(Texts.get("NewSQLService"), Texts.get("CreateANewSQLService"), TypeUtility.getType(RuntimeClasses.ISqlService), SdkProperties.SUFFIX_SQL_SERVICE);
+ m_serviceNewWizardPage.setLocationBundle(serverBundle);
+ m_serviceNewWizardPage.addStatusProvider(statusProvider);
+ m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractSqlService));
+ m_serviceNewWizardPage.addPropertyChangeListener(new P_LocationPropertyListener());
+
+ addPage(m_serviceNewWizardPage);
+ addPage(m_locationWizardPage);
+
+ // init
+ m_serviceNewWizardPage.setSuperType(TypeUtility.getType(RuntimeClasses.AbstractSqlService));
+ }
+
+ private ITreeNode createTree(IScoutBundle serverBundle) {
+ ITreeNode rootNode = TreeUtility.createBundleTree(serverBundle.getScoutProject(), NodeFilters.getByType(IScoutBundle.BUNDLE_SERVER));
+
+ if (serverBundle != null) {
+ ITreeNode serverNode = TreeUtility.findNode(rootNode, NodeFilters.getByData(serverBundle));
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_IMPLEMENTATION, Texts.get("Service"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), TYPE_SERVICE_IMPLEMENTATION);
+ // service implementation
+ TreeUtility.createNode(serverNode, TYPE_SERVICE_REG_SERVER, Texts.get("ServiceRegistration"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Public), TYPE_SERVICE_REG_SERVER);
+ }
+ return rootNode;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ IType superType = m_serviceNewWizardPage.getSuperType();
+ if (superType != null) {
+ m_operation.setServiceSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
+ }
+ IScoutBundle implementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (implementationBundle != null) {
+ m_operation.setImplementationBundle(implementationBundle);
+ m_operation.setServicePackageName(implementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_COMMON_SQL));
+ m_operation.setServiceName(m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION, true, true));
+ }
+ IScoutBundle[] serverRegBundles = m_locationWizardPage.getLocationBundles(TYPE_SERVICE_REG_SERVER, true, true);
+ for (IScoutBundle sb : serverRegBundles) {
+ m_operation.addServiceRegistrationBundle(sb);
+ }
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
+ try {
+ m_operation.validate();
+ m_operation.run(monitor, workingCopyManager);
+ return true;
+ }
+ catch (IllegalArgumentException e) {
+ ScoutSdkUi.logWarning("validation error of operation '" + m_operation.getOperationName() + "'. " + e.getMessage());
+ return false;
+ }
+ catch (CoreException e) {
+ ScoutSdkUi.logError("error during executing operation '" + m_operation.getOperationName() + "'.", e);
+ return false;
+ }
+ }
+
+ private class P_LocationPropertyListener implements PropertyChangeListener {
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ if (evt.getPropertyName().equals(ServiceNewWizardPage.PROP_TYPE_NAME)) {
+ String typeName = m_serviceNewWizardPage.getTypeName();
+ if (!StringUtility.isNullOrEmpty(typeName)) {
+ String prefix = typeName.replaceAll(SdkProperties.SUFFIX_SQL_SERVICE + "$", "");
+ TreeUtility.findNode(m_locationWizardPageRoot, NodeFilters.getByType(TYPE_SERVICE_IMPLEMENTATION)).setText(prefix + SdkProperties.SUFFIX_SQL_SERVICE);
+ m_locationWizardPage.refreshTree();
+ }
+ m_locationWizardPage.pingStateChanging();
+ }
+ }
+ } // end class P_LocationPropertyListener
+
+ private class P_InitialCheckerFilter implements ITreeNodeFilter {
+ @Override
+ public boolean accept(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+
+ case IScoutBundle.BUNDLE_CLIENT:
+ case IScoutBundle.BUNDLE_SHARED:
+ case IScoutBundle.BUNDLE_SERVER:
+ default:
+ return false;
+ }
+ }
+ } // end class P_InitialCheckerFilter
+
+ private class P_TreeDndListener implements ITreeDndListener {
+ @Override
+ public boolean isDragableNode(ITreeNode node) {
+ switch (node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_REG_SERVER:
+ return true;
+ default:
+ return false;
+ }
+ }
+
+ @Override
+ public void validateTarget(DndEvent dndEvent) {
+ if (dndEvent.targetParent == null) {
+ dndEvent.doit = false;
+ return;
+ }
+ if (dndEvent.operation == DND.DROP_COPY) {
+ validateDropCopy(dndEvent);
+ }
+ else if (dndEvent.operation == DND.DROP_MOVE) {
+ validateDropMove(dndEvent);
+ }
+ }
+
+ @Override
+ public void dndPerformed(DndEvent dndEvent) {
+
+ m_serviceNewWizardPage.pingStateChanging();
+ }
+
+ private void validateDropCopy(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+ }
+
+ private void validateDropMove(DndEvent dndEvent) {
+ switch (dndEvent.node.getType()) {
+ case TYPE_SERVICE_IMPLEMENTATION:
+ case TYPE_SERVICE_REG_SERVER:
+ dndEvent.doit = dndEvent.targetParent.getType() == IScoutBundle.BUNDLE_SERVER;
+ break;
+ default:
+ dndEvent.doit = false;
+ break;
+ }
+
+ }
+ } // end class P_TreeDndListener
+
+ private class P_StatusRevalidator implements IStatusProvider {
+
+ @Override
+ public void validate(Object source, MultiStatus multiStatus) {
+ multiStatus.add(getStatusServiceRegistrationServer());
+ multiStatus.add(getStatusTypeNames());
+ }
+
+ protected IStatus getStatusTypeNames() {
+
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplementationBundle != null) {
+ ITreeNode serviceImplNode = m_locationWizardPage.getTreeNode(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ if (serviceImplNode != null) {
+ String fqn = serviceImplementationBundle.getPackageName(IScoutBundle.SERVER_PACKAGE_APPENDIX_SERVICES_COMMON_SQL) + "." + serviceImplNode.getText();
+ if (serviceImplementationBundle.findType(fqn) != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "'" + serviceImplNode.getText() + "' " + Texts.get("AlreadyExists") + ".");
+ }
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusServiceRegistrationServer() {
+ IScoutBundle serviceImplementationBundle = m_locationWizardPage.getLocationBundle(TYPE_SERVICE_IMPLEMENTATION, true, true);
+ ITreeNode[] serviceRegistrationServerNodes = m_locationWizardPage.getTreeNodes(TYPE_SERVICE_REG_SERVER, true, true);
+ for (ITreeNode serviceRegNode : serviceRegistrationServerNodes) {
+ Object data = serviceRegNode.getParent().getData();
+ if (data instanceof IScoutBundle) {
+ IScoutBundle serviceRegistrationBundle = (IScoutBundle) data;
+ if (serviceImplementationBundle != null && serviceRegistrationBundle != null) {
+ if (!serviceRegistrationBundle.isOnClasspath(serviceImplementationBundle)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("XIsNotOnClasspathOfServiceY", m_locationWizardPage.getTextOfNode(TYPE_SERVICE_IMPLEMENTATION), serviceRegistrationBundle.getBundleName()));
+ }
+ }
+ }
+ }
+
+ return Status.OK_STATUS;
+ }
+
+ } // end class P_StatusRevalidator
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/DefaultTableColumnNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/DefaultTableColumnNewWizard.java
index de2f1ca26..112a28d87 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/DefaultTableColumnNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/DefaultTableColumnNewWizard.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.tablecolumn;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.tablecolumn.TableColumnNewWizard.CONTINUE_OPERATION;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-
-public class DefaultTableColumnNewWizard extends AbstractFormFieldWizard {
-
- private DefaultTableColumnNewWizardPage m_page1;
- private CONTINUE_OPERATION m_nextOperation;
-
- public DefaultTableColumnNewWizard(CONTINUE_OPERATION op) {
- setWindowTitle(Texts.get("NewTableColumn"));
- m_nextOperation = op;
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new DefaultTableColumnNewWizardPage(getDeclaringType(), m_nextOperation);
- addPage(m_page1);
- }
-
- @Override
- public void setSuperType(IType superType) {
- m_page1.setSuperType(superType);
- }
-
- @Override
- protected void postFinishDisplayThread() {
- IType createdField = m_page1.getCreatedColumn();
- if (TypeUtility.exists(createdField)) {
- ScoutSdkUi.showJavaElementInEditor(createdField, false);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.tablecolumn;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.tablecolumn.TableColumnNewWizard.CONTINUE_OPERATION;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+public class DefaultTableColumnNewWizard extends AbstractFormFieldWizard {
+
+ private DefaultTableColumnNewWizardPage m_page1;
+ private CONTINUE_OPERATION m_nextOperation;
+
+ public DefaultTableColumnNewWizard(CONTINUE_OPERATION op) {
+ setWindowTitle(Texts.get("NewTableColumn"));
+ m_nextOperation = op;
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new DefaultTableColumnNewWizardPage(getDeclaringType(), m_nextOperation);
+ addPage(m_page1);
+ }
+
+ @Override
+ public void setSuperType(IType superType) {
+ m_page1.setSuperType(superType);
+ }
+
+ @Override
+ protected void postFinishDisplayThread() {
+ IType createdField = m_page1.getCreatedColumn();
+ if (TypeUtility.exists(createdField)) {
+ ScoutSdkUi.showJavaElementInEditor(createdField, false);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/DefaultTableColumnNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/DefaultTableColumnNewWizardPage.java
index 5da0f31a1..9f7bb42d3 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/DefaultTableColumnNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/DefaultTableColumnNewWizardPage.java
@@ -1,362 +1,362 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.tablecolumn;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.nls.sdk.model.workspace.project.INlsProject;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.TableColumnNewOperation;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.buttongroup.ButtonGroup;
-import org.eclipse.scout.sdk.ui.fields.buttongroup.IButtonGroupListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.ScoutWizardDialog;
-import org.eclipse.scout.sdk.ui.wizard.tablecolumn.TableColumnNewWizard.CONTINUE_OPERATION;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
-import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * <h3>DefaultTableColumnNewWizardPage</h3> ...
- */
-public class DefaultTableColumnNewWizardPage extends AbstractWorkspaceWizardPage {
- private INlsEntry m_nlsName;
- private String m_typeName;
- private String m_genericSignature;
- private SiblingProposal m_sibling;
- private CONTINUE_OPERATION m_continueOperation;
-
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_genericTypeField;
- private ProposalTextField m_siblingField;
-
- // process members
- private final IType m_declaringType;
- private IType m_superType;
- private IType m_createdColumn;
-
- public DefaultTableColumnNewWizardPage(IType declaringType, CONTINUE_OPERATION op) {
- super(DefaultTableColumnNewWizardPage.class.getName());
- setTitle(Texts.get("NewTableColumn"));
- setDescription(Texts.get("CreateANewTableColumn"));
- // default values
- m_genericSignature = Signature.createTypeSignature(Long.class.getName(), true);
- m_declaringType = declaringType;
- m_sibling = SiblingProposal.SIBLING_END;
- m_continueOperation = op;
- }
-
- @Override
- protected void createContent(Composite parent) {
- createFieldGroup(parent);
- createNextStepsGroup(parent);
- parent.setLayout(new GridLayout(1, false));
- }
-
- private void createNextStepsGroup(Composite p) {
- Group g = new Group(p, SWT.NONE);
- g.setText(Texts.get("NextStep"));
- g.setLayout(new GridLayout(1, false));
- g.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
-
- ButtonGroup<CONTINUE_OPERATION> nextStepOptions = new ButtonGroup<CONTINUE_OPERATION>(g, SWT.RADIO);
- nextStepOptions.createButton(Texts.get("CreateMoreColumn"), CONTINUE_OPERATION.ADD_MORE_COLUMNS);
- nextStepOptions.createButton(Texts.get("FinishWizard"), CONTINUE_OPERATION.FINISH);
- nextStepOptions.addButtonGroupListener(new IButtonGroupListener<CONTINUE_OPERATION>() {
-
- @Override
- public void handleSelectionChanged(List<CONTINUE_OPERATION> newSelection) {
- m_continueOperation = newSelection.get(0);
- }
- });
- nextStepOptions.setValue(m_continueOperation);
- nextStepOptions.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- private void createFieldGroup(Composite p) {
- Group fieldGroup = new Group(p, SWT.NONE);
- fieldGroup.setText(Texts.get("Column"));
-
- INlsProject nlsProject = ScoutTypeUtility.findNlsProject(m_declaringType);
- m_nlsNameField = getFieldToolkit().createNlsProposalTextField(fieldGroup, nlsProject, Texts.get("Name"));
- m_nlsNameField.acceptProposal(m_nlsName);
- m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- INlsEntry oldEntry = getNlsName();
- m_nlsName = (INlsEntry) event.proposal;
- if (m_nlsName != null) {
- if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
- m_typeNameField.setText(m_nlsName.getKey());
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_typeNameField = getFieldToolkit().createStyledTextField(fieldGroup, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_TABLE_COLUMN);
- m_typeNameField.setText(m_typeName);
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_typeName = m_typeNameField.getText();
- pingStateChanging();
- }
- });
-
- m_genericTypeField = getFieldToolkit().createSignatureProposalField(fieldGroup, Texts.get("GenericType"), ScoutTypeUtility.getScoutBundle(m_declaringType));
- m_genericTypeField.acceptProposal(getGenericSignature());
- m_genericTypeField.setEnabled(TypeUtility.isGenericType(getSuperType()));
- m_genericTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_genericSignature = (String) event.proposal;
- pingStateChanging();
- }
- });
-
- m_siblingField = getFieldToolkit().createSiblingProposalField(fieldGroup, m_declaringType, TypeUtility.getType(RuntimeClasses.IColumn));
- m_siblingField.acceptProposal(m_sibling);
- m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_sibling = (SiblingProposal) event.proposal;
- pingStateChanging();
- }
- });
-
- // layout
- fieldGroup.setLayout(new GridLayout(1, false));
- fieldGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
-
- m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_genericTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_siblingField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
-
- if (CONTINUE_OPERATION.ADD_MORE_COLUMNS == m_continueOperation) {
- // start another wizard if one additional column should be created.
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- TableColumnNewWizard wizard = new TableColumnNewWizard(m_continueOperation);
- wizard.initWizard(m_declaringType);
- ScoutWizardDialog wizardDialog = new ScoutWizardDialog(wizard);
- wizardDialog.open();
- }
- });
- }
-
- TableColumnNewOperation operation = new TableColumnNewOperation(m_declaringType, true);
- // write back members
- IType superTypeProp = getSuperType();
- if (superTypeProp != null) {
- String sig = null;
- if (getGenericSignature() != null) {
- sig = Signature.createTypeSignature(superTypeProp.getFullyQualifiedName() + "<" + Signature.toString(getGenericSignature()) + ">", true);
- }
- else {
- sig = Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true);
- }
- operation.setSuperTypeSignature(sig);
- }
- operation.setNlsEntry(getNlsName());
- operation.setTypeName(getTypeName());
- if (getSibling() == SiblingProposal.SIBLING_END) {
- IStructuredType structuredType = ScoutTypeUtility.createStructuredTable(m_declaringType);
- operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_COLUMN));
- }
- else {
- operation.setSibling(getSibling().getElement());
- }
- operation.validate();
- operation.run(monitor, workingCopyManager);
- m_createdColumn = operation.getCreatedColumn();
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusGenericType());
- if (isControlCreated()) {
- m_genericTypeField.setEnabled(TypeUtility.isGenericType(getSuperType()));
- }
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_TABLE_COLUMN)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- /**
- * @return the createdColumn
- */
- public IType getCreatedColumn() {
- return m_createdColumn;
- }
-
- protected IStatus getStatusGenericType() throws JavaModelException {
- if (TypeUtility.isGenericType(getSuperType())) {
- if (getGenericSignature() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "Generic type can not be null!");
- }
- }
- return Status.OK_STATUS;
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- if (TypeUtility.isGenericType(getSuperType())) {
- setGenericSignature(Signature.createTypeSignature(Long.class.getName(), true));
- }
- else {
- setGenericSignature(null);
- }
- m_superType = superType;
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public IType getSuperType() {
- return m_superType;
- }
-
- public INlsEntry getNlsName() {
- return m_nlsName;
- }
-
- public void setNlsName(INlsEntry nlsName) {
- try {
- setStateChanging(true);
- m_nlsName = nlsName;
- if (isControlCreated()) {
- m_nlsNameField.acceptProposal(nlsName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getTypeName() {
- return m_typeName;
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- m_typeName = typeName;
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public void setGenericSignature(String genericSignature) {
- try {
- setStateChanging(true);
- m_genericSignature = genericSignature;
- if (isControlCreated()) {
- m_genericTypeField.acceptProposal(genericSignature);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getGenericSignature() {
- return m_genericSignature;
- }
-
- public SiblingProposal getSibling() {
- return m_sibling;
- }
-
- public void setSibling(SiblingProposal sibling) {
- try {
- setStateChanging(true);
- m_sibling = sibling;
- if (isControlCreated()) {
- m_siblingField.acceptProposal(sibling);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.tablecolumn;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.nls.sdk.model.workspace.project.INlsProject;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.TableColumnNewOperation;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.buttongroup.ButtonGroup;
+import org.eclipse.scout.sdk.ui.fields.buttongroup.IButtonGroupListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.ScoutWizardDialog;
+import org.eclipse.scout.sdk.ui.wizard.tablecolumn.TableColumnNewWizard.CONTINUE_OPERATION;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+
+/**
+ * <h3>DefaultTableColumnNewWizardPage</h3> ...
+ */
+public class DefaultTableColumnNewWizardPage extends AbstractWorkspaceWizardPage {
+ private INlsEntry m_nlsName;
+ private String m_typeName;
+ private String m_genericSignature;
+ private SiblingProposal m_sibling;
+ private CONTINUE_OPERATION m_continueOperation;
+
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_genericTypeField;
+ private ProposalTextField m_siblingField;
+
+ // process members
+ private final IType m_declaringType;
+ private IType m_superType;
+ private IType m_createdColumn;
+
+ public DefaultTableColumnNewWizardPage(IType declaringType, CONTINUE_OPERATION op) {
+ super(DefaultTableColumnNewWizardPage.class.getName());
+ setTitle(Texts.get("NewTableColumn"));
+ setDescription(Texts.get("CreateANewTableColumn"));
+ // default values
+ m_genericSignature = Signature.createTypeSignature(Long.class.getName(), true);
+ m_declaringType = declaringType;
+ m_sibling = SiblingProposal.SIBLING_END;
+ m_continueOperation = op;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ createFieldGroup(parent);
+ createNextStepsGroup(parent);
+ parent.setLayout(new GridLayout(1, false));
+ }
+
+ private void createNextStepsGroup(Composite p) {
+ Group g = new Group(p, SWT.NONE);
+ g.setText(Texts.get("NextStep"));
+ g.setLayout(new GridLayout(1, false));
+ g.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+
+ ButtonGroup<CONTINUE_OPERATION> nextStepOptions = new ButtonGroup<CONTINUE_OPERATION>(g, SWT.RADIO);
+ nextStepOptions.createButton(Texts.get("CreateMoreColumn"), CONTINUE_OPERATION.ADD_MORE_COLUMNS);
+ nextStepOptions.createButton(Texts.get("FinishWizard"), CONTINUE_OPERATION.FINISH);
+ nextStepOptions.addButtonGroupListener(new IButtonGroupListener<CONTINUE_OPERATION>() {
+
+ @Override
+ public void handleSelectionChanged(List<CONTINUE_OPERATION> newSelection) {
+ m_continueOperation = newSelection.get(0);
+ }
+ });
+ nextStepOptions.setValue(m_continueOperation);
+ nextStepOptions.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ private void createFieldGroup(Composite p) {
+ Group fieldGroup = new Group(p, SWT.NONE);
+ fieldGroup.setText(Texts.get("Column"));
+
+ INlsProject nlsProject = ScoutTypeUtility.findNlsProject(m_declaringType);
+ m_nlsNameField = getFieldToolkit().createNlsProposalTextField(fieldGroup, nlsProject, Texts.get("Name"));
+ m_nlsNameField.acceptProposal(m_nlsName);
+ m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ INlsEntry oldEntry = getNlsName();
+ m_nlsName = (INlsEntry) event.proposal;
+ if (m_nlsName != null) {
+ if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
+ m_typeNameField.setText(m_nlsName.getKey());
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(fieldGroup, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_TABLE_COLUMN);
+ m_typeNameField.setText(m_typeName);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_typeName = m_typeNameField.getText();
+ pingStateChanging();
+ }
+ });
+
+ m_genericTypeField = getFieldToolkit().createSignatureProposalField(fieldGroup, Texts.get("GenericType"), ScoutTypeUtility.getScoutBundle(m_declaringType));
+ m_genericTypeField.acceptProposal(getGenericSignature());
+ m_genericTypeField.setEnabled(TypeUtility.isGenericType(getSuperType()));
+ m_genericTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_genericSignature = (String) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ m_siblingField = getFieldToolkit().createSiblingProposalField(fieldGroup, m_declaringType, TypeUtility.getType(RuntimeClasses.IColumn));
+ m_siblingField.acceptProposal(m_sibling);
+ m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_sibling = (SiblingProposal) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ fieldGroup.setLayout(new GridLayout(1, false));
+ fieldGroup.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+
+ m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_genericTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_siblingField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+
+ if (CONTINUE_OPERATION.ADD_MORE_COLUMNS == m_continueOperation) {
+ // start another wizard if one additional column should be created.
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ TableColumnNewWizard wizard = new TableColumnNewWizard(m_continueOperation);
+ wizard.initWizard(m_declaringType);
+ ScoutWizardDialog wizardDialog = new ScoutWizardDialog(wizard);
+ wizardDialog.open();
+ }
+ });
+ }
+
+ TableColumnNewOperation operation = new TableColumnNewOperation(m_declaringType, true);
+ // write back members
+ IType superTypeProp = getSuperType();
+ if (superTypeProp != null) {
+ String sig = null;
+ if (getGenericSignature() != null) {
+ sig = Signature.createTypeSignature(superTypeProp.getFullyQualifiedName() + "<" + Signature.toString(getGenericSignature()) + ">", true);
+ }
+ else {
+ sig = Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true);
+ }
+ operation.setSuperTypeSignature(sig);
+ }
+ operation.setNlsEntry(getNlsName());
+ operation.setTypeName(getTypeName());
+ if (getSibling() == SiblingProposal.SIBLING_END) {
+ IStructuredType structuredType = ScoutTypeUtility.createStructuredTable(m_declaringType);
+ operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_COLUMN));
+ }
+ else {
+ operation.setSibling(getSibling().getElement());
+ }
+ operation.validate();
+ operation.run(monitor, workingCopyManager);
+ m_createdColumn = operation.getCreatedColumn();
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusGenericType());
+ if (isControlCreated()) {
+ m_genericTypeField.setEnabled(TypeUtility.isGenericType(getSuperType()));
+ }
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_TABLE_COLUMN)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ /**
+ * @return the createdColumn
+ */
+ public IType getCreatedColumn() {
+ return m_createdColumn;
+ }
+
+ protected IStatus getStatusGenericType() throws JavaModelException {
+ if (TypeUtility.isGenericType(getSuperType())) {
+ if (getGenericSignature() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, "Generic type can not be null!");
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ if (TypeUtility.isGenericType(getSuperType())) {
+ setGenericSignature(Signature.createTypeSignature(Long.class.getName(), true));
+ }
+ else {
+ setGenericSignature(null);
+ }
+ m_superType = superType;
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getSuperType() {
+ return m_superType;
+ }
+
+ public INlsEntry getNlsName() {
+ return m_nlsName;
+ }
+
+ public void setNlsName(INlsEntry nlsName) {
+ try {
+ setStateChanging(true);
+ m_nlsName = nlsName;
+ if (isControlCreated()) {
+ m_nlsNameField.acceptProposal(nlsName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getTypeName() {
+ return m_typeName;
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ m_typeName = typeName;
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public void setGenericSignature(String genericSignature) {
+ try {
+ setStateChanging(true);
+ m_genericSignature = genericSignature;
+ if (isControlCreated()) {
+ m_genericTypeField.acceptProposal(genericSignature);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getGenericSignature() {
+ return m_genericSignature;
+ }
+
+ public SiblingProposal getSibling() {
+ return m_sibling;
+ }
+
+ public void setSibling(SiblingProposal sibling) {
+ try {
+ setStateChanging(true);
+ m_sibling = sibling;
+ if (isControlCreated()) {
+ m_siblingField.acceptProposal(sibling);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/SmartTableColumnNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/SmartTableColumnNewWizard.java
index b8adf3aaa..757c03848 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/SmartTableColumnNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/SmartTableColumnNewWizard.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.tablecolumn;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.tablecolumn.TableColumnNewWizard.CONTINUE_OPERATION;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-
-/**
- * <h3>SmartTableColumnNewWizard</h3> ...
- */
-public class SmartTableColumnNewWizard extends AbstractFormFieldWizard {
-
- private SmartTableColumnNewWizardPage m_page1;
- private CONTINUE_OPERATION m_nextOperation;
-
- public SmartTableColumnNewWizard(CONTINUE_OPERATION op) {
- setWindowTitle(Texts.get("NewSmartTableColumn"));
- m_nextOperation = op;
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new SmartTableColumnNewWizardPage(getDeclaringType(), m_nextOperation);
- addPage(m_page1);
- }
-
- @Override
- public void setSuperType(IType superType) {
- m_page1.setSuperType(superType);
- }
-
- @Override
- protected void postFinishDisplayThread() {
- IType createdField = m_page1.getCreatedColumn();
- if (TypeUtility.exists(createdField)) {
- ScoutSdkUi.showJavaElementInEditor(createdField, false);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.tablecolumn;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.tablecolumn.TableColumnNewWizard.CONTINUE_OPERATION;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+/**
+ * <h3>SmartTableColumnNewWizard</h3> ...
+ */
+public class SmartTableColumnNewWizard extends AbstractFormFieldWizard {
+
+ private SmartTableColumnNewWizardPage m_page1;
+ private CONTINUE_OPERATION m_nextOperation;
+
+ public SmartTableColumnNewWizard(CONTINUE_OPERATION op) {
+ setWindowTitle(Texts.get("NewSmartTableColumn"));
+ m_nextOperation = op;
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new SmartTableColumnNewWizardPage(getDeclaringType(), m_nextOperation);
+ addPage(m_page1);
+ }
+
+ @Override
+ public void setSuperType(IType superType) {
+ m_page1.setSuperType(superType);
+ }
+
+ @Override
+ protected void postFinishDisplayThread() {
+ IType createdField = m_page1.getCreatedColumn();
+ if (TypeUtility.exists(createdField)) {
+ ScoutSdkUi.showJavaElementInEditor(createdField, false);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/SmartTableColumnNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/SmartTableColumnNewWizardPage.java
index a48672e8a..eef726306 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/SmartTableColumnNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/SmartTableColumnNewWizardPage.java
@@ -1,458 +1,458 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.tablecolumn;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.SmartTableColumnNewOperation;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.buttongroup.ButtonGroup;
-import org.eclipse.scout.sdk.ui.fields.buttongroup.IButtonGroupListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.AbstractJavaElementContentProvider;
-import org.eclipse.scout.sdk.ui.fields.proposal.signature.SignatureProposalProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.ScoutWizardDialog;
-import org.eclipse.scout.sdk.ui.wizard.tablecolumn.TableColumnNewWizard.CONTINUE_OPERATION;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
-import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Group;
-
-/**
- * <h3> {@link SmartTableColumnNewWizardPage}</h3> ...
- */
-public class SmartTableColumnNewWizardPage extends AbstractWorkspaceWizardPage {
- final IType iColumn = TypeUtility.getType(RuntimeClasses.IColumn);
- final IType lookupCall = TypeUtility.getType(RuntimeClasses.LookupCall);
- final IType iCodeType = TypeUtility.getType(RuntimeClasses.ICodeType);
-
- private INlsEntry m_nlsName;
- private String m_typeName;
- private String m_genericSignature;
- private IType m_lookupCall;
- private IType m_codeType;
- private CONTINUE_OPERATION m_continueOperation;
- private SiblingProposal m_sibling;
-
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_genericTypeField;
- private ProposalTextField m_lookupCallField;
- private ProposalTextField m_codeTypeField;
- private ProposalTextField m_siblingField;
-
- // process members
- private final IType m_declaringType;
- private IType m_superType;
- private IType m_createdColumn;
-
- public SmartTableColumnNewWizardPage(IType declaringType, CONTINUE_OPERATION op) {
- super(SmartTableColumnNewWizardPage.class.getName());
- setTitle(Texts.get("NewSmartTableColumn"));
- setDescription(Texts.get("CreateANewSmartTableColumn"));
- m_declaringType = declaringType;
- // default values
- m_genericSignature = Signature.createTypeSignature(Long.class.getName(), true);
- m_sibling = SiblingProposal.SIBLING_END;
- m_continueOperation = op;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- createColumnGroup(parent);
- createNextStepsGroup(parent);
-
- parent.setLayout(new GridLayout(1, true));
- }
-
- private void createColumnGroup(Composite p) {
- Group g = new Group(p, SWT.NONE);
- g.setText(Texts.get("Column"));
-
- m_nlsNameField = getFieldToolkit().createNlsProposalTextField(g, ScoutTypeUtility.findNlsProject(m_declaringType), Texts.get("Name"));
- m_nlsNameField.acceptProposal(m_nlsName);
- m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- INlsEntry oldEntry = getNlsName();
- m_nlsName = (INlsEntry) event.proposal;
- if (m_nlsName != null) {
- if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
- m_typeNameField.setText(m_nlsName.getKey());
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_typeNameField = getFieldToolkit().createStyledTextField(g, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_TABLE_COLUMN);
- m_typeNameField.setText(m_typeName);
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_typeName = m_typeNameField.getText();
- pingStateChanging();
- }
- });
-
- m_genericTypeField = getFieldToolkit().createSignatureProposalField(g, Texts.get("GenericType"), ScoutTypeUtility.getScoutBundle(m_declaringType), SignatureProposalProvider.DEFAULT_MOST_USED);
- m_genericTypeField.acceptProposal(getGenericSignature());
- m_genericTypeField.setEnabled(TypeUtility.isGenericType(getSuperType()));
- m_genericTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_genericSignature = (String) event.proposal;
- pingStateChanging();
- }
- });
-
- m_lookupCallField = getFieldToolkit().createJavaElementProposalField(g, Texts.get("LookupCall"), new AbstractJavaElementContentProvider() {
- @Override
- protected Object[][] computeProposals() {
- return new Object[][]{ScoutTypeUtility.getClassesOnClasspath(lookupCall, getSharedBundle().getJavaProject())};
- }
- });
- m_lookupCallField.acceptProposal(getLookupCall());
- m_lookupCallField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- m_lookupCall = (IType) event.proposal;
- m_codeTypeField.acceptProposal(null);
- m_codeTypeField.setEnabled(m_lookupCall == null);
- }
- finally {
- setStateChanging(false);
- }
- pingStateChanging();
- }
- });
-
- m_codeTypeField = getFieldToolkit().createJavaElementProposalField(g, Texts.get("CodeType"), new AbstractJavaElementContentProvider() {
- @Override
- protected Object[][] computeProposals() {
- return new Object[][]{ScoutTypeUtility.getClassesOnClasspath(iCodeType, getSharedBundle().getJavaProject())};
- }
- });
- m_codeTypeField.acceptProposal(getCodeType());
- m_codeTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- m_codeType = (IType) event.proposal;
- m_lookupCallField.acceptProposal(null);
- m_lookupCallField.setEnabled(m_codeType == null);
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_siblingField = getFieldToolkit().createSiblingProposalField(g, m_declaringType, iColumn);
- m_siblingField.acceptProposal(m_sibling);
- m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_sibling = (SiblingProposal) event.proposal;
- pingStateChanging();
- }
- });
-
- // layout
- g.setLayout(new GridLayout(1, false));
- g.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
-
- m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_genericTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_lookupCallField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_codeTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_siblingField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- private void createNextStepsGroup(Composite p) {
- Group g = new Group(p, SWT.NONE);
- g.setText(Texts.get("NextStep"));
- g.setLayout(new GridLayout(1, false));
- g.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
-
- ButtonGroup<CONTINUE_OPERATION> nextStepOptions = new ButtonGroup<CONTINUE_OPERATION>(g, SWT.RADIO);
- nextStepOptions.createButton(Texts.get("CreateMoreColumn"), CONTINUE_OPERATION.ADD_MORE_COLUMNS);
- nextStepOptions.createButton(Texts.get("FinishWizard"), CONTINUE_OPERATION.FINISH);
- nextStepOptions.addButtonGroupListener(new IButtonGroupListener<CONTINUE_OPERATION>() {
-
- @Override
- public void handleSelectionChanged(List<CONTINUE_OPERATION> newSelection) {
- m_continueOperation = newSelection.get(0);
- }
- });
- nextStepOptions.setValue(m_continueOperation);
- nextStepOptions.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- if (CONTINUE_OPERATION.ADD_MORE_COLUMNS == m_continueOperation) {
- // start another wizard if one additional column should be created.
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- TableColumnNewWizard wizard = new TableColumnNewWizard(m_continueOperation);
- wizard.initWizard(m_declaringType);
- ScoutWizardDialog wizardDialog = new ScoutWizardDialog(wizard);
- wizardDialog.open();
- }
- });
- }
-
- SmartTableColumnNewOperation operation = new SmartTableColumnNewOperation(m_declaringType, true);
- // write back members
- IType superType = getSuperType();
- if (superType != null) {
- String sig = null;
- if (getGenericSignature() != null) {
- sig = Signature.createTypeSignature(superType.getFullyQualifiedName() + "<" + Signature.toString(getGenericSignature()) + ">", true);
- }
- else {
- sig = Signature.createTypeSignature(superType.getFullyQualifiedName(), true);
- }
- operation.setSuperTypeSignature(sig);
- }
- operation.setNlsEntry(getNlsName());
- operation.setTypeName(getTypeName());
- operation.setCodeType(getCodeType());
- if (getLookupCall() != null) {
- operation.setLookupCall(getLookupCall());
- }
- if (getSibling() == SiblingProposal.SIBLING_END) {
- IStructuredType structuredType = ScoutTypeUtility.createStructuredTable(m_declaringType);
- operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_COLUMN));
- }
- else {
- operation.setSibling(getSibling().getElement());
- }
- operation.validate();
- operation.run(monitor, workingCopyManager);
- m_createdColumn = operation.getCreatedColumn();
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusGenericType());
- multiStatus.add(getStatusLookupCallCodeType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_TABLE_COLUMN)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusGenericType() throws JavaModelException {
- if (TypeUtility.isGenericType(getSuperType())) {
- if (getGenericSignature() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("GenericTypeCanNotBeNull"));
- }
- }
- return Status.OK_STATUS;
- }
-
- protected IStatus getStatusLookupCallCodeType() {
- if (getCodeType() != null && getLookupCall() != null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("OnlyOneOfCodeTypeOrLookupCallCanBeProcessed"));
- }
- return Status.OK_STATUS;
- }
-
- public IScoutBundle getClientBundle() {
- return ScoutTypeUtility.getScoutBundle(m_declaringType);
- }
-
- public IScoutBundle getSharedBundle() {
- return getClientBundle().findBestMatchShared();
- }
-
- /**
- * @return the createdColumn
- */
- public IType getCreatedColumn() {
- return m_createdColumn;
- }
-
- public void setSuperType(IType superType) {
- m_superType = superType;
- }
-
- public IType getSuperType() {
- return m_superType;
- }
-
- public INlsEntry getNlsName() {
- return m_nlsName;
- }
-
- public void setNlsName(INlsEntry nlsName) {
- try {
- setStateChanging(true);
- m_nlsName = nlsName;
- if (isControlCreated()) {
- m_nlsNameField.acceptProposal(nlsName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getTypeName() {
- return m_typeName;
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- m_typeName = typeName;
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public void setGenericSignature(String genericSignature) {
- try {
- setStateChanging(true);
- m_genericSignature = genericSignature;
- if (isControlCreated()) {
- m_genericTypeField.acceptProposal(genericSignature);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getGenericSignature() {
- return m_genericSignature;
- }
-
- public void setLookupCall(IType lookupCall) {
- try {
- setStateChanging(true);
- m_lookupCall = lookupCall;
- if (isControlCreated()) {
- m_codeTypeField.acceptProposal(lookupCall);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public IType getLookupCall() {
- return m_lookupCall;
- }
-
- public IType getCodeType() {
- return m_codeType;
- }
-
- public void setCodeType(IType codeType) {
- try {
- setStateChanging(true);
- m_codeType = codeType;
- if (isControlCreated()) {
- m_codeTypeField.acceptProposal(codeType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public SiblingProposal getSibling() {
- return m_sibling;
- }
-
- public void setSibling(SiblingProposal sibling) {
- try {
- setStateChanging(true);
- m_sibling = sibling;
- if (isControlCreated()) {
- m_siblingField.acceptProposal(sibling);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.tablecolumn;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.SmartTableColumnNewOperation;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.buttongroup.ButtonGroup;
+import org.eclipse.scout.sdk.ui.fields.buttongroup.IButtonGroupListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.AbstractJavaElementContentProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.signature.SignatureProposalProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.ScoutWizardDialog;
+import org.eclipse.scout.sdk.ui.wizard.tablecolumn.TableColumnNewWizard.CONTINUE_OPERATION;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Group;
+
+/**
+ * <h3> {@link SmartTableColumnNewWizardPage}</h3> ...
+ */
+public class SmartTableColumnNewWizardPage extends AbstractWorkspaceWizardPage {
+ final IType iColumn = TypeUtility.getType(RuntimeClasses.IColumn);
+ final IType lookupCall = TypeUtility.getType(RuntimeClasses.LookupCall);
+ final IType iCodeType = TypeUtility.getType(RuntimeClasses.ICodeType);
+
+ private INlsEntry m_nlsName;
+ private String m_typeName;
+ private String m_genericSignature;
+ private IType m_lookupCall;
+ private IType m_codeType;
+ private CONTINUE_OPERATION m_continueOperation;
+ private SiblingProposal m_sibling;
+
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_genericTypeField;
+ private ProposalTextField m_lookupCallField;
+ private ProposalTextField m_codeTypeField;
+ private ProposalTextField m_siblingField;
+
+ // process members
+ private final IType m_declaringType;
+ private IType m_superType;
+ private IType m_createdColumn;
+
+ public SmartTableColumnNewWizardPage(IType declaringType, CONTINUE_OPERATION op) {
+ super(SmartTableColumnNewWizardPage.class.getName());
+ setTitle(Texts.get("NewSmartTableColumn"));
+ setDescription(Texts.get("CreateANewSmartTableColumn"));
+ m_declaringType = declaringType;
+ // default values
+ m_genericSignature = Signature.createTypeSignature(Long.class.getName(), true);
+ m_sibling = SiblingProposal.SIBLING_END;
+ m_continueOperation = op;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ createColumnGroup(parent);
+ createNextStepsGroup(parent);
+
+ parent.setLayout(new GridLayout(1, true));
+ }
+
+ private void createColumnGroup(Composite p) {
+ Group g = new Group(p, SWT.NONE);
+ g.setText(Texts.get("Column"));
+
+ m_nlsNameField = getFieldToolkit().createNlsProposalTextField(g, ScoutTypeUtility.findNlsProject(m_declaringType), Texts.get("Name"));
+ m_nlsNameField.acceptProposal(m_nlsName);
+ m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ INlsEntry oldEntry = getNlsName();
+ m_nlsName = (INlsEntry) event.proposal;
+ if (m_nlsName != null) {
+ if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
+ m_typeNameField.setText(m_nlsName.getKey());
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(g, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_TABLE_COLUMN);
+ m_typeNameField.setText(m_typeName);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_typeName = m_typeNameField.getText();
+ pingStateChanging();
+ }
+ });
+
+ m_genericTypeField = getFieldToolkit().createSignatureProposalField(g, Texts.get("GenericType"), ScoutTypeUtility.getScoutBundle(m_declaringType), SignatureProposalProvider.DEFAULT_MOST_USED);
+ m_genericTypeField.acceptProposal(getGenericSignature());
+ m_genericTypeField.setEnabled(TypeUtility.isGenericType(getSuperType()));
+ m_genericTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_genericSignature = (String) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ m_lookupCallField = getFieldToolkit().createJavaElementProposalField(g, Texts.get("LookupCall"), new AbstractJavaElementContentProvider() {
+ @Override
+ protected Object[][] computeProposals() {
+ return new Object[][]{ScoutTypeUtility.getClassesOnClasspath(lookupCall, getSharedBundle().getJavaProject())};
+ }
+ });
+ m_lookupCallField.acceptProposal(getLookupCall());
+ m_lookupCallField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ m_lookupCall = (IType) event.proposal;
+ m_codeTypeField.acceptProposal(null);
+ m_codeTypeField.setEnabled(m_lookupCall == null);
+ }
+ finally {
+ setStateChanging(false);
+ }
+ pingStateChanging();
+ }
+ });
+
+ m_codeTypeField = getFieldToolkit().createJavaElementProposalField(g, Texts.get("CodeType"), new AbstractJavaElementContentProvider() {
+ @Override
+ protected Object[][] computeProposals() {
+ return new Object[][]{ScoutTypeUtility.getClassesOnClasspath(iCodeType, getSharedBundle().getJavaProject())};
+ }
+ });
+ m_codeTypeField.acceptProposal(getCodeType());
+ m_codeTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ m_codeType = (IType) event.proposal;
+ m_lookupCallField.acceptProposal(null);
+ m_lookupCallField.setEnabled(m_codeType == null);
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_siblingField = getFieldToolkit().createSiblingProposalField(g, m_declaringType, iColumn);
+ m_siblingField.acceptProposal(m_sibling);
+ m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_sibling = (SiblingProposal) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ g.setLayout(new GridLayout(1, false));
+ g.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+
+ m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_genericTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_lookupCallField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_codeTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_siblingField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ private void createNextStepsGroup(Composite p) {
+ Group g = new Group(p, SWT.NONE);
+ g.setText(Texts.get("NextStep"));
+ g.setLayout(new GridLayout(1, false));
+ g.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+
+ ButtonGroup<CONTINUE_OPERATION> nextStepOptions = new ButtonGroup<CONTINUE_OPERATION>(g, SWT.RADIO);
+ nextStepOptions.createButton(Texts.get("CreateMoreColumn"), CONTINUE_OPERATION.ADD_MORE_COLUMNS);
+ nextStepOptions.createButton(Texts.get("FinishWizard"), CONTINUE_OPERATION.FINISH);
+ nextStepOptions.addButtonGroupListener(new IButtonGroupListener<CONTINUE_OPERATION>() {
+
+ @Override
+ public void handleSelectionChanged(List<CONTINUE_OPERATION> newSelection) {
+ m_continueOperation = newSelection.get(0);
+ }
+ });
+ nextStepOptions.setValue(m_continueOperation);
+ nextStepOptions.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ if (CONTINUE_OPERATION.ADD_MORE_COLUMNS == m_continueOperation) {
+ // start another wizard if one additional column should be created.
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ TableColumnNewWizard wizard = new TableColumnNewWizard(m_continueOperation);
+ wizard.initWizard(m_declaringType);
+ ScoutWizardDialog wizardDialog = new ScoutWizardDialog(wizard);
+ wizardDialog.open();
+ }
+ });
+ }
+
+ SmartTableColumnNewOperation operation = new SmartTableColumnNewOperation(m_declaringType, true);
+ // write back members
+ IType superType = getSuperType();
+ if (superType != null) {
+ String sig = null;
+ if (getGenericSignature() != null) {
+ sig = Signature.createTypeSignature(superType.getFullyQualifiedName() + "<" + Signature.toString(getGenericSignature()) + ">", true);
+ }
+ else {
+ sig = Signature.createTypeSignature(superType.getFullyQualifiedName(), true);
+ }
+ operation.setSuperTypeSignature(sig);
+ }
+ operation.setNlsEntry(getNlsName());
+ operation.setTypeName(getTypeName());
+ operation.setCodeType(getCodeType());
+ if (getLookupCall() != null) {
+ operation.setLookupCall(getLookupCall());
+ }
+ if (getSibling() == SiblingProposal.SIBLING_END) {
+ IStructuredType structuredType = ScoutTypeUtility.createStructuredTable(m_declaringType);
+ operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_COLUMN));
+ }
+ else {
+ operation.setSibling(getSibling().getElement());
+ }
+ operation.validate();
+ operation.run(monitor, workingCopyManager);
+ m_createdColumn = operation.getCreatedColumn();
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusGenericType());
+ multiStatus.add(getStatusLookupCallCodeType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_TABLE_COLUMN)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusGenericType() throws JavaModelException {
+ if (TypeUtility.isGenericType(getSuperType())) {
+ if (getGenericSignature() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("GenericTypeCanNotBeNull"));
+ }
+ }
+ return Status.OK_STATUS;
+ }
+
+ protected IStatus getStatusLookupCallCodeType() {
+ if (getCodeType() != null && getLookupCall() != null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("OnlyOneOfCodeTypeOrLookupCallCanBeProcessed"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ public IScoutBundle getClientBundle() {
+ return ScoutTypeUtility.getScoutBundle(m_declaringType);
+ }
+
+ public IScoutBundle getSharedBundle() {
+ return getClientBundle().findBestMatchShared();
+ }
+
+ /**
+ * @return the createdColumn
+ */
+ public IType getCreatedColumn() {
+ return m_createdColumn;
+ }
+
+ public void setSuperType(IType superType) {
+ m_superType = superType;
+ }
+
+ public IType getSuperType() {
+ return m_superType;
+ }
+
+ public INlsEntry getNlsName() {
+ return m_nlsName;
+ }
+
+ public void setNlsName(INlsEntry nlsName) {
+ try {
+ setStateChanging(true);
+ m_nlsName = nlsName;
+ if (isControlCreated()) {
+ m_nlsNameField.acceptProposal(nlsName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getTypeName() {
+ return m_typeName;
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ m_typeName = typeName;
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public void setGenericSignature(String genericSignature) {
+ try {
+ setStateChanging(true);
+ m_genericSignature = genericSignature;
+ if (isControlCreated()) {
+ m_genericTypeField.acceptProposal(genericSignature);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getGenericSignature() {
+ return m_genericSignature;
+ }
+
+ public void setLookupCall(IType lookupCall) {
+ try {
+ setStateChanging(true);
+ m_lookupCall = lookupCall;
+ if (isControlCreated()) {
+ m_codeTypeField.acceptProposal(lookupCall);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getLookupCall() {
+ return m_lookupCall;
+ }
+
+ public IType getCodeType() {
+ return m_codeType;
+ }
+
+ public void setCodeType(IType codeType) {
+ try {
+ setStateChanging(true);
+ m_codeType = codeType;
+ if (isControlCreated()) {
+ m_codeTypeField.acceptProposal(codeType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public SiblingProposal getSibling() {
+ return m_sibling;
+ }
+
+ public void setSibling(SiblingProposal sibling) {
+ try {
+ setStateChanging(true);
+ m_sibling = sibling;
+ if (isControlCreated()) {
+ m_siblingField.acceptProposal(sibling);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/TableColumnNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/TableColumnNewWizard.java
index 2555c27cc..8fc2ff3bb 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/TableColumnNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/TableColumnNewWizard.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.tablecolumn;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
-
-/**
- * <h3> {@link TableColumnNewWizard}</h3> This wizard is the starting wizard to create a new table column. and will be
- * followed by a {@link SmartTableColumnNewWizard} or a {@link DefaultTableColumnNewWizard}.
- *
- * @see TableColumnNewWizardPage1
- */
-public class TableColumnNewWizard extends AbstractFormFieldWizard {
-
- private TableColumnNewWizardPage1 m_page1;
- private CONTINUE_OPERATION m_nextOperation;
-
- public static enum CONTINUE_OPERATION {
- ADD_MORE_COLUMNS, FINISH
- }
-
- public TableColumnNewWizard(CONTINUE_OPERATION op) {
- setWindowTitle(Texts.get("NewTableColumn"));
- m_nextOperation = op;
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new TableColumnNewWizardPage1(getDeclaringType(), m_nextOperation);
- addPage(m_page1);
- }
-
- @Override
- public void setSuperType(IType superType) {
- m_page1.setSuperType(superType);
- }
-
- @Override
- public boolean needsPreviousAndNextButtons() {
- return true;
- }
-
- @Override
- public boolean canFinish() {
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.tablecolumn;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
+
+/**
+ * <h3> {@link TableColumnNewWizard}</h3> This wizard is the starting wizard to create a new table column. and will be
+ * followed by a {@link SmartTableColumnNewWizard} or a {@link DefaultTableColumnNewWizard}.
+ *
+ * @see TableColumnNewWizardPage1
+ */
+public class TableColumnNewWizard extends AbstractFormFieldWizard {
+
+ private TableColumnNewWizardPage1 m_page1;
+ private CONTINUE_OPERATION m_nextOperation;
+
+ public static enum CONTINUE_OPERATION {
+ ADD_MORE_COLUMNS, FINISH
+ }
+
+ public TableColumnNewWizard(CONTINUE_OPERATION op) {
+ setWindowTitle(Texts.get("NewTableColumn"));
+ m_nextOperation = op;
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new TableColumnNewWizardPage1(getDeclaringType(), m_nextOperation);
+ addPage(m_page1);
+ }
+
+ @Override
+ public void setSuperType(IType superType) {
+ m_page1.setSuperType(superType);
+ }
+
+ @Override
+ public boolean needsPreviousAndNextButtons() {
+ return true;
+ }
+
+ @Override
+ public boolean canFinish() {
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/TableColumnNewWizardPage1.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/TableColumnNewWizardPage1.java
index f0360b000..7c413e1d7 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/TableColumnNewWizardPage1.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/tablecolumn/TableColumnNewWizardPage1.java
@@ -1,315 +1,315 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.tablecolumn;
-
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.wizard.IWizardContainer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.fields.table.FilteredTable;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.ui.wizard.tablecolumn.TableColumnNewWizard.CONTINUE_OPERATION;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.ITypeHierarchy;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3> {@link TableColumnNewWizardPage1}</h3> ...
- */
-public class TableColumnNewWizardPage1 extends AbstractWorkspaceWizardPage {
- final IType iColumn = TypeUtility.getType(RuntimeClasses.IColumn);
- final IType iSmartColumn = TypeUtility.getType(RuntimeClasses.ISmartColumn);
-
- private IType m_declaringType;
- private boolean m_showAllTemplates;
- private CONTINUE_OPERATION m_nextOperation;
-
- private FilteredTable m_filteredTable;
- private Button m_showAllTemplatesField;
- private P_BCTypeTemplate m_selectedTemplate;
- private IWizardPage m_nextPage;
-
- public TableColumnNewWizardPage1(IType declaringType, CONTINUE_OPERATION op) {
- super(TableColumnNewWizardPage1.class.getName());
- setTitle(Texts.get("TableColumnTemplates"));
- setDescription(Texts.get("ChooseATemplateForYourTableColumn"));
- m_declaringType = declaringType;
- m_nextOperation = op;
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_filteredTable = new FilteredTable(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL);
- m_filteredTable.getViewer().addFilter(new P_ModeFilter());
- m_filteredTable.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- if (!event.getSelection().isEmpty()) {
- StructuredSelection selection = (StructuredSelection) event.getSelection();
- m_selectedTemplate = (P_BCTypeTemplate) selection.getFirstElement();
- validateNextPage();
- pingStateChanging();
- }
-
- }
- });
- m_filteredTable.getViewer().addDoubleClickListener(new IDoubleClickListener() {
- @Override
- public void doubleClick(DoubleClickEvent event) {
- Object selectedItem = null;
- if (!event.getSelection().isEmpty()) {
- StructuredSelection selection = (StructuredSelection) event.getSelection();
- selectedItem = selection.getFirstElement();
- m_selectedTemplate = (P_BCTypeTemplate) selectedItem;
- validateNextPage();
- IWizardPage page = getNextPage();
- if (page == null) {
- // something must have happend getting the next page
- return;
- }
-
- // show the next page
- IWizardContainer container = getWizard().getContainer();
- if (container != null) {
- container.showPage(page);
- }
- }
- }
- });
-
- HashMap<String, P_BCTypeTemplate> templates = new HashMap<String, P_BCTypeTemplate>();
- templates.put(RuntimeClasses.AbstractStringColumn, new P_BCTypeTemplate(Texts.get("StringColumn"), TypeUtility.getType(RuntimeClasses.AbstractStringColumn)));
- templates.put(RuntimeClasses.AbstractBooleanColumn, new P_BCTypeTemplate(Texts.get("BooleanColumn"), TypeUtility.getType(RuntimeClasses.AbstractBooleanColumn)));
- templates.put(RuntimeClasses.AbstractDateColumn, new P_BCTypeTemplate(Texts.get("DateColumn"), TypeUtility.getType(RuntimeClasses.AbstractDateColumn)));
- templates.put(RuntimeClasses.AbstractDoubleColumn, new P_BCTypeTemplate(Texts.get("DoubleColumn"), TypeUtility.getType(RuntimeClasses.AbstractDoubleColumn)));
- templates.put(RuntimeClasses.AbstractIntegerColumn, new P_BCTypeTemplate(Texts.get("IntegerColumn"), TypeUtility.getType(RuntimeClasses.AbstractIntegerColumn)));
- templates.put(RuntimeClasses.AbstractLongColumn, new P_BCTypeTemplate(Texts.get("LongColumn"), TypeUtility.getType(RuntimeClasses.AbstractLongColumn)));
- templates.put(RuntimeClasses.AbstractSmartColumn, new P_BCTypeTemplate(Texts.get("SmartColumn"), TypeUtility.getType(RuntimeClasses.AbstractSmartColumn)));
-
- ITypeHierarchy columnHierarchy = TypeUtility.getPrimaryTypeHierarchy(iColumn);
- for (IType t : columnHierarchy.getAllClasses(TypeFilters.getAbstractOnClasspath(m_declaringType.getJavaProject()))) {
- if (!templates.containsKey(t.getFullyQualifiedName())) {
- templates.put(t.getFullyQualifiedName(), new P_BCTypeTemplate(null, t));
- }
- }
- P_TableContentProvider provider = new P_TableContentProvider(templates.values().toArray(new P_BCTypeTemplate[templates.size()]));
- m_filteredTable.getViewer().setLabelProvider(provider);
- m_filteredTable.getViewer().setContentProvider(provider);
- m_filteredTable.getViewer().setInput(provider);
-
- m_showAllTemplatesField = new Button(parent, SWT.CHECK);
- m_showAllTemplatesField.setSelection(false);
- m_showAllTemplatesField.setText(Texts.get("ShowAllTemplates"));
- m_showAllTemplatesField.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- setStateChanging(true);
- setShowAllTemplates(m_showAllTemplatesField.getSelection());
-
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- // layout
- parent.setLayout(new GridLayout(1, true));
- m_filteredTable.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH | GridData.GRAB_VERTICAL));
- }
-
- protected void validateNextPage() {
- if (m_selectedTemplate == null) {
- m_nextPage = null;
- }
- else {
- org.eclipse.jdt.core.ITypeHierarchy selectedSuperTypeHierarchy = null;
- try {
- selectedSuperTypeHierarchy = m_selectedTemplate.getType().newSupertypeHierarchy(null);
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not build type hierarchy of '" + m_selectedTemplate.getType().getFullyQualifiedName() + "'.", e);
- }
- if (selectedSuperTypeHierarchy != null && selectedSuperTypeHierarchy.contains(iSmartColumn)) {
- SmartTableColumnNewWizard wizard = new SmartTableColumnNewWizard(m_nextOperation);
- wizard.initWizard(m_declaringType);
- wizard.setSuperType(m_selectedTemplate.getType());
- m_nextPage = wizard.getPages()[0];
- }
- else {
- DefaultTableColumnNewWizard wizard = new DefaultTableColumnNewWizard(m_nextOperation);
- wizard.initWizard(m_declaringType);
- wizard.setSuperType(m_selectedTemplate.getType());
- m_nextPage = wizard.getPages()[0];
- }
- }
- }
-
- @Override
- public IWizardPage getNextPage() {
- return m_nextPage;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- if (m_selectedTemplate != null) {
- multiStatus.add(Status.OK_STATUS);
- }
- else {
- multiStatus.add(new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("ATemplateMustBeSelected")));
- }
- }
-
- public void setSuperType(IType selectedType) {
- IStructuredContentProvider prov = (IStructuredContentProvider) m_filteredTable.getViewer().getContentProvider();
- for (Object row : prov.getElements(null)) {
- if (((P_BCTypeTemplate) row).getType().equals(selectedType)) {
- m_filteredTable.getViewer().setSelection(new StructuredSelection(selectedType));
- }
- }
- validateNextPage();
- }
-
- public boolean isShowAllTemplates() {
- return m_showAllTemplates;
- }
-
- public void setShowAllTemplates(boolean showAllTemplates) {
- try {
- setStateChanging(true);
- m_showAllTemplates = showAllTemplates;
- if (isControlCreated()) {
- m_showAllTemplatesField.setSelection(showAllTemplates);
- m_filteredTable.getViewer().refresh();
- }
-
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public IType getSelectedSuperType() {
- return m_selectedTemplate.getType();
- }
-
- private class P_TableContentProvider implements IStructuredContentProvider, ITableLabelProvider {
- P_BCTypeTemplate[] m_templates;
-
- private P_TableContentProvider(P_BCTypeTemplate[] templates) {
- m_templates = templates;
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- return m_templates;
- }
-
- @Override
- public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex == 0) {
- return ScoutSdkUi.getImage(ScoutSdkUi.FormField);
- }
- return null;
- }
-
- @Override
- public String getColumnText(Object element, int columnIndex) {
- if (isShowAllTemplates()) {
- return ((P_BCTypeTemplate) element).getType().getElementName();
- }
- else {
- return ((P_BCTypeTemplate) element).getTemplateName();
- }
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- @Override
- public void addListener(ILabelProviderListener listener) {
- }
-
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- @Override
- public void removeListener(ILabelProviderListener listener) {
- }
- } // end class P_TableContentProvider
-
- private class P_BCTypeTemplate {
- private final IType m_type;
- private final String m_templateName;
-
- public P_BCTypeTemplate(String templateName, IType type) {
- m_templateName = templateName;
- m_type = type;
-
- }
-
- public IType getType() {
- return m_type;
- }
-
- public String getTemplateName() {
- return m_templateName;
- }
-
- } // end class P_BCTypeTemplate
-
- private class P_ModeFilter extends ViewerFilter {
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (m_showAllTemplates) {
- return true;
- }
- else {
- return ((P_BCTypeTemplate) element).getTemplateName() != null;
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.tablecolumn;
+
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.fields.table.FilteredTable;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.ui.wizard.tablecolumn.TableColumnNewWizard.CONTINUE_OPERATION;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.ITypeHierarchy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3> {@link TableColumnNewWizardPage1}</h3> ...
+ */
+public class TableColumnNewWizardPage1 extends AbstractWorkspaceWizardPage {
+ final IType iColumn = TypeUtility.getType(RuntimeClasses.IColumn);
+ final IType iSmartColumn = TypeUtility.getType(RuntimeClasses.ISmartColumn);
+
+ private IType m_declaringType;
+ private boolean m_showAllTemplates;
+ private CONTINUE_OPERATION m_nextOperation;
+
+ private FilteredTable m_filteredTable;
+ private Button m_showAllTemplatesField;
+ private P_BCTypeTemplate m_selectedTemplate;
+ private IWizardPage m_nextPage;
+
+ public TableColumnNewWizardPage1(IType declaringType, CONTINUE_OPERATION op) {
+ super(TableColumnNewWizardPage1.class.getName());
+ setTitle(Texts.get("TableColumnTemplates"));
+ setDescription(Texts.get("ChooseATemplateForYourTableColumn"));
+ m_declaringType = declaringType;
+ m_nextOperation = op;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_filteredTable = new FilteredTable(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL);
+ m_filteredTable.getViewer().addFilter(new P_ModeFilter());
+ m_filteredTable.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (!event.getSelection().isEmpty()) {
+ StructuredSelection selection = (StructuredSelection) event.getSelection();
+ m_selectedTemplate = (P_BCTypeTemplate) selection.getFirstElement();
+ validateNextPage();
+ pingStateChanging();
+ }
+
+ }
+ });
+ m_filteredTable.getViewer().addDoubleClickListener(new IDoubleClickListener() {
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ Object selectedItem = null;
+ if (!event.getSelection().isEmpty()) {
+ StructuredSelection selection = (StructuredSelection) event.getSelection();
+ selectedItem = selection.getFirstElement();
+ m_selectedTemplate = (P_BCTypeTemplate) selectedItem;
+ validateNextPage();
+ IWizardPage page = getNextPage();
+ if (page == null) {
+ // something must have happend getting the next page
+ return;
+ }
+
+ // show the next page
+ IWizardContainer container = getWizard().getContainer();
+ if (container != null) {
+ container.showPage(page);
+ }
+ }
+ }
+ });
+
+ HashMap<String, P_BCTypeTemplate> templates = new HashMap<String, P_BCTypeTemplate>();
+ templates.put(RuntimeClasses.AbstractStringColumn, new P_BCTypeTemplate(Texts.get("StringColumn"), TypeUtility.getType(RuntimeClasses.AbstractStringColumn)));
+ templates.put(RuntimeClasses.AbstractBooleanColumn, new P_BCTypeTemplate(Texts.get("BooleanColumn"), TypeUtility.getType(RuntimeClasses.AbstractBooleanColumn)));
+ templates.put(RuntimeClasses.AbstractDateColumn, new P_BCTypeTemplate(Texts.get("DateColumn"), TypeUtility.getType(RuntimeClasses.AbstractDateColumn)));
+ templates.put(RuntimeClasses.AbstractDoubleColumn, new P_BCTypeTemplate(Texts.get("DoubleColumn"), TypeUtility.getType(RuntimeClasses.AbstractDoubleColumn)));
+ templates.put(RuntimeClasses.AbstractIntegerColumn, new P_BCTypeTemplate(Texts.get("IntegerColumn"), TypeUtility.getType(RuntimeClasses.AbstractIntegerColumn)));
+ templates.put(RuntimeClasses.AbstractLongColumn, new P_BCTypeTemplate(Texts.get("LongColumn"), TypeUtility.getType(RuntimeClasses.AbstractLongColumn)));
+ templates.put(RuntimeClasses.AbstractSmartColumn, new P_BCTypeTemplate(Texts.get("SmartColumn"), TypeUtility.getType(RuntimeClasses.AbstractSmartColumn)));
+
+ ITypeHierarchy columnHierarchy = TypeUtility.getPrimaryTypeHierarchy(iColumn);
+ for (IType t : columnHierarchy.getAllClasses(TypeFilters.getAbstractOnClasspath(m_declaringType.getJavaProject()))) {
+ if (!templates.containsKey(t.getFullyQualifiedName())) {
+ templates.put(t.getFullyQualifiedName(), new P_BCTypeTemplate(null, t));
+ }
+ }
+ P_TableContentProvider provider = new P_TableContentProvider(templates.values().toArray(new P_BCTypeTemplate[templates.size()]));
+ m_filteredTable.getViewer().setLabelProvider(provider);
+ m_filteredTable.getViewer().setContentProvider(provider);
+ m_filteredTable.getViewer().setInput(provider);
+
+ m_showAllTemplatesField = new Button(parent, SWT.CHECK);
+ m_showAllTemplatesField.setSelection(false);
+ m_showAllTemplatesField.setText(Texts.get("ShowAllTemplates"));
+ m_showAllTemplatesField.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ setStateChanging(true);
+ setShowAllTemplates(m_showAllTemplatesField.getSelection());
+
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+ m_filteredTable.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH | GridData.GRAB_VERTICAL));
+ }
+
+ protected void validateNextPage() {
+ if (m_selectedTemplate == null) {
+ m_nextPage = null;
+ }
+ else {
+ org.eclipse.jdt.core.ITypeHierarchy selectedSuperTypeHierarchy = null;
+ try {
+ selectedSuperTypeHierarchy = m_selectedTemplate.getType().newSupertypeHierarchy(null);
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not build type hierarchy of '" + m_selectedTemplate.getType().getFullyQualifiedName() + "'.", e);
+ }
+ if (selectedSuperTypeHierarchy != null && selectedSuperTypeHierarchy.contains(iSmartColumn)) {
+ SmartTableColumnNewWizard wizard = new SmartTableColumnNewWizard(m_nextOperation);
+ wizard.initWizard(m_declaringType);
+ wizard.setSuperType(m_selectedTemplate.getType());
+ m_nextPage = wizard.getPages()[0];
+ }
+ else {
+ DefaultTableColumnNewWizard wizard = new DefaultTableColumnNewWizard(m_nextOperation);
+ wizard.initWizard(m_declaringType);
+ wizard.setSuperType(m_selectedTemplate.getType());
+ m_nextPage = wizard.getPages()[0];
+ }
+ }
+ }
+
+ @Override
+ public IWizardPage getNextPage() {
+ return m_nextPage;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ if (m_selectedTemplate != null) {
+ multiStatus.add(Status.OK_STATUS);
+ }
+ else {
+ multiStatus.add(new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("ATemplateMustBeSelected")));
+ }
+ }
+
+ public void setSuperType(IType selectedType) {
+ IStructuredContentProvider prov = (IStructuredContentProvider) m_filteredTable.getViewer().getContentProvider();
+ for (Object row : prov.getElements(null)) {
+ if (((P_BCTypeTemplate) row).getType().equals(selectedType)) {
+ m_filteredTable.getViewer().setSelection(new StructuredSelection(selectedType));
+ }
+ }
+ validateNextPage();
+ }
+
+ public boolean isShowAllTemplates() {
+ return m_showAllTemplates;
+ }
+
+ public void setShowAllTemplates(boolean showAllTemplates) {
+ try {
+ setStateChanging(true);
+ m_showAllTemplates = showAllTemplates;
+ if (isControlCreated()) {
+ m_showAllTemplatesField.setSelection(showAllTemplates);
+ m_filteredTable.getViewer().refresh();
+ }
+
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getSelectedSuperType() {
+ return m_selectedTemplate.getType();
+ }
+
+ private class P_TableContentProvider implements IStructuredContentProvider, ITableLabelProvider {
+ P_BCTypeTemplate[] m_templates;
+
+ private P_TableContentProvider(P_BCTypeTemplate[] templates) {
+ m_templates = templates;
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return m_templates;
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ return ScoutSdkUi.getImage(ScoutSdkUi.FormField);
+ }
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ if (isShowAllTemplates()) {
+ return ((P_BCTypeTemplate) element).getType().getElementName();
+ }
+ else {
+ return ((P_BCTypeTemplate) element).getTemplateName();
+ }
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ }
+ } // end class P_TableContentProvider
+
+ private class P_BCTypeTemplate {
+ private final IType m_type;
+ private final String m_templateName;
+
+ public P_BCTypeTemplate(String templateName, IType type) {
+ m_templateName = templateName;
+ m_type = type;
+
+ }
+
+ public IType getType() {
+ return m_type;
+ }
+
+ public String getTemplateName() {
+ return m_templateName;
+ }
+
+ } // end class P_BCTypeTemplate
+
+ private class P_ModeFilter extends ViewerFilter {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (m_showAllTemplates) {
+ return true;
+ }
+ else {
+ return ((P_BCTypeTemplate) element).getTemplateName() != null;
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/OutlineToolbuttonNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/OutlineToolbuttonNewWizardPage.java
index 36f996a08..14a4c085a 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/OutlineToolbuttonNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/OutlineToolbuttonNewWizardPage.java
@@ -1,247 +1,247 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.toolbutton;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.OutlineToolbuttonNewOperation;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.AbstractJavaElementContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
-import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>CalendarItemProviderNewWizardPage</h3> ...
- */
-public class OutlineToolbuttonNewWizardPage extends AbstractWorkspaceWizardPage {
-
- final IType iToolButton = TypeUtility.getType(RuntimeClasses.IToolButton);
- final IType iOutline = TypeUtility.getType(RuntimeClasses.IOutline);
-
- private IType m_outline;
- private String m_typeName;
- private SiblingProposal m_sibling;
-
- private ProposalTextField m_outlineField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_siblingField;
-
- // process members
- private final IType m_declaringType;
-
- public OutlineToolbuttonNewWizardPage(IType declaringType) {
- super(OutlineToolbuttonNewWizardPage.class.getName());
- setTitle(Texts.get("NewOutlineToolButton"));
- setDescription(Texts.get("CreateANewOutlineToolButton"));
- m_declaringType = declaringType;
- // default
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- m_outlineField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("Outline"), new AbstractJavaElementContentProvider() {
- @Override
- protected Object[][] computeProposals() {
- return new Object[][]{ScoutTypeUtility.getClassesOnClasspath(iOutline, m_declaringType.getJavaProject())};
- }
- });
- m_outlineField.acceptProposal(getOutline());
- m_outlineField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- m_outline = (IType) event.proposal;
- if (getOutline() != null && StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
- m_typeNameField.setText(getOutline().getElementName());
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_TOOL);
- m_typeNameField.setText(m_typeName);
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_typeName = m_typeNameField.getText();
- pingStateChanging();
- }
- });
-
- m_siblingField = getFieldToolkit().createSiblingProposalField(parent, m_declaringType, TypeUtility.getType(RuntimeClasses.IToolButton));
- m_siblingField.acceptProposal(m_sibling);
- m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_sibling = (SiblingProposal) event.proposal;
- pingStateChanging();
- }
- });
-
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- m_outlineField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_siblingField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- OutlineToolbuttonNewOperation operation = new OutlineToolbuttonNewOperation(m_declaringType);
-
- // write back members
- operation.setTypeName(getTypeName());
-
- ToolbuttonNewWizardPage1 previousPage = (ToolbuttonNewWizardPage1) getWizard().getPage(ToolbuttonNewWizardPage1.class.getName());
- if (previousPage.getSuperType() != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(previousPage.getSuperType().getFullyQualifiedName(), true));
- }
- if (getOutline() != null) {
- operation.setOutlineType(getOutline());
- }
- if (getSibling() == SiblingProposal.SIBLING_END) {
- IStructuredType structuredType = ScoutTypeUtility.createStructuredOutline(m_declaringType);
- operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_TOOL_BUTTON));
- }
- else {
- operation.setSibling(getSibling().getElement());
- }
- operation.run(monitor, workingCopyManager);
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusOutline());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_TOOL)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusOutline() {
- if (getOutline() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("AnOutlineMustBeSelected"));
- }
- return Status.OK_STATUS;
- }
-
- @Override
- public IWizardPage getNextPage() {
- return null;
- }
-
- public void setOutline(IType outline) {
- try {
- setStateChanging(true);
- m_outline = outline;
- if (isControlCreated()) {
- m_outlineField.acceptProposal(outline);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public IType getOutline() {
- return m_outline;
- }
-
- public String getTypeName() {
- return m_typeName;
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- m_typeName = typeName;
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public SiblingProposal getSibling() {
- return m_sibling;
- }
-
- public void setSibling(SiblingProposal sibling) {
- try {
- setStateChanging(true);
- m_sibling = sibling;
- if (isControlCreated()) {
- m_siblingField.acceptProposal(sibling);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.toolbutton;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.OutlineToolbuttonNewOperation;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.AbstractJavaElementContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>CalendarItemProviderNewWizardPage</h3> ...
+ */
+public class OutlineToolbuttonNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ final IType iToolButton = TypeUtility.getType(RuntimeClasses.IToolButton);
+ final IType iOutline = TypeUtility.getType(RuntimeClasses.IOutline);
+
+ private IType m_outline;
+ private String m_typeName;
+ private SiblingProposal m_sibling;
+
+ private ProposalTextField m_outlineField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_siblingField;
+
+ // process members
+ private final IType m_declaringType;
+
+ public OutlineToolbuttonNewWizardPage(IType declaringType) {
+ super(OutlineToolbuttonNewWizardPage.class.getName());
+ setTitle(Texts.get("NewOutlineToolButton"));
+ setDescription(Texts.get("CreateANewOutlineToolButton"));
+ m_declaringType = declaringType;
+ // default
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ m_outlineField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("Outline"), new AbstractJavaElementContentProvider() {
+ @Override
+ protected Object[][] computeProposals() {
+ return new Object[][]{ScoutTypeUtility.getClassesOnClasspath(iOutline, m_declaringType.getJavaProject())};
+ }
+ });
+ m_outlineField.acceptProposal(getOutline());
+ m_outlineField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ m_outline = (IType) event.proposal;
+ if (getOutline() != null && StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
+ m_typeNameField.setText(getOutline().getElementName());
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_TOOL);
+ m_typeNameField.setText(m_typeName);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_typeName = m_typeNameField.getText();
+ pingStateChanging();
+ }
+ });
+
+ m_siblingField = getFieldToolkit().createSiblingProposalField(parent, m_declaringType, TypeUtility.getType(RuntimeClasses.IToolButton));
+ m_siblingField.acceptProposal(m_sibling);
+ m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_sibling = (SiblingProposal) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ m_outlineField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_siblingField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ OutlineToolbuttonNewOperation operation = new OutlineToolbuttonNewOperation(m_declaringType);
+
+ // write back members
+ operation.setTypeName(getTypeName());
+
+ ToolbuttonNewWizardPage1 previousPage = (ToolbuttonNewWizardPage1) getWizard().getPage(ToolbuttonNewWizardPage1.class.getName());
+ if (previousPage.getSuperType() != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(previousPage.getSuperType().getFullyQualifiedName(), true));
+ }
+ if (getOutline() != null) {
+ operation.setOutlineType(getOutline());
+ }
+ if (getSibling() == SiblingProposal.SIBLING_END) {
+ IStructuredType structuredType = ScoutTypeUtility.createStructuredOutline(m_declaringType);
+ operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_TOOL_BUTTON));
+ }
+ else {
+ operation.setSibling(getSibling().getElement());
+ }
+ operation.run(monitor, workingCopyManager);
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusOutline());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_TOOL)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusOutline() {
+ if (getOutline() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("AnOutlineMustBeSelected"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ @Override
+ public IWizardPage getNextPage() {
+ return null;
+ }
+
+ public void setOutline(IType outline) {
+ try {
+ setStateChanging(true);
+ m_outline = outline;
+ if (isControlCreated()) {
+ m_outlineField.acceptProposal(outline);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getOutline() {
+ return m_outline;
+ }
+
+ public String getTypeName() {
+ return m_typeName;
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ m_typeName = typeName;
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public SiblingProposal getSibling() {
+ return m_sibling;
+ }
+
+ public void setSibling(SiblingProposal sibling) {
+ try {
+ setStateChanging(true);
+ m_sibling = sibling;
+ if (isControlCreated()) {
+ m_siblingField.acceptProposal(sibling);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizard.java
index 880e5f39e..976819172 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizard.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.toolbutton;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-
-public class ToolbuttonNewWizard extends AbstractFormFieldWizard {
-
- private ToolbuttonNewWizardPage1 m_page1;
- private ToolbuttonNewWizardPage2 m_page2a;
- private OutlineToolbuttonNewWizardPage m_page2b;
-
- public ToolbuttonNewWizard(IType formType) {
- setWindowTitle(Texts.get("NewToolButton"));
- initWizard(formType);
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new ToolbuttonNewWizardPage1(getDeclaringType());
- addPage(m_page1);
- m_page2a = new ToolbuttonNewWizardPage2(getDeclaringType());
- addPage(m_page2a);
- m_page2b = new OutlineToolbuttonNewWizardPage(getDeclaringType());
- addPage(m_page2b);
- }
-
- @Override
- public void setSuperType(IType superType) {
- m_page1.setSuperType(superType);
- }
-
- @Override
- public boolean canFinish() {
- return m_page1.isPageComplete() && m_page1.getNextPage() != null && m_page1.getNextPage().isPageComplete();
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
- boolean validPage = false;
- try {
- validPage = m_page1.performFinish(monitor, workingCopyManager);
- if (validPage) {
- validPage = ((AbstractWorkspaceWizardPage) m_page1.getNextPage()).performFinish(monitor, workingCopyManager);
- }
- }
- catch (Exception e) {
- ScoutSdkUi.logError("exception during perfoming finish on wizard.", e);
- }
- return validPage;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.toolbutton;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+
+public class ToolbuttonNewWizard extends AbstractFormFieldWizard {
+
+ private ToolbuttonNewWizardPage1 m_page1;
+ private ToolbuttonNewWizardPage2 m_page2a;
+ private OutlineToolbuttonNewWizardPage m_page2b;
+
+ public ToolbuttonNewWizard(IType formType) {
+ setWindowTitle(Texts.get("NewToolButton"));
+ initWizard(formType);
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new ToolbuttonNewWizardPage1(getDeclaringType());
+ addPage(m_page1);
+ m_page2a = new ToolbuttonNewWizardPage2(getDeclaringType());
+ addPage(m_page2a);
+ m_page2b = new OutlineToolbuttonNewWizardPage(getDeclaringType());
+ addPage(m_page2b);
+ }
+
+ @Override
+ public void setSuperType(IType superType) {
+ m_page1.setSuperType(superType);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return m_page1.isPageComplete() && m_page1.getNextPage() != null && m_page1.getNextPage().isPageComplete();
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) {
+ boolean validPage = false;
+ try {
+ validPage = m_page1.performFinish(monitor, workingCopyManager);
+ if (validPage) {
+ validPage = ((AbstractWorkspaceWizardPage) m_page1.getNextPage()).performFinish(monitor, workingCopyManager);
+ }
+ }
+ catch (Exception e) {
+ ScoutSdkUi.logError("exception during perfoming finish on wizard.", e);
+ }
+ return validPage;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizardPage1.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizardPage1.java
index ef60eca01..592c9d82c 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizardPage1.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizardPage1.java
@@ -1,187 +1,187 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.toolbutton;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ITableLabelProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.fields.table.FilteredTable;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>TableColumnNewWizardPage</h3> ...
- */
-public class ToolbuttonNewWizardPage1 extends AbstractWorkspaceWizardPage {
-
- final IType iToolbutton = TypeUtility.getType(RuntimeClasses.IToolButton);
- final IType abstractOutlineToolButton = TypeUtility.getType(RuntimeClasses.AbstractOutlineToolButton);
-
- private IType m_declaringType;
- private FilteredTable m_filteredTable;
- private IWizardPage m_nextPage;
- private IType m_superType;
-
- public ToolbuttonNewWizardPage1(IType declaringType) {
- super(ToolbuttonNewWizardPage1.class.getName());
- setTitle(Texts.get("ToolButtonTemplates"));
- setDescription(Texts.get("ChooseATemplateForYourToolButton"));
- m_declaringType = declaringType;
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_filteredTable = new FilteredTable(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL);
- m_filteredTable.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- if (!event.getSelection().isEmpty()) {
- StructuredSelection selection = (StructuredSelection) event.getSelection();
- m_superType = (IType) selection.getFirstElement();
- validateNextPage();
- pingStateChanging();
- }
-
- }
- });
-
- P_TableContentProvider provider = new P_TableContentProvider(ScoutTypeUtility.getAbstractTypesOnClasspath(iToolbutton, m_declaringType.getJavaProject()));
- m_filteredTable.getViewer().setLabelProvider(provider);
- m_filteredTable.getViewer().setContentProvider(provider);
- m_filteredTable.getViewer().setInput(provider);
-
- // layout
- parent.setLayout(new GridLayout(1, true));
- m_filteredTable.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH | GridData.GRAB_VERTICAL));
- }
-
- protected void validateNextPage() {
- if (TypeUtility.exists(getSuperType())) {
- ITypeHierarchy superTypeHierarchy = null;
- try {
- superTypeHierarchy = getSuperType().newSupertypeHierarchy(null);
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not build super type hierarchy of '" + getSuperType().getFullyQualifiedName() + "'.", e);
- }
- if (superTypeHierarchy != null && superTypeHierarchy.contains(abstractOutlineToolButton)) {
- m_nextPage = getWizard().getPage(OutlineToolbuttonNewWizardPage.class.getName());
- }
- else {
- m_nextPage = getWizard().getPage(ToolbuttonNewWizardPage2.class.getName());
- }
- }
- else {
- m_nextPage = null;
- }
- }
-
- @Override
- public IWizardPage getNextPage() {
- return m_nextPage;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- if (getSuperType() != null) {
- multiStatus.add(Status.OK_STATUS);
- }
- else {
- multiStatus.add(new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("ATemplateMustBeSelected")));
- }
- }
-
- public void setSuperType(IType selectedType) {
- try {
- m_superType = selectedType;
- if (isControlCreated()) {
- m_filteredTable.getViewer().setSelection(new StructuredSelection(selectedType));
-
- validateNextPage();
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public IType getSuperType() {
- return m_superType;
- }
-
- private class P_TableContentProvider implements IStructuredContentProvider, ITableLabelProvider {
- IType[] m_templates;
-
- private P_TableContentProvider(IType[] templates) {
- m_templates = templates;
- }
-
- @Override
- public Object[] getElements(Object inputElement) {
- return m_templates;
- }
-
- @Override
- public Image getColumnImage(Object element, int columnIndex) {
- if (columnIndex == 0) {
- return ScoutSdkUi.getImage(ScoutSdkUi.FormField);
- }
- return null;
- }
-
- @Override
- public String getColumnText(Object element, int columnIndex) {
- return ((IType) element).getElementName();
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
-
- @Override
- public void addListener(ILabelProviderListener listener) {
- }
-
- @Override
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- @Override
- public void removeListener(ILabelProviderListener listener) {
- }
- } // end class P_TableContentProvider
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.toolbutton;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.ITableLabelProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.fields.table.FilteredTable;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>TableColumnNewWizardPage</h3> ...
+ */
+public class ToolbuttonNewWizardPage1 extends AbstractWorkspaceWizardPage {
+
+ final IType iToolbutton = TypeUtility.getType(RuntimeClasses.IToolButton);
+ final IType abstractOutlineToolButton = TypeUtility.getType(RuntimeClasses.AbstractOutlineToolButton);
+
+ private IType m_declaringType;
+ private FilteredTable m_filteredTable;
+ private IWizardPage m_nextPage;
+ private IType m_superType;
+
+ public ToolbuttonNewWizardPage1(IType declaringType) {
+ super(ToolbuttonNewWizardPage1.class.getName());
+ setTitle(Texts.get("ToolButtonTemplates"));
+ setDescription(Texts.get("ChooseATemplateForYourToolButton"));
+ m_declaringType = declaringType;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_filteredTable = new FilteredTable(parent, SWT.SINGLE | SWT.BORDER | SWT.FULL_SELECTION | SWT.V_SCROLL);
+ m_filteredTable.getViewer().addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ if (!event.getSelection().isEmpty()) {
+ StructuredSelection selection = (StructuredSelection) event.getSelection();
+ m_superType = (IType) selection.getFirstElement();
+ validateNextPage();
+ pingStateChanging();
+ }
+
+ }
+ });
+
+ P_TableContentProvider provider = new P_TableContentProvider(ScoutTypeUtility.getAbstractTypesOnClasspath(iToolbutton, m_declaringType.getJavaProject()));
+ m_filteredTable.getViewer().setLabelProvider(provider);
+ m_filteredTable.getViewer().setContentProvider(provider);
+ m_filteredTable.getViewer().setInput(provider);
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+ m_filteredTable.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_BOTH | GridData.GRAB_VERTICAL));
+ }
+
+ protected void validateNextPage() {
+ if (TypeUtility.exists(getSuperType())) {
+ ITypeHierarchy superTypeHierarchy = null;
+ try {
+ superTypeHierarchy = getSuperType().newSupertypeHierarchy(null);
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not build super type hierarchy of '" + getSuperType().getFullyQualifiedName() + "'.", e);
+ }
+ if (superTypeHierarchy != null && superTypeHierarchy.contains(abstractOutlineToolButton)) {
+ m_nextPage = getWizard().getPage(OutlineToolbuttonNewWizardPage.class.getName());
+ }
+ else {
+ m_nextPage = getWizard().getPage(ToolbuttonNewWizardPage2.class.getName());
+ }
+ }
+ else {
+ m_nextPage = null;
+ }
+ }
+
+ @Override
+ public IWizardPage getNextPage() {
+ return m_nextPage;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ if (getSuperType() != null) {
+ multiStatus.add(Status.OK_STATUS);
+ }
+ else {
+ multiStatus.add(new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("ATemplateMustBeSelected")));
+ }
+ }
+
+ public void setSuperType(IType selectedType) {
+ try {
+ m_superType = selectedType;
+ if (isControlCreated()) {
+ m_filteredTable.getViewer().setSelection(new StructuredSelection(selectedType));
+
+ validateNextPage();
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getSuperType() {
+ return m_superType;
+ }
+
+ private class P_TableContentProvider implements IStructuredContentProvider, ITableLabelProvider {
+ IType[] m_templates;
+
+ private P_TableContentProvider(IType[] templates) {
+ m_templates = templates;
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return m_templates;
+ }
+
+ @Override
+ public Image getColumnImage(Object element, int columnIndex) {
+ if (columnIndex == 0) {
+ return ScoutSdkUi.getImage(ScoutSdkUi.FormField);
+ }
+ return null;
+ }
+
+ @Override
+ public String getColumnText(Object element, int columnIndex) {
+ return ((IType) element).getElementName();
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ }
+ } // end class P_TableContentProvider
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizardPage2.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizardPage2.java
index 8a290c2ee..42e3ca9b2 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizardPage2.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/toolbutton/ToolbuttonNewWizardPage2.java
@@ -1,236 +1,236 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.toolbutton;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.ToolbuttonNewOperation;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
-import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>CalendarItemProviderNewWizardPage</h3> ...
- */
-public class ToolbuttonNewWizardPage2 extends AbstractWorkspaceWizardPage {
-
- final IType iToolbutton = TypeUtility.getType(RuntimeClasses.IToolButton);
-
- private INlsEntry m_nlsName;
- private String m_typeName;
- private SiblingProposal m_sibling;
-
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_siblingField;
-
- // process members
- private final IType m_declaringType;
-
- public ToolbuttonNewWizardPage2(IType declaringType) {
- super(ToolbuttonNewWizardPage2.class.getName());
- setTitle(Texts.get("NewToolButton"));
- setDescription(Texts.get("CreateANewToolButton"));
- m_declaringType = declaringType;
-
- m_sibling = SiblingProposal.SIBLING_END;
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, ScoutTypeUtility.findNlsProject(m_declaringType), Texts.get("Name"));
- m_nlsNameField.acceptProposal(m_nlsName);
- m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- INlsEntry oldEntry = getNlsName();
- m_nlsName = (INlsEntry) event.proposal;
- if (m_nlsName != null) {
- if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
- m_typeNameField.setText(m_nlsName.getKey());
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_TOOL);
- m_typeNameField.setText(m_typeName);
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_typeName = m_typeNameField.getText();
- pingStateChanging();
- }
- });
-
- m_siblingField = getFieldToolkit().createSiblingProposalField(parent, m_declaringType, TypeUtility.getType(RuntimeClasses.IToolButton));
- m_siblingField.acceptProposal(m_sibling);
- m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_sibling = (SiblingProposal) event.proposal;
- pingStateChanging();
- }
- });
-
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_siblingField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- @Override
- public IWizardPage getNextPage() {
- return null;
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- ToolbuttonNewOperation operation = new ToolbuttonNewOperation(m_declaringType);
-
- // write back members
- ToolbuttonNewWizardPage1 previousPage = (ToolbuttonNewWizardPage1) getWizard().getPage(ToolbuttonNewWizardPage1.class.getName());
- IType superType = previousPage.getSuperType();
- if (superType != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
- }
- operation.setTypeName(getTypeName());
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- if (getSibling() == SiblingProposal.SIBLING_END) {
- IStructuredType structuredType = ScoutTypeUtility.createStructuredType(m_declaringType);
- operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_TOOL_BUTTON));
- }
- else {
- operation.setSibling(getSibling().getElement());
- }
- operation.run(monitor, workingCopyManager);
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_TOOL)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- public INlsEntry getNlsName() {
- return m_nlsName;
- }
-
- public void setNlsName(INlsEntry nlsName) {
- try {
- setStateChanging(true);
- m_nlsName = nlsName;
- if (isControlCreated()) {
- m_nlsNameField.acceptProposal(nlsName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getTypeName() {
- return m_typeName;
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- m_typeName = typeName;
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public SiblingProposal getSibling() {
- return m_sibling;
- }
-
- public void setSibling(SiblingProposal sibling) {
- try {
- setStateChanging(true);
- m_sibling = sibling;
- if (isControlCreated()) {
- m_siblingField.acceptProposal(sibling);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.toolbutton;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.ToolbuttonNewOperation;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>CalendarItemProviderNewWizardPage</h3> ...
+ */
+public class ToolbuttonNewWizardPage2 extends AbstractWorkspaceWizardPage {
+
+ final IType iToolbutton = TypeUtility.getType(RuntimeClasses.IToolButton);
+
+ private INlsEntry m_nlsName;
+ private String m_typeName;
+ private SiblingProposal m_sibling;
+
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_siblingField;
+
+ // process members
+ private final IType m_declaringType;
+
+ public ToolbuttonNewWizardPage2(IType declaringType) {
+ super(ToolbuttonNewWizardPage2.class.getName());
+ setTitle(Texts.get("NewToolButton"));
+ setDescription(Texts.get("CreateANewToolButton"));
+ m_declaringType = declaringType;
+
+ m_sibling = SiblingProposal.SIBLING_END;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, ScoutTypeUtility.findNlsProject(m_declaringType), Texts.get("Name"));
+ m_nlsNameField.acceptProposal(m_nlsName);
+ m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ INlsEntry oldEntry = getNlsName();
+ m_nlsName = (INlsEntry) event.proposal;
+ if (m_nlsName != null) {
+ if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
+ m_typeNameField.setText(m_nlsName.getKey());
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_TOOL);
+ m_typeNameField.setText(m_typeName);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_typeName = m_typeNameField.getText();
+ pingStateChanging();
+ }
+ });
+
+ m_siblingField = getFieldToolkit().createSiblingProposalField(parent, m_declaringType, TypeUtility.getType(RuntimeClasses.IToolButton));
+ m_siblingField.acceptProposal(m_sibling);
+ m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_sibling = (SiblingProposal) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_siblingField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ public IWizardPage getNextPage() {
+ return null;
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ ToolbuttonNewOperation operation = new ToolbuttonNewOperation(m_declaringType);
+
+ // write back members
+ ToolbuttonNewWizardPage1 previousPage = (ToolbuttonNewWizardPage1) getWizard().getPage(ToolbuttonNewWizardPage1.class.getName());
+ IType superType = previousPage.getSuperType();
+ if (superType != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(superType.getFullyQualifiedName(), true));
+ }
+ operation.setTypeName(getTypeName());
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ if (getSibling() == SiblingProposal.SIBLING_END) {
+ IStructuredType structuredType = ScoutTypeUtility.createStructuredType(m_declaringType);
+ operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_TOOL_BUTTON));
+ }
+ else {
+ operation.setSibling(getSibling().getElement());
+ }
+ operation.run(monitor, workingCopyManager);
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_TOOL)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ public INlsEntry getNlsName() {
+ return m_nlsName;
+ }
+
+ public void setNlsName(INlsEntry nlsName) {
+ try {
+ setStateChanging(true);
+ m_nlsName = nlsName;
+ if (isControlCreated()) {
+ m_nlsNameField.acceptProposal(nlsName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getTypeName() {
+ return m_typeName;
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ m_typeName = typeName;
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public SiblingProposal getSibling() {
+ return m_sibling;
+ }
+
+ public void setSibling(SiblingProposal sibling) {
+ try {
+ setStateChanging(true);
+ m_sibling = sibling;
+ if (isControlCreated()) {
+ m_siblingField.acceptProposal(sibling);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/WizardNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/WizardNewWizard.java
index d782bc235..3e0e17309 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/WizardNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/WizardNewWizard.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.wizard;
-
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-
-/**
- * <h3>{@link WizardNewWizard}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 19.05.2011
- */
-public class WizardNewWizard extends AbstractWorkspaceWizard {
-
- private WizardNewWizardPage m_page1;
- private final IScoutBundle m_clientBundle;
-
- public WizardNewWizard(IScoutBundle clientBundle) {
- setWindowTitle(Texts.get("NewWizard"));
- m_clientBundle = clientBundle;
- m_page1 = new WizardNewWizardPage(getClientBundle());
- addPage(m_page1);
- }
-
- public IScoutBundle getClientBundle() {
- return m_clientBundle;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.wizard;
+
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+
+/**
+ * <h3>{@link WizardNewWizard}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 19.05.2011
+ */
+public class WizardNewWizard extends AbstractWorkspaceWizard {
+
+ private WizardNewWizardPage m_page1;
+ private final IScoutBundle m_clientBundle;
+
+ public WizardNewWizard(IScoutBundle clientBundle) {
+ setWindowTitle(Texts.get("NewWizard"));
+ m_clientBundle = clientBundle;
+ m_page1 = new WizardNewWizardPage(getClientBundle());
+ addPage(m_page1);
+ }
+
+ public IScoutBundle getClientBundle() {
+ return m_clientBundle;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/WizardNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/WizardNewWizardPage.java
index fbb71c340..120e15e8e 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/WizardNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/WizardNewWizardPage.java
@@ -1,234 +1,234 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.wizard;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.WizardNewOperation;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>WizardNewWizardPage</h3> ...
- */
-public class WizardNewWizardPage extends AbstractWorkspaceWizardPage {
-
- final IType iWizard = TypeUtility.getType(RuntimeClasses.IWizard);
- final IType abstractWizard = TypeUtility.getType(RuntimeClasses.AbstractWizard);
-
- private INlsEntry m_nlsName;
- private String m_typeName;
- private IType m_superType;
-
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
-
- // process members
- private final IScoutBundle m_clientBundle;
-
- public WizardNewWizardPage(IScoutBundle clientBundle) {
- super(WizardNewWizardPage.class.getName());
- setTitle(Texts.get("NewWizard"));
- setDescription(Texts.get("CreateANewWizard"));
- m_clientBundle = clientBundle;
- m_superType = abstractWizard;
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, getClientBundle().findBestMatchNlsProject(), Texts.get("Name"));
- m_nlsNameField.acceptProposal(m_nlsName);
- m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- INlsEntry oldEntry = getNlsName();
- m_nlsName = (INlsEntry) event.proposal;
- if (m_nlsName != null) {
- if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
- m_typeNameField.setText(m_nlsName.getKey());
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_WIZARD);
- m_typeNameField.setText(m_typeName);
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- m_typeName = m_typeNameField.getText();
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new JavaElementAbstractTypeContentProvider(iWizard, getClientBundle().getJavaProject(), abstractWizard));
- m_superTypeField.acceptProposal(m_superType);
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- m_superType = (IType) event.proposal;
- pingStateChanging();
- }
- });
-
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- GridData tablePageData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- m_nlsNameField.setLayoutData(tablePageData);
- m_typeNameField.setLayoutData(tablePageData);
- m_superTypeField.setLayoutData(tablePageData);
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- WizardNewOperation m_operation = new WizardNewOperation();
- m_operation.setClientBundle(getClientBundle());
- // write back members
- if (getNlsName() != null) {
- m_operation.setNlsEntry(getNlsName());
- }
- m_operation.setTypeName(getTypeName());
- IType superTypeProp = getSuperType();
- if (superTypeProp != null) {
- m_operation.setSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
- }
-
- m_operation.run(monitor, workingCopyManager);
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- public IScoutBundle getClientBundle() {
- return m_clientBundle;
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_WIZARD)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.existsType(getClientBundle().getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_UI_WIZARDS) + "." + getTypeName())) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- public INlsEntry getNlsName() {
- return m_nlsName;
- }
-
- public void setNlsName(INlsEntry nlsName) {
- try {
- setStateChanging(true);
- m_nlsName = nlsName;
- if (isControlCreated()) {
- m_nlsNameField.acceptProposal(nlsName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public String getTypeName() {
- return m_typeName;
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- m_typeName = typeName;
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public IType getSuperType() {
- return m_superType;
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- m_superType = superType;
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.wizard;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.WizardNewOperation;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>WizardNewWizardPage</h3> ...
+ */
+public class WizardNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ final IType iWizard = TypeUtility.getType(RuntimeClasses.IWizard);
+ final IType abstractWizard = TypeUtility.getType(RuntimeClasses.AbstractWizard);
+
+ private INlsEntry m_nlsName;
+ private String m_typeName;
+ private IType m_superType;
+
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+
+ // process members
+ private final IScoutBundle m_clientBundle;
+
+ public WizardNewWizardPage(IScoutBundle clientBundle) {
+ super(WizardNewWizardPage.class.getName());
+ setTitle(Texts.get("NewWizard"));
+ setDescription(Texts.get("CreateANewWizard"));
+ m_clientBundle = clientBundle;
+ m_superType = abstractWizard;
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, getClientBundle().findBestMatchNlsProject(), Texts.get("Name"));
+ m_nlsNameField.acceptProposal(m_nlsName);
+ m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ INlsEntry oldEntry = getNlsName();
+ m_nlsName = (INlsEntry) event.proposal;
+ if (m_nlsName != null) {
+ if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
+ m_typeNameField.setText(m_nlsName.getKey());
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_WIZARD);
+ m_typeNameField.setText(m_typeName);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ m_typeName = m_typeNameField.getText();
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new JavaElementAbstractTypeContentProvider(iWizard, getClientBundle().getJavaProject(), abstractWizard));
+ m_superTypeField.acceptProposal(m_superType);
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ m_superType = (IType) event.proposal;
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ GridData tablePageData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ m_nlsNameField.setLayoutData(tablePageData);
+ m_typeNameField.setLayoutData(tablePageData);
+ m_superTypeField.setLayoutData(tablePageData);
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ WizardNewOperation m_operation = new WizardNewOperation();
+ m_operation.setClientBundle(getClientBundle());
+ // write back members
+ if (getNlsName() != null) {
+ m_operation.setNlsEntry(getNlsName());
+ }
+ m_operation.setTypeName(getTypeName());
+ IType superTypeProp = getSuperType();
+ if (superTypeProp != null) {
+ m_operation.setSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
+ }
+
+ m_operation.run(monitor, workingCopyManager);
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ public IScoutBundle getClientBundle() {
+ return m_clientBundle;
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_WIZARD)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.existsType(getClientBundle().getPackageName(IScoutBundle.CLIENT_PACKAGE_APPENDIX_UI_WIZARDS) + "." + getTypeName())) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ public INlsEntry getNlsName() {
+ return m_nlsName;
+ }
+
+ public void setNlsName(INlsEntry nlsName) {
+ try {
+ setStateChanging(true);
+ m_nlsName = nlsName;
+ if (isControlCreated()) {
+ m_nlsNameField.acceptProposal(nlsName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public String getTypeName() {
+ return m_typeName;
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ m_typeName = typeName;
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public IType getSuperType() {
+ return m_superType;
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ m_superType = superType;
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/step/WizardStepNewWizard.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/step/WizardStepNewWizard.java
index e9444f086..4daf45744 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/step/WizardStepNewWizard.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/step/WizardStepNewWizard.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.wizard.step;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-
-public class WizardStepNewWizard extends AbstractFormFieldWizard {
-
- private WizardStepNewWizardPage m_page1;
-
- public WizardStepNewWizard() {
- setWindowTitle(Texts.get("NewWizardStep"));
- }
-
- @Override
- public void initWizard(IType declaringType) {
- super.initWizard(declaringType);
- m_page1 = new WizardStepNewWizardPage(getDeclaringType());
- addPage(m_page1);
- }
-
- @Override
- public void setSuperType(IType superType) {
- m_page1.setSuperType(superType);
- }
-
- @Override
- protected void postFinishDisplayThread() {
- IType createdField = m_page1.getCreatedWizardStep();
- if (TypeUtility.exists(createdField)) {
- ScoutSdkUi.showJavaElementInEditor(createdField, false);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.wizard.step;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.ui.extensions.AbstractFormFieldWizard;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+public class WizardStepNewWizard extends AbstractFormFieldWizard {
+
+ private WizardStepNewWizardPage m_page1;
+
+ public WizardStepNewWizard() {
+ setWindowTitle(Texts.get("NewWizardStep"));
+ }
+
+ @Override
+ public void initWizard(IType declaringType) {
+ super.initWizard(declaringType);
+ m_page1 = new WizardStepNewWizardPage(getDeclaringType());
+ addPage(m_page1);
+ }
+
+ @Override
+ public void setSuperType(IType superType) {
+ m_page1.setSuperType(superType);
+ }
+
+ @Override
+ protected void postFinishDisplayThread() {
+ IType createdField = m_page1.getCreatedWizardStep();
+ if (TypeUtility.exists(createdField)) {
+ ScoutSdkUi.showJavaElementInEditor(createdField, false);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/step/WizardStepNewWizardPage.java b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/step/WizardStepNewWizardPage.java
index 68e9a5253..837a7e4af 100644
--- a/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/step/WizardStepNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ui/src/org/eclipse/scout/sdk/ui/wizard/wizard/step/WizardStepNewWizardPage.java
@@ -1,312 +1,312 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ui.wizard.wizard.step;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.nls.sdk.internal.ui.action.NlsProposal;
-import org.eclipse.scout.nls.sdk.model.INlsEntry;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.Texts;
-import org.eclipse.scout.sdk.operation.WizardStepNewOperation;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
-import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.Regex;
-import org.eclipse.scout.sdk.util.SdkProperties;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType;
-import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
-import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * <h3>{@link WizardStepNewWizardPage}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 02.09.2010
- */
-public class WizardStepNewWizardPage extends AbstractWorkspaceWizardPage {
-
- final IType iWizardStep = TypeUtility.getType(RuntimeClasses.IWizardStep);
- final IType abstractWizardStep = TypeUtility.getType(RuntimeClasses.AbstractWizardStep);
-
- /** {@link NlsProposal} **/
- public static final String PROP_NLS_NAME = "nlsName";
-
- /** {@link String} **/
- public static final String PROP_TYPE_NAME = "typeName";
- /** {@link ITypeProposal} **/
- public static final String PROP_SUPER_TYPE = "superType";
-
- /** {@link ITypeProposal} **/
- public static final String PROP_SIBLING = "sibling";
-
- private ProposalTextField m_nlsNameField;
- private StyledTextField m_typeNameField;
- private ProposalTextField m_superTypeField;
- private ProposalTextField m_siblingField;
-
- // process members
- private final IType m_declaringType;
- private IType m_createdWizardStep;
-
- public WizardStepNewWizardPage(IType declaringType) {
- super(WizardStepNewWizardPage.class.getName());
- setTitle(Texts.get("NewWizardStep"));
- setDescription(Texts.get("CreateANewWizardStep"));
- m_declaringType = declaringType;
-
- // default values
- IType superType = getSuperType();
- if (superType == null) {
- superType = abstractWizardStep;
- }
- setSuperTypeInternal(superType);
- setSibling(SiblingProposal.SIBLING_END);
- }
-
- @Override
- protected void createContent(Composite parent) {
-
- m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, ScoutTypeUtility.findNlsProject(m_declaringType), Texts.get("Name"));
- m_nlsNameField.acceptProposal(getNlsName());
- m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- try {
- setStateChanging(true);
- INlsEntry oldEntry = getNlsName();
- INlsEntry newEntry = (INlsEntry) event.proposal;
- setNlsNameInternal(newEntry);
- if (newEntry != null) {
- if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
- m_typeNameField.setText(newEntry.getKey());
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
- m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_WIZARD_STEP);
- m_typeNameField.setText(getTypeName());
- m_typeNameField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- setTypeNameInternal(m_typeNameField.getText());
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
- new JavaElementAbstractTypeContentProvider(iWizardStep, m_declaringType.getJavaProject(), abstractWizardStep));
- m_superTypeField.acceptProposal(getSuperType());
- m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setSuperTypeInternal((IType) event.proposal);
- pingStateChanging();
- }
- });
-
- m_siblingField = getFieldToolkit().createSiblingProposalField(parent, m_declaringType, iWizardStep);
- m_siblingField.acceptProposal(getSibling());
- m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- setSiblingInternal((SiblingProposal) event.proposal);
- pingStateChanging();
- }
- });
-
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- m_siblingField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
- }
-
- @Override
- public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- WizardStepNewOperation operation = new WizardStepNewOperation(m_declaringType);
-
- // write back members
- if (getNlsName() != null) {
- operation.setNlsEntry(getNlsName());
- }
- operation.setTypeName(getTypeName());
- IType superTypeProp = getSuperType();
- if (superTypeProp != null) {
- operation.setSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
- }
- if (getSibling() == SiblingProposal.SIBLING_END) {
- IStructuredType structuredType = ScoutTypeUtility.createStructuredWizard(m_declaringType);
- operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_WIZARD_STEP));
- }
- else {
- operation.setSibling(getSibling().getElement());
- }
- operation.run(monitor, workingCopyManager);
- m_createdWizardStep = operation.getCreatedWizardStep();
- return true;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- try {
- multiStatus.add(getStatusNameField());
- multiStatus.add(getStatusSuperType());
- }
- catch (JavaModelException e) {
- ScoutSdkUi.logError("could not validate name field.", e);
- }
- }
-
- protected IStatus getStatusNameField() throws JavaModelException {
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_WIZARD_STEP)) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
- }
- // check not allowed names
- if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
- }
- if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
- return Status.OK_STATUS;
- }
- else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
- return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
- }
- else {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
- }
- }
-
- protected IStatus getStatusSuperType() throws JavaModelException {
- if (getSuperType() == null) {
- return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
- }
- return Status.OK_STATUS;
- }
-
- /**
- * @return the createdWizardStep
- */
- public IType getCreatedWizardStep() {
- return m_createdWizardStep;
- }
-
- public INlsEntry getNlsName() {
- return (INlsEntry) getProperty(PROP_NLS_NAME);
- }
-
- public void setNlsName(INlsEntry nlsName) {
- try {
- setStateChanging(true);
- setNlsNameInternal(nlsName);
- if (isControlCreated()) {
- m_nlsNameField.acceptProposal(nlsName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setNlsNameInternal(INlsEntry nlsName) {
- setProperty(PROP_NLS_NAME, nlsName);
- }
-
- public String getTypeName() {
- return getPropertyString(PROP_TYPE_NAME);
- }
-
- public void setTypeName(String typeName) {
- try {
- setStateChanging(true);
- setTypeNameInternal(typeName);
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setTypeNameInternal(String typeName) {
- setPropertyString(PROP_TYPE_NAME, typeName);
- }
-
- public IType getSuperType() {
- return (IType) getProperty(PROP_SUPER_TYPE);
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- setSuperTypeInternal(superType);
- if (isControlCreated()) {
- m_superTypeField.acceptProposal(superType);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setSuperTypeInternal(IType superType) {
- setProperty(PROP_SUPER_TYPE, superType);
- }
-
- public SiblingProposal getSibling() {
- return (SiblingProposal) getProperty(PROP_SIBLING);
- }
-
- public void setSibling(SiblingProposal sibling) {
- try {
- setStateChanging(true);
- setSiblingInternal(sibling);
- if (isControlCreated()) {
- m_siblingField.acceptProposal(sibling);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setSiblingInternal(SiblingProposal sibling) {
- setProperty(PROP_SIBLING, sibling);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ui.wizard.wizard.step;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.nls.sdk.internal.ui.action.NlsProposal;
+import org.eclipse.scout.nls.sdk.model.INlsEntry;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.Texts;
+import org.eclipse.scout.sdk.operation.WizardStepNewOperation;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.SiblingProposal;
+import org.eclipse.scout.sdk.ui.fields.proposal.javaelement.JavaElementAbstractTypeContentProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.Regex;
+import org.eclipse.scout.sdk.util.SdkProperties;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType;
+import org.eclipse.scout.sdk.workspace.type.IStructuredType.CATEGORIES;
+import org.eclipse.scout.sdk.workspace.type.ScoutTypeUtility;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * <h3>{@link WizardStepNewWizardPage}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 02.09.2010
+ */
+public class WizardStepNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ final IType iWizardStep = TypeUtility.getType(RuntimeClasses.IWizardStep);
+ final IType abstractWizardStep = TypeUtility.getType(RuntimeClasses.AbstractWizardStep);
+
+ /** {@link NlsProposal} **/
+ public static final String PROP_NLS_NAME = "nlsName";
+
+ /** {@link String} **/
+ public static final String PROP_TYPE_NAME = "typeName";
+ /** {@link ITypeProposal} **/
+ public static final String PROP_SUPER_TYPE = "superType";
+
+ /** {@link ITypeProposal} **/
+ public static final String PROP_SIBLING = "sibling";
+
+ private ProposalTextField m_nlsNameField;
+ private StyledTextField m_typeNameField;
+ private ProposalTextField m_superTypeField;
+ private ProposalTextField m_siblingField;
+
+ // process members
+ private final IType m_declaringType;
+ private IType m_createdWizardStep;
+
+ public WizardStepNewWizardPage(IType declaringType) {
+ super(WizardStepNewWizardPage.class.getName());
+ setTitle(Texts.get("NewWizardStep"));
+ setDescription(Texts.get("CreateANewWizardStep"));
+ m_declaringType = declaringType;
+
+ // default values
+ IType superType = getSuperType();
+ if (superType == null) {
+ superType = abstractWizardStep;
+ }
+ setSuperTypeInternal(superType);
+ setSibling(SiblingProposal.SIBLING_END);
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+
+ m_nlsNameField = getFieldToolkit().createNlsProposalTextField(parent, ScoutTypeUtility.findNlsProject(m_declaringType), Texts.get("Name"));
+ m_nlsNameField.acceptProposal(getNlsName());
+ m_nlsNameField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ try {
+ setStateChanging(true);
+ INlsEntry oldEntry = getNlsName();
+ INlsEntry newEntry = (INlsEntry) event.proposal;
+ setNlsNameInternal(newEntry);
+ if (newEntry != null) {
+ if (oldEntry == null || oldEntry.getKey().equals(m_typeNameField.getModifiableText()) || StringUtility.isNullOrEmpty(m_typeNameField.getModifiableText())) {
+ m_typeNameField.setText(newEntry.getKey());
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("TypeName"));
+ m_typeNameField.setReadOnlySuffix(SdkProperties.SUFFIX_WIZARD_STEP);
+ m_typeNameField.setText(getTypeName());
+ m_typeNameField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setTypeNameInternal(m_typeNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createJavaElementProposalField(parent, Texts.get("SuperType"),
+ new JavaElementAbstractTypeContentProvider(iWizardStep, m_declaringType.getJavaProject(), abstractWizardStep));
+ m_superTypeField.acceptProposal(getSuperType());
+ m_superTypeField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setSuperTypeInternal((IType) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ m_siblingField = getFieldToolkit().createSiblingProposalField(parent, m_declaringType, iWizardStep);
+ m_siblingField.acceptProposal(getSibling());
+ m_siblingField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ setSiblingInternal((SiblingProposal) event.proposal);
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ m_nlsNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_typeNameField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_superTypeField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ m_siblingField.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ public boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ WizardStepNewOperation operation = new WizardStepNewOperation(m_declaringType);
+
+ // write back members
+ if (getNlsName() != null) {
+ operation.setNlsEntry(getNlsName());
+ }
+ operation.setTypeName(getTypeName());
+ IType superTypeProp = getSuperType();
+ if (superTypeProp != null) {
+ operation.setSuperTypeSignature(Signature.createTypeSignature(superTypeProp.getFullyQualifiedName(), true));
+ }
+ if (getSibling() == SiblingProposal.SIBLING_END) {
+ IStructuredType structuredType = ScoutTypeUtility.createStructuredWizard(m_declaringType);
+ operation.setSibling(structuredType.getSibling(CATEGORIES.TYPE_WIZARD_STEP));
+ }
+ else {
+ operation.setSibling(getSibling().getElement());
+ }
+ operation.run(monitor, workingCopyManager);
+ m_createdWizardStep = operation.getCreatedWizardStep();
+ return true;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ try {
+ multiStatus.add(getStatusNameField());
+ multiStatus.add(getStatusSuperType());
+ }
+ catch (JavaModelException e) {
+ ScoutSdkUi.logError("could not validate name field.", e);
+ }
+ }
+
+ protected IStatus getStatusNameField() throws JavaModelException {
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(SdkProperties.SUFFIX_WIZARD_STEP)) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_fieldNull"));
+ }
+ // check not allowed names
+ if (TypeUtility.exists(m_declaringType.getType(getTypeName()))) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_nameAlreadyUsed"));
+ }
+ if (Regex.REGEX_WELLFORMD_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return Status.OK_STATUS;
+ }
+ else if (Regex.REGEX_JAVAFIELD.matcher(getTypeName()).matches()) {
+ return new Status(IStatus.WARNING, ScoutSdkUi.PLUGIN_ID, Texts.get("Warning_notWellformedJavaName"));
+ }
+ else {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("Error_invalidFieldX", getTypeName()));
+ }
+ }
+
+ protected IStatus getStatusSuperType() throws JavaModelException {
+ if (getSuperType() == null) {
+ return new Status(IStatus.ERROR, ScoutSdkUi.PLUGIN_ID, Texts.get("TheSuperTypeCanNotBeNull"));
+ }
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * @return the createdWizardStep
+ */
+ public IType getCreatedWizardStep() {
+ return m_createdWizardStep;
+ }
+
+ public INlsEntry getNlsName() {
+ return (INlsEntry) getProperty(PROP_NLS_NAME);
+ }
+
+ public void setNlsName(INlsEntry nlsName) {
+ try {
+ setStateChanging(true);
+ setNlsNameInternal(nlsName);
+ if (isControlCreated()) {
+ m_nlsNameField.acceptProposal(nlsName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setNlsNameInternal(INlsEntry nlsName) {
+ setProperty(PROP_NLS_NAME, nlsName);
+ }
+
+ public String getTypeName() {
+ return getPropertyString(PROP_TYPE_NAME);
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ setStateChanging(true);
+ setTypeNameInternal(typeName);
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setTypeNameInternal(String typeName) {
+ setPropertyString(PROP_TYPE_NAME, typeName);
+ }
+
+ public IType getSuperType() {
+ return (IType) getProperty(PROP_SUPER_TYPE);
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ setSuperTypeInternal(superType);
+ if (isControlCreated()) {
+ m_superTypeField.acceptProposal(superType);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setSuperTypeInternal(IType superType) {
+ setProperty(PROP_SUPER_TYPE, superType);
+ }
+
+ public SiblingProposal getSibling() {
+ return (SiblingProposal) getProperty(PROP_SIBLING);
+ }
+
+ public void setSibling(SiblingProposal sibling) {
+ try {
+ setStateChanging(true);
+ setSiblingInternal(sibling);
+ if (isControlCreated()) {
+ m_siblingField.acceptProposal(sibling);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setSiblingInternal(SiblingProposal sibling) {
+ setProperty(PROP_SIBLING, sibling);
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/.classpath b/org.eclipse.scout.sdk.util/.classpath
index 8a8f1668c..ad32c83a7 100644
--- a/org.eclipse.scout.sdk.util/.classpath
+++ b/org.eclipse.scout.sdk.util/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.scout.sdk.util/.project b/org.eclipse.scout.sdk.util/.project
index f2c3f4b1d..18fb3246d 100644
--- a/org.eclipse.scout.sdk.util/.project
+++ b/org.eclipse.scout.sdk.util/.project
@@ -1,35 +1,35 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.scout.sdk.util</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
- <linkedResources>
- <link>
- <name>.settings</name>
- <type>2</type>
- <locationURI>WORKSPACE_LOC/org.eclipse.scout.sdk.feature/.settings</locationURI>
- </link>
- </linkedResources>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.scout.sdk.util</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+ <linkedResources>
+ <link>
+ <name>.settings</name>
+ <type>2</type>
+ <locationURI>WORKSPACE_LOC/org.eclipse.scout.sdk.feature/.settings</locationURI>
+ </link>
+ </linkedResources>
+</projectDescription>
diff --git a/org.eclipse.scout.sdk.util/build.properties b/org.eclipse.scout.sdk.util/build.properties
index 785a40c0e..9cbab3c13 100644
--- a/org.eclipse.scout.sdk.util/build.properties
+++ b/org.eclipse.scout.sdk.util/build.properties
@@ -1,6 +1,6 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- about.html
-src.includes = about.html
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ about.html
+src.includes = about.html
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/NamingUtility.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/NamingUtility.java
index 1c6c80df6..d9146679c 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/NamingUtility.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/NamingUtility.java
@@ -1,88 +1,88 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util;
-
-import java.text.ParseException;
-
-import org.eclipse.scout.commons.StringUtility;
-
-/**
- * <h3>{@link NamingUtility}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 24.11.2010
- */
-public final class NamingUtility {
-
- private NamingUtility() {
- }
-
- public static String getSimpleName(String qualifiedName) {
- int i = qualifiedName.lastIndexOf(".");
- if (i >= 0) {
- return qualifiedName.substring(i + 1);
- }
- else {
- return qualifiedName;
- }
- }
-
- public static String parseJavaTypeName(String name, String text, String[] discouragedSuffixes) throws ParseException {
- if (text == null) text = "";
- if (text.length() <= 1) {
- return null;
- }
- else if (!Character.isJavaIdentifierStart(text.charAt(0))) {
- throw new ParseException(name + " must start with upper case A-Z", 0);
- }
- else if (!Character.isUpperCase(text.charAt(0))) {
- text = Character.toUpperCase(text.charAt(0)) + text.substring(1);
- }
- else {
- String textLow = text.toLowerCase();
- if (discouragedSuffixes != null) {
- for (int i = 0; i < discouragedSuffixes.length; i++) {
- if (textLow.endsWith(discouragedSuffixes[i].toLowerCase())) {
- throw new ParseException(name + " must not end with '" + discouragedSuffixes[i] + "'", 0);
- }
- }
- }
- for (int i = 1; i < text.length(); i++) {
- if (!Character.isJavaIdentifierPart(text.charAt(i))) {
- throw new ParseException("'" + text + "' is not a valid java name", 0);
- }
- }
- }
- // all checks ok
- return text;
- }
-
- public static String removeSuffixes(String s, String... suffixes) {
- return StringUtility.removeSuffixes(s, suffixes);
- }
-
- /**
- * lowercase java-bean name
- */
- public static String toVariableName(String javaName) {
- if (javaName == null || javaName.length() == 0) return null;
- return Character.toLowerCase(javaName.charAt(0)) + javaName.substring(1);
- }
-
- /**
- * uppercase java-bean name
- */
- public static String toBeanName(String javaName) {
- if (javaName == null || javaName.length() == 0) return null;
- return Character.toUpperCase(javaName.charAt(0)) + javaName.substring(1);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util;
+
+import java.text.ParseException;
+
+import org.eclipse.scout.commons.StringUtility;
+
+/**
+ * <h3>{@link NamingUtility}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 24.11.2010
+ */
+public final class NamingUtility {
+
+ private NamingUtility() {
+ }
+
+ public static String getSimpleName(String qualifiedName) {
+ int i = qualifiedName.lastIndexOf(".");
+ if (i >= 0) {
+ return qualifiedName.substring(i + 1);
+ }
+ else {
+ return qualifiedName;
+ }
+ }
+
+ public static String parseJavaTypeName(String name, String text, String[] discouragedSuffixes) throws ParseException {
+ if (text == null) text = "";
+ if (text.length() <= 1) {
+ return null;
+ }
+ else if (!Character.isJavaIdentifierStart(text.charAt(0))) {
+ throw new ParseException(name + " must start with upper case A-Z", 0);
+ }
+ else if (!Character.isUpperCase(text.charAt(0))) {
+ text = Character.toUpperCase(text.charAt(0)) + text.substring(1);
+ }
+ else {
+ String textLow = text.toLowerCase();
+ if (discouragedSuffixes != null) {
+ for (int i = 0; i < discouragedSuffixes.length; i++) {
+ if (textLow.endsWith(discouragedSuffixes[i].toLowerCase())) {
+ throw new ParseException(name + " must not end with '" + discouragedSuffixes[i] + "'", 0);
+ }
+ }
+ }
+ for (int i = 1; i < text.length(); i++) {
+ if (!Character.isJavaIdentifierPart(text.charAt(i))) {
+ throw new ParseException("'" + text + "' is not a valid java name", 0);
+ }
+ }
+ }
+ // all checks ok
+ return text;
+ }
+
+ public static String removeSuffixes(String s, String... suffixes) {
+ return StringUtility.removeSuffixes(s, suffixes);
+ }
+
+ /**
+ * lowercase java-bean name
+ */
+ public static String toVariableName(String javaName) {
+ if (javaName == null || javaName.length() == 0) return null;
+ return Character.toLowerCase(javaName.charAt(0)) + javaName.substring(1);
+ }
+
+ /**
+ * uppercase java-bean name
+ */
+ public static String toBeanName(String javaName) {
+ if (javaName == null || javaName.length() == 0) return null;
+ return Character.toUpperCase(javaName.charAt(0)) + javaName.substring(1);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/PropertyMap.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/PropertyMap.java
index 173990c21..0124293e0 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/PropertyMap.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/PropertyMap.java
@@ -1,43 +1,43 @@
-package org.eclipse.scout.sdk.util;
-
-import java.beans.PropertyChangeListener;
-import java.util.Map;
-
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-
-public class PropertyMap {
- private final BasicPropertySupport m_props;
-
- public PropertyMap() {
- m_props = new BasicPropertySupport(null);
- }
-
- public Object getProperty(String name) {
- return getProperty(name, Object.class);
- }
-
- @SuppressWarnings("unchecked")
- public <T extends Object> T getProperty(String name, Class<T> type) {
- return (T) m_props.getProperty(name);
- }
-
- public void setProperty(String name, Object value) {
- m_props.setProperty(name, value);
- }
-
- public Map<String, Object> getPropertiesMap() {
- return m_props.getPropertiesMap();
- }
-
- public boolean hasProperty(String name) {
- return m_props.hasProperty(name);
- }
-
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- m_props.addPropertyChangeListener(listener);
- }
-
- public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
- m_props.addPropertyChangeListener(propertyName, listener);
- }
-}
+package org.eclipse.scout.sdk.util;
+
+import java.beans.PropertyChangeListener;
+import java.util.Map;
+
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+
+public class PropertyMap {
+ private final BasicPropertySupport m_props;
+
+ public PropertyMap() {
+ m_props = new BasicPropertySupport(null);
+ }
+
+ public Object getProperty(String name) {
+ return getProperty(name, Object.class);
+ }
+
+ @SuppressWarnings("unchecked")
+ public <T extends Object> T getProperty(String name, Class<T> type) {
+ return (T) m_props.getProperty(name);
+ }
+
+ public void setProperty(String name, Object value) {
+ m_props.setProperty(name, value);
+ }
+
+ public Map<String, Object> getPropertiesMap() {
+ return m_props.getPropertiesMap();
+ }
+
+ public boolean hasProperty(String name) {
+ return m_props.hasProperty(name);
+ }
+
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ m_props.addPropertyChangeListener(listener);
+ }
+
+ public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) {
+ m_props.addPropertyChangeListener(propertyName, listener);
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/AstUtility.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/AstUtility.java
index 67f7f831a..97d7b9c72 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/AstUtility.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/AstUtility.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.ast;
-
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.util.ast.visitor.TypeSignatureResolveVisitor;
-import org.eclipse.scout.sdk.util.ast.visitor.VariableResolveVisitor;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.signature.SignatureUtility;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-
-/**
- * <h3>{@link AstUtility}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 27.02.2011
- */
-public final class AstUtility {
-
- public static VariableType getTypeSignature(ASTNode node, ASTNode rootNode, IJavaElement containerElement) {
- TypeSignatureResolveVisitor visitor = new TypeSignatureResolveVisitor(rootNode, containerElement);
- node.accept(visitor);
- VariableType var = new VariableType("");
- var.setTypeSignature(visitor.getTypeSignature());
- var.addAssignedSignatures(visitor.getAssignedSignatures());
- return var;
- }
-
- public static VariableType resolveVariable(String variableName, IJavaElement containerElement, ASTNode rootNode, ASTNode stopNode) {
- VariableResolveVisitor visitor = new VariableResolveVisitor(variableName, containerElement, rootNode, stopNode);
- rootNode.accept(visitor);
- VariableType var = new VariableType(variableName);
- var.addAssignedSignatures(visitor.getAssignedTypesSignatures());
- var.setTypeSignature(visitor.getVariableTypeSignature());
- return var;
- }
-
- public static String resolveReturnValueSignature(String typeSignature, String methodName) {
- try {
- if (!StringUtility.isNullOrEmpty(typeSignature)) {
- IType refType = TypeUtility.getTypeBySignature(typeSignature);
- if (TypeUtility.exists(refType)) {
- IMethod method = TypeUtility.getMethod(refType, methodName);
- if (TypeUtility.exists(method)) {
- return SignatureUtility.getResolvedSignature(method.getReturnType(), refType);
- }
- }
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("could not parse return type of method '" + methodName + "' on type '" + typeSignature + "'");
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.ast;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.util.ast.visitor.TypeSignatureResolveVisitor;
+import org.eclipse.scout.sdk.util.ast.visitor.VariableResolveVisitor;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.signature.SignatureUtility;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+/**
+ * <h3>{@link AstUtility}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 27.02.2011
+ */
+public final class AstUtility {
+
+ public static VariableType getTypeSignature(ASTNode node, ASTNode rootNode, IJavaElement containerElement) {
+ TypeSignatureResolveVisitor visitor = new TypeSignatureResolveVisitor(rootNode, containerElement);
+ node.accept(visitor);
+ VariableType var = new VariableType("");
+ var.setTypeSignature(visitor.getTypeSignature());
+ var.addAssignedSignatures(visitor.getAssignedSignatures());
+ return var;
+ }
+
+ public static VariableType resolveVariable(String variableName, IJavaElement containerElement, ASTNode rootNode, ASTNode stopNode) {
+ VariableResolveVisitor visitor = new VariableResolveVisitor(variableName, containerElement, rootNode, stopNode);
+ rootNode.accept(visitor);
+ VariableType var = new VariableType(variableName);
+ var.addAssignedSignatures(visitor.getAssignedTypesSignatures());
+ var.setTypeSignature(visitor.getVariableTypeSignature());
+ return var;
+ }
+
+ public static String resolveReturnValueSignature(String typeSignature, String methodName) {
+ try {
+ if (!StringUtility.isNullOrEmpty(typeSignature)) {
+ IType refType = TypeUtility.getTypeBySignature(typeSignature);
+ if (TypeUtility.exists(refType)) {
+ IMethod method = TypeUtility.getMethod(refType, methodName);
+ if (TypeUtility.exists(method)) {
+ return SignatureUtility.getResolvedSignature(method.getReturnType(), refType);
+ }
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("could not parse return type of method '" + methodName + "' on type '" + typeSignature + "'");
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/VariableType.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/VariableType.java
index 947dd171c..4d47824eb 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/VariableType.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/VariableType.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.ast;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * <h3>{@link VariableType}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 27.02.2011
- */
-public class VariableType {
-
- private final String m_variableName;
- private String m_typeSignature;
- private List<String /*signature*/> m_assignedTypeSignatures;
-
- public VariableType(String variableName) {
- m_variableName = variableName;
- m_assignedTypeSignatures = new ArrayList<String>();
- }
-
- /**
- * @return the variableName
- */
- public String getVariableName() {
- return m_variableName;
- }
-
- public String[] getAssignedTypeSignatures() {
- return m_assignedTypeSignatures.toArray(new String[m_assignedTypeSignatures.size()]);
- }
-
- void addAssignedSignature(String signature) {
- m_assignedTypeSignatures.add(signature);
- }
-
- void addAssignedSignatures(String[] signatures) {
- m_assignedTypeSignatures.addAll(Arrays.asList(signatures));
- }
-
- /**
- * @param typeSignature
- * the typeSignature to set
- */
- void setTypeSignature(String typeSignature) {
- m_typeSignature = typeSignature;
- }
-
- /**
- * @return the typeSignature
- */
- public String getTypeSignature() {
- return m_typeSignature;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.ast;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * <h3>{@link VariableType}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 27.02.2011
+ */
+public class VariableType {
+
+ private final String m_variableName;
+ private String m_typeSignature;
+ private List<String /*signature*/> m_assignedTypeSignatures;
+
+ public VariableType(String variableName) {
+ m_variableName = variableName;
+ m_assignedTypeSignatures = new ArrayList<String>();
+ }
+
+ /**
+ * @return the variableName
+ */
+ public String getVariableName() {
+ return m_variableName;
+ }
+
+ public String[] getAssignedTypeSignatures() {
+ return m_assignedTypeSignatures.toArray(new String[m_assignedTypeSignatures.size()]);
+ }
+
+ void addAssignedSignature(String signature) {
+ m_assignedTypeSignatures.add(signature);
+ }
+
+ void addAssignedSignatures(String[] signatures) {
+ m_assignedTypeSignatures.addAll(Arrays.asList(signatures));
+ }
+
+ /**
+ * @param typeSignature
+ * the typeSignature to set
+ */
+ void setTypeSignature(String typeSignature) {
+ m_typeSignature = typeSignature;
+ }
+
+ /**
+ * @return the typeSignature
+ */
+ public String getTypeSignature() {
+ return m_typeSignature;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/DefaultAstVisitor.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/DefaultAstVisitor.java
index 685aa55d5..d8c819799 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/DefaultAstVisitor.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/DefaultAstVisitor.java
@@ -1,526 +1,526 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.ast.visitor;
-
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ASTVisitor;
-import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration;
-import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration;
-import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
-import org.eclipse.jdt.core.dom.ArrayAccess;
-import org.eclipse.jdt.core.dom.ArrayCreation;
-import org.eclipse.jdt.core.dom.ArrayInitializer;
-import org.eclipse.jdt.core.dom.ArrayType;
-import org.eclipse.jdt.core.dom.AssertStatement;
-import org.eclipse.jdt.core.dom.Assignment;
-import org.eclipse.jdt.core.dom.Block;
-import org.eclipse.jdt.core.dom.BlockComment;
-import org.eclipse.jdt.core.dom.BooleanLiteral;
-import org.eclipse.jdt.core.dom.BreakStatement;
-import org.eclipse.jdt.core.dom.CastExpression;
-import org.eclipse.jdt.core.dom.CatchClause;
-import org.eclipse.jdt.core.dom.CharacterLiteral;
-import org.eclipse.jdt.core.dom.ClassInstanceCreation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.ConditionalExpression;
-import org.eclipse.jdt.core.dom.ConstructorInvocation;
-import org.eclipse.jdt.core.dom.ContinueStatement;
-import org.eclipse.jdt.core.dom.DoStatement;
-import org.eclipse.jdt.core.dom.EmptyStatement;
-import org.eclipse.jdt.core.dom.EnhancedForStatement;
-import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
-import org.eclipse.jdt.core.dom.EnumDeclaration;
-import org.eclipse.jdt.core.dom.ExpressionStatement;
-import org.eclipse.jdt.core.dom.FieldAccess;
-import org.eclipse.jdt.core.dom.FieldDeclaration;
-import org.eclipse.jdt.core.dom.ForStatement;
-import org.eclipse.jdt.core.dom.IfStatement;
-import org.eclipse.jdt.core.dom.ImportDeclaration;
-import org.eclipse.jdt.core.dom.InfixExpression;
-import org.eclipse.jdt.core.dom.Initializer;
-import org.eclipse.jdt.core.dom.InstanceofExpression;
-import org.eclipse.jdt.core.dom.Javadoc;
-import org.eclipse.jdt.core.dom.LabeledStatement;
-import org.eclipse.jdt.core.dom.LineComment;
-import org.eclipse.jdt.core.dom.MarkerAnnotation;
-import org.eclipse.jdt.core.dom.MemberRef;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.MethodInvocation;
-import org.eclipse.jdt.core.dom.MethodRef;
-import org.eclipse.jdt.core.dom.MethodRefParameter;
-import org.eclipse.jdt.core.dom.Modifier;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.NullLiteral;
-import org.eclipse.jdt.core.dom.NumberLiteral;
-import org.eclipse.jdt.core.dom.PackageDeclaration;
-import org.eclipse.jdt.core.dom.ParameterizedType;
-import org.eclipse.jdt.core.dom.ParenthesizedExpression;
-import org.eclipse.jdt.core.dom.PostfixExpression;
-import org.eclipse.jdt.core.dom.PrefixExpression;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.QualifiedName;
-import org.eclipse.jdt.core.dom.QualifiedType;
-import org.eclipse.jdt.core.dom.ReturnStatement;
-import org.eclipse.jdt.core.dom.SimpleName;
-import org.eclipse.jdt.core.dom.SimpleType;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.jdt.core.dom.StringLiteral;
-import org.eclipse.jdt.core.dom.SuperConstructorInvocation;
-import org.eclipse.jdt.core.dom.SuperFieldAccess;
-import org.eclipse.jdt.core.dom.SuperMethodInvocation;
-import org.eclipse.jdt.core.dom.SwitchCase;
-import org.eclipse.jdt.core.dom.SwitchStatement;
-import org.eclipse.jdt.core.dom.SynchronizedStatement;
-import org.eclipse.jdt.core.dom.TagElement;
-import org.eclipse.jdt.core.dom.TextElement;
-import org.eclipse.jdt.core.dom.ThisExpression;
-import org.eclipse.jdt.core.dom.ThrowStatement;
-import org.eclipse.jdt.core.dom.TryStatement;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jdt.core.dom.TypeDeclarationStatement;
-import org.eclipse.jdt.core.dom.TypeLiteral;
-import org.eclipse.jdt.core.dom.TypeParameter;
-import org.eclipse.jdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
-import org.eclipse.jdt.core.dom.WhileStatement;
-import org.eclipse.jdt.core.dom.WildcardType;
-
-/**
- * <h3>{@link DefaultAstVisitor}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 24.02.2011
- */
-public class DefaultAstVisitor extends ASTVisitor {
-
- public boolean visitNode(ASTNode node) {
- return true;
- }
-
- @Override
- public boolean visit(AnnotationTypeDeclaration node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(AnnotationTypeMemberDeclaration node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(AnonymousClassDeclaration node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ArrayAccess node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ArrayCreation node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ArrayInitializer node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ArrayType node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(AssertStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(Assignment node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(Block node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(BlockComment node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(BooleanLiteral node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(BreakStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(CastExpression node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(CatchClause node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(CharacterLiteral node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ClassInstanceCreation node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(CompilationUnit node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ConditionalExpression node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ConstructorInvocation node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ContinueStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(DoStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(EmptyStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(EnhancedForStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(EnumConstantDeclaration node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(EnumDeclaration node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ExpressionStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(FieldAccess node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(FieldDeclaration node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ForStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(IfStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ImportDeclaration node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(InfixExpression node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(Initializer node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(InstanceofExpression node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(Javadoc node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(LabeledStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(LineComment node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(MarkerAnnotation node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(MemberRef node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(MemberValuePair node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(MethodDeclaration node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(MethodInvocation node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(MethodRef node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(MethodRefParameter node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(Modifier node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(NormalAnnotation node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(NullLiteral node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(NumberLiteral node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(PackageDeclaration node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ParameterizedType node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ParenthesizedExpression node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(PostfixExpression node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(PrefixExpression node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(PrimitiveType node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(QualifiedName node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(QualifiedType node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ReturnStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(SimpleName node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(SimpleType node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(SingleMemberAnnotation node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(SingleVariableDeclaration node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(StringLiteral node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(SuperConstructorInvocation node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(SuperFieldAccess node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(SuperMethodInvocation node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(SwitchCase node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(SwitchStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(SynchronizedStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(TagElement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(TextElement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ThisExpression node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(ThrowStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(TryStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(TypeDeclaration node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(TypeDeclarationStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(TypeLiteral node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(TypeParameter node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(VariableDeclarationExpression node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(VariableDeclarationFragment node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(VariableDeclarationStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(WhileStatement node) {
- return visitNode(node);
- }
-
- @Override
- public boolean visit(WildcardType node) {
- return visitNode(node);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.ast.visitor;
+
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTVisitor;
+import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration;
+import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration;
+import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
+import org.eclipse.jdt.core.dom.ArrayAccess;
+import org.eclipse.jdt.core.dom.ArrayCreation;
+import org.eclipse.jdt.core.dom.ArrayInitializer;
+import org.eclipse.jdt.core.dom.ArrayType;
+import org.eclipse.jdt.core.dom.AssertStatement;
+import org.eclipse.jdt.core.dom.Assignment;
+import org.eclipse.jdt.core.dom.Block;
+import org.eclipse.jdt.core.dom.BlockComment;
+import org.eclipse.jdt.core.dom.BooleanLiteral;
+import org.eclipse.jdt.core.dom.BreakStatement;
+import org.eclipse.jdt.core.dom.CastExpression;
+import org.eclipse.jdt.core.dom.CatchClause;
+import org.eclipse.jdt.core.dom.CharacterLiteral;
+import org.eclipse.jdt.core.dom.ClassInstanceCreation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ConditionalExpression;
+import org.eclipse.jdt.core.dom.ConstructorInvocation;
+import org.eclipse.jdt.core.dom.ContinueStatement;
+import org.eclipse.jdt.core.dom.DoStatement;
+import org.eclipse.jdt.core.dom.EmptyStatement;
+import org.eclipse.jdt.core.dom.EnhancedForStatement;
+import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
+import org.eclipse.jdt.core.dom.EnumDeclaration;
+import org.eclipse.jdt.core.dom.ExpressionStatement;
+import org.eclipse.jdt.core.dom.FieldAccess;
+import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.ForStatement;
+import org.eclipse.jdt.core.dom.IfStatement;
+import org.eclipse.jdt.core.dom.ImportDeclaration;
+import org.eclipse.jdt.core.dom.InfixExpression;
+import org.eclipse.jdt.core.dom.Initializer;
+import org.eclipse.jdt.core.dom.InstanceofExpression;
+import org.eclipse.jdt.core.dom.Javadoc;
+import org.eclipse.jdt.core.dom.LabeledStatement;
+import org.eclipse.jdt.core.dom.LineComment;
+import org.eclipse.jdt.core.dom.MarkerAnnotation;
+import org.eclipse.jdt.core.dom.MemberRef;
+import org.eclipse.jdt.core.dom.MemberValuePair;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.MethodInvocation;
+import org.eclipse.jdt.core.dom.MethodRef;
+import org.eclipse.jdt.core.dom.MethodRefParameter;
+import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jdt.core.dom.NormalAnnotation;
+import org.eclipse.jdt.core.dom.NullLiteral;
+import org.eclipse.jdt.core.dom.NumberLiteral;
+import org.eclipse.jdt.core.dom.PackageDeclaration;
+import org.eclipse.jdt.core.dom.ParameterizedType;
+import org.eclipse.jdt.core.dom.ParenthesizedExpression;
+import org.eclipse.jdt.core.dom.PostfixExpression;
+import org.eclipse.jdt.core.dom.PrefixExpression;
+import org.eclipse.jdt.core.dom.PrimitiveType;
+import org.eclipse.jdt.core.dom.QualifiedName;
+import org.eclipse.jdt.core.dom.QualifiedType;
+import org.eclipse.jdt.core.dom.ReturnStatement;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.dom.SimpleType;
+import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.StringLiteral;
+import org.eclipse.jdt.core.dom.SuperConstructorInvocation;
+import org.eclipse.jdt.core.dom.SuperFieldAccess;
+import org.eclipse.jdt.core.dom.SuperMethodInvocation;
+import org.eclipse.jdt.core.dom.SwitchCase;
+import org.eclipse.jdt.core.dom.SwitchStatement;
+import org.eclipse.jdt.core.dom.SynchronizedStatement;
+import org.eclipse.jdt.core.dom.TagElement;
+import org.eclipse.jdt.core.dom.TextElement;
+import org.eclipse.jdt.core.dom.ThisExpression;
+import org.eclipse.jdt.core.dom.ThrowStatement;
+import org.eclipse.jdt.core.dom.TryStatement;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.TypeDeclarationStatement;
+import org.eclipse.jdt.core.dom.TypeLiteral;
+import org.eclipse.jdt.core.dom.TypeParameter;
+import org.eclipse.jdt.core.dom.VariableDeclarationExpression;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
+import org.eclipse.jdt.core.dom.WhileStatement;
+import org.eclipse.jdt.core.dom.WildcardType;
+
+/**
+ * <h3>{@link DefaultAstVisitor}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 24.02.2011
+ */
+public class DefaultAstVisitor extends ASTVisitor {
+
+ public boolean visitNode(ASTNode node) {
+ return true;
+ }
+
+ @Override
+ public boolean visit(AnnotationTypeDeclaration node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(AnnotationTypeMemberDeclaration node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(AnonymousClassDeclaration node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ArrayAccess node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ArrayCreation node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ArrayInitializer node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ArrayType node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(AssertStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(Assignment node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(Block node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(BlockComment node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(BooleanLiteral node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(BreakStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(CastExpression node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(CatchClause node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(CharacterLiteral node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ClassInstanceCreation node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(CompilationUnit node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ConditionalExpression node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ConstructorInvocation node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ContinueStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(DoStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(EmptyStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(EnhancedForStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(EnumConstantDeclaration node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(EnumDeclaration node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ExpressionStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(FieldAccess node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(FieldDeclaration node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ForStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(IfStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ImportDeclaration node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(InfixExpression node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(Initializer node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(InstanceofExpression node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(Javadoc node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(LabeledStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(LineComment node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(MarkerAnnotation node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(MemberRef node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(MemberValuePair node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(MethodDeclaration node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(MethodInvocation node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(MethodRef node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(MethodRefParameter node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(Modifier node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(NormalAnnotation node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(NullLiteral node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(NumberLiteral node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(PackageDeclaration node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ParameterizedType node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ParenthesizedExpression node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(PostfixExpression node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(PrefixExpression node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(PrimitiveType node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(QualifiedName node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(QualifiedType node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ReturnStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(SimpleName node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(SimpleType node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(SingleMemberAnnotation node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(SingleVariableDeclaration node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(StringLiteral node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(SuperConstructorInvocation node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(SuperFieldAccess node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(SuperMethodInvocation node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(SwitchCase node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(SwitchStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(SynchronizedStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(TagElement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(TextElement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ThisExpression node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(ThrowStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(TryStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(TypeDeclaration node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(TypeDeclarationStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(TypeLiteral node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(TypeParameter node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(VariableDeclarationExpression node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(VariableDeclarationFragment node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(VariableDeclarationStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(WhileStatement node) {
+ return visitNode(node);
+ }
+
+ @Override
+ public boolean visit(WildcardType node) {
+ return visitNode(node);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/TypeSignatureResolveVisitor.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/TypeSignatureResolveVisitor.java
index 1b6b004f7..86042e6e3 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/TypeSignatureResolveVisitor.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/TypeSignatureResolveVisitor.java
@@ -1,243 +1,243 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.ast.visitor;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
-
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ClassInstanceCreation;
-import org.eclipse.jdt.core.dom.MethodInvocation;
-import org.eclipse.jdt.core.dom.SimpleName;
-import org.eclipse.jdt.core.dom.SimpleType;
-import org.eclipse.scout.sdk.util.ast.AstUtility;
-import org.eclipse.scout.sdk.util.ast.VariableType;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.jdt.JdtUtility;
-import org.eclipse.scout.sdk.util.signature.SignatureUtility;
-
-/**
- * <h3>{@link TypeSignatureResolveVisitor}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 27.02.2011
- */
-public class TypeSignatureResolveVisitor extends DefaultAstVisitor {
-
- private boolean m_debug = false;
- private boolean m_canceled;
- public String m_indent = "";
-
- private final IJavaElement m_containerElement;
- private final ASTNode m_rootNode;
- private int m_mode;
- private HashSet<String> m_assignedSignatures;
- private String m_typeSignature;
- private P_MethodInvocation m_methodInvocation;
-
- public TypeSignatureResolveVisitor(ASTNode rootNode, IJavaElement containerElement) {
- m_rootNode = rootNode;
- m_containerElement = containerElement;
- m_assignedSignatures = new HashSet<String>();
- }
-
- @Override
- public void preVisit(ASTNode node) {
- if (m_debug && !m_canceled) {
- SdkUtilActivator.logInfo(m_indent + "typeSigResolve " + node.getNodeType() + " " + node + " ");
- m_indent += " ";
- }
- }
-
- @Override
- public void postVisit(ASTNode node) {
- if (m_debug && !m_canceled) {
- m_indent = m_indent.replaceFirst("\\s\\s$", "");
- SdkUtilActivator.logInfo(m_indent + "end " + node.getNodeType());
- }
- }
-
- @Override
- public boolean visitNode(ASTNode node) {
- return !m_canceled;
- }
-
- @Override
- public boolean visit(ClassInstanceCreation node) {
- if (m_canceled) {
- return false;
- }
- m_mode = node.getNodeType();
- return super.visit(node);
- }
-
- @Override
- public void endVisit(ClassInstanceCreation node) {
- if (m_mode == node.getNodeType()) {
- m_mode = -1;
- m_canceled = true;
- }
- }
-
- @Override
- public boolean visit(MethodInvocation node) {
- if (m_canceled) {
- return false;
- }
- m_methodInvocation = new P_MethodInvocation();
- m_mode = node.getNodeType();
- return super.visit(node);
- }
-
- @Override
- public void endVisit(MethodInvocation node) {
- if (m_mode == node.getNodeType()) {
- if (m_methodInvocation != null) {
- List<SimpleName> segments = m_methodInvocation.m_segments;
- ArrayList<String> fqSignatures = new ArrayList<String>();
- if (segments.size() > 1) {
- VariableType var = AstUtility.getTypeSignature(segments.get(0), m_rootNode, m_containerElement);
- if (var.getAssignedTypeSignatures().length > 0) {
- fqSignatures.addAll(Arrays.asList(var.getAssignedTypeSignatures()));
- }
- else if (var.getTypeSignature() != null) {
- fqSignatures.add(var.getTypeSignature());
- }
- for (int i = 1; i < segments.size(); i++) {
- ArrayList<String> newList = new ArrayList<String>();
- for (String sig : fqSignatures) {
- String newSig = AstUtility.resolveReturnValueSignature(sig, segments.get(i).getFullyQualifiedName());
- newList.add(newSig);
- }
- fqSignatures = newList;
- }
- }
- else if (segments.size() == 1) {
- IType declaringType = JdtUtility.findDeclaringType(m_containerElement);
- String resolveReturnValueSignature = AstUtility.resolveReturnValueSignature(Signature.createTypeSignature(declaringType.getFullyQualifiedName(), true), node.getName().getFullyQualifiedName());
- m_typeSignature = resolveReturnValueSignature;
- }
- m_assignedSignatures.addAll(fqSignatures);
- m_canceled = true;
- m_methodInvocation = null;
- }
- m_mode = -1;
- m_canceled = true;
- }
- }
-
- @Override
- public boolean visit(SimpleType node) {
- if (m_canceled) {
- return false;
- }
- switch (m_mode) {
- case ASTNode.CLASS_INSTANCE_CREATION:
-
- String signature = Signature.createTypeSignature(node.getName().getFullyQualifiedName(), false);
- IType declaringType = JdtUtility.findDeclaringType(m_containerElement);
- try {
- String resolvedSignature = SignatureUtility.getResolvedSignature(signature, declaringType);
- if (resolvedSignature != null) {
- m_typeSignature = resolvedSignature;
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("could not resolve class instance creation of '" + signature + "' in '" + declaringType.getFullyQualifiedName() + "'.");
- }
- m_canceled = true;
- return false;
- case ASTNode.METHOD_INVOCATION:
-
- return false;
- default:
- break;
- }
- return super.visit(node);
- }
-
- @Override
- public boolean visit(SimpleName node) {
- if (m_canceled) {
- return false;
- }
- switch (m_mode) {
- case ASTNode.METHOD_INVOCATION:
- if (m_methodInvocation != null) {
- m_methodInvocation.m_segments.add(node);
- }
-// if (m_typeSignature == null) {
-// IType declaringType = JdtUtility.findDeclaringType(m_containerElement);
-// String resolveReturnValueSignature = AstUtility.resolveReturnValueSignature(Signature.createTypeSignature(declaringType.getFullyQualifiedName(), true), node.getFullyQualifiedName());
-// m_typeSignature = resolveReturnValueSignature;
-// }
-// else {
-// String resolveReturnValueSignature = AstUtility.resolveReturnValueSignature(m_typeSignature, node.getFullyQualifiedName());
-// m_typeSignature = resolveReturnValueSignature;
-// }
- return false;
-
- default:
- if (!m_assignedSignatures.isEmpty() || m_typeSignature != null) {
- HashSet<String> newSet = new HashSet<String>();
- if (!m_assignedSignatures.isEmpty()) {
- for (String s : m_assignedSignatures) {
- newSet.add(AstUtility.resolveReturnValueSignature(s, node.getFullyQualifiedName()));
- }
- }
- else if (m_typeSignature != null) {
- newSet.add(AstUtility.resolveReturnValueSignature(m_typeSignature, node.getFullyQualifiedName()));
- }
- m_typeSignature = null;
- m_assignedSignatures.clear();
- m_assignedSignatures.addAll(newSet);
- }
- else {
- VariableResolveVisitor visitor = new VariableResolveVisitor(node.getFullyQualifiedName(), m_containerElement, m_rootNode, node);
- m_rootNode.accept(visitor);
- String[] assignedTypesSignatures = visitor.getAssignedTypesSignatures();
- if (assignedTypesSignatures.length > 0) {
- m_assignedSignatures.addAll(Arrays.asList(assignedTypesSignatures));
- }
- else if (visitor.getVariableTypeSignature() != null) {
- m_typeSignature = visitor.getVariableTypeSignature();
- }
- }
- break;
- }
-
- return super.visit(node);
- }
-
- /**
- * @return the assignedSignatures
- */
- public String[] getAssignedSignatures() {
- return m_assignedSignatures.toArray(new String[m_assignedSignatures.size()]);
- }
-
- /**
- * @return the typeSignature
- */
- public String getTypeSignature() {
- return m_typeSignature;
- }
-
- private class P_MethodInvocation {
- private List<SimpleName> m_segments = new ArrayList<SimpleName>();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.ast.visitor;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ClassInstanceCreation;
+import org.eclipse.jdt.core.dom.MethodInvocation;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.dom.SimpleType;
+import org.eclipse.scout.sdk.util.ast.AstUtility;
+import org.eclipse.scout.sdk.util.ast.VariableType;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.jdt.JdtUtility;
+import org.eclipse.scout.sdk.util.signature.SignatureUtility;
+
+/**
+ * <h3>{@link TypeSignatureResolveVisitor}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 27.02.2011
+ */
+public class TypeSignatureResolveVisitor extends DefaultAstVisitor {
+
+ private boolean m_debug = false;
+ private boolean m_canceled;
+ public String m_indent = "";
+
+ private final IJavaElement m_containerElement;
+ private final ASTNode m_rootNode;
+ private int m_mode;
+ private HashSet<String> m_assignedSignatures;
+ private String m_typeSignature;
+ private P_MethodInvocation m_methodInvocation;
+
+ public TypeSignatureResolveVisitor(ASTNode rootNode, IJavaElement containerElement) {
+ m_rootNode = rootNode;
+ m_containerElement = containerElement;
+ m_assignedSignatures = new HashSet<String>();
+ }
+
+ @Override
+ public void preVisit(ASTNode node) {
+ if (m_debug && !m_canceled) {
+ SdkUtilActivator.logInfo(m_indent + "typeSigResolve " + node.getNodeType() + " " + node + " ");
+ m_indent += " ";
+ }
+ }
+
+ @Override
+ public void postVisit(ASTNode node) {
+ if (m_debug && !m_canceled) {
+ m_indent = m_indent.replaceFirst("\\s\\s$", "");
+ SdkUtilActivator.logInfo(m_indent + "end " + node.getNodeType());
+ }
+ }
+
+ @Override
+ public boolean visitNode(ASTNode node) {
+ return !m_canceled;
+ }
+
+ @Override
+ public boolean visit(ClassInstanceCreation node) {
+ if (m_canceled) {
+ return false;
+ }
+ m_mode = node.getNodeType();
+ return super.visit(node);
+ }
+
+ @Override
+ public void endVisit(ClassInstanceCreation node) {
+ if (m_mode == node.getNodeType()) {
+ m_mode = -1;
+ m_canceled = true;
+ }
+ }
+
+ @Override
+ public boolean visit(MethodInvocation node) {
+ if (m_canceled) {
+ return false;
+ }
+ m_methodInvocation = new P_MethodInvocation();
+ m_mode = node.getNodeType();
+ return super.visit(node);
+ }
+
+ @Override
+ public void endVisit(MethodInvocation node) {
+ if (m_mode == node.getNodeType()) {
+ if (m_methodInvocation != null) {
+ List<SimpleName> segments = m_methodInvocation.m_segments;
+ ArrayList<String> fqSignatures = new ArrayList<String>();
+ if (segments.size() > 1) {
+ VariableType var = AstUtility.getTypeSignature(segments.get(0), m_rootNode, m_containerElement);
+ if (var.getAssignedTypeSignatures().length > 0) {
+ fqSignatures.addAll(Arrays.asList(var.getAssignedTypeSignatures()));
+ }
+ else if (var.getTypeSignature() != null) {
+ fqSignatures.add(var.getTypeSignature());
+ }
+ for (int i = 1; i < segments.size(); i++) {
+ ArrayList<String> newList = new ArrayList<String>();
+ for (String sig : fqSignatures) {
+ String newSig = AstUtility.resolveReturnValueSignature(sig, segments.get(i).getFullyQualifiedName());
+ newList.add(newSig);
+ }
+ fqSignatures = newList;
+ }
+ }
+ else if (segments.size() == 1) {
+ IType declaringType = JdtUtility.findDeclaringType(m_containerElement);
+ String resolveReturnValueSignature = AstUtility.resolveReturnValueSignature(Signature.createTypeSignature(declaringType.getFullyQualifiedName(), true), node.getName().getFullyQualifiedName());
+ m_typeSignature = resolveReturnValueSignature;
+ }
+ m_assignedSignatures.addAll(fqSignatures);
+ m_canceled = true;
+ m_methodInvocation = null;
+ }
+ m_mode = -1;
+ m_canceled = true;
+ }
+ }
+
+ @Override
+ public boolean visit(SimpleType node) {
+ if (m_canceled) {
+ return false;
+ }
+ switch (m_mode) {
+ case ASTNode.CLASS_INSTANCE_CREATION:
+
+ String signature = Signature.createTypeSignature(node.getName().getFullyQualifiedName(), false);
+ IType declaringType = JdtUtility.findDeclaringType(m_containerElement);
+ try {
+ String resolvedSignature = SignatureUtility.getResolvedSignature(signature, declaringType);
+ if (resolvedSignature != null) {
+ m_typeSignature = resolvedSignature;
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("could not resolve class instance creation of '" + signature + "' in '" + declaringType.getFullyQualifiedName() + "'.");
+ }
+ m_canceled = true;
+ return false;
+ case ASTNode.METHOD_INVOCATION:
+
+ return false;
+ default:
+ break;
+ }
+ return super.visit(node);
+ }
+
+ @Override
+ public boolean visit(SimpleName node) {
+ if (m_canceled) {
+ return false;
+ }
+ switch (m_mode) {
+ case ASTNode.METHOD_INVOCATION:
+ if (m_methodInvocation != null) {
+ m_methodInvocation.m_segments.add(node);
+ }
+// if (m_typeSignature == null) {
+// IType declaringType = JdtUtility.findDeclaringType(m_containerElement);
+// String resolveReturnValueSignature = AstUtility.resolveReturnValueSignature(Signature.createTypeSignature(declaringType.getFullyQualifiedName(), true), node.getFullyQualifiedName());
+// m_typeSignature = resolveReturnValueSignature;
+// }
+// else {
+// String resolveReturnValueSignature = AstUtility.resolveReturnValueSignature(m_typeSignature, node.getFullyQualifiedName());
+// m_typeSignature = resolveReturnValueSignature;
+// }
+ return false;
+
+ default:
+ if (!m_assignedSignatures.isEmpty() || m_typeSignature != null) {
+ HashSet<String> newSet = new HashSet<String>();
+ if (!m_assignedSignatures.isEmpty()) {
+ for (String s : m_assignedSignatures) {
+ newSet.add(AstUtility.resolveReturnValueSignature(s, node.getFullyQualifiedName()));
+ }
+ }
+ else if (m_typeSignature != null) {
+ newSet.add(AstUtility.resolveReturnValueSignature(m_typeSignature, node.getFullyQualifiedName()));
+ }
+ m_typeSignature = null;
+ m_assignedSignatures.clear();
+ m_assignedSignatures.addAll(newSet);
+ }
+ else {
+ VariableResolveVisitor visitor = new VariableResolveVisitor(node.getFullyQualifiedName(), m_containerElement, m_rootNode, node);
+ m_rootNode.accept(visitor);
+ String[] assignedTypesSignatures = visitor.getAssignedTypesSignatures();
+ if (assignedTypesSignatures.length > 0) {
+ m_assignedSignatures.addAll(Arrays.asList(assignedTypesSignatures));
+ }
+ else if (visitor.getVariableTypeSignature() != null) {
+ m_typeSignature = visitor.getVariableTypeSignature();
+ }
+ }
+ break;
+ }
+
+ return super.visit(node);
+ }
+
+ /**
+ * @return the assignedSignatures
+ */
+ public String[] getAssignedSignatures() {
+ return m_assignedSignatures.toArray(new String[m_assignedSignatures.size()]);
+ }
+
+ /**
+ * @return the typeSignature
+ */
+ public String getTypeSignature() {
+ return m_typeSignature;
+ }
+
+ private class P_MethodInvocation {
+ private List<SimpleName> m_segments = new ArrayList<SimpleName>();
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/VariableResolveVisitor.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/VariableResolveVisitor.java
index 53185f909..09b838074 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/VariableResolveVisitor.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/ast/visitor/VariableResolveVisitor.java
@@ -1,302 +1,302 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.ast.visitor;
-
-import java.util.HashSet;
-
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.Assignment;
-import org.eclipse.jdt.core.dom.MethodInvocation;
-import org.eclipse.jdt.core.dom.SimpleName;
-import org.eclipse.jdt.core.dom.SimpleType;
-import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.jdt.JdtUtility;
-import org.eclipse.scout.sdk.util.signature.SignatureUtility;
-
-/**
- * <h3>{@link VariableResolveVisitor}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 27.02.2011
- */
-public class VariableResolveVisitor extends DefaultAstVisitor {
-
- private boolean m_debug = false;
- private boolean m_canceled;
- public String m_indent = "";
-
- public String m_variableTypeSignature;
- private HashSet<String /*signatures*/> m_assignedTypes;
-
- private P_Variable m_currentVariable;
- private final String m_variableName;
- private final ASTNode m_rootNode;
- private final ASTNode m_stopNode;
- private final IJavaElement m_containerElement;
- private int m_mode = -1;
-
- public VariableResolveVisitor(String variableName, IJavaElement containerElement, ASTNode rootNode, ASTNode stopNode) {
- m_variableName = variableName;
- m_containerElement = containerElement;
- m_rootNode = rootNode;
- m_stopNode = stopNode;
- m_assignedTypes = new HashSet<String>();
-
- }
-
- @Override
- public void preVisit(ASTNode node) {
- if (node.equals(m_stopNode)) {
- m_canceled = true;
- }
- if (m_debug && !m_canceled) {
- SdkUtilActivator.logInfo(m_indent + "varResolve " + node.getNodeType() + " " + node + " ");
- m_indent += " ";
- }
- }
-
- @Override
- public void postVisit(ASTNode node) {
- if (m_debug && !m_canceled) {
- m_indent = m_indent.replaceFirst("\\s\\s$", "");
- SdkUtilActivator.logInfo(m_indent + "end " + node.getNodeType());
- }
- }
-
- @Override
- public boolean visitNode(ASTNode node) {
- if (m_canceled) {
- return false;
- }
- return true;
- }
-
- @Override
- public boolean visit(SingleVariableDeclaration node) {
- if (m_canceled) {
- return false;
- }
- m_mode = node.getNodeType();
- m_currentVariable = new P_Variable();
- return true;
- }
-
- @Override
- public void endVisit(SingleVariableDeclaration node) {
- if (m_canceled) {
- return;
- }
- if (m_mode == node.getNodeType()) {
- if (m_currentVariable != null) {
- store(m_currentVariable);
- m_currentVariable = null;
- }
- m_mode = -1;
- }
- }
-
- @Override
- public boolean visit(SimpleType node) {
- if (m_canceled) {
- return false;
- }
- if (m_currentVariable != null) {
- switch (m_mode) {
- case ASTNode.VARIABLE_DECLARATION_STATEMENT:
- case ASTNode.SINGLE_VARIABLE_DECLARATION:
- case ASTNode.ASSIGNMENT:
- if (m_currentVariable.variableTypeName == null) {
- try {
- String resolvedSignature = SignatureUtility.getResolvedSignature(Signature.createTypeSignature(node.getName().getFullyQualifiedName(), false), JdtUtility.findDeclaringType(m_containerElement));
- m_currentVariable.variableTypeName = resolvedSignature;
- }
- catch (JavaModelException e) {
- e.printStackTrace();
- }
- return false;
- }
-
- break;
- default:
- break;
- }
- }
- return super.visit(node);
- }
-
- @Override
- public boolean visit(SimpleName node) {
- if (m_canceled) {
- return false;
- }
- if (m_currentVariable != null) {
- switch (m_mode) {
- case ASTNode.VARIABLE_DECLARATION_FRAGMENT:
- case ASTNode.SINGLE_VARIABLE_DECLARATION:
- case ASTNode.ASSIGNMENT:
- if (m_currentVariable.variableName == null) {
- if (m_variableName.equals(node.getFullyQualifiedName())) {
- m_currentVariable.variableName = m_variableName;
- }
- else {
- m_currentVariable = null;
- }
- return false;
- }
- break;
-
- default:
- break;
- }
- }
-
- return super.visit(node);
- }
-
- @Override
- public boolean visit(VariableDeclarationStatement node) {
- if (m_canceled) {
- return false;
- }
- m_mode = node.getNodeType();
- m_currentVariable = new P_Variable();
- return true;
- }
-
- @Override
- public void endVisit(VariableDeclarationStatement node) {
- if (m_canceled) {
- return;
- }
- if (m_mode == node.getNodeType()) {
- if (m_currentVariable != null) {
- store(m_currentVariable);
- m_currentVariable = null;
- }
- m_mode = -1;
- }
- }
-
- @Override
- public boolean visit(VariableDeclarationFragment node) {
- if (m_canceled) {
- return false;
- }
- m_mode = node.getNodeType();
- if (m_currentVariable == null) {
- m_currentVariable = new P_Variable();
- }
- return true;
- }
-
- @Override
- public void endVisit(VariableDeclarationFragment node) {
- if (m_canceled) {
- return;
- }
- if (m_mode == node.getNodeType()) {
- if (m_currentVariable != null) {
- store(m_currentVariable);
- m_currentVariable = null;
- }
- m_mode = -1;
- }
- }
-
- @Override
- public boolean visit(Assignment node) {
- if (m_canceled) {
- return false;
- }
- m_mode = node.getNodeType();
- if (m_currentVariable == null) {
- m_currentVariable = new P_Variable();
- }
- return true;
- }
-
- @Override
- public void endVisit(Assignment node) {
- if (m_canceled) {
- return;
- }
- if (m_mode == node.getNodeType()) {
- if (m_currentVariable != null) {
- store(m_currentVariable);
- m_currentVariable = null;
- }
- m_mode = -1;
- }
- }
-
- @Override
- public boolean visit(MethodInvocation node) {
- if (m_canceled) {
- return false;
- }
- if (m_currentVariable != null) {
- TypeSignatureResolveVisitor innerVisitor = new TypeSignatureResolveVisitor(m_rootNode, m_containerElement);
- node.accept(innerVisitor);
- String[] assignedSignatures = innerVisitor.getAssignedSignatures();
- if (assignedSignatures.length > 0) {
- for (String as : assignedSignatures) {
- m_assignedTypes.add(as);
- }
- }
- if (m_variableTypeSignature == null && innerVisitor.getTypeSignature() != null) {
- m_variableTypeSignature = innerVisitor.getTypeSignature();
- }
- return false;
- }
- return super.visit(node);
- }
-
- private void store(P_Variable var) {
- if (var != null && var.isAssigned()) {
- if (m_variableTypeSignature == null) {
- m_variableTypeSignature = var.variableTypeName;
- }
- for (String s : var.assignedTypeName) {
- m_assignedTypes.add(s);
- }
- }
- }
-
- /**
- * @return the assignedTypes
- */
- public String[] getAssignedTypesSignatures() {
- return m_assignedTypes.toArray(new String[m_assignedTypes.size()]);
- }
-
- /**
- * @return the variableTypeSignature
- */
- public String getVariableTypeSignature() {
- return m_variableTypeSignature;
- }
-
- private class P_Variable {
- public String variableTypeName;
- public String variableName;
- public HashSet<String> assignedTypeName = new HashSet<String>();
-
- public boolean isAssigned() {
- return variableName != null && (assignedTypeName != null || !variableTypeName.isEmpty());
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.ast.visitor;
+
+import java.util.HashSet;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.Assignment;
+import org.eclipse.jdt.core.dom.MethodInvocation;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.dom.SimpleType;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.jdt.JdtUtility;
+import org.eclipse.scout.sdk.util.signature.SignatureUtility;
+
+/**
+ * <h3>{@link VariableResolveVisitor}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 27.02.2011
+ */
+public class VariableResolveVisitor extends DefaultAstVisitor {
+
+ private boolean m_debug = false;
+ private boolean m_canceled;
+ public String m_indent = "";
+
+ public String m_variableTypeSignature;
+ private HashSet<String /*signatures*/> m_assignedTypes;
+
+ private P_Variable m_currentVariable;
+ private final String m_variableName;
+ private final ASTNode m_rootNode;
+ private final ASTNode m_stopNode;
+ private final IJavaElement m_containerElement;
+ private int m_mode = -1;
+
+ public VariableResolveVisitor(String variableName, IJavaElement containerElement, ASTNode rootNode, ASTNode stopNode) {
+ m_variableName = variableName;
+ m_containerElement = containerElement;
+ m_rootNode = rootNode;
+ m_stopNode = stopNode;
+ m_assignedTypes = new HashSet<String>();
+
+ }
+
+ @Override
+ public void preVisit(ASTNode node) {
+ if (node.equals(m_stopNode)) {
+ m_canceled = true;
+ }
+ if (m_debug && !m_canceled) {
+ SdkUtilActivator.logInfo(m_indent + "varResolve " + node.getNodeType() + " " + node + " ");
+ m_indent += " ";
+ }
+ }
+
+ @Override
+ public void postVisit(ASTNode node) {
+ if (m_debug && !m_canceled) {
+ m_indent = m_indent.replaceFirst("\\s\\s$", "");
+ SdkUtilActivator.logInfo(m_indent + "end " + node.getNodeType());
+ }
+ }
+
+ @Override
+ public boolean visitNode(ASTNode node) {
+ if (m_canceled) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public boolean visit(SingleVariableDeclaration node) {
+ if (m_canceled) {
+ return false;
+ }
+ m_mode = node.getNodeType();
+ m_currentVariable = new P_Variable();
+ return true;
+ }
+
+ @Override
+ public void endVisit(SingleVariableDeclaration node) {
+ if (m_canceled) {
+ return;
+ }
+ if (m_mode == node.getNodeType()) {
+ if (m_currentVariable != null) {
+ store(m_currentVariable);
+ m_currentVariable = null;
+ }
+ m_mode = -1;
+ }
+ }
+
+ @Override
+ public boolean visit(SimpleType node) {
+ if (m_canceled) {
+ return false;
+ }
+ if (m_currentVariable != null) {
+ switch (m_mode) {
+ case ASTNode.VARIABLE_DECLARATION_STATEMENT:
+ case ASTNode.SINGLE_VARIABLE_DECLARATION:
+ case ASTNode.ASSIGNMENT:
+ if (m_currentVariable.variableTypeName == null) {
+ try {
+ String resolvedSignature = SignatureUtility.getResolvedSignature(Signature.createTypeSignature(node.getName().getFullyQualifiedName(), false), JdtUtility.findDeclaringType(m_containerElement));
+ m_currentVariable.variableTypeName = resolvedSignature;
+ }
+ catch (JavaModelException e) {
+ e.printStackTrace();
+ }
+ return false;
+ }
+
+ break;
+ default:
+ break;
+ }
+ }
+ return super.visit(node);
+ }
+
+ @Override
+ public boolean visit(SimpleName node) {
+ if (m_canceled) {
+ return false;
+ }
+ if (m_currentVariable != null) {
+ switch (m_mode) {
+ case ASTNode.VARIABLE_DECLARATION_FRAGMENT:
+ case ASTNode.SINGLE_VARIABLE_DECLARATION:
+ case ASTNode.ASSIGNMENT:
+ if (m_currentVariable.variableName == null) {
+ if (m_variableName.equals(node.getFullyQualifiedName())) {
+ m_currentVariable.variableName = m_variableName;
+ }
+ else {
+ m_currentVariable = null;
+ }
+ return false;
+ }
+ break;
+
+ default:
+ break;
+ }
+ }
+
+ return super.visit(node);
+ }
+
+ @Override
+ public boolean visit(VariableDeclarationStatement node) {
+ if (m_canceled) {
+ return false;
+ }
+ m_mode = node.getNodeType();
+ m_currentVariable = new P_Variable();
+ return true;
+ }
+
+ @Override
+ public void endVisit(VariableDeclarationStatement node) {
+ if (m_canceled) {
+ return;
+ }
+ if (m_mode == node.getNodeType()) {
+ if (m_currentVariable != null) {
+ store(m_currentVariable);
+ m_currentVariable = null;
+ }
+ m_mode = -1;
+ }
+ }
+
+ @Override
+ public boolean visit(VariableDeclarationFragment node) {
+ if (m_canceled) {
+ return false;
+ }
+ m_mode = node.getNodeType();
+ if (m_currentVariable == null) {
+ m_currentVariable = new P_Variable();
+ }
+ return true;
+ }
+
+ @Override
+ public void endVisit(VariableDeclarationFragment node) {
+ if (m_canceled) {
+ return;
+ }
+ if (m_mode == node.getNodeType()) {
+ if (m_currentVariable != null) {
+ store(m_currentVariable);
+ m_currentVariable = null;
+ }
+ m_mode = -1;
+ }
+ }
+
+ @Override
+ public boolean visit(Assignment node) {
+ if (m_canceled) {
+ return false;
+ }
+ m_mode = node.getNodeType();
+ if (m_currentVariable == null) {
+ m_currentVariable = new P_Variable();
+ }
+ return true;
+ }
+
+ @Override
+ public void endVisit(Assignment node) {
+ if (m_canceled) {
+ return;
+ }
+ if (m_mode == node.getNodeType()) {
+ if (m_currentVariable != null) {
+ store(m_currentVariable);
+ m_currentVariable = null;
+ }
+ m_mode = -1;
+ }
+ }
+
+ @Override
+ public boolean visit(MethodInvocation node) {
+ if (m_canceled) {
+ return false;
+ }
+ if (m_currentVariable != null) {
+ TypeSignatureResolveVisitor innerVisitor = new TypeSignatureResolveVisitor(m_rootNode, m_containerElement);
+ node.accept(innerVisitor);
+ String[] assignedSignatures = innerVisitor.getAssignedSignatures();
+ if (assignedSignatures.length > 0) {
+ for (String as : assignedSignatures) {
+ m_assignedTypes.add(as);
+ }
+ }
+ if (m_variableTypeSignature == null && innerVisitor.getTypeSignature() != null) {
+ m_variableTypeSignature = innerVisitor.getTypeSignature();
+ }
+ return false;
+ }
+ return super.visit(node);
+ }
+
+ private void store(P_Variable var) {
+ if (var != null && var.isAssigned()) {
+ if (m_variableTypeSignature == null) {
+ m_variableTypeSignature = var.variableTypeName;
+ }
+ for (String s : var.assignedTypeName) {
+ m_assignedTypes.add(s);
+ }
+ }
+ }
+
+ /**
+ * @return the assignedTypes
+ */
+ public String[] getAssignedTypesSignatures() {
+ return m_assignedTypes.toArray(new String[m_assignedTypes.size()]);
+ }
+
+ /**
+ * @return the variableTypeSignature
+ */
+ public String getVariableTypeSignature() {
+ return m_variableTypeSignature;
+ }
+
+ private class P_Variable {
+ public String variableTypeName;
+ public String variableName;
+ public HashSet<String> assignedTypeName = new HashSet<String>();
+
+ public boolean isAssigned() {
+ return variableName != null && (assignedTypeName != null || !variableTypeName.isEmpty());
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/SdkUtilActivator.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/SdkUtilActivator.java
index 3ee0eee5e..20342063a 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/SdkUtilActivator.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/SdkUtilActivator.java
@@ -1,67 +1,67 @@
-package org.eclipse.scout.sdk.util.internal;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.scout.sdk.util.log.SdkLogManager;
-import org.osgi.framework.BundleContext;
-
-public class SdkUtilActivator extends Plugin {
-
- public final static String PLUGIN_ID = "org.eclipse.scout.sdk.util";
-
- private static SdkUtilActivator plugin;
- private static SdkLogManager logManager;
-
- public static SdkUtilActivator getDefault() {
- return plugin;
- }
-
- @Override
- public void start(BundleContext bundleContext) throws Exception {
- super.start(bundleContext);
- plugin = this;
- logManager = new SdkLogManager(this);
- }
-
- @Override
- public void stop(BundleContext bundleContext) throws Exception {
- plugin = null;
- logManager = null;
- super.stop(bundleContext);
- }
-
- public static void logInfo(Throwable t) {
- logManager.logInfo(t);
- }
-
- public static void logInfo(String message) {
- logManager.logInfo(message);
- }
-
- public static void logInfo(String message, Throwable t) {
- logManager.logInfo(message, t);
- }
-
- public static void logWarning(String message) {
- logManager.logWarning(message);
- }
-
- public static void logWarning(Throwable t) {
- logManager.logWarning(t);
- }
-
- public static void logWarning(String message, Throwable t) {
- logManager.logWarning(message, t);
- }
-
- public static void logError(Throwable t) {
- logManager.logError(t);
- }
-
- public static void logError(String message) {
- logManager.logError(message);
- }
-
- public static void logError(String message, Throwable t) {
- logManager.logError(message, t);
- }
-}
+package org.eclipse.scout.sdk.util.internal;
+
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.scout.sdk.util.log.SdkLogManager;
+import org.osgi.framework.BundleContext;
+
+public class SdkUtilActivator extends Plugin {
+
+ public final static String PLUGIN_ID = "org.eclipse.scout.sdk.util";
+
+ private static SdkUtilActivator plugin;
+ private static SdkLogManager logManager;
+
+ public static SdkUtilActivator getDefault() {
+ return plugin;
+ }
+
+ @Override
+ public void start(BundleContext bundleContext) throws Exception {
+ super.start(bundleContext);
+ plugin = this;
+ logManager = new SdkLogManager(this);
+ }
+
+ @Override
+ public void stop(BundleContext bundleContext) throws Exception {
+ plugin = null;
+ logManager = null;
+ super.stop(bundleContext);
+ }
+
+ public static void logInfo(Throwable t) {
+ logManager.logInfo(t);
+ }
+
+ public static void logInfo(String message) {
+ logManager.logInfo(message);
+ }
+
+ public static void logInfo(String message, Throwable t) {
+ logManager.logInfo(message, t);
+ }
+
+ public static void logWarning(String message) {
+ logManager.logWarning(message);
+ }
+
+ public static void logWarning(Throwable t) {
+ logManager.logWarning(t);
+ }
+
+ public static void logWarning(String message, Throwable t) {
+ logManager.logWarning(message, t);
+ }
+
+ public static void logError(Throwable t) {
+ logManager.logError(t);
+ }
+
+ public static void logError(String message) {
+ logManager.logError(message);
+ }
+
+ public static void logError(String message, Throwable t) {
+ logManager.logError(message, t);
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/CachedTypeHierarchy.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/CachedTypeHierarchy.java
index ed92d8520..82b5d612a 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/CachedTypeHierarchy.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/CachedTypeHierarchy.java
@@ -1,104 +1,104 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.internal.typecache;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.ICachedTypeHierarchy;
-import org.eclipse.scout.sdk.util.typecache.ITypeHierarchyChangedListener;
-
-/**
- *
- */
-public class CachedTypeHierarchy extends TypeHierarchy implements ICachedTypeHierarchy {
-
- private boolean m_created = false;
- private EventListenerList m_hierarchyListeners = new EventListenerList();
-
- CachedTypeHierarchy(IType type) {
- super(type);
- }
-
- @Override
- public void invalidate() {
- m_created = false;
- }
-
- void handleTypeAdding(IType type) {
- fireHierarchyChanged(ITypeHierarchyChangedListener.PRE_TYPE_ADDING, type);
- invalidate();
- fireHierarchyChanged(ITypeHierarchyChangedListener.POST_TYPE_ADDING, type);
- }
-
- void handleTypeChanged(IType type) {
- fireHierarchyChanged(ITypeHierarchyChangedListener.PRE_TYPE_CHANGED, type);
- invalidate();
- fireHierarchyChanged(ITypeHierarchyChangedListener.POST_TYPE_CHANGED, type);
- }
-
- void handleTypeRemoving(IType type) {
- fireHierarchyChanged(ITypeHierarchyChangedListener.PRE_TYPE_REMOVING, type);
- invalidate();
- fireHierarchyChanged(ITypeHierarchyChangedListener.POST_TYPE_REMOVING, type);
- }
-
- private void fireHierarchyChanged(int type, IType affectedType) {
- for (ITypeHierarchyChangedListener l : m_hierarchyListeners.getListeners(ITypeHierarchyChangedListener.class)) {
- l.handleEvent(type, affectedType);
- }
- }
-
- @Override
- public boolean isCreated() {
- return m_created;
- }
-
- @Override
- public void addHierarchyListener(ITypeHierarchyChangedListener listener) {
- m_hierarchyListeners.add(ITypeHierarchyChangedListener.class, listener);
- }
-
- @Override
- public void removeHierarchyListener(ITypeHierarchyChangedListener listener) {
- m_hierarchyListeners.remove(ITypeHierarchyChangedListener.class, listener);
- }
-
- @Override
- void revalidate(IProgressMonitor monitor) {
- if (!m_created) {
- // TODO aho verify type and project exitstance
- if (!TypeUtility.exists(getType()) || !getType().getJavaProject().exists()) {
- throw new IllegalArgumentException("type or project does not exist");
- }
- try {
- if (getJdtHierarchy() == null) {
- setJdtHierarchy(getType().newTypeHierarchy(monitor));
- }
- else {
- if (TypeUtility.exists(getType()) && getType().getJavaProject().exists()) {
- getJdtHierarchy().refresh(monitor);
- }
- else {
- return;
- }
- }
- m_created = true;
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("Unable to refresh cached type hierarchy for type " + getType().getFullyQualifiedName(), e);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.internal.typecache;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.ICachedTypeHierarchy;
+import org.eclipse.scout.sdk.util.typecache.ITypeHierarchyChangedListener;
+
+/**
+ *
+ */
+public class CachedTypeHierarchy extends TypeHierarchy implements ICachedTypeHierarchy {
+
+ private boolean m_created = false;
+ private EventListenerList m_hierarchyListeners = new EventListenerList();
+
+ CachedTypeHierarchy(IType type) {
+ super(type);
+ }
+
+ @Override
+ public void invalidate() {
+ m_created = false;
+ }
+
+ void handleTypeAdding(IType type) {
+ fireHierarchyChanged(ITypeHierarchyChangedListener.PRE_TYPE_ADDING, type);
+ invalidate();
+ fireHierarchyChanged(ITypeHierarchyChangedListener.POST_TYPE_ADDING, type);
+ }
+
+ void handleTypeChanged(IType type) {
+ fireHierarchyChanged(ITypeHierarchyChangedListener.PRE_TYPE_CHANGED, type);
+ invalidate();
+ fireHierarchyChanged(ITypeHierarchyChangedListener.POST_TYPE_CHANGED, type);
+ }
+
+ void handleTypeRemoving(IType type) {
+ fireHierarchyChanged(ITypeHierarchyChangedListener.PRE_TYPE_REMOVING, type);
+ invalidate();
+ fireHierarchyChanged(ITypeHierarchyChangedListener.POST_TYPE_REMOVING, type);
+ }
+
+ private void fireHierarchyChanged(int type, IType affectedType) {
+ for (ITypeHierarchyChangedListener l : m_hierarchyListeners.getListeners(ITypeHierarchyChangedListener.class)) {
+ l.handleEvent(type, affectedType);
+ }
+ }
+
+ @Override
+ public boolean isCreated() {
+ return m_created;
+ }
+
+ @Override
+ public void addHierarchyListener(ITypeHierarchyChangedListener listener) {
+ m_hierarchyListeners.add(ITypeHierarchyChangedListener.class, listener);
+ }
+
+ @Override
+ public void removeHierarchyListener(ITypeHierarchyChangedListener listener) {
+ m_hierarchyListeners.remove(ITypeHierarchyChangedListener.class, listener);
+ }
+
+ @Override
+ void revalidate(IProgressMonitor monitor) {
+ if (!m_created) {
+ // TODO aho verify type and project exitstance
+ if (!TypeUtility.exists(getType()) || !getType().getJavaProject().exists()) {
+ throw new IllegalArgumentException("type or project does not exist");
+ }
+ try {
+ if (getJdtHierarchy() == null) {
+ setJdtHierarchy(getType().newTypeHierarchy(monitor));
+ }
+ else {
+ if (TypeUtility.exists(getType()) && getType().getJavaProject().exists()) {
+ getJdtHierarchy().refresh(monitor);
+ }
+ else {
+ return;
+ }
+ }
+ m_created = true;
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("Unable to refresh cached type hierarchy for type " + getType().getFullyQualifiedName(), e);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/CombinedHierarchy.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/CombinedHierarchy.java
index 0d6d841db..3928823d4 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/CombinedHierarchy.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/CombinedHierarchy.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.internal.typecache;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-
-/**
- *
- */
-public class CombinedHierarchy extends TypeHierarchy {
-
- /**
- * @param type
- * @param jdtHierarchy
- */
- public CombinedHierarchy(IType type, ITypeHierarchy jdtHierarchy) {
- super(type, jdtHierarchy);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.internal.typecache;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+
+/**
+ *
+ */
+public class CombinedHierarchy extends TypeHierarchy {
+
+ /**
+ * @param type
+ * @param jdtHierarchy
+ */
+ public CombinedHierarchy(IType type, ITypeHierarchy jdtHierarchy) {
+ super(type, jdtHierarchy);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/HierarchyCache.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/HierarchyCache.java
index 810b746b9..6e2cb134c 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/HierarchyCache.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/HierarchyCache.java
@@ -1,286 +1,286 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.internal.typecache;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaElementDelta;
-import org.eclipse.jdt.core.IRegion;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.jdt.JdtEvent;
-import org.eclipse.scout.sdk.util.type.ITypeFilter;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IHierarchyCache;
-import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
-
-/**
- *
- */
-public final class HierarchyCache implements IHierarchyCache {
-
- private static final HierarchyCache INSTANCE = new HierarchyCache();
-
- private final Object m_cacheLock;
- private final HashMap<IType, PrimaryTypeTypeHierarchy> m_cachedPrimaryTypeHierarchies;
-
- public static HierarchyCache getInstance() {
- return INSTANCE;
- }
-
- private HierarchyCache() {
- m_cachedPrimaryTypeHierarchies = new HashMap<IType, PrimaryTypeTypeHierarchy>();
- m_cacheLock = new Object();
- }
-
- @Override
- public void dispose() {
- synchronized (m_cacheLock) {
- m_cachedPrimaryTypeHierarchies.clear();
- }
- }
-
- @Override
- public IPrimaryTypeTypeHierarchy[] getAllCachedHierarchies() {
- synchronized (m_cacheLock) {
- return m_cachedPrimaryTypeHierarchies.values().toArray(new IPrimaryTypeTypeHierarchy[m_cachedPrimaryTypeHierarchies.size()]);
- }
- }
-
- @Override
- public IPrimaryTypeTypeHierarchy getPrimaryTypeHierarchy(IType type) throws IllegalArgumentException {
- if (!TypeUtility.exists(type) || !type.getJavaProject().exists()) {
- throw new IllegalArgumentException("type does not exist!");
- }
- else if (TypeUtility.exists(type.getDeclaringType())) {
- throw new IllegalArgumentException("type '" + type.getElementName() + "' must be a primary type.");
- }
- PrimaryTypeTypeHierarchy hierarchy = null;
- synchronized (m_cacheLock) {
- hierarchy = m_cachedPrimaryTypeHierarchies.get(type);
- if (hierarchy != null && (!TypeUtility.exists(hierarchy.getType()) || !TypeUtility.exists(hierarchy.getType().getJavaProject()))) {
- // discard old create new
- m_cachedPrimaryTypeHierarchies.remove(type);
- hierarchy = null;
- }
- if (hierarchy == null) {
- hierarchy = new PrimaryTypeTypeHierarchy(type);
- m_cachedPrimaryTypeHierarchies.put(type, hierarchy);
- }
- }
- return hierarchy;
- }
-
- /**
- * @param region
- * @return
- */
- @Override
- public TypeHierarchy getLocalHierarchy(IRegion region) {
- try {
- ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null);
- return new TypeHierarchy(null, hierarchy);
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not build hierarchy of region '" + region + "'.", e);
- }
- return null;
- }
-
- @Override
- public TypeHierarchy getSuperHierarchy(IType type) {
- try {
- ITypeHierarchy hierarchy = type.newSupertypeHierarchy(new NullProgressMonitor());
- return new TypeHierarchy(null, hierarchy);
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not build super hierarchy '" + type.getFullyQualifiedName() + "'.", e);
- }
- return null;
- }
-
- private void handleTypeChange(IType t, ITypeHierarchy superTypeHierarchy) {
- try {
- ArrayList<CachedTypeHierarchy> hierarchies = new ArrayList<CachedTypeHierarchy>();
- if (!TypeUtility.exists(t.getDeclaringType())) {
- synchronized (m_cacheLock) {
- hierarchies.addAll(m_cachedPrimaryTypeHierarchies.values());
- }
- }
- if (hierarchies.size() > 0) {
- for (CachedTypeHierarchy h : hierarchies) {
- if (h.isCreated()) {
- IType[] superTypes = superTypeHierarchy.getSupertypes(t);
- if (h.contains(t)) {
- if (!h.containsInSubhierarchy(h.getType(), superTypes)) {
- // remove
- h.handleTypeRemoving(t);
-
- }
- else {
- IType[] hierarchySuperTypes = h.getSubtypes(t);
- if (!TypeUtility.equalTypes(hierarchySuperTypes, superTypes)) {
- // changed
- h.handleTypeChanged(t);
- }
- }
- }
- else {
- if (h.containsInSubhierarchy(h.getType(), superTypes)) {
- // add
- h.handleTypeAdding(t);
-
- }
- }
- }
- }
- }
- }
- catch (Exception e) {
- SdkUtilActivator.logError("could not handle type('" + t.getFullyQualifiedName() + "') change in hierarchies.", e);
- }
- }
-
- /**
- * @param type
- */
- private void handleTypeRemoved(IType type) {
- try {
- ArrayList<CachedTypeHierarchy> hierarchies = new ArrayList<CachedTypeHierarchy>();
- synchronized (m_cacheLock) {
- hierarchies.addAll(m_cachedPrimaryTypeHierarchies.values());
- }
- ITypeFilter compilationUnitFilter = TypeFilters.getInnterTypeFilter(type);
- for (CachedTypeHierarchy h : hierarchies) {
- if (h.isCreated()) {
- IType[] allTypes = h.getJdtHierarchy().getAllTypes();
- for (IType candidate : allTypes) {
- if (compilationUnitFilter.accept(candidate)) {
- // remove
- h.handleTypeRemoving(candidate);
- break;
- }
- }
- }
-
- }
- }
- catch (Exception e) {
- SdkUtilActivator.logError("could not handle type removed ('" + type.getElementName() + "') change in hierarchies.");
- }
- }
-
- private void handleJavaElementRemoved(IJavaElement element) {
- if (element.getElementType() < IJavaElement.TYPE) {
- try {
- ArrayList<CachedTypeHierarchy> hierarchies = new ArrayList<CachedTypeHierarchy>();
- synchronized (m_cacheLock) {
- hierarchies.addAll(m_cachedPrimaryTypeHierarchies.values());
- }
- for (CachedTypeHierarchy h : hierarchies) {
- if (TypeUtility.isAncestor(element, h.getType())) {
- synchronized (m_cacheLock) {
- m_cachedPrimaryTypeHierarchies.remove(h.getType());
- }
- }
- else if (h.isCreated()) {
- IType[] allTypes = h.getJdtHierarchy().getAllTypes();
- for (IType candidate : allTypes) {
- if (TypeUtility.isAncestor(element, candidate)) {
- h.handleTypeRemoving(candidate);
- }
- }
- }
- }
- }
- catch (Exception e) {
- SdkUtilActivator.logError("could not handle element removed event ('" + element.getElementName() + "') in hierarchies.");
- }
- }
- else if (element.getElementType() == IJavaElement.TYPE) {
- handleTypeRemoved((IType) element);
- }
- }
-
- private void handleCompilationUnitChagnedExternal(ICompilationUnit icu) {
- IRegion region = JavaCore.newRegion();
- region.add(icu);
- try {
- ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null);
- for (IType t : icu.getTypes()) {
- reqTypeChangedFromExternal(t, hierarchy);
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not find types in compilation unti '" + icu.getElementName() + "'.", e);
- }
- }
-
- private void reqTypeChangedFromExternal(IType type, ITypeHierarchy hierarchy) {
- handleTypeChange(type, hierarchy);
- try {
- for (IType subType : type.getTypes()) {
- reqTypeChangedFromExternal(subType, hierarchy);
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not find subtypes of type '" + type.getElementName() + "'.", e);
- }
- }
-
- public void clearCache() {
- ArrayList<CachedTypeHierarchy> hierarchies = new ArrayList<CachedTypeHierarchy>();
- synchronized (m_cacheLock) {
- hierarchies.addAll(m_cachedPrimaryTypeHierarchies.values());
- m_cachedPrimaryTypeHierarchies.clear();
- }
- for (CachedTypeHierarchy hierarchy : hierarchies) {
- hierarchy.invalidate();
- }
- }
-
- /**
- * will be notified before events are passed through the event listener list from {@link JavaResourceChangedEmitter}
- *
- * @param e
- */
- public void elementChanged(JdtEvent e) {
- switch (e.getEventType()) {
- case IJavaElementDelta.ADDED:
- case IJavaElementDelta.CHANGED: {
- if (e.getElementType() == IJavaElement.TYPE && e.getDeclaringType() == null) {
- handleTypeChange((IType) e.getElement(), e.getSuperTypeHierarchy());
- }
- break;
- }
- case IJavaElementDelta.REMOVED: {
- if (TypeUtility.exists(e.getElement().getParent())) {
- handleJavaElementRemoved(e.getElement());
- }
- break;
- }
- case JavaResourceChangedEmitter.CHANGED_EXTERNAL:
- if (e.getElementType() == IJavaElement.COMPILATION_UNIT) {
- handleCompilationUnitChagnedExternal((ICompilationUnit) e.getElement());
- }
- break;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.internal.typecache;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaElementDelta;
+import org.eclipse.jdt.core.IRegion;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.jdt.JdtEvent;
+import org.eclipse.scout.sdk.util.type.ITypeFilter;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IHierarchyCache;
+import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
+
+/**
+ *
+ */
+public final class HierarchyCache implements IHierarchyCache {
+
+ private static final HierarchyCache INSTANCE = new HierarchyCache();
+
+ private final Object m_cacheLock;
+ private final HashMap<IType, PrimaryTypeTypeHierarchy> m_cachedPrimaryTypeHierarchies;
+
+ public static HierarchyCache getInstance() {
+ return INSTANCE;
+ }
+
+ private HierarchyCache() {
+ m_cachedPrimaryTypeHierarchies = new HashMap<IType, PrimaryTypeTypeHierarchy>();
+ m_cacheLock = new Object();
+ }
+
+ @Override
+ public void dispose() {
+ synchronized (m_cacheLock) {
+ m_cachedPrimaryTypeHierarchies.clear();
+ }
+ }
+
+ @Override
+ public IPrimaryTypeTypeHierarchy[] getAllCachedHierarchies() {
+ synchronized (m_cacheLock) {
+ return m_cachedPrimaryTypeHierarchies.values().toArray(new IPrimaryTypeTypeHierarchy[m_cachedPrimaryTypeHierarchies.size()]);
+ }
+ }
+
+ @Override
+ public IPrimaryTypeTypeHierarchy getPrimaryTypeHierarchy(IType type) throws IllegalArgumentException {
+ if (!TypeUtility.exists(type) || !type.getJavaProject().exists()) {
+ throw new IllegalArgumentException("type does not exist!");
+ }
+ else if (TypeUtility.exists(type.getDeclaringType())) {
+ throw new IllegalArgumentException("type '" + type.getElementName() + "' must be a primary type.");
+ }
+ PrimaryTypeTypeHierarchy hierarchy = null;
+ synchronized (m_cacheLock) {
+ hierarchy = m_cachedPrimaryTypeHierarchies.get(type);
+ if (hierarchy != null && (!TypeUtility.exists(hierarchy.getType()) || !TypeUtility.exists(hierarchy.getType().getJavaProject()))) {
+ // discard old create new
+ m_cachedPrimaryTypeHierarchies.remove(type);
+ hierarchy = null;
+ }
+ if (hierarchy == null) {
+ hierarchy = new PrimaryTypeTypeHierarchy(type);
+ m_cachedPrimaryTypeHierarchies.put(type, hierarchy);
+ }
+ }
+ return hierarchy;
+ }
+
+ /**
+ * @param region
+ * @return
+ */
+ @Override
+ public TypeHierarchy getLocalHierarchy(IRegion region) {
+ try {
+ ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null);
+ return new TypeHierarchy(null, hierarchy);
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not build hierarchy of region '" + region + "'.", e);
+ }
+ return null;
+ }
+
+ @Override
+ public TypeHierarchy getSuperHierarchy(IType type) {
+ try {
+ ITypeHierarchy hierarchy = type.newSupertypeHierarchy(new NullProgressMonitor());
+ return new TypeHierarchy(null, hierarchy);
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not build super hierarchy '" + type.getFullyQualifiedName() + "'.", e);
+ }
+ return null;
+ }
+
+ private void handleTypeChange(IType t, ITypeHierarchy superTypeHierarchy) {
+ try {
+ ArrayList<CachedTypeHierarchy> hierarchies = new ArrayList<CachedTypeHierarchy>();
+ if (!TypeUtility.exists(t.getDeclaringType())) {
+ synchronized (m_cacheLock) {
+ hierarchies.addAll(m_cachedPrimaryTypeHierarchies.values());
+ }
+ }
+ if (hierarchies.size() > 0) {
+ for (CachedTypeHierarchy h : hierarchies) {
+ if (h.isCreated()) {
+ IType[] superTypes = superTypeHierarchy.getSupertypes(t);
+ if (h.contains(t)) {
+ if (!h.containsInSubhierarchy(h.getType(), superTypes)) {
+ // remove
+ h.handleTypeRemoving(t);
+
+ }
+ else {
+ IType[] hierarchySuperTypes = h.getSubtypes(t);
+ if (!TypeUtility.equalTypes(hierarchySuperTypes, superTypes)) {
+ // changed
+ h.handleTypeChanged(t);
+ }
+ }
+ }
+ else {
+ if (h.containsInSubhierarchy(h.getType(), superTypes)) {
+ // add
+ h.handleTypeAdding(t);
+
+ }
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ SdkUtilActivator.logError("could not handle type('" + t.getFullyQualifiedName() + "') change in hierarchies.", e);
+ }
+ }
+
+ /**
+ * @param type
+ */
+ private void handleTypeRemoved(IType type) {
+ try {
+ ArrayList<CachedTypeHierarchy> hierarchies = new ArrayList<CachedTypeHierarchy>();
+ synchronized (m_cacheLock) {
+ hierarchies.addAll(m_cachedPrimaryTypeHierarchies.values());
+ }
+ ITypeFilter compilationUnitFilter = TypeFilters.getInnterTypeFilter(type);
+ for (CachedTypeHierarchy h : hierarchies) {
+ if (h.isCreated()) {
+ IType[] allTypes = h.getJdtHierarchy().getAllTypes();
+ for (IType candidate : allTypes) {
+ if (compilationUnitFilter.accept(candidate)) {
+ // remove
+ h.handleTypeRemoving(candidate);
+ break;
+ }
+ }
+ }
+
+ }
+ }
+ catch (Exception e) {
+ SdkUtilActivator.logError("could not handle type removed ('" + type.getElementName() + "') change in hierarchies.");
+ }
+ }
+
+ private void handleJavaElementRemoved(IJavaElement element) {
+ if (element.getElementType() < IJavaElement.TYPE) {
+ try {
+ ArrayList<CachedTypeHierarchy> hierarchies = new ArrayList<CachedTypeHierarchy>();
+ synchronized (m_cacheLock) {
+ hierarchies.addAll(m_cachedPrimaryTypeHierarchies.values());
+ }
+ for (CachedTypeHierarchy h : hierarchies) {
+ if (TypeUtility.isAncestor(element, h.getType())) {
+ synchronized (m_cacheLock) {
+ m_cachedPrimaryTypeHierarchies.remove(h.getType());
+ }
+ }
+ else if (h.isCreated()) {
+ IType[] allTypes = h.getJdtHierarchy().getAllTypes();
+ for (IType candidate : allTypes) {
+ if (TypeUtility.isAncestor(element, candidate)) {
+ h.handleTypeRemoving(candidate);
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ SdkUtilActivator.logError("could not handle element removed event ('" + element.getElementName() + "') in hierarchies.");
+ }
+ }
+ else if (element.getElementType() == IJavaElement.TYPE) {
+ handleTypeRemoved((IType) element);
+ }
+ }
+
+ private void handleCompilationUnitChagnedExternal(ICompilationUnit icu) {
+ IRegion region = JavaCore.newRegion();
+ region.add(icu);
+ try {
+ ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null);
+ for (IType t : icu.getTypes()) {
+ reqTypeChangedFromExternal(t, hierarchy);
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not find types in compilation unti '" + icu.getElementName() + "'.", e);
+ }
+ }
+
+ private void reqTypeChangedFromExternal(IType type, ITypeHierarchy hierarchy) {
+ handleTypeChange(type, hierarchy);
+ try {
+ for (IType subType : type.getTypes()) {
+ reqTypeChangedFromExternal(subType, hierarchy);
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not find subtypes of type '" + type.getElementName() + "'.", e);
+ }
+ }
+
+ public void clearCache() {
+ ArrayList<CachedTypeHierarchy> hierarchies = new ArrayList<CachedTypeHierarchy>();
+ synchronized (m_cacheLock) {
+ hierarchies.addAll(m_cachedPrimaryTypeHierarchies.values());
+ m_cachedPrimaryTypeHierarchies.clear();
+ }
+ for (CachedTypeHierarchy hierarchy : hierarchies) {
+ hierarchy.invalidate();
+ }
+ }
+
+ /**
+ * will be notified before events are passed through the event listener list from {@link JavaResourceChangedEmitter}
+ *
+ * @param e
+ */
+ public void elementChanged(JdtEvent e) {
+ switch (e.getEventType()) {
+ case IJavaElementDelta.ADDED:
+ case IJavaElementDelta.CHANGED: {
+ if (e.getElementType() == IJavaElement.TYPE && e.getDeclaringType() == null) {
+ handleTypeChange((IType) e.getElement(), e.getSuperTypeHierarchy());
+ }
+ break;
+ }
+ case IJavaElementDelta.REMOVED: {
+ if (TypeUtility.exists(e.getElement().getParent())) {
+ handleJavaElementRemoved(e.getElement());
+ }
+ break;
+ }
+ case JavaResourceChangedEmitter.CHANGED_EXTERNAL:
+ if (e.getElementType() == IJavaElement.COMPILATION_UNIT) {
+ handleCompilationUnitChagnedExternal((ICompilationUnit) e.getElement());
+ }
+ break;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/JavaResourceChangedEmitter.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/JavaResourceChangedEmitter.java
index 1fd4009c4..399bbe134 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/JavaResourceChangedEmitter.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/JavaResourceChangedEmitter.java
@@ -1,596 +1,596 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.internal.typecache;
-
-import java.io.PrintStream;
-import java.lang.ref.WeakReference;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map.Entry;
-import java.util.WeakHashMap;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.BufferChangedEvent;
-import org.eclipse.jdt.core.ElementChangedEvent;
-import org.eclipse.jdt.core.IBuffer;
-import org.eclipse.jdt.core.IBufferChangedListener;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IElementChangedListener;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaElementDelta;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.commons.EventListenerList;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.jdt.IJavaResourceChangedListener;
-import org.eclipse.scout.sdk.util.jdt.JdtEvent;
-import org.eclipse.scout.sdk.util.jdt.finegraned.FineGrainedJavaElementDelta;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IJavaResourceChangedEmitter;
-
-/**
- *
- */
-public final class JavaResourceChangedEmitter implements IJavaResourceChangedEmitter {
- public static final int CHANGED_EXTERNAL = 229;
-
- public static final int CHANGED_FLAG_MASK =
- IJavaElementDelta.F_CONTENT |
- IJavaElementDelta.F_MODIFIERS |
- IJavaElementDelta.F_MOVED_FROM |
- IJavaElementDelta.F_MOVED_TO |
- IJavaElementDelta.F_REORDER |
- IJavaElementDelta.F_SUPER_TYPES |
- IJavaElementDelta.F_OPENED |
- IJavaElementDelta.F_CLOSED |
- IJavaElementDelta.F_PRIMARY_WORKING_COPY |
- IJavaElementDelta.F_CATEGORIES |
- IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED |
- IJavaElementDelta.F_ANNOTATIONS;
-
- private static final JavaResourceChangedEmitter INSTANCE = new JavaResourceChangedEmitter(HierarchyCache.getInstance());
-
- private P_JavaElementChangedListener m_javaElementListener;
- private Object m_resourceLock = new Object();
- private HashMap<ICompilationUnit, JdtEventCollector> m_eventCollectors;
- private EventListenerList m_eventListeners = new EventListenerList();
- private WeakHashMap<IType, ArrayList<WeakReference<IJavaResourceChangedListener>>> m_innerTypeChangedListeners;
- private WeakHashMap<IType, ArrayList<WeakReference<IJavaResourceChangedListener>>> m_methodChangedListeners;
- private Object m_eventListenerLock;
- private final HierarchyCache m_hierarchyCache;
- private IBufferChangedListener m_sourceBufferListener;
- private IResourceChangeListener m_resourceListener;
-
- public static ICompilationUnit[] getPendingWorkingCopies() {
- synchronized (INSTANCE.m_resourceLock) {
- return INSTANCE.m_eventCollectors.keySet().toArray(new ICompilationUnit[INSTANCE.m_eventCollectors.size()]);
- }
- }
-
- private JavaResourceChangedEmitter(HierarchyCache hierarchyCache) {
- m_hierarchyCache = hierarchyCache;
- m_eventCollectors = new HashMap<ICompilationUnit, JdtEventCollector>();
- m_eventListenerLock = new Object();
- m_innerTypeChangedListeners = new WeakHashMap<IType, ArrayList<WeakReference<IJavaResourceChangedListener>>>();
- m_methodChangedListeners = new WeakHashMap<IType, ArrayList<WeakReference<IJavaResourceChangedListener>>>();
- m_sourceBufferListener = new P_SourceBufferListener();
- m_javaElementListener = new P_JavaElementChangedListener();
- JavaCore.addElementChangedListener(m_javaElementListener);
- m_resourceListener = new P_ResourceListener();
- ResourcesPlugin.getWorkspace().addResourceChangeListener(m_resourceListener);
- // ast tracker
- for (ICompilationUnit icu : JavaCore.getWorkingCopies(null)) {
- try {
- aquireEventCollector(icu);
- }
- catch (JavaModelException ex) {
- SdkUtilActivator.logWarning("could not aquire event collector for '" + icu.getElementName() + "'.", ex);
- }
- }
- }
-
- public static JavaResourceChangedEmitter getInstance() {
- return INSTANCE;
- }
-
- @Override
- public void dispose() {
- JavaCore.removeElementChangedListener(m_javaElementListener);
- m_eventCollectors.clear();
- m_innerTypeChangedListeners.clear();
- m_methodChangedListeners.clear();
- }
-
- @Override
- public void addInnerTypeChangedListener(IType type, IJavaResourceChangedListener listener) {
- synchronized (m_eventListenerLock) {
- ArrayList<WeakReference<IJavaResourceChangedListener>> listenerList = m_innerTypeChangedListeners.get(type);
- if (listenerList == null) {
- listenerList = new ArrayList<WeakReference<IJavaResourceChangedListener>>();
- m_innerTypeChangedListeners.put(type, listenerList);
- }
- listenerList.add(new WeakReference<IJavaResourceChangedListener>(listener));
- }
- }
-
- @Override
- public void removeInnerTypeChangedListener(IType type, IJavaResourceChangedListener listener) {
- synchronized (m_eventListenerLock) {
- ArrayList<WeakReference<IJavaResourceChangedListener>> listenerList = m_innerTypeChangedListeners.get(type);
- if (listenerList != null) {
- for (Iterator<WeakReference<IJavaResourceChangedListener>> it = listenerList.iterator(); it.hasNext();) {
- WeakReference<IJavaResourceChangedListener> ref = it.next();
- if (ref.get() == null || ref.get().equals(listener)) {
- it.remove();
- }
- }
- if (listenerList.isEmpty()) {
- m_innerTypeChangedListeners.remove(type);
- }
- }
- }
- }
-
- @Override
- public void addMethodChangedListener(IType type, IJavaResourceChangedListener listener) {
- synchronized (m_eventListenerLock) {
- ArrayList<WeakReference<IJavaResourceChangedListener>> listenerList = m_methodChangedListeners.get(type);
- if (listenerList == null) {
- listenerList = new ArrayList<WeakReference<IJavaResourceChangedListener>>();
- m_methodChangedListeners.put(type, listenerList);
- }
- listenerList.add(new WeakReference<IJavaResourceChangedListener>(listener));
- }
- }
-
- @Override
- public void removeMethodChangedListener(IType type, IJavaResourceChangedListener listener) {
- synchronized (m_eventListenerLock) {
- ArrayList<WeakReference<IJavaResourceChangedListener>> listenerList = m_methodChangedListeners.get(type);
- if (listenerList != null) {
- for (Iterator<WeakReference<IJavaResourceChangedListener>> it = listenerList.iterator(); it.hasNext();) {
- WeakReference<IJavaResourceChangedListener> ref = it.next();
- if (ref.get() == null || ref.get().equals(listener)) {
- it.remove();
- }
- }
- if (listenerList.isEmpty()) {
- m_methodChangedListeners.remove(type);
- }
- }
- }
- }
-
- @Override
- public void addJavaResourceChangedListener(IJavaResourceChangedListener listener) {
- m_eventListeners.add(IJavaResourceChangedListener.class, listener);
- }
-
- @Override
- public void removeJavaResourceChangedListener(IJavaResourceChangedListener listener) {
- m_eventListeners.remove(IJavaResourceChangedListener.class, listener);
- }
-
- private void handleJdtDelta(ElementChangedEvent rootEvent, IJavaElementDelta delta) {
- IJavaElement e = delta.getElement();
- if (e == null) {
- return;
- }
- JdtEventCollector collector = null;
- ICompilationUnit compilationUnit = (ICompilationUnit) e.getAncestor(IJavaElement.COMPILATION_UNIT);
- if (compilationUnit != null && TypeUtility.exists(compilationUnit)) {
- collector = m_eventCollectors.get(compilationUnit);
- try {
- if (collector == null && compilationUnit.hasUnsavedChanges()) {
- collector = aquireEventCollector(compilationUnit);
- }
- }
- catch (JavaModelException ex) {
- SdkUtilActivator.logWarning("could not aquire event collector for '" + compilationUnit.getElementName() + "'.", ex);
- }
- }
- int kind = delta.getKind();
- int flags = delta.getFlags();
- switch (kind) {
- case IJavaElementDelta.ADDED:
- if (e.getElementType() < IJavaElement.COMPILATION_UNIT) {
- // fire straight
- fireEvent(new JdtEvent(JavaResourceChangedEmitter.this, kind, e));
- }
- else {
- addEvent(collector, new JdtEvent(JavaResourceChangedEmitter.this, kind, e));
- }
- break;
- case IJavaElementDelta.REMOVED:
- if (e.getElementType() <= IJavaElement.COMPILATION_UNIT) {
- // remove all open event collectors
- removeEventCollectors(e);
- // fire straight
- fireEvent(new JdtEvent(JavaResourceChangedEmitter.this, kind, e));
- }
- else {
- addEvent(collector, new JdtEvent(JavaResourceChangedEmitter.this, kind, e));
- }
- break;
- case IJavaElementDelta.CHANGED:
- if (e.getElementType() < IJavaElement.COMPILATION_UNIT) {
- fireEvent(new JdtEvent(JavaResourceChangedEmitter.this, kind, delta.getElement()));
- }
- else if (e.getElementType() == IJavaElement.COMPILATION_UNIT) {
- if (collector != null && (flags & CHANGED_FLAG_MASK) != 0) {
- FineGrainedJavaElementDelta[] astDiff = collector.updateAst();
- if (astDiff != null && astDiff.length > 0) {
- for (FineGrainedJavaElementDelta a : astDiff) {
- if (TypeUtility.exists(a.getElement())) {
- addEvent(collector, new JdtEvent(JavaResourceChangedEmitter.this, kind, a.getElement()));
- }
- }
- }
- else if (collector.isEmpty()) {
- addEvent(collector, new JdtEvent(JavaResourceChangedEmitter.this, (collector != null) ? kind : CHANGED_EXTERNAL, e));
- }
- }
- }
- else {
- addEvent(collector, new JdtEvent(JavaResourceChangedEmitter.this, (collector != null) ? kind : CHANGED_EXTERNAL, e));
- }
- }
-
- if (e.getElementType() == IJavaElement.COMPILATION_UNIT) {
- ICompilationUnit icu = (ICompilationUnit) e;
- try {
- if (!icu.hasUnsavedChanges()) {
- if (rootEvent.getType() == ElementChangedEvent.POST_RECONCILE) {
- // the reconcile event is before the post change event. (fast save)
- releaseEventCollector((ICompilationUnit) e, true);
- }
- else if (rootEvent.getType() == ElementChangedEvent.POST_CHANGE && ((flags & IJavaElementDelta.F_CHILDREN) == 0) && ((flags & IJavaElementDelta.F_CONTENT) == 0)) {
- // normal save
- releaseEventCollector(icu, true);
- }
- }
- }
- catch (JavaModelException ex) {
- SdkUtilActivator.logWarning("could not release event collector for '" + icu.getElementName() + "'.", ex);
- }
- }
- }
-
- private void addEvent(JdtEventCollector collector, JdtEvent event) {
- if (collector != null) {
- if (collector.isEmpty()) {
- fireEvent(new JdtEvent(JavaResourceChangedEmitter.this, JdtEvent.BUFFER_DIRTY, collector.getCompilationUnit()));
- }
- collector.addEvent(event);
- }
- else {
- fireEvent(event);
- }
- }
-
- private JdtEventCollector aquireEventCollector(ICompilationUnit icu) throws JavaModelException {
- JdtEventCollector collector = null;
- collector = m_eventCollectors.get(icu);
- if (collector == null && icu.isWorkingCopy()) {
- collector = new JdtEventCollector(icu);
- m_eventCollectors.put(icu, collector);
- icu.getBuffer().addBufferChangedListener(m_sourceBufferListener);
- }
- return collector;
- }
-
- private void releaseEventCollector(ICompilationUnit icu, boolean clearWorkingCopy) {
- JdtEventCollector collector = null;
- if (icu.isWorkingCopy()) {
- collector = m_eventCollectors.get(icu);
- }
- else {
- collector = m_eventCollectors.remove(icu);
- }
- if (collector != null && !collector.isEmpty()) {
- boolean fireChanges = false;
- JdtEvent[] jdtEvents = new JdtEvent[0];
- synchronized (m_resourceLock) {
- if (collector != null && collector.hasEvents()) {
- long resourceModification = icu.getResource().getModificationStamp();
- fireChanges = (icu == null) || resourceModification != collector.getLastModification();
- jdtEvents = collector.removeAllEvents(resourceModification);
- }
- }
- if (fireChanges) {
- for (JdtEvent e : jdtEvents) {
- fireEvent(e);
- }
- }
- fireEvent(new JdtEvent(JavaResourceChangedEmitter.this, JdtEvent.BUFFER_SYNC, icu));
- }
- }
-
- private void removeEventCollectors(IJavaElement element) {
- synchronized (m_resourceLock) {
- for (Iterator<Entry<ICompilationUnit, JdtEventCollector>> it = m_eventCollectors.entrySet().iterator(); it.hasNext();) {
- Entry<ICompilationUnit, JdtEventCollector> cur = it.next();
- if (TypeUtility.isAncestor(element, cur.getKey())) {
- it.remove();
- }
- }
- }
- }
-
- private void fireEvent(JdtEvent e) {
- // first notify hierarchies which could be used of other listeners
- if (m_hierarchyCache != null) {
- m_hierarchyCache.elementChanged(e);
- }
- for (IJavaResourceChangedListener l : m_eventListeners.getListeners(IJavaResourceChangedListener.class)) {
- try {
- l.handleEvent(e);
- }
- catch (Exception ex) {
- SdkUtilActivator.logWarning("error during listener notification.", ex);
- }
- }
- // type
- if (e.getElementType() == IJavaElement.TYPE) {
- ArrayList<IJavaResourceChangedListener> listeners = new ArrayList<IJavaResourceChangedListener>();
- synchronized (m_eventListenerLock) {
- ArrayList<WeakReference<IJavaResourceChangedListener>> listenerList = m_innerTypeChangedListeners.get(e.getDeclaringType());
- if (listenerList != null) {
- for (Iterator<WeakReference<IJavaResourceChangedListener>> it = listenerList.iterator(); it.hasNext();) {
- WeakReference<IJavaResourceChangedListener> ref = it.next();
- IJavaResourceChangedListener listener = ref.get();
- if (listener == null) {
- it.remove();
- }
- else {
- listeners.add(listener);
-
- }
- }
- if (listenerList.isEmpty()) {
- m_innerTypeChangedListeners.remove(e.getDeclaringType());
- }
- }
- }
- for (IJavaResourceChangedListener l : listeners) {
- l.handleEvent(e);
- }
- }
- // method
- if (e.getElementType() == IJavaElement.METHOD) {
- ArrayList<IJavaResourceChangedListener> listeners = new ArrayList<IJavaResourceChangedListener>();
- synchronized (m_eventListenerLock) {
- ArrayList<WeakReference<IJavaResourceChangedListener>> listenerList = m_methodChangedListeners.get(e.getDeclaringType());
- if (listenerList != null) {
- for (Iterator<WeakReference<IJavaResourceChangedListener>> it = listenerList.iterator(); it.hasNext();) {
- WeakReference<IJavaResourceChangedListener> ref = it.next();
- IJavaResourceChangedListener listener = ref.get();
- if (listener == null) {
- it.remove();
- }
- else {
- listeners.add(listener);
-
- }
- }
- if (listenerList.isEmpty()) {
- m_methodChangedListeners.remove(e.getDeclaringType());
- }
- }
- }
- for (IJavaResourceChangedListener l : listeners) {
- l.handleEvent(e);
- }
- }
- }
-
- private void printEventType(int type, PrintStream out) {
- switch (type) {
- case IJavaElementDelta.ADDED:
- out.print("ADDED");
- case IJavaElementDelta.REMOVED:
- out.print("REMOVED");
- case IJavaElementDelta.CHANGED:
- out.print("CHANGED");
- case JdtEvent.BUFFER_DIRTY:
- out.print("BUFFER_DIRTY");
- case JdtEvent.BUFFER_SYNC:
- out.print("BUFFER_SYNC");
- default:
- out.print("UNDEFINED");
- }
- out.flush();
- }
-
- @SuppressWarnings("deprecation")
- private void printJdtFlags(int flags, PrintStream out) {
- boolean first = true;
- out.print("flags for '" + flags + "'[");
- if ((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_ADDED_TO_CLASSPATH");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_CONTENT) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_CONTENT");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_MODIFIERS) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_MODIFIERS");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_CHILDREN) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_CHILDREN");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_MOVED_FROM) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_MOVED_FROM");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_MOVED_TO) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_MOVED_TO");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_ADDED_TO_CLASSPATH");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_REMOVED_FROM_CLASSPATH");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_CLASSPATH_REORDER) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_CLASSPATH_REORDER");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_REORDER) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_REORDER");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_OPENED) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_OPENED");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_CLOSED) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_CLOSED");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_SUPER_TYPES) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_SUPER_TYPES");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_SOURCEATTACHED) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_SOURCEATTACHED");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_SOURCEDETACHED) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_SOURCEDETACHED");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_FINE_GRAINED) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_FINE_GRAINED");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_ARCHIVE_CONTENT_CHANGED");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_PRIMARY_WORKING_COPY) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_PRIMARY_WORKING_COPY");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_CLASSPATH_CHANGED) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_CLASSPATH_CHANGED");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_PRIMARY_RESOURCE) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_PRIMARY_RESOURCE");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_AST_AFFECTED) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_AST_AFFECTED");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_CATEGORIES) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_CATEGORIES");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_RESOLVED_CLASSPATH_CHANGED");
- first = false;
- }
- if ((flags & IJavaElementDelta.F_ANNOTATIONS) != 0) {
- out.print(((!first) ? (", ") : ("")) + "F_ANNOTATIONS");
- first = false;
- }
- out.print("]");
- out.flush();
- }
-
- private class P_ResourceListener implements IResourceChangeListener {
- @Override
- public void resourceChanged(final IResourceChangeEvent event) {
- IResourceDelta delta = event.getDelta();
- try {
- if (delta != null) {
- delta.accept(new IResourceDeltaVisitor() {
- @Override
- public boolean visit(IResourceDelta visitDelta) {
- IResource resource = visitDelta.getResource();
- if (resource.getType() == IFile.FILE && StringUtility.equalsIgnoreCase("java", resource.getFileExtension())) {
- return false;
- }
- return true;
- }
- });
- }
- }
- catch (CoreException e) {
- SdkUtilActivator.logWarning(e);
- }
- }
- } // end class P_ResourceListener
-
- private class P_SourceBufferListener implements IBufferChangedListener {
- @Override
- public void bufferChanged(BufferChangedEvent event) {
- IBuffer buffer = event.getBuffer();
- ICompilationUnit icu = (ICompilationUnit) buffer.getOwner();
- if (!buffer.hasUnsavedChanges() && buffer.isClosed()) {
- // release
- releaseEventCollector(icu, icu.isWorkingCopy());
- if (!icu.isWorkingCopy()) {
- buffer.removeBufferChangedListener(m_sourceBufferListener);
- }
- }
- }
- } // end class P_SourceBufferListener
-
- private class P_JavaElementChangedListener implements IElementChangedListener {
-
- @Override
- public void elementChanged(ElementChangedEvent event) {
- try {
- visitDelta(event, event.getDelta(), event.getType());
- }
- catch (Exception e) {
- e.printStackTrace();
- }
- }
-
- private void visitDelta(ElementChangedEvent rootEvent, IJavaElementDelta delta, int eventType) {
- // annotations
- for (IJavaElementDelta annotationDelta : delta.getAnnotationDeltas()) {
- visitDelta(rootEvent, annotationDelta, eventType);
- }
- if ((delta.getFlags() & IJavaElementDelta.F_CHILDREN) != 0) {
- IJavaElementDelta[] childDeltas = delta.getAffectedChildren();
- if (childDeltas != null && childDeltas.length > 0) {
- for (int i = 0; i < childDeltas.length; i++) {
- visitDelta(rootEvent, childDeltas[i], eventType);
- }
- }
- }
- else {
- handleJdtDelta(rootEvent, delta);
- }
- }
- } // end class P_JavaElementChangedListener
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.internal.typecache;
+
+import java.io.PrintStream;
+import java.lang.ref.WeakReference;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map.Entry;
+import java.util.WeakHashMap;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.BufferChangedEvent;
+import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jdt.core.IBuffer;
+import org.eclipse.jdt.core.IBufferChangedListener;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IElementChangedListener;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaElementDelta;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.commons.EventListenerList;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.jdt.IJavaResourceChangedListener;
+import org.eclipse.scout.sdk.util.jdt.JdtEvent;
+import org.eclipse.scout.sdk.util.jdt.finegraned.FineGrainedJavaElementDelta;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IJavaResourceChangedEmitter;
+
+/**
+ *
+ */
+public final class JavaResourceChangedEmitter implements IJavaResourceChangedEmitter {
+ public static final int CHANGED_EXTERNAL = 229;
+
+ public static final int CHANGED_FLAG_MASK =
+ IJavaElementDelta.F_CONTENT |
+ IJavaElementDelta.F_MODIFIERS |
+ IJavaElementDelta.F_MOVED_FROM |
+ IJavaElementDelta.F_MOVED_TO |
+ IJavaElementDelta.F_REORDER |
+ IJavaElementDelta.F_SUPER_TYPES |
+ IJavaElementDelta.F_OPENED |
+ IJavaElementDelta.F_CLOSED |
+ IJavaElementDelta.F_PRIMARY_WORKING_COPY |
+ IJavaElementDelta.F_CATEGORIES |
+ IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED |
+ IJavaElementDelta.F_ANNOTATIONS;
+
+ private static final JavaResourceChangedEmitter INSTANCE = new JavaResourceChangedEmitter(HierarchyCache.getInstance());
+
+ private P_JavaElementChangedListener m_javaElementListener;
+ private Object m_resourceLock = new Object();
+ private HashMap<ICompilationUnit, JdtEventCollector> m_eventCollectors;
+ private EventListenerList m_eventListeners = new EventListenerList();
+ private WeakHashMap<IType, ArrayList<WeakReference<IJavaResourceChangedListener>>> m_innerTypeChangedListeners;
+ private WeakHashMap<IType, ArrayList<WeakReference<IJavaResourceChangedListener>>> m_methodChangedListeners;
+ private Object m_eventListenerLock;
+ private final HierarchyCache m_hierarchyCache;
+ private IBufferChangedListener m_sourceBufferListener;
+ private IResourceChangeListener m_resourceListener;
+
+ public static ICompilationUnit[] getPendingWorkingCopies() {
+ synchronized (INSTANCE.m_resourceLock) {
+ return INSTANCE.m_eventCollectors.keySet().toArray(new ICompilationUnit[INSTANCE.m_eventCollectors.size()]);
+ }
+ }
+
+ private JavaResourceChangedEmitter(HierarchyCache hierarchyCache) {
+ m_hierarchyCache = hierarchyCache;
+ m_eventCollectors = new HashMap<ICompilationUnit, JdtEventCollector>();
+ m_eventListenerLock = new Object();
+ m_innerTypeChangedListeners = new WeakHashMap<IType, ArrayList<WeakReference<IJavaResourceChangedListener>>>();
+ m_methodChangedListeners = new WeakHashMap<IType, ArrayList<WeakReference<IJavaResourceChangedListener>>>();
+ m_sourceBufferListener = new P_SourceBufferListener();
+ m_javaElementListener = new P_JavaElementChangedListener();
+ JavaCore.addElementChangedListener(m_javaElementListener);
+ m_resourceListener = new P_ResourceListener();
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(m_resourceListener);
+ // ast tracker
+ for (ICompilationUnit icu : JavaCore.getWorkingCopies(null)) {
+ try {
+ aquireEventCollector(icu);
+ }
+ catch (JavaModelException ex) {
+ SdkUtilActivator.logWarning("could not aquire event collector for '" + icu.getElementName() + "'.", ex);
+ }
+ }
+ }
+
+ public static JavaResourceChangedEmitter getInstance() {
+ return INSTANCE;
+ }
+
+ @Override
+ public void dispose() {
+ JavaCore.removeElementChangedListener(m_javaElementListener);
+ m_eventCollectors.clear();
+ m_innerTypeChangedListeners.clear();
+ m_methodChangedListeners.clear();
+ }
+
+ @Override
+ public void addInnerTypeChangedListener(IType type, IJavaResourceChangedListener listener) {
+ synchronized (m_eventListenerLock) {
+ ArrayList<WeakReference<IJavaResourceChangedListener>> listenerList = m_innerTypeChangedListeners.get(type);
+ if (listenerList == null) {
+ listenerList = new ArrayList<WeakReference<IJavaResourceChangedListener>>();
+ m_innerTypeChangedListeners.put(type, listenerList);
+ }
+ listenerList.add(new WeakReference<IJavaResourceChangedListener>(listener));
+ }
+ }
+
+ @Override
+ public void removeInnerTypeChangedListener(IType type, IJavaResourceChangedListener listener) {
+ synchronized (m_eventListenerLock) {
+ ArrayList<WeakReference<IJavaResourceChangedListener>> listenerList = m_innerTypeChangedListeners.get(type);
+ if (listenerList != null) {
+ for (Iterator<WeakReference<IJavaResourceChangedListener>> it = listenerList.iterator(); it.hasNext();) {
+ WeakReference<IJavaResourceChangedListener> ref = it.next();
+ if (ref.get() == null || ref.get().equals(listener)) {
+ it.remove();
+ }
+ }
+ if (listenerList.isEmpty()) {
+ m_innerTypeChangedListeners.remove(type);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void addMethodChangedListener(IType type, IJavaResourceChangedListener listener) {
+ synchronized (m_eventListenerLock) {
+ ArrayList<WeakReference<IJavaResourceChangedListener>> listenerList = m_methodChangedListeners.get(type);
+ if (listenerList == null) {
+ listenerList = new ArrayList<WeakReference<IJavaResourceChangedListener>>();
+ m_methodChangedListeners.put(type, listenerList);
+ }
+ listenerList.add(new WeakReference<IJavaResourceChangedListener>(listener));
+ }
+ }
+
+ @Override
+ public void removeMethodChangedListener(IType type, IJavaResourceChangedListener listener) {
+ synchronized (m_eventListenerLock) {
+ ArrayList<WeakReference<IJavaResourceChangedListener>> listenerList = m_methodChangedListeners.get(type);
+ if (listenerList != null) {
+ for (Iterator<WeakReference<IJavaResourceChangedListener>> it = listenerList.iterator(); it.hasNext();) {
+ WeakReference<IJavaResourceChangedListener> ref = it.next();
+ if (ref.get() == null || ref.get().equals(listener)) {
+ it.remove();
+ }
+ }
+ if (listenerList.isEmpty()) {
+ m_methodChangedListeners.remove(type);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void addJavaResourceChangedListener(IJavaResourceChangedListener listener) {
+ m_eventListeners.add(IJavaResourceChangedListener.class, listener);
+ }
+
+ @Override
+ public void removeJavaResourceChangedListener(IJavaResourceChangedListener listener) {
+ m_eventListeners.remove(IJavaResourceChangedListener.class, listener);
+ }
+
+ private void handleJdtDelta(ElementChangedEvent rootEvent, IJavaElementDelta delta) {
+ IJavaElement e = delta.getElement();
+ if (e == null) {
+ return;
+ }
+ JdtEventCollector collector = null;
+ ICompilationUnit compilationUnit = (ICompilationUnit) e.getAncestor(IJavaElement.COMPILATION_UNIT);
+ if (compilationUnit != null && TypeUtility.exists(compilationUnit)) {
+ collector = m_eventCollectors.get(compilationUnit);
+ try {
+ if (collector == null && compilationUnit.hasUnsavedChanges()) {
+ collector = aquireEventCollector(compilationUnit);
+ }
+ }
+ catch (JavaModelException ex) {
+ SdkUtilActivator.logWarning("could not aquire event collector for '" + compilationUnit.getElementName() + "'.", ex);
+ }
+ }
+ int kind = delta.getKind();
+ int flags = delta.getFlags();
+ switch (kind) {
+ case IJavaElementDelta.ADDED:
+ if (e.getElementType() < IJavaElement.COMPILATION_UNIT) {
+ // fire straight
+ fireEvent(new JdtEvent(JavaResourceChangedEmitter.this, kind, e));
+ }
+ else {
+ addEvent(collector, new JdtEvent(JavaResourceChangedEmitter.this, kind, e));
+ }
+ break;
+ case IJavaElementDelta.REMOVED:
+ if (e.getElementType() <= IJavaElement.COMPILATION_UNIT) {
+ // remove all open event collectors
+ removeEventCollectors(e);
+ // fire straight
+ fireEvent(new JdtEvent(JavaResourceChangedEmitter.this, kind, e));
+ }
+ else {
+ addEvent(collector, new JdtEvent(JavaResourceChangedEmitter.this, kind, e));
+ }
+ break;
+ case IJavaElementDelta.CHANGED:
+ if (e.getElementType() < IJavaElement.COMPILATION_UNIT) {
+ fireEvent(new JdtEvent(JavaResourceChangedEmitter.this, kind, delta.getElement()));
+ }
+ else if (e.getElementType() == IJavaElement.COMPILATION_UNIT) {
+ if (collector != null && (flags & CHANGED_FLAG_MASK) != 0) {
+ FineGrainedJavaElementDelta[] astDiff = collector.updateAst();
+ if (astDiff != null && astDiff.length > 0) {
+ for (FineGrainedJavaElementDelta a : astDiff) {
+ if (TypeUtility.exists(a.getElement())) {
+ addEvent(collector, new JdtEvent(JavaResourceChangedEmitter.this, kind, a.getElement()));
+ }
+ }
+ }
+ else if (collector.isEmpty()) {
+ addEvent(collector, new JdtEvent(JavaResourceChangedEmitter.this, (collector != null) ? kind : CHANGED_EXTERNAL, e));
+ }
+ }
+ }
+ else {
+ addEvent(collector, new JdtEvent(JavaResourceChangedEmitter.this, (collector != null) ? kind : CHANGED_EXTERNAL, e));
+ }
+ }
+
+ if (e.getElementType() == IJavaElement.COMPILATION_UNIT) {
+ ICompilationUnit icu = (ICompilationUnit) e;
+ try {
+ if (!icu.hasUnsavedChanges()) {
+ if (rootEvent.getType() == ElementChangedEvent.POST_RECONCILE) {
+ // the reconcile event is before the post change event. (fast save)
+ releaseEventCollector((ICompilationUnit) e, true);
+ }
+ else if (rootEvent.getType() == ElementChangedEvent.POST_CHANGE && ((flags & IJavaElementDelta.F_CHILDREN) == 0) && ((flags & IJavaElementDelta.F_CONTENT) == 0)) {
+ // normal save
+ releaseEventCollector(icu, true);
+ }
+ }
+ }
+ catch (JavaModelException ex) {
+ SdkUtilActivator.logWarning("could not release event collector for '" + icu.getElementName() + "'.", ex);
+ }
+ }
+ }
+
+ private void addEvent(JdtEventCollector collector, JdtEvent event) {
+ if (collector != null) {
+ if (collector.isEmpty()) {
+ fireEvent(new JdtEvent(JavaResourceChangedEmitter.this, JdtEvent.BUFFER_DIRTY, collector.getCompilationUnit()));
+ }
+ collector.addEvent(event);
+ }
+ else {
+ fireEvent(event);
+ }
+ }
+
+ private JdtEventCollector aquireEventCollector(ICompilationUnit icu) throws JavaModelException {
+ JdtEventCollector collector = null;
+ collector = m_eventCollectors.get(icu);
+ if (collector == null && icu.isWorkingCopy()) {
+ collector = new JdtEventCollector(icu);
+ m_eventCollectors.put(icu, collector);
+ icu.getBuffer().addBufferChangedListener(m_sourceBufferListener);
+ }
+ return collector;
+ }
+
+ private void releaseEventCollector(ICompilationUnit icu, boolean clearWorkingCopy) {
+ JdtEventCollector collector = null;
+ if (icu.isWorkingCopy()) {
+ collector = m_eventCollectors.get(icu);
+ }
+ else {
+ collector = m_eventCollectors.remove(icu);
+ }
+ if (collector != null && !collector.isEmpty()) {
+ boolean fireChanges = false;
+ JdtEvent[] jdtEvents = new JdtEvent[0];
+ synchronized (m_resourceLock) {
+ if (collector != null && collector.hasEvents()) {
+ long resourceModification = icu.getResource().getModificationStamp();
+ fireChanges = (icu == null) || resourceModification != collector.getLastModification();
+ jdtEvents = collector.removeAllEvents(resourceModification);
+ }
+ }
+ if (fireChanges) {
+ for (JdtEvent e : jdtEvents) {
+ fireEvent(e);
+ }
+ }
+ fireEvent(new JdtEvent(JavaResourceChangedEmitter.this, JdtEvent.BUFFER_SYNC, icu));
+ }
+ }
+
+ private void removeEventCollectors(IJavaElement element) {
+ synchronized (m_resourceLock) {
+ for (Iterator<Entry<ICompilationUnit, JdtEventCollector>> it = m_eventCollectors.entrySet().iterator(); it.hasNext();) {
+ Entry<ICompilationUnit, JdtEventCollector> cur = it.next();
+ if (TypeUtility.isAncestor(element, cur.getKey())) {
+ it.remove();
+ }
+ }
+ }
+ }
+
+ private void fireEvent(JdtEvent e) {
+ // first notify hierarchies which could be used of other listeners
+ if (m_hierarchyCache != null) {
+ m_hierarchyCache.elementChanged(e);
+ }
+ for (IJavaResourceChangedListener l : m_eventListeners.getListeners(IJavaResourceChangedListener.class)) {
+ try {
+ l.handleEvent(e);
+ }
+ catch (Exception ex) {
+ SdkUtilActivator.logWarning("error during listener notification.", ex);
+ }
+ }
+ // type
+ if (e.getElementType() == IJavaElement.TYPE) {
+ ArrayList<IJavaResourceChangedListener> listeners = new ArrayList<IJavaResourceChangedListener>();
+ synchronized (m_eventListenerLock) {
+ ArrayList<WeakReference<IJavaResourceChangedListener>> listenerList = m_innerTypeChangedListeners.get(e.getDeclaringType());
+ if (listenerList != null) {
+ for (Iterator<WeakReference<IJavaResourceChangedListener>> it = listenerList.iterator(); it.hasNext();) {
+ WeakReference<IJavaResourceChangedListener> ref = it.next();
+ IJavaResourceChangedListener listener = ref.get();
+ if (listener == null) {
+ it.remove();
+ }
+ else {
+ listeners.add(listener);
+
+ }
+ }
+ if (listenerList.isEmpty()) {
+ m_innerTypeChangedListeners.remove(e.getDeclaringType());
+ }
+ }
+ }
+ for (IJavaResourceChangedListener l : listeners) {
+ l.handleEvent(e);
+ }
+ }
+ // method
+ if (e.getElementType() == IJavaElement.METHOD) {
+ ArrayList<IJavaResourceChangedListener> listeners = new ArrayList<IJavaResourceChangedListener>();
+ synchronized (m_eventListenerLock) {
+ ArrayList<WeakReference<IJavaResourceChangedListener>> listenerList = m_methodChangedListeners.get(e.getDeclaringType());
+ if (listenerList != null) {
+ for (Iterator<WeakReference<IJavaResourceChangedListener>> it = listenerList.iterator(); it.hasNext();) {
+ WeakReference<IJavaResourceChangedListener> ref = it.next();
+ IJavaResourceChangedListener listener = ref.get();
+ if (listener == null) {
+ it.remove();
+ }
+ else {
+ listeners.add(listener);
+
+ }
+ }
+ if (listenerList.isEmpty()) {
+ m_methodChangedListeners.remove(e.getDeclaringType());
+ }
+ }
+ }
+ for (IJavaResourceChangedListener l : listeners) {
+ l.handleEvent(e);
+ }
+ }
+ }
+
+ private void printEventType(int type, PrintStream out) {
+ switch (type) {
+ case IJavaElementDelta.ADDED:
+ out.print("ADDED");
+ case IJavaElementDelta.REMOVED:
+ out.print("REMOVED");
+ case IJavaElementDelta.CHANGED:
+ out.print("CHANGED");
+ case JdtEvent.BUFFER_DIRTY:
+ out.print("BUFFER_DIRTY");
+ case JdtEvent.BUFFER_SYNC:
+ out.print("BUFFER_SYNC");
+ default:
+ out.print("UNDEFINED");
+ }
+ out.flush();
+ }
+
+ @SuppressWarnings("deprecation")
+ private void printJdtFlags(int flags, PrintStream out) {
+ boolean first = true;
+ out.print("flags for '" + flags + "'[");
+ if ((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_ADDED_TO_CLASSPATH");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_CONTENT) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_CONTENT");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_MODIFIERS) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_MODIFIERS");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_CHILDREN) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_CHILDREN");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_MOVED_FROM) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_MOVED_FROM");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_MOVED_TO) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_MOVED_TO");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_ADDED_TO_CLASSPATH) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_ADDED_TO_CLASSPATH");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_REMOVED_FROM_CLASSPATH) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_REMOVED_FROM_CLASSPATH");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_CLASSPATH_REORDER) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_CLASSPATH_REORDER");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_REORDER) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_REORDER");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_OPENED) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_OPENED");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_CLOSED) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_CLOSED");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_SUPER_TYPES) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_SUPER_TYPES");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_SOURCEATTACHED) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_SOURCEATTACHED");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_SOURCEDETACHED) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_SOURCEDETACHED");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_FINE_GRAINED) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_FINE_GRAINED");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_ARCHIVE_CONTENT_CHANGED) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_ARCHIVE_CONTENT_CHANGED");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_PRIMARY_WORKING_COPY) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_PRIMARY_WORKING_COPY");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_CLASSPATH_CHANGED) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_CLASSPATH_CHANGED");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_PRIMARY_RESOURCE) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_PRIMARY_RESOURCE");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_AST_AFFECTED) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_AST_AFFECTED");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_CATEGORIES) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_CATEGORIES");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_RESOLVED_CLASSPATH_CHANGED");
+ first = false;
+ }
+ if ((flags & IJavaElementDelta.F_ANNOTATIONS) != 0) {
+ out.print(((!first) ? (", ") : ("")) + "F_ANNOTATIONS");
+ first = false;
+ }
+ out.print("]");
+ out.flush();
+ }
+
+ private class P_ResourceListener implements IResourceChangeListener {
+ @Override
+ public void resourceChanged(final IResourceChangeEvent event) {
+ IResourceDelta delta = event.getDelta();
+ try {
+ if (delta != null) {
+ delta.accept(new IResourceDeltaVisitor() {
+ @Override
+ public boolean visit(IResourceDelta visitDelta) {
+ IResource resource = visitDelta.getResource();
+ if (resource.getType() == IFile.FILE && StringUtility.equalsIgnoreCase("java", resource.getFileExtension())) {
+ return false;
+ }
+ return true;
+ }
+ });
+ }
+ }
+ catch (CoreException e) {
+ SdkUtilActivator.logWarning(e);
+ }
+ }
+ } // end class P_ResourceListener
+
+ private class P_SourceBufferListener implements IBufferChangedListener {
+ @Override
+ public void bufferChanged(BufferChangedEvent event) {
+ IBuffer buffer = event.getBuffer();
+ ICompilationUnit icu = (ICompilationUnit) buffer.getOwner();
+ if (!buffer.hasUnsavedChanges() && buffer.isClosed()) {
+ // release
+ releaseEventCollector(icu, icu.isWorkingCopy());
+ if (!icu.isWorkingCopy()) {
+ buffer.removeBufferChangedListener(m_sourceBufferListener);
+ }
+ }
+ }
+ } // end class P_SourceBufferListener
+
+ private class P_JavaElementChangedListener implements IElementChangedListener {
+
+ @Override
+ public void elementChanged(ElementChangedEvent event) {
+ try {
+ visitDelta(event, event.getDelta(), event.getType());
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ private void visitDelta(ElementChangedEvent rootEvent, IJavaElementDelta delta, int eventType) {
+ // annotations
+ for (IJavaElementDelta annotationDelta : delta.getAnnotationDeltas()) {
+ visitDelta(rootEvent, annotationDelta, eventType);
+ }
+ if ((delta.getFlags() & IJavaElementDelta.F_CHILDREN) != 0) {
+ IJavaElementDelta[] childDeltas = delta.getAffectedChildren();
+ if (childDeltas != null && childDeltas.length > 0) {
+ for (int i = 0; i < childDeltas.length; i++) {
+ visitDelta(rootEvent, childDeltas[i], eventType);
+ }
+ }
+ }
+ else {
+ handleJdtDelta(rootEvent, delta);
+ }
+ }
+ } // end class P_JavaElementChangedListener
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/JdtEventCollector.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/JdtEventCollector.java
index 0426f9c3c..a78093deb 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/JdtEventCollector.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/JdtEventCollector.java
@@ -1,118 +1,118 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.internal.typecache;
-
-import java.util.HashMap;
-import java.util.HashSet;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ASTParser;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.scout.sdk.util.jdt.JdtEvent;
-import org.eclipse.scout.sdk.util.jdt.finegraned.FineGrainedAstMatcher;
-import org.eclipse.scout.sdk.util.jdt.finegraned.FineGrainedJavaElementDelta;
-
-/**
- *
- */
-public class JdtEventCollector {
-
- private final ICompilationUnit m_icu;
- private long m_lastModification;
- private CompilationUnit m_ast;
- private HashMap<IJavaElement, JdtEvent> m_events;
-
- JdtEventCollector(ICompilationUnit icu) {
- m_icu = icu;
- m_lastModification = icu.getResource().getModificationStamp();
- m_events = new HashMap<IJavaElement, JdtEvent>();
- m_ast = createAst();
- }
-
- private CompilationUnit createAst() {
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setCompilerOptions(JavaCore.getOptions());
- parser.setKind(ASTParser.K_COMPILATION_UNIT);
- parser.setSource(getCompilationUnit());
- return (CompilationUnit) parser.createAST(null);
- }
-
- public FineGrainedJavaElementDelta[] updateAst() {
- final CompilationUnit newAst = createAst();
- final HashSet<FineGrainedJavaElementDelta> set = new HashSet<FineGrainedJavaElementDelta>();
- FineGrainedAstMatcher matcher = new FineGrainedAstMatcher() {
- @Override
- protected boolean processDelta(boolean match, ASTNode node, Object other) {
- if (!match) {
- try {
-
- IJavaElement e = ((ICompilationUnit) newAst.getJavaElement()).getElementAt(node.getStartPosition());
- if (e != null) {
- set.add(new FineGrainedJavaElementDelta(e));
- }
- }
- catch (JavaModelException e1) {
- // nop
- }
- }
- return true;
- }
- };
- newAst.subtreeMatch(matcher, m_ast);
- m_ast = newAst;
- return set.toArray(new FineGrainedJavaElementDelta[set.size()]);
- }
-
- public void addEvent(JdtEvent e) {
- m_events.put(e.getElement(), e);
- }
-
- public boolean containsEventFor(IJavaElement element) {
- return m_events.containsKey(element);
- }
-
- public boolean hasEvents() {
- return !m_events.isEmpty();
- }
-
- public JdtEvent[] getEvents() {
- return m_events.values().toArray(new JdtEvent[m_events.size()]);
- }
-
- public JdtEvent[] removeAllEvents(long resourceTimestamp) {
- JdtEvent[] events = m_events.values().toArray(new JdtEvent[m_events.size()]);
- m_events.clear();
- m_lastModification = resourceTimestamp;
- return events;
- }
-
- public boolean isEmpty() {
- return m_events.size() == 0;
- }
-
- public long getLastModification() {
- return m_lastModification;
- }
-
- public ICompilationUnit getCompilationUnit() {
- return m_icu;
- }
-
- public CompilationUnit getAst() {
- return m_ast;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.internal.typecache;
+
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.scout.sdk.util.jdt.JdtEvent;
+import org.eclipse.scout.sdk.util.jdt.finegraned.FineGrainedAstMatcher;
+import org.eclipse.scout.sdk.util.jdt.finegraned.FineGrainedJavaElementDelta;
+
+/**
+ *
+ */
+public class JdtEventCollector {
+
+ private final ICompilationUnit m_icu;
+ private long m_lastModification;
+ private CompilationUnit m_ast;
+ private HashMap<IJavaElement, JdtEvent> m_events;
+
+ JdtEventCollector(ICompilationUnit icu) {
+ m_icu = icu;
+ m_lastModification = icu.getResource().getModificationStamp();
+ m_events = new HashMap<IJavaElement, JdtEvent>();
+ m_ast = createAst();
+ }
+
+ private CompilationUnit createAst() {
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setCompilerOptions(JavaCore.getOptions());
+ parser.setKind(ASTParser.K_COMPILATION_UNIT);
+ parser.setSource(getCompilationUnit());
+ return (CompilationUnit) parser.createAST(null);
+ }
+
+ public FineGrainedJavaElementDelta[] updateAst() {
+ final CompilationUnit newAst = createAst();
+ final HashSet<FineGrainedJavaElementDelta> set = new HashSet<FineGrainedJavaElementDelta>();
+ FineGrainedAstMatcher matcher = new FineGrainedAstMatcher() {
+ @Override
+ protected boolean processDelta(boolean match, ASTNode node, Object other) {
+ if (!match) {
+ try {
+
+ IJavaElement e = ((ICompilationUnit) newAst.getJavaElement()).getElementAt(node.getStartPosition());
+ if (e != null) {
+ set.add(new FineGrainedJavaElementDelta(e));
+ }
+ }
+ catch (JavaModelException e1) {
+ // nop
+ }
+ }
+ return true;
+ }
+ };
+ newAst.subtreeMatch(matcher, m_ast);
+ m_ast = newAst;
+ return set.toArray(new FineGrainedJavaElementDelta[set.size()]);
+ }
+
+ public void addEvent(JdtEvent e) {
+ m_events.put(e.getElement(), e);
+ }
+
+ public boolean containsEventFor(IJavaElement element) {
+ return m_events.containsKey(element);
+ }
+
+ public boolean hasEvents() {
+ return !m_events.isEmpty();
+ }
+
+ public JdtEvent[] getEvents() {
+ return m_events.values().toArray(new JdtEvent[m_events.size()]);
+ }
+
+ public JdtEvent[] removeAllEvents(long resourceTimestamp) {
+ JdtEvent[] events = m_events.values().toArray(new JdtEvent[m_events.size()]);
+ m_events.clear();
+ m_lastModification = resourceTimestamp;
+ return events;
+ }
+
+ public boolean isEmpty() {
+ return m_events.size() == 0;
+ }
+
+ public long getLastModification() {
+ return m_lastModification;
+ }
+
+ public ICompilationUnit getCompilationUnit() {
+ return m_icu;
+ }
+
+ public CompilationUnit getAst() {
+ return m_ast;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/PrimaryTypeTypeHierarchy.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/PrimaryTypeTypeHierarchy.java
index 1843cb077..22b92e879 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/PrimaryTypeTypeHierarchy.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/PrimaryTypeTypeHierarchy.java
@@ -1,232 +1,232 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.internal.typecache;
-
-import java.util.Comparator;
-
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IRegion;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.type.ITypeFilter;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
-
-/**
- *
- */
-public class PrimaryTypeTypeHierarchy extends CachedTypeHierarchy implements IPrimaryTypeTypeHierarchy {
-
- private ITypeFilter m_primaryTypeFilter = new P_PrimaryTypeFilter();
-
- /**
- * @param type
- */
- public PrimaryTypeTypeHierarchy(IType type) {
- super(type);
- }
-
- @Override
- public IType[] getAllSubtypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- ITypeFilter internalFilter = null;
- if (filter == null) {
- internalFilter = m_primaryTypeFilter;
- }
- else {
- internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
- }
- return super.getAllSubtypes(type, internalFilter, comparator);
- }
-
- @Override
- public IType[] getAllClasses(ITypeFilter filter, Comparator<IType> comparator) {
- ITypeFilter internalFilter = null;
- if (filter == null) {
- internalFilter = m_primaryTypeFilter;
- }
- else {
- internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
- }
- return super.getAllClasses(internalFilter, comparator);
- }
-
- @Override
- public IType[] getAllInterfaces(ITypeFilter filter, Comparator<IType> comparator) {
- ITypeFilter internalFilter = null;
- if (filter == null) {
- internalFilter = m_primaryTypeFilter;
- }
- else {
- internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
- }
- return super.getAllInterfaces(internalFilter, comparator);
- }
-
- @Override
- public IType[] getAllSuperclasses(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- ITypeFilter internalFilter = null;
- if (filter == null) {
- internalFilter = m_primaryTypeFilter;
- }
- else {
- internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
- }
- return super.getAllSuperclasses(type, internalFilter, comparator);
- }
-
- @Override
- public IType[] getAllSuperInterfaces(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- ITypeFilter internalFilter = null;
- if (filter == null) {
- internalFilter = m_primaryTypeFilter;
- }
- else {
- internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
- }
- return super.getAllSuperInterfaces(type, internalFilter, comparator);
- }
-
- @Override
- public IType[] getAllSupertypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- ITypeFilter internalFilter = null;
- if (filter == null) {
- internalFilter = m_primaryTypeFilter;
- }
- else {
- internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
- }
- return super.getAllSupertypes(type, internalFilter, comparator);
- }
-
- @Override
- public IType[] getAllTypes(ITypeFilter filter, Comparator<IType> comparator) {
- ITypeFilter internalFilter = null;
- if (filter == null) {
- internalFilter = m_primaryTypeFilter;
- }
- else {
- internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
- }
- return super.getAllTypes(internalFilter, comparator);
- }
-
- @Override
- public IType[] getSubclasses(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- ITypeFilter internalFilter = null;
- if (filter == null) {
- internalFilter = m_primaryTypeFilter;
- }
- else {
- internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
- }
- return super.getSubclasses(type, internalFilter, comparator);
- }
-
- @Override
- public IType[] getSubtypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- ITypeFilter internalFilter = null;
- if (filter == null) {
- internalFilter = m_primaryTypeFilter;
- }
- else {
- internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
- }
- return super.getSubtypes(type, internalFilter, comparator);
- }
-
- @Override
- public IType getSuperclass(IType type) {
- if (m_primaryTypeFilter.accept(type)) {
- return super.getSuperclass(type);
- }
- return null;
- }
-
- @Override
- public IType[] getSuperInterfaces(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- ITypeFilter internalFilter = null;
- if (filter == null) {
- internalFilter = m_primaryTypeFilter;
- }
- else {
- internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
- }
- return super.getSuperInterfaces(type, internalFilter, comparator);
- }
-
- @Override
- public IType[] getSupertypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- ITypeFilter internalFilter = null;
- if (filter == null) {
- internalFilter = m_primaryTypeFilter;
- }
- else {
- internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
- }
- return super.getSupertypes(type, internalFilter, comparator);
- }
-
- @Override
- public org.eclipse.scout.sdk.util.typecache.ITypeHierarchy combinedTypeHierarchy(IRegion additionalRegion) {
- if (additionalRegion == null) {
- throw new IllegalArgumentException("additional region can not be null");
- }
- IRegion region = JavaCore.newRegion();
- for (IJavaElement e : getAllTypes()) {
- region.add(e);
- }
- for (IJavaElement e : additionalRegion.getElements()) {
- region.add(e);
- }
- try {
- ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null);
- return new CombinedHierarchy(getType(), hierarchy);
-
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("could not create combined type hierarchy for '" + getType().getFullyQualifiedName() + "'.", e);
- return null;
- }
- }
-
- @Override
- public org.eclipse.scout.sdk.util.typecache.ITypeHierarchy combinedTypeHierarchy(IJavaElement... additionalElements) {
- if (additionalElements == null) {
- throw new IllegalArgumentException("additional region can not be null");
- }
- IRegion region = JavaCore.newRegion();
- for (IJavaElement e : getAllTypes()) {
- region.add(e);
- }
- for (IJavaElement e : additionalElements) {
- region.add(e);
- }
- try {
- ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null);
- return new CombinedHierarchy(getType(), hierarchy);
-
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("could not create combined type hierarchy for '" + getType().getFullyQualifiedName() + "'.", e);
- return null;
- }
- }
-
- private class P_PrimaryTypeFilter implements ITypeFilter {
- @Override
- public boolean accept(IType type) {
- return type.getDeclaringType() == null;
- }
- } // end class P_PrimaryFilter
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.internal.typecache;
+
+import java.util.Comparator;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IRegion;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.type.ITypeFilter;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
+
+/**
+ *
+ */
+public class PrimaryTypeTypeHierarchy extends CachedTypeHierarchy implements IPrimaryTypeTypeHierarchy {
+
+ private ITypeFilter m_primaryTypeFilter = new P_PrimaryTypeFilter();
+
+ /**
+ * @param type
+ */
+ public PrimaryTypeTypeHierarchy(IType type) {
+ super(type);
+ }
+
+ @Override
+ public IType[] getAllSubtypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ ITypeFilter internalFilter = null;
+ if (filter == null) {
+ internalFilter = m_primaryTypeFilter;
+ }
+ else {
+ internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
+ }
+ return super.getAllSubtypes(type, internalFilter, comparator);
+ }
+
+ @Override
+ public IType[] getAllClasses(ITypeFilter filter, Comparator<IType> comparator) {
+ ITypeFilter internalFilter = null;
+ if (filter == null) {
+ internalFilter = m_primaryTypeFilter;
+ }
+ else {
+ internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
+ }
+ return super.getAllClasses(internalFilter, comparator);
+ }
+
+ @Override
+ public IType[] getAllInterfaces(ITypeFilter filter, Comparator<IType> comparator) {
+ ITypeFilter internalFilter = null;
+ if (filter == null) {
+ internalFilter = m_primaryTypeFilter;
+ }
+ else {
+ internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
+ }
+ return super.getAllInterfaces(internalFilter, comparator);
+ }
+
+ @Override
+ public IType[] getAllSuperclasses(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ ITypeFilter internalFilter = null;
+ if (filter == null) {
+ internalFilter = m_primaryTypeFilter;
+ }
+ else {
+ internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
+ }
+ return super.getAllSuperclasses(type, internalFilter, comparator);
+ }
+
+ @Override
+ public IType[] getAllSuperInterfaces(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ ITypeFilter internalFilter = null;
+ if (filter == null) {
+ internalFilter = m_primaryTypeFilter;
+ }
+ else {
+ internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
+ }
+ return super.getAllSuperInterfaces(type, internalFilter, comparator);
+ }
+
+ @Override
+ public IType[] getAllSupertypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ ITypeFilter internalFilter = null;
+ if (filter == null) {
+ internalFilter = m_primaryTypeFilter;
+ }
+ else {
+ internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
+ }
+ return super.getAllSupertypes(type, internalFilter, comparator);
+ }
+
+ @Override
+ public IType[] getAllTypes(ITypeFilter filter, Comparator<IType> comparator) {
+ ITypeFilter internalFilter = null;
+ if (filter == null) {
+ internalFilter = m_primaryTypeFilter;
+ }
+ else {
+ internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
+ }
+ return super.getAllTypes(internalFilter, comparator);
+ }
+
+ @Override
+ public IType[] getSubclasses(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ ITypeFilter internalFilter = null;
+ if (filter == null) {
+ internalFilter = m_primaryTypeFilter;
+ }
+ else {
+ internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
+ }
+ return super.getSubclasses(type, internalFilter, comparator);
+ }
+
+ @Override
+ public IType[] getSubtypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ ITypeFilter internalFilter = null;
+ if (filter == null) {
+ internalFilter = m_primaryTypeFilter;
+ }
+ else {
+ internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
+ }
+ return super.getSubtypes(type, internalFilter, comparator);
+ }
+
+ @Override
+ public IType getSuperclass(IType type) {
+ if (m_primaryTypeFilter.accept(type)) {
+ return super.getSuperclass(type);
+ }
+ return null;
+ }
+
+ @Override
+ public IType[] getSuperInterfaces(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ ITypeFilter internalFilter = null;
+ if (filter == null) {
+ internalFilter = m_primaryTypeFilter;
+ }
+ else {
+ internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
+ }
+ return super.getSuperInterfaces(type, internalFilter, comparator);
+ }
+
+ @Override
+ public IType[] getSupertypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ ITypeFilter internalFilter = null;
+ if (filter == null) {
+ internalFilter = m_primaryTypeFilter;
+ }
+ else {
+ internalFilter = TypeFilters.getMultiTypeFilter(filter, m_primaryTypeFilter);
+ }
+ return super.getSupertypes(type, internalFilter, comparator);
+ }
+
+ @Override
+ public org.eclipse.scout.sdk.util.typecache.ITypeHierarchy combinedTypeHierarchy(IRegion additionalRegion) {
+ if (additionalRegion == null) {
+ throw new IllegalArgumentException("additional region can not be null");
+ }
+ IRegion region = JavaCore.newRegion();
+ for (IJavaElement e : getAllTypes()) {
+ region.add(e);
+ }
+ for (IJavaElement e : additionalRegion.getElements()) {
+ region.add(e);
+ }
+ try {
+ ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null);
+ return new CombinedHierarchy(getType(), hierarchy);
+
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("could not create combined type hierarchy for '" + getType().getFullyQualifiedName() + "'.", e);
+ return null;
+ }
+ }
+
+ @Override
+ public org.eclipse.scout.sdk.util.typecache.ITypeHierarchy combinedTypeHierarchy(IJavaElement... additionalElements) {
+ if (additionalElements == null) {
+ throw new IllegalArgumentException("additional region can not be null");
+ }
+ IRegion region = JavaCore.newRegion();
+ for (IJavaElement e : getAllTypes()) {
+ region.add(e);
+ }
+ for (IJavaElement e : additionalElements) {
+ region.add(e);
+ }
+ try {
+ ITypeHierarchy hierarchy = JavaCore.newTypeHierarchy(region, null, null);
+ return new CombinedHierarchy(getType(), hierarchy);
+
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("could not create combined type hierarchy for '" + getType().getFullyQualifiedName() + "'.", e);
+ return null;
+ }
+ }
+
+ private class P_PrimaryTypeFilter implements ITypeFilter {
+ @Override
+ public boolean accept(IType type) {
+ return type.getDeclaringType() == null;
+ }
+ } // end class P_PrimaryFilter
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/TypeCache.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/TypeCache.java
index ef1f200f3..2a8aa61d0 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/TypeCache.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/TypeCache.java
@@ -1,228 +1,228 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.internal.typecache;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.TreeMap;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.core.search.SearchMatch;
-import org.eclipse.jdt.core.search.SearchParticipant;
-import org.eclipse.jdt.core.search.SearchPattern;
-import org.eclipse.jdt.core.search.SearchRequestor;
-import org.eclipse.jdt.core.search.TypeDeclarationMatch;
-import org.eclipse.scout.commons.CompositeLong;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.ITypeCache;
-
-/**
- *
- */
-public final class TypeCache implements ITypeCache {
-
- private final static TypeCache INSTANCE = new TypeCache();
-
- private final Object m_cacheLock;
- private HashMap<String, List<IType>> m_cache;
- private P_ResourceListener m_resourceChangeListener;
-
- private final static Pattern DOLLAR_REMOVE_REGEX = Pattern.compile("\\$");
-
- public static TypeCache getInstance() {
- return INSTANCE;
- }
-
- private TypeCache() {
- m_cache = new HashMap<String, List<IType>>();
- m_cacheLock = new Object();
- m_resourceChangeListener = new P_ResourceListener();
- ResourcesPlugin.getWorkspace().addResourceChangeListener(m_resourceChangeListener);
- }
-
- @Override
- public void dispose() {
- if (m_cache != null) {
- clearCache();
- }
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(m_resourceChangeListener);
- m_resourceChangeListener = null;
- m_cache = null;
- }
-
- private void clearCache() {
- synchronized (m_cacheLock) {
- m_cache.clear();
- }
- }
-
- @Override
- public IType[] getAllCachedTypes() {
- ArrayList<IType> types = new ArrayList<IType>();
- synchronized (m_cacheLock) {
- for (List<IType> lists : m_cache.values()) {
- for (IType t : lists) {
- types.add(t);
- }
- }
- }
- return types.toArray(new IType[types.size()]);
- }
-
- @Override
- public IType getType(String fullyQualifiedName) {
- IType[] types = getTypes(fullyQualifiedName);
- if (types.length == 1) {
- return types[0];
- }
- else if (types.length > 1) {
- SdkUtilActivator.logWarning("found more than one type matches for '" + fullyQualifiedName + "' (matches: '" + types.length + "').");
- return types[0];
- }
- return null;
- }
-
- @Override
- public IType[] getTypes(String fullyQualifiedName) {
- if (StringUtility.isNullOrEmpty(fullyQualifiedName)) {
- return new IType[0];
- }
- fullyQualifiedName = DOLLAR_REMOVE_REGEX.matcher(fullyQualifiedName).replaceAll("\\.");
- List<IType> types = new ArrayList<IType>();
- synchronized (m_cacheLock) {
- types = m_cache.get(fullyQualifiedName);
- if (types == null) {
- types = new ArrayList<IType>();
- }
- // keep cache clean
- if (types.size() > 0) {
- Iterator<IType> it = types.iterator();
- while (it.hasNext()) {
- IType type = it.next();
- if (type == null || !type.exists()) {
- it.remove();
- }
- }
- }
- if (types.size() == 0) {
- m_cache.remove(fullyQualifiedName);
- }
- }
- if (types.size() == 0) {
- try {
- types = resolveType(fullyQualifiedName);
- }
- catch (CoreException e) {
- SdkUtilActivator.logError("error during resolving type '" + fullyQualifiedName + "'.", e);
- }
- synchronized (m_cacheLock) {
- if (types.size() > 0) {
- m_cache.put(fullyQualifiedName, types);
- }
- else {
- m_cache.remove(fullyQualifiedName);
- SdkUtilActivator.logWarning("could not resolve type '" + fullyQualifiedName + "'.");
- }
- }
- }
- return types.toArray(new IType[types.size()]);
- }
-
- @Override
- public boolean existsType(String fullyQualifiedName) {
- if (StringUtility.isNullOrEmpty(fullyQualifiedName)) {
- return false;
- }
- return TypeUtility.exists(getType(fullyQualifiedName));
- }
-
- private List<IType> resolveType(final String fqn) throws CoreException {
- if (StringUtility.isNullOrEmpty(fqn)) {
- return new ArrayList<IType>();
- }
-
- final TreeMap<CompositeLong, IType> matchList = new TreeMap<CompositeLong, IType>();
- //speed tuning, only search for last component of pattern, remaining checks are done in accept
- String fastPat = DOLLAR_REMOVE_REGEX.matcher(fqn).replaceAll("\\.");
- int i = fastPat.lastIndexOf('.');
- if (i >= 0) {
- fastPat = fastPat.substring(i + 1);
- }
- if (!StringUtility.hasText(fastPat)) {
- return new ArrayList<IType>();
- }
-
- new SearchEngine().search(
- SearchPattern.createPattern(fastPat, IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_EXACT_MATCH),
- new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},
- SearchEngine.createWorkspaceScope(),
- new SearchRequestor() {
- @Override
- public final void acceptSearchMatch(SearchMatch match) throws CoreException {
- if (match instanceof TypeDeclarationMatch) {
- TypeDeclarationMatch typeMatch = (TypeDeclarationMatch) match;
-
- IType t = (IType) typeMatch.getElement();
- if (t.exists() && t.getJavaProject().exists() && t.getFullyQualifiedName('.').indexOf(fqn) >= 0) {
- matchList.put(new CompositeLong(t.isBinary() ? 1 : 0, matchList.size()), t);
- }
- }
- }
- },
- null
- );
-
- return new ArrayList<IType>(matchList.values());
- }
-
- private class P_ResourceListener implements IResourceChangeListener {
- @Override
- public void resourceChanged(final IResourceChangeEvent event) {
- IResourceDelta delta = event.getDelta();
- try {
- if (delta != null) {
- delta.accept(new IResourceDeltaVisitor() {
- @Override
- public boolean visit(IResourceDelta visitDelta) {
- IResource resource = visitDelta.getResource();
- if (resource.getType() == IResource.PROJECT && ((visitDelta.getFlags() & (IResourceDelta.OPEN | IResourceDelta.REMOVED)) != 0)) {
- clearCache();
- return false;
- }
- return true;
- }
-
- });
- }
- else if (event.getType() == IResourceChangeEvent.PRE_DELETE && event.getResource().getType() == IResource.PROJECT) {
- clearCache();
- }
- }
- catch (CoreException e) {
- SdkUtilActivator.logWarning(e);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.internal.typecache;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.TreeMap;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.core.search.SearchMatch;
+import org.eclipse.jdt.core.search.SearchParticipant;
+import org.eclipse.jdt.core.search.SearchPattern;
+import org.eclipse.jdt.core.search.SearchRequestor;
+import org.eclipse.jdt.core.search.TypeDeclarationMatch;
+import org.eclipse.scout.commons.CompositeLong;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.ITypeCache;
+
+/**
+ *
+ */
+public final class TypeCache implements ITypeCache {
+
+ private final static TypeCache INSTANCE = new TypeCache();
+
+ private final Object m_cacheLock;
+ private HashMap<String, List<IType>> m_cache;
+ private P_ResourceListener m_resourceChangeListener;
+
+ private final static Pattern DOLLAR_REMOVE_REGEX = Pattern.compile("\\$");
+
+ public static TypeCache getInstance() {
+ return INSTANCE;
+ }
+
+ private TypeCache() {
+ m_cache = new HashMap<String, List<IType>>();
+ m_cacheLock = new Object();
+ m_resourceChangeListener = new P_ResourceListener();
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(m_resourceChangeListener);
+ }
+
+ @Override
+ public void dispose() {
+ if (m_cache != null) {
+ clearCache();
+ }
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(m_resourceChangeListener);
+ m_resourceChangeListener = null;
+ m_cache = null;
+ }
+
+ private void clearCache() {
+ synchronized (m_cacheLock) {
+ m_cache.clear();
+ }
+ }
+
+ @Override
+ public IType[] getAllCachedTypes() {
+ ArrayList<IType> types = new ArrayList<IType>();
+ synchronized (m_cacheLock) {
+ for (List<IType> lists : m_cache.values()) {
+ for (IType t : lists) {
+ types.add(t);
+ }
+ }
+ }
+ return types.toArray(new IType[types.size()]);
+ }
+
+ @Override
+ public IType getType(String fullyQualifiedName) {
+ IType[] types = getTypes(fullyQualifiedName);
+ if (types.length == 1) {
+ return types[0];
+ }
+ else if (types.length > 1) {
+ SdkUtilActivator.logWarning("found more than one type matches for '" + fullyQualifiedName + "' (matches: '" + types.length + "').");
+ return types[0];
+ }
+ return null;
+ }
+
+ @Override
+ public IType[] getTypes(String fullyQualifiedName) {
+ if (StringUtility.isNullOrEmpty(fullyQualifiedName)) {
+ return new IType[0];
+ }
+ fullyQualifiedName = DOLLAR_REMOVE_REGEX.matcher(fullyQualifiedName).replaceAll("\\.");
+ List<IType> types = new ArrayList<IType>();
+ synchronized (m_cacheLock) {
+ types = m_cache.get(fullyQualifiedName);
+ if (types == null) {
+ types = new ArrayList<IType>();
+ }
+ // keep cache clean
+ if (types.size() > 0) {
+ Iterator<IType> it = types.iterator();
+ while (it.hasNext()) {
+ IType type = it.next();
+ if (type == null || !type.exists()) {
+ it.remove();
+ }
+ }
+ }
+ if (types.size() == 0) {
+ m_cache.remove(fullyQualifiedName);
+ }
+ }
+ if (types.size() == 0) {
+ try {
+ types = resolveType(fullyQualifiedName);
+ }
+ catch (CoreException e) {
+ SdkUtilActivator.logError("error during resolving type '" + fullyQualifiedName + "'.", e);
+ }
+ synchronized (m_cacheLock) {
+ if (types.size() > 0) {
+ m_cache.put(fullyQualifiedName, types);
+ }
+ else {
+ m_cache.remove(fullyQualifiedName);
+ SdkUtilActivator.logWarning("could not resolve type '" + fullyQualifiedName + "'.");
+ }
+ }
+ }
+ return types.toArray(new IType[types.size()]);
+ }
+
+ @Override
+ public boolean existsType(String fullyQualifiedName) {
+ if (StringUtility.isNullOrEmpty(fullyQualifiedName)) {
+ return false;
+ }
+ return TypeUtility.exists(getType(fullyQualifiedName));
+ }
+
+ private List<IType> resolveType(final String fqn) throws CoreException {
+ if (StringUtility.isNullOrEmpty(fqn)) {
+ return new ArrayList<IType>();
+ }
+
+ final TreeMap<CompositeLong, IType> matchList = new TreeMap<CompositeLong, IType>();
+ //speed tuning, only search for last component of pattern, remaining checks are done in accept
+ String fastPat = DOLLAR_REMOVE_REGEX.matcher(fqn).replaceAll("\\.");
+ int i = fastPat.lastIndexOf('.');
+ if (i >= 0) {
+ fastPat = fastPat.substring(i + 1);
+ }
+ if (!StringUtility.hasText(fastPat)) {
+ return new ArrayList<IType>();
+ }
+
+ new SearchEngine().search(
+ SearchPattern.createPattern(fastPat, IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_EXACT_MATCH),
+ new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},
+ SearchEngine.createWorkspaceScope(),
+ new SearchRequestor() {
+ @Override
+ public final void acceptSearchMatch(SearchMatch match) throws CoreException {
+ if (match instanceof TypeDeclarationMatch) {
+ TypeDeclarationMatch typeMatch = (TypeDeclarationMatch) match;
+
+ IType t = (IType) typeMatch.getElement();
+ if (t.exists() && t.getJavaProject().exists() && t.getFullyQualifiedName('.').indexOf(fqn) >= 0) {
+ matchList.put(new CompositeLong(t.isBinary() ? 1 : 0, matchList.size()), t);
+ }
+ }
+ }
+ },
+ null
+ );
+
+ return new ArrayList<IType>(matchList.values());
+ }
+
+ private class P_ResourceListener implements IResourceChangeListener {
+ @Override
+ public void resourceChanged(final IResourceChangeEvent event) {
+ IResourceDelta delta = event.getDelta();
+ try {
+ if (delta != null) {
+ delta.accept(new IResourceDeltaVisitor() {
+ @Override
+ public boolean visit(IResourceDelta visitDelta) {
+ IResource resource = visitDelta.getResource();
+ if (resource.getType() == IResource.PROJECT && ((visitDelta.getFlags() & (IResourceDelta.OPEN | IResourceDelta.REMOVED)) != 0)) {
+ clearCache();
+ return false;
+ }
+ return true;
+ }
+
+ });
+ }
+ else if (event.getType() == IResourceChangeEvent.PRE_DELETE && event.getResource().getType() == IResource.PROJECT) {
+ clearCache();
+ }
+ }
+ catch (CoreException e) {
+ SdkUtilActivator.logWarning(e);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/TypeHierarchy.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/TypeHierarchy.java
index 278c4d26f..0f4eacd0e 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/TypeHierarchy.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/TypeHierarchy.java
@@ -1,480 +1,480 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.internal.typecache;
-
-import java.util.Arrays;
-import java.util.Comparator;
-import java.util.HashSet;
-import java.util.TreeSet;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.scout.sdk.util.type.ITypeFilter;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-
-/**
- *
- */
-public class TypeHierarchy implements org.eclipse.scout.sdk.util.typecache.ITypeHierarchy {
-
- private ITypeHierarchy m_hierarchy;
- private final IType m_type;
-
- TypeHierarchy(IType type) {
- this(type, null);
- }
-
- TypeHierarchy(IType type, ITypeHierarchy jdtHierarchy) {
- setJdtHierarchy(jdtHierarchy);
- m_type = type;
-
- }
-
- @Override
- public ITypeHierarchy getJdtHierarchy() {
- return m_hierarchy;
- }
-
- protected void setJdtHierarchy(ITypeHierarchy hierarchy) {
- m_hierarchy = hierarchy;
- }
-
- @Override
- public boolean contains(IType type) {
- return contains(type, null);
- }
-
- public boolean contains(IType type, IProgressMonitor monitor) {
- revalidate(monitor);
- return TypeUtility.exists(type) && m_hierarchy.contains(type);
- }
-
- void revalidate(IProgressMonitor monitor) {
- // void here
- }
-
- @Override
- public IType getType() {
- return m_type;
- }
-
- /**
- * @return
- * @see org.eclipse.jdt.core.ITypeHierarchy#getAllClasses()
- */
- @Override
- public IType[] getAllClasses() {
- return getAllClasses(null);
- }
-
- @Override
- public IType[] getAllClasses(ITypeFilter filter) {
- return getAllClasses(filter, null);
- }
-
- @Override
- public IType[] getAllClasses(ITypeFilter filter, Comparator<IType> comparator) {
- revalidate(null);
- IType[] classes = m_hierarchy.getAllClasses();
- HashSet<IType> unsortedResult = new HashSet<IType>();
- for (IType candidate : classes) {
- if (TypeUtility.exists(candidate)) {
- if (filter == null || filter.accept(candidate)) {
- unsortedResult.add(candidate);
- }
- }
- }
- if (comparator != null) {
- TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
- sortedResult.addAll(unsortedResult);
- return sortedResult.toArray(new IType[sortedResult.size()]);
- }
- else {
- return unsortedResult.toArray(new IType[unsortedResult.size()]);
- }
- }
-
- @Override
- public IType[] getAllInterfaces() {
- return getAllInterfaces(null);
- }
-
- @Override
- public IType[] getAllInterfaces(ITypeFilter filter) {
- return getAllInterfaces(filter, null);
- }
-
- @Override
- public IType[] getAllInterfaces(ITypeFilter filter, Comparator<IType> comparator) {
- revalidate(null);
- IType[] types = m_hierarchy.getAllInterfaces();
- HashSet<IType> unsortedResult = new HashSet<IType>();
- for (IType candidate : types) {
- if (TypeUtility.exists(candidate)) {
- if (filter == null || filter.accept(candidate)) {
- unsortedResult.add(candidate);
- }
- }
- }
- if (comparator != null) {
- TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
- sortedResult.addAll(unsortedResult);
- return sortedResult.toArray(new IType[sortedResult.size()]);
- }
- else {
- return unsortedResult.toArray(new IType[unsortedResult.size()]);
- }
- }
-
- @Override
- public boolean isSubtype(IType type, IType potentialSubtype) {
- HashSet<IType> allSubTypes = new HashSet<IType>(Arrays.asList(getAllSubtypes(type)));
- allSubTypes.add(type);
- return allSubTypes.contains(potentialSubtype);
- }
-
- @Override
- public boolean containsInSubhierarchy(IType type, IType[] potentialSubtypes) {
- HashSet<IType> allSubTypes = new HashSet<IType>(Arrays.asList(getAllSubtypes(type)));
- allSubTypes.add(type);
- for (IType pt : potentialSubtypes) {
- if (allSubTypes.contains(pt)) {
- return true;
- }
- }
- return false;
-
- }
-
- @Override
- public IType[] getAllSubtypes(IType type) {
- return getAllSubtypes(type, null);
- }
-
- @Override
- public IType[] getAllSubtypes(IType type, ITypeFilter filter) {
- return getAllSubtypes(type, filter, null);
- }
-
- @Override
- public IType[] getAllSubtypes(IType type, ITypeFilter filter, Comparator<IType> typeComparator) {
- revalidate(null);
- IType[] subtypes = m_hierarchy.getAllSubtypes(type);
- HashSet<IType> unsortedResult = new HashSet<IType>();
- for (IType candidate : subtypes) {
- if (TypeUtility.exists(candidate)) {
- if (filter == null || filter.accept(candidate)) {
- unsortedResult.add(candidate);
- }
- }
- }
- if (typeComparator != null) {
- TreeSet<IType> sortedResult = new TreeSet<IType>(typeComparator);
- sortedResult.addAll(unsortedResult);
- return sortedResult.toArray(new IType[sortedResult.size()]);
- }
- else {
- return unsortedResult.toArray(new IType[unsortedResult.size()]);
- }
- }
-
- @Override
- public IType[] getAllSuperclasses(IType type) {
- return getAllSuperclasses(type, null);
- }
-
- @Override
- public IType[] getAllSuperclasses(IType type, ITypeFilter filter) {
- return getAllSuperclasses(type, filter, null);
- }
-
- @Override
- public IType[] getAllSuperclasses(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- revalidate(null);
- IType[] types = m_hierarchy.getAllSuperclasses(type);
- HashSet<IType> unsortedResult = new HashSet<IType>();
- for (IType candidate : types) {
- if (TypeUtility.exists(candidate)) {
- if (filter == null || filter.accept(candidate)) {
- unsortedResult.add(candidate);
- }
- }
- }
- if (comparator != null) {
- TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
- sortedResult.addAll(unsortedResult);
- return sortedResult.toArray(new IType[sortedResult.size()]);
- }
- else {
- return unsortedResult.toArray(new IType[unsortedResult.size()]);
- }
- }
-
- @Override
- public IType[] getAllSuperInterfaces(IType type) {
- return getAllSuperInterfaces(type, null);
- }
-
- @Override
- public IType[] getAllSuperInterfaces(IType type, ITypeFilter filter) {
- return getAllSuperInterfaces(type, filter, null);
- }
-
- @Override
- public IType[] getAllSuperInterfaces(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- revalidate(null);
- IType[] types = m_hierarchy.getAllSuperInterfaces(type);
- HashSet<IType> unsortedResult = new HashSet<IType>();
- for (IType candidate : types) {
- if (TypeUtility.exists(candidate)) {
- if (filter == null || filter.accept(candidate)) {
- unsortedResult.add(candidate);
- }
- }
- }
- if (comparator != null) {
- TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
- sortedResult.addAll(unsortedResult);
- return sortedResult.toArray(new IType[sortedResult.size()]);
- }
- else {
- return unsortedResult.toArray(new IType[unsortedResult.size()]);
- }
- }
-
- @Override
- public IType[] getAllSupertypes(IType type) {
- return getAllSupertypes(type, null);
- }
-
- @Override
- public IType[] getAllSupertypes(IType type, ITypeFilter filter) {
- return getAllSupertypes(type, filter, null);
- }
-
- @Override
- public IType[] getAllSupertypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- revalidate(null);
- IType[] types = m_hierarchy.getAllSupertypes(type);
- HashSet<IType> unsortedResult = new HashSet<IType>();
- for (IType candidate : types) {
- if (TypeUtility.exists(candidate)) {
- if (filter == null || filter.accept(candidate)) {
- unsortedResult.add(candidate);
- }
- }
- }
- if (comparator != null) {
- TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
- sortedResult.addAll(unsortedResult);
- return sortedResult.toArray(new IType[sortedResult.size()]);
- }
- else {
- return unsortedResult.toArray(new IType[unsortedResult.size()]);
- }
- }
-
- /**
- * @return
- * @see org.eclipse.jdt.core.ITypeHierarchy#getAllTypes()
- */
- @Override
- public IType[] getAllTypes() {
- return getAllTypes(null);
- }
-
- @Override
- public IType[] getAllTypes(ITypeFilter filter) {
- return getAllTypes(filter, null);
- }
-
- @Override
- public IType[] getAllTypes(ITypeFilter filter, Comparator<IType> comparator) {
- revalidate(null);
- IType[] types = m_hierarchy.getAllTypes();
- HashSet<IType> unsortedResult = new HashSet<IType>();
- for (IType candidate : types) {
- if (TypeUtility.exists(candidate)) {
- if (filter == null || filter.accept(candidate)) {
- unsortedResult.add(candidate);
- }
- }
- }
- if (comparator != null) {
- TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
- sortedResult.addAll(unsortedResult);
- return sortedResult.toArray(new IType[sortedResult.size()]);
- }
- else {
- return unsortedResult.toArray(new IType[unsortedResult.size()]);
- }
- }
-
- /**
- * @param type
- * @return
- * @see org.eclipse.jdt.core.ITypeHierarchy#getSubclasses(org.eclipse.jdt.core.IType)
- */
- @Override
- public IType[] getSubclasses(IType type) {
- return getSubclasses(type, null);
- }
-
- @Override
- public IType[] getSubclasses(IType type, ITypeFilter filter) {
- return getSubclasses(type, filter, null);
- }
-
- @Override
- public IType[] getSubclasses(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- revalidate(null);
- IType[] types = m_hierarchy.getSubclasses(type);
- HashSet<IType> unsortedResult = new HashSet<IType>();
- for (IType candidate : types) {
- if (TypeUtility.exists(candidate)) {
- if (filter == null || filter.accept(candidate)) {
- unsortedResult.add(candidate);
- }
- }
- }
- if (comparator != null) {
- TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
- sortedResult.addAll(unsortedResult);
- return sortedResult.toArray(new IType[sortedResult.size()]);
- }
- else {
- return unsortedResult.toArray(new IType[unsortedResult.size()]);
- }
- }
-
- @Override
- public IType[] getSubtypes(IType type) {
- return getSubtypes(type, null);
- }
-
- @Override
- public IType[] getSubtypes(IType type, ITypeFilter filter) {
- return getSubtypes(type, filter, null);
- }
-
- @Override
- public IType[] getSubtypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- revalidate(null);
- IType[] types = m_hierarchy.getSubtypes(type);
- HashSet<IType> unsortedResult = new HashSet<IType>();
- for (IType candidate : types) {
- if (TypeUtility.exists(candidate)) {
- if (filter == null || filter.accept(candidate)) {
- unsortedResult.add(candidate);
- }
- }
- }
- if (comparator != null) {
- TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
- sortedResult.addAll(unsortedResult);
- return sortedResult.toArray(new IType[sortedResult.size()]);
- }
- else {
- return unsortedResult.toArray(new IType[unsortedResult.size()]);
- }
- }
-
- /**
- * @param type
- * @return
- * @see org.eclipse.jdt.core.ITypeHierarchy#getSuperclass(org.eclipse.jdt.core.IType)
- */
- @Override
- public IType getSuperclass(IType type) {
- revalidate(null);
- IType superclass = m_hierarchy.getSuperclass(type);
- if (!TypeUtility.exists(superclass)) {
- superclass = null;
- }
- return superclass;
- }
-
- /**
- * @param type
- * @return
- * @see org.eclipse.jdt.core.ITypeHierarchy#getSuperInterfaces(org.eclipse.jdt.core.IType)
- */
- @Override
- public IType[] getSuperInterfaces(IType type) {
- return getSuperInterfaces(type, null);
- }
-
- @Override
- public IType[] getSuperInterfaces(IType type, ITypeFilter filter) {
- return getSuperInterfaces(type, filter, null);
- }
-
- @Override
- public IType[] getSuperInterfaces(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- revalidate(null);
- IType[] types = m_hierarchy.getSuperInterfaces(type);
- HashSet<IType> unsortedResult = new HashSet<IType>();
- for (IType candidate : types) {
- if (TypeUtility.exists(candidate)) {
- if (filter == null || filter.accept(candidate)) {
- unsortedResult.add(candidate);
- }
- }
- }
- if (comparator != null) {
- TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
- sortedResult.addAll(unsortedResult);
- return sortedResult.toArray(new IType[sortedResult.size()]);
- }
- else {
- return unsortedResult.toArray(new IType[unsortedResult.size()]);
- }
- }
-
- /**
- * @param type
- * @return
- * @see org.eclipse.jdt.core.ITypeHierarchy#getSupertypes(org.eclipse.jdt.core.IType)
- */
- @Override
- public IType[] getSupertypes(IType type) {
- return getSupertypes(type, null);
- }
-
- @Override
- public IType[] getSupertypes(IType type, ITypeFilter filter) {
- return getSupertypes(type, filter, null);
- }
-
- @Override
- public IType[] getSupertypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- revalidate(null);
- IType[] types = m_hierarchy.getSupertypes(type);
- HashSet<IType> unsortedResult = new HashSet<IType>();
- for (IType candidate : types) {
- if (TypeUtility.exists(candidate)) {
- if (filter == null || filter.accept(candidate)) {
- unsortedResult.add(candidate);
- }
- }
- }
- if (comparator != null) {
- TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
- sortedResult.addAll(unsortedResult);
- return sortedResult.toArray(new IType[sortedResult.size()]);
- }
- else {
- return unsortedResult.toArray(new IType[unsortedResult.size()]);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.internal.typecache;
+
+import java.util.Arrays;
+import java.util.Comparator;
+import java.util.HashSet;
+import java.util.TreeSet;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.scout.sdk.util.type.ITypeFilter;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+/**
+ *
+ */
+public class TypeHierarchy implements org.eclipse.scout.sdk.util.typecache.ITypeHierarchy {
+
+ private ITypeHierarchy m_hierarchy;
+ private final IType m_type;
+
+ TypeHierarchy(IType type) {
+ this(type, null);
+ }
+
+ TypeHierarchy(IType type, ITypeHierarchy jdtHierarchy) {
+ setJdtHierarchy(jdtHierarchy);
+ m_type = type;
+
+ }
+
+ @Override
+ public ITypeHierarchy getJdtHierarchy() {
+ return m_hierarchy;
+ }
+
+ protected void setJdtHierarchy(ITypeHierarchy hierarchy) {
+ m_hierarchy = hierarchy;
+ }
+
+ @Override
+ public boolean contains(IType type) {
+ return contains(type, null);
+ }
+
+ public boolean contains(IType type, IProgressMonitor monitor) {
+ revalidate(monitor);
+ return TypeUtility.exists(type) && m_hierarchy.contains(type);
+ }
+
+ void revalidate(IProgressMonitor monitor) {
+ // void here
+ }
+
+ @Override
+ public IType getType() {
+ return m_type;
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getAllClasses()
+ */
+ @Override
+ public IType[] getAllClasses() {
+ return getAllClasses(null);
+ }
+
+ @Override
+ public IType[] getAllClasses(ITypeFilter filter) {
+ return getAllClasses(filter, null);
+ }
+
+ @Override
+ public IType[] getAllClasses(ITypeFilter filter, Comparator<IType> comparator) {
+ revalidate(null);
+ IType[] classes = m_hierarchy.getAllClasses();
+ HashSet<IType> unsortedResult = new HashSet<IType>();
+ for (IType candidate : classes) {
+ if (TypeUtility.exists(candidate)) {
+ if (filter == null || filter.accept(candidate)) {
+ unsortedResult.add(candidate);
+ }
+ }
+ }
+ if (comparator != null) {
+ TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
+ sortedResult.addAll(unsortedResult);
+ return sortedResult.toArray(new IType[sortedResult.size()]);
+ }
+ else {
+ return unsortedResult.toArray(new IType[unsortedResult.size()]);
+ }
+ }
+
+ @Override
+ public IType[] getAllInterfaces() {
+ return getAllInterfaces(null);
+ }
+
+ @Override
+ public IType[] getAllInterfaces(ITypeFilter filter) {
+ return getAllInterfaces(filter, null);
+ }
+
+ @Override
+ public IType[] getAllInterfaces(ITypeFilter filter, Comparator<IType> comparator) {
+ revalidate(null);
+ IType[] types = m_hierarchy.getAllInterfaces();
+ HashSet<IType> unsortedResult = new HashSet<IType>();
+ for (IType candidate : types) {
+ if (TypeUtility.exists(candidate)) {
+ if (filter == null || filter.accept(candidate)) {
+ unsortedResult.add(candidate);
+ }
+ }
+ }
+ if (comparator != null) {
+ TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
+ sortedResult.addAll(unsortedResult);
+ return sortedResult.toArray(new IType[sortedResult.size()]);
+ }
+ else {
+ return unsortedResult.toArray(new IType[unsortedResult.size()]);
+ }
+ }
+
+ @Override
+ public boolean isSubtype(IType type, IType potentialSubtype) {
+ HashSet<IType> allSubTypes = new HashSet<IType>(Arrays.asList(getAllSubtypes(type)));
+ allSubTypes.add(type);
+ return allSubTypes.contains(potentialSubtype);
+ }
+
+ @Override
+ public boolean containsInSubhierarchy(IType type, IType[] potentialSubtypes) {
+ HashSet<IType> allSubTypes = new HashSet<IType>(Arrays.asList(getAllSubtypes(type)));
+ allSubTypes.add(type);
+ for (IType pt : potentialSubtypes) {
+ if (allSubTypes.contains(pt)) {
+ return true;
+ }
+ }
+ return false;
+
+ }
+
+ @Override
+ public IType[] getAllSubtypes(IType type) {
+ return getAllSubtypes(type, null);
+ }
+
+ @Override
+ public IType[] getAllSubtypes(IType type, ITypeFilter filter) {
+ return getAllSubtypes(type, filter, null);
+ }
+
+ @Override
+ public IType[] getAllSubtypes(IType type, ITypeFilter filter, Comparator<IType> typeComparator) {
+ revalidate(null);
+ IType[] subtypes = m_hierarchy.getAllSubtypes(type);
+ HashSet<IType> unsortedResult = new HashSet<IType>();
+ for (IType candidate : subtypes) {
+ if (TypeUtility.exists(candidate)) {
+ if (filter == null || filter.accept(candidate)) {
+ unsortedResult.add(candidate);
+ }
+ }
+ }
+ if (typeComparator != null) {
+ TreeSet<IType> sortedResult = new TreeSet<IType>(typeComparator);
+ sortedResult.addAll(unsortedResult);
+ return sortedResult.toArray(new IType[sortedResult.size()]);
+ }
+ else {
+ return unsortedResult.toArray(new IType[unsortedResult.size()]);
+ }
+ }
+
+ @Override
+ public IType[] getAllSuperclasses(IType type) {
+ return getAllSuperclasses(type, null);
+ }
+
+ @Override
+ public IType[] getAllSuperclasses(IType type, ITypeFilter filter) {
+ return getAllSuperclasses(type, filter, null);
+ }
+
+ @Override
+ public IType[] getAllSuperclasses(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ revalidate(null);
+ IType[] types = m_hierarchy.getAllSuperclasses(type);
+ HashSet<IType> unsortedResult = new HashSet<IType>();
+ for (IType candidate : types) {
+ if (TypeUtility.exists(candidate)) {
+ if (filter == null || filter.accept(candidate)) {
+ unsortedResult.add(candidate);
+ }
+ }
+ }
+ if (comparator != null) {
+ TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
+ sortedResult.addAll(unsortedResult);
+ return sortedResult.toArray(new IType[sortedResult.size()]);
+ }
+ else {
+ return unsortedResult.toArray(new IType[unsortedResult.size()]);
+ }
+ }
+
+ @Override
+ public IType[] getAllSuperInterfaces(IType type) {
+ return getAllSuperInterfaces(type, null);
+ }
+
+ @Override
+ public IType[] getAllSuperInterfaces(IType type, ITypeFilter filter) {
+ return getAllSuperInterfaces(type, filter, null);
+ }
+
+ @Override
+ public IType[] getAllSuperInterfaces(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ revalidate(null);
+ IType[] types = m_hierarchy.getAllSuperInterfaces(type);
+ HashSet<IType> unsortedResult = new HashSet<IType>();
+ for (IType candidate : types) {
+ if (TypeUtility.exists(candidate)) {
+ if (filter == null || filter.accept(candidate)) {
+ unsortedResult.add(candidate);
+ }
+ }
+ }
+ if (comparator != null) {
+ TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
+ sortedResult.addAll(unsortedResult);
+ return sortedResult.toArray(new IType[sortedResult.size()]);
+ }
+ else {
+ return unsortedResult.toArray(new IType[unsortedResult.size()]);
+ }
+ }
+
+ @Override
+ public IType[] getAllSupertypes(IType type) {
+ return getAllSupertypes(type, null);
+ }
+
+ @Override
+ public IType[] getAllSupertypes(IType type, ITypeFilter filter) {
+ return getAllSupertypes(type, filter, null);
+ }
+
+ @Override
+ public IType[] getAllSupertypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ revalidate(null);
+ IType[] types = m_hierarchy.getAllSupertypes(type);
+ HashSet<IType> unsortedResult = new HashSet<IType>();
+ for (IType candidate : types) {
+ if (TypeUtility.exists(candidate)) {
+ if (filter == null || filter.accept(candidate)) {
+ unsortedResult.add(candidate);
+ }
+ }
+ }
+ if (comparator != null) {
+ TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
+ sortedResult.addAll(unsortedResult);
+ return sortedResult.toArray(new IType[sortedResult.size()]);
+ }
+ else {
+ return unsortedResult.toArray(new IType[unsortedResult.size()]);
+ }
+ }
+
+ /**
+ * @return
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getAllTypes()
+ */
+ @Override
+ public IType[] getAllTypes() {
+ return getAllTypes(null);
+ }
+
+ @Override
+ public IType[] getAllTypes(ITypeFilter filter) {
+ return getAllTypes(filter, null);
+ }
+
+ @Override
+ public IType[] getAllTypes(ITypeFilter filter, Comparator<IType> comparator) {
+ revalidate(null);
+ IType[] types = m_hierarchy.getAllTypes();
+ HashSet<IType> unsortedResult = new HashSet<IType>();
+ for (IType candidate : types) {
+ if (TypeUtility.exists(candidate)) {
+ if (filter == null || filter.accept(candidate)) {
+ unsortedResult.add(candidate);
+ }
+ }
+ }
+ if (comparator != null) {
+ TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
+ sortedResult.addAll(unsortedResult);
+ return sortedResult.toArray(new IType[sortedResult.size()]);
+ }
+ else {
+ return unsortedResult.toArray(new IType[unsortedResult.size()]);
+ }
+ }
+
+ /**
+ * @param type
+ * @return
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getSubclasses(org.eclipse.jdt.core.IType)
+ */
+ @Override
+ public IType[] getSubclasses(IType type) {
+ return getSubclasses(type, null);
+ }
+
+ @Override
+ public IType[] getSubclasses(IType type, ITypeFilter filter) {
+ return getSubclasses(type, filter, null);
+ }
+
+ @Override
+ public IType[] getSubclasses(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ revalidate(null);
+ IType[] types = m_hierarchy.getSubclasses(type);
+ HashSet<IType> unsortedResult = new HashSet<IType>();
+ for (IType candidate : types) {
+ if (TypeUtility.exists(candidate)) {
+ if (filter == null || filter.accept(candidate)) {
+ unsortedResult.add(candidate);
+ }
+ }
+ }
+ if (comparator != null) {
+ TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
+ sortedResult.addAll(unsortedResult);
+ return sortedResult.toArray(new IType[sortedResult.size()]);
+ }
+ else {
+ return unsortedResult.toArray(new IType[unsortedResult.size()]);
+ }
+ }
+
+ @Override
+ public IType[] getSubtypes(IType type) {
+ return getSubtypes(type, null);
+ }
+
+ @Override
+ public IType[] getSubtypes(IType type, ITypeFilter filter) {
+ return getSubtypes(type, filter, null);
+ }
+
+ @Override
+ public IType[] getSubtypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ revalidate(null);
+ IType[] types = m_hierarchy.getSubtypes(type);
+ HashSet<IType> unsortedResult = new HashSet<IType>();
+ for (IType candidate : types) {
+ if (TypeUtility.exists(candidate)) {
+ if (filter == null || filter.accept(candidate)) {
+ unsortedResult.add(candidate);
+ }
+ }
+ }
+ if (comparator != null) {
+ TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
+ sortedResult.addAll(unsortedResult);
+ return sortedResult.toArray(new IType[sortedResult.size()]);
+ }
+ else {
+ return unsortedResult.toArray(new IType[unsortedResult.size()]);
+ }
+ }
+
+ /**
+ * @param type
+ * @return
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getSuperclass(org.eclipse.jdt.core.IType)
+ */
+ @Override
+ public IType getSuperclass(IType type) {
+ revalidate(null);
+ IType superclass = m_hierarchy.getSuperclass(type);
+ if (!TypeUtility.exists(superclass)) {
+ superclass = null;
+ }
+ return superclass;
+ }
+
+ /**
+ * @param type
+ * @return
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getSuperInterfaces(org.eclipse.jdt.core.IType)
+ */
+ @Override
+ public IType[] getSuperInterfaces(IType type) {
+ return getSuperInterfaces(type, null);
+ }
+
+ @Override
+ public IType[] getSuperInterfaces(IType type, ITypeFilter filter) {
+ return getSuperInterfaces(type, filter, null);
+ }
+
+ @Override
+ public IType[] getSuperInterfaces(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ revalidate(null);
+ IType[] types = m_hierarchy.getSuperInterfaces(type);
+ HashSet<IType> unsortedResult = new HashSet<IType>();
+ for (IType candidate : types) {
+ if (TypeUtility.exists(candidate)) {
+ if (filter == null || filter.accept(candidate)) {
+ unsortedResult.add(candidate);
+ }
+ }
+ }
+ if (comparator != null) {
+ TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
+ sortedResult.addAll(unsortedResult);
+ return sortedResult.toArray(new IType[sortedResult.size()]);
+ }
+ else {
+ return unsortedResult.toArray(new IType[unsortedResult.size()]);
+ }
+ }
+
+ /**
+ * @param type
+ * @return
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getSupertypes(org.eclipse.jdt.core.IType)
+ */
+ @Override
+ public IType[] getSupertypes(IType type) {
+ return getSupertypes(type, null);
+ }
+
+ @Override
+ public IType[] getSupertypes(IType type, ITypeFilter filter) {
+ return getSupertypes(type, filter, null);
+ }
+
+ @Override
+ public IType[] getSupertypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ revalidate(null);
+ IType[] types = m_hierarchy.getSupertypes(type);
+ HashSet<IType> unsortedResult = new HashSet<IType>();
+ for (IType candidate : types) {
+ if (TypeUtility.exists(candidate)) {
+ if (filter == null || filter.accept(candidate)) {
+ unsortedResult.add(candidate);
+ }
+ }
+ }
+ if (comparator != null) {
+ TreeSet<IType> sortedResult = new TreeSet<IType>(comparator);
+ sortedResult.addAll(unsortedResult);
+ return sortedResult.toArray(new IType[sortedResult.size()]);
+ }
+ else {
+ return unsortedResult.toArray(new IType[unsortedResult.size()]);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/WorkingCopyManager.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/WorkingCopyManager.java
index 77242e797..db8406103 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/WorkingCopyManager.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/internal/typecache/WorkingCopyManager.java
@@ -1,118 +1,118 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.internal.typecache;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.internal.compiler.SourceElementParser;
-import org.eclipse.jdt.internal.core.JavaModelManager;
-import org.eclipse.jdt.internal.core.search.indexing.IndexManager;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.jdt.JdtUtility;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-
-/**
- * <h3>WorkingCopyManager</h3> ...
- */
-@SuppressWarnings("restriction")
-public class WorkingCopyManager implements IWorkingCopyManager {
-
- private Object LOCK = new Object();
- private List<ICompilationUnit> m_workingCopies = new ArrayList<ICompilationUnit>();
-
- public WorkingCopyManager() {
- }
-
- @Override
- public void register(ICompilationUnit icu, IProgressMonitor monitor) throws JavaModelException {
- if (icu.isReadOnly()) {
- throw new IllegalArgumentException("try to get a working copy of the read only icu '" + icu.getElementName() + "'.");
- }
- synchronized (LOCK) {
- if (!m_workingCopies.contains(icu)) {
- icu.becomeWorkingCopy(monitor);
- m_workingCopies.add(icu);
- }
- }
- }
-
- @Override
- public void unregisterAll(IProgressMonitor monitor) {
- synchronized (LOCK) {
- for (Iterator<ICompilationUnit> it = m_workingCopies.iterator(); it.hasNext();) {
- releaseCompilationUnit(it.next(), monitor);
- }
- m_workingCopies.clear();
- }
- }
-
- @Override
- public void unregister(ICompilationUnit icu, IProgressMonitor monitor) {
- synchronized (LOCK) {
- if (m_workingCopies.remove(icu)) {
- releaseCompilationUnit(icu, monitor);
- }
- }
- }
-
- private void releaseCompilationUnit(ICompilationUnit icu, IProgressMonitor monitor) {
- try {
- if (!monitor.isCanceled()) {
- icu.commitWorkingCopy(true, monitor);
- indexCompilationUnitSync(icu);
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("could not commit working copy '" + icu.getElementName() + "'", e);
- }
- finally {
- try {
- icu.discardWorkingCopy();
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("could not discard working copy '" + icu.getElementName() + "'", e);
- }
- }
- }
-
- private void indexCompilationUnitSync(ICompilationUnit icu) {
- IJavaProject jp = icu.getJavaProject();
- IndexManager im = JavaModelManager.getIndexManager();
- IPath containerPath = jp.getProject().getFullPath();
-
- SourceElementParser parser = im.getSourceElementParser(jp, null/*requestor will be set by indexer*/);
- im.addSource((IFile) icu.getResource(), containerPath, parser);
- JdtUtility.waitForJobFamily(containerPath.toString());
- }
-
- @Override
- public CompilationUnit reconcile(ICompilationUnit icu, IProgressMonitor monitor) throws CoreException {
- synchronized (LOCK) {
- if (!m_workingCopies.contains(icu)) {
- throw new CoreException(new ScoutStatus("compilation unit " + icu.getElementName() + " has not been registered"));
- }
- return icu.reconcile(AST.JLS3, true, icu.getOwner(), monitor);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.internal.typecache;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.internal.compiler.SourceElementParser;
+import org.eclipse.jdt.internal.core.JavaModelManager;
+import org.eclipse.jdt.internal.core.search.indexing.IndexManager;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.jdt.JdtUtility;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+
+/**
+ * <h3>WorkingCopyManager</h3> ...
+ */
+@SuppressWarnings("restriction")
+public class WorkingCopyManager implements IWorkingCopyManager {
+
+ private Object LOCK = new Object();
+ private List<ICompilationUnit> m_workingCopies = new ArrayList<ICompilationUnit>();
+
+ public WorkingCopyManager() {
+ }
+
+ @Override
+ public void register(ICompilationUnit icu, IProgressMonitor monitor) throws JavaModelException {
+ if (icu.isReadOnly()) {
+ throw new IllegalArgumentException("try to get a working copy of the read only icu '" + icu.getElementName() + "'.");
+ }
+ synchronized (LOCK) {
+ if (!m_workingCopies.contains(icu)) {
+ icu.becomeWorkingCopy(monitor);
+ m_workingCopies.add(icu);
+ }
+ }
+ }
+
+ @Override
+ public void unregisterAll(IProgressMonitor monitor) {
+ synchronized (LOCK) {
+ for (Iterator<ICompilationUnit> it = m_workingCopies.iterator(); it.hasNext();) {
+ releaseCompilationUnit(it.next(), monitor);
+ }
+ m_workingCopies.clear();
+ }
+ }
+
+ @Override
+ public void unregister(ICompilationUnit icu, IProgressMonitor monitor) {
+ synchronized (LOCK) {
+ if (m_workingCopies.remove(icu)) {
+ releaseCompilationUnit(icu, monitor);
+ }
+ }
+ }
+
+ private void releaseCompilationUnit(ICompilationUnit icu, IProgressMonitor monitor) {
+ try {
+ if (!monitor.isCanceled()) {
+ icu.commitWorkingCopy(true, monitor);
+ indexCompilationUnitSync(icu);
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("could not commit working copy '" + icu.getElementName() + "'", e);
+ }
+ finally {
+ try {
+ icu.discardWorkingCopy();
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("could not discard working copy '" + icu.getElementName() + "'", e);
+ }
+ }
+ }
+
+ private void indexCompilationUnitSync(ICompilationUnit icu) {
+ IJavaProject jp = icu.getJavaProject();
+ IndexManager im = JavaModelManager.getIndexManager();
+ IPath containerPath = jp.getProject().getFullPath();
+
+ SourceElementParser parser = im.getSourceElementParser(jp, null/*requestor will be set by indexer*/);
+ im.addSource((IFile) icu.getResource(), containerPath, parser);
+ JdtUtility.waitForJobFamily(containerPath.toString());
+ }
+
+ @Override
+ public CompilationUnit reconcile(ICompilationUnit icu, IProgressMonitor monitor) throws CoreException {
+ synchronized (LOCK) {
+ if (!m_workingCopies.contains(icu)) {
+ throw new CoreException(new ScoutStatus("compilation unit " + icu.getElementName() + " has not been registered"));
+ }
+ return icu.reconcile(AST.JLS3, true, icu.getOwner(), monitor);
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/javadoc/JavaDoc.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/javadoc/JavaDoc.java
index b14f61785..1e7d84cea 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/javadoc/JavaDoc.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/javadoc/JavaDoc.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.javadoc;
-
-import java.util.ArrayList;
-
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.ISourceRange;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.resources.ResourceUtility;
-import org.eclipse.text.edits.InsertEdit;
-import org.eclipse.text.edits.TextEdit;
-
-/**
- *
- */
-public class JavaDoc {
-
- private final IMember m_member;
- private ArrayList<String> m_newLines = new ArrayList<String>();
-
- public JavaDoc(IMember member) {
- m_member = member;
- }
-
- public void appendLine(String commentLine) {
- m_newLines.add(commentLine);
- }
-
- public void removeLine(String commentLine) {
- m_newLines.remove(commentLine);
- }
-
- protected String[] getNewLines() {
- return m_newLines.toArray(m_newLines.toArray(new String[m_newLines.size()]));
- }
-
- public TextEdit getEdit() {
- String NL = ResourceUtility.getLineSeparator(getMember().getCompilationUnit());
- StringBuilder javaDoc = new StringBuilder();
- String[] newLines = getNewLines();
- if (newLines.length > 0) {
- for (String line : newLines) {
- javaDoc.append("* " + line + NL);
- }
- try {
- int insertPosition = -1;
- ISourceRange javadocRange = getMember().getJavadocRange();
- if (javadocRange != null) {
- String existingDoc = getMember().getCompilationUnit().getBuffer().getText(javadocRange.getOffset(), javadocRange.getLength());
- insertPosition = javadocRange.getOffset() + existingDoc.lastIndexOf("*/");
- }
- else {
- insertPosition = getMember().getSourceRange().getOffset();
- javaDoc.insert(0, "/**" + NL);
- javaDoc.append("*/" + NL);
- }
- if (insertPosition > 0) {
- return new InsertEdit(insertPosition, javaDoc.toString());
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not parse java doc of '" + getMember().getElementName() + "' in compilation unit '" + getMember().getCompilationUnit().getElementName() + "'.", e);
- }
- }
- return null;
- }
-
- public IMember getMember() {
- return m_member;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.javadoc;
+
+import java.util.ArrayList;
+
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.resources.ResourceUtility;
+import org.eclipse.text.edits.InsertEdit;
+import org.eclipse.text.edits.TextEdit;
+
+/**
+ *
+ */
+public class JavaDoc {
+
+ private final IMember m_member;
+ private ArrayList<String> m_newLines = new ArrayList<String>();
+
+ public JavaDoc(IMember member) {
+ m_member = member;
+ }
+
+ public void appendLine(String commentLine) {
+ m_newLines.add(commentLine);
+ }
+
+ public void removeLine(String commentLine) {
+ m_newLines.remove(commentLine);
+ }
+
+ protected String[] getNewLines() {
+ return m_newLines.toArray(m_newLines.toArray(new String[m_newLines.size()]));
+ }
+
+ public TextEdit getEdit() {
+ String NL = ResourceUtility.getLineSeparator(getMember().getCompilationUnit());
+ StringBuilder javaDoc = new StringBuilder();
+ String[] newLines = getNewLines();
+ if (newLines.length > 0) {
+ for (String line : newLines) {
+ javaDoc.append("* " + line + NL);
+ }
+ try {
+ int insertPosition = -1;
+ ISourceRange javadocRange = getMember().getJavadocRange();
+ if (javadocRange != null) {
+ String existingDoc = getMember().getCompilationUnit().getBuffer().getText(javadocRange.getOffset(), javadocRange.getLength());
+ insertPosition = javadocRange.getOffset() + existingDoc.lastIndexOf("*/");
+ }
+ else {
+ insertPosition = getMember().getSourceRange().getOffset();
+ javaDoc.insert(0, "/**" + NL);
+ javaDoc.append("*/" + NL);
+ }
+ if (insertPosition > 0) {
+ return new InsertEdit(insertPosition, javaDoc.toString());
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not parse java doc of '" + getMember().getElementName() + "' in compilation unit '" + getMember().getCompilationUnit().getElementName() + "'.", e);
+ }
+ }
+ return null;
+ }
+
+ public IMember getMember() {
+ return m_member;
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/ElementChangedListenerEx.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/ElementChangedListenerEx.java
index 0ba1effc0..225978904 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/ElementChangedListenerEx.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/ElementChangedListenerEx.java
@@ -1,152 +1,152 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.jdt;
-
-import org.eclipse.jdt.core.ElementChangedEvent;
-import org.eclipse.jdt.core.IElementChangedListener;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaElementDelta;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.scout.sdk.util.jdt.finegraned.FineGrainedJavaElementDelta;
-import org.eclipse.scout.sdk.util.jdt.finegraned.FineGrainedJavaElementDeltaManager;
-
-/**
- * WARNING: JDT is not correctly reporting changes in ITypes and IMethods
- * JDT stops reporting at ICompilationUnit workingCopyManager on content-only changes, whereas add/remove changes are
- * reported down to IMethod workingCopyManager.
- *
- * @Note never add the IJavaElementDelta.F_FINE_GRAINED flag to the CHANGED_FLAG_MASK.
- * Therefore this class is taking this into account and tries to report as precise as possible down to fine
- * grained levels
- */
-public class ElementChangedListenerEx implements IElementChangedListener {
- public static final int CHANGED_FLAG_MASK =
- IJavaElementDelta.F_CONTENT |
- IJavaElementDelta.F_MODIFIERS |
- IJavaElementDelta.F_MOVED_FROM |
- IJavaElementDelta.F_MOVED_TO |
- IJavaElementDelta.F_REORDER |
- IJavaElementDelta.F_SUPER_TYPES |
- IJavaElementDelta.F_OPENED |
- IJavaElementDelta.F_CLOSED |
- IJavaElementDelta.F_CATEGORIES |
- IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED |
- IJavaElementDelta.F_ANNOTATIONS;
-
- @Override
- public void elementChanged(ElementChangedEvent e) {
- CompilationUnit ast = e.getDelta().getCompilationUnitAST();
- visitDelta(e.getDelta(), e.getType(), ast);
- }
-
- private boolean visitDelta(IJavaElementDelta delta, int type, CompilationUnit ast) {
- int flags = delta.getFlags();
- int kind = delta.getKind();
- IJavaElement e = delta.getElement();
- if (e != null) {
- switch (kind) {
- case IJavaElementDelta.ADDED: {
- if (!visit(kind, flags, e, ast)) return false;
- if (!visitAdd(flags, e, ast)) return false;
- break;
- }
- case IJavaElementDelta.REMOVED: {
- if (!visit(kind, flags, e, ast)) return false;
- if (!visitRemove(flags, e, ast)) return false;
- break;
- }
- case IJavaElementDelta.CHANGED: {
- if (e.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
- if (!visitPackageModify(flags, e, ast)) return false;
- }
- if ((flags & CHANGED_FLAG_MASK) != 0) {
- // workaround: try to find out what really changed
- if (e.getElementType() == IJavaElement.COMPILATION_UNIT) {
- for (FineGrainedJavaElementDelta a : FineGrainedJavaElementDeltaManager.getInstance().getDelta(delta)) {
- if (!visit(kind, flags, a.getElement(), ast)) return false;
- if (!visitModify(flags, a.getElement(), ast)) return false;
- }
- }
- else {
- if (!visit(kind, flags, e, ast)) return false;
- if (!visitModify(flags, e, ast)) return false;
- }
- }
- break;
- }
- }
- }
- // children
- if ((flags & IJavaElementDelta.F_CHILDREN) != 0) {
- IJavaElementDelta[] childDeltas = delta.getAffectedChildren();
- if (childDeltas != null && childDeltas.length > 0) {
- for (int i = 0; i < childDeltas.length; i++) {
- if (!visitDelta(childDeltas[i], type, ast)) return false;
- }
- }
- }
- return true;
- }
-
- /**
- * @param kind
- * ADDED, REMOVED, CHANGED
- * @param flags
- * F_...
- * @param e
- * IJavaElement
- * @param ast
- * CompilationUnit AST (can be null)
- */
- protected boolean visit(int kind, int flags, IJavaElement e, CompilationUnit ast) {
- return true;
- }
-
- /**
- * @param flags
- * F_...
- * @param e
- * IJavaElement
- * @param cu
- * CompilationUnit AST (can be null)
- */
- protected boolean visitAdd(int flags, IJavaElement e, CompilationUnit ast) {
- return true;
- }
-
- /**
- * @param flags
- * F_...
- * @param e
- * IJavaElement
- * @param cu
- * CompilationUnit AST (can be null)
- */
- protected boolean visitRemove(int flags, IJavaElement e, CompilationUnit ast) {
- return true;
- }
-
- /**
- * @param flags
- * F_...
- * @param e
- * IJavaElement
- * @param cu
- * CompilationUnit AST (can be null)
- */
- protected boolean visitModify(int flags, IJavaElement e, CompilationUnit ast) {
- return true;
- }
-
- protected boolean visitPackageModify(int flags, IJavaElement e, CompilationUnit ast) {
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.jdt;
+
+import org.eclipse.jdt.core.ElementChangedEvent;
+import org.eclipse.jdt.core.IElementChangedListener;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaElementDelta;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.scout.sdk.util.jdt.finegraned.FineGrainedJavaElementDelta;
+import org.eclipse.scout.sdk.util.jdt.finegraned.FineGrainedJavaElementDeltaManager;
+
+/**
+ * WARNING: JDT is not correctly reporting changes in ITypes and IMethods
+ * JDT stops reporting at ICompilationUnit workingCopyManager on content-only changes, whereas add/remove changes are
+ * reported down to IMethod workingCopyManager.
+ *
+ * @Note never add the IJavaElementDelta.F_FINE_GRAINED flag to the CHANGED_FLAG_MASK.
+ * Therefore this class is taking this into account and tries to report as precise as possible down to fine
+ * grained levels
+ */
+public class ElementChangedListenerEx implements IElementChangedListener {
+ public static final int CHANGED_FLAG_MASK =
+ IJavaElementDelta.F_CONTENT |
+ IJavaElementDelta.F_MODIFIERS |
+ IJavaElementDelta.F_MOVED_FROM |
+ IJavaElementDelta.F_MOVED_TO |
+ IJavaElementDelta.F_REORDER |
+ IJavaElementDelta.F_SUPER_TYPES |
+ IJavaElementDelta.F_OPENED |
+ IJavaElementDelta.F_CLOSED |
+ IJavaElementDelta.F_CATEGORIES |
+ IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED |
+ IJavaElementDelta.F_ANNOTATIONS;
+
+ @Override
+ public void elementChanged(ElementChangedEvent e) {
+ CompilationUnit ast = e.getDelta().getCompilationUnitAST();
+ visitDelta(e.getDelta(), e.getType(), ast);
+ }
+
+ private boolean visitDelta(IJavaElementDelta delta, int type, CompilationUnit ast) {
+ int flags = delta.getFlags();
+ int kind = delta.getKind();
+ IJavaElement e = delta.getElement();
+ if (e != null) {
+ switch (kind) {
+ case IJavaElementDelta.ADDED: {
+ if (!visit(kind, flags, e, ast)) return false;
+ if (!visitAdd(flags, e, ast)) return false;
+ break;
+ }
+ case IJavaElementDelta.REMOVED: {
+ if (!visit(kind, flags, e, ast)) return false;
+ if (!visitRemove(flags, e, ast)) return false;
+ break;
+ }
+ case IJavaElementDelta.CHANGED: {
+ if (e.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
+ if (!visitPackageModify(flags, e, ast)) return false;
+ }
+ if ((flags & CHANGED_FLAG_MASK) != 0) {
+ // workaround: try to find out what really changed
+ if (e.getElementType() == IJavaElement.COMPILATION_UNIT) {
+ for (FineGrainedJavaElementDelta a : FineGrainedJavaElementDeltaManager.getInstance().getDelta(delta)) {
+ if (!visit(kind, flags, a.getElement(), ast)) return false;
+ if (!visitModify(flags, a.getElement(), ast)) return false;
+ }
+ }
+ else {
+ if (!visit(kind, flags, e, ast)) return false;
+ if (!visitModify(flags, e, ast)) return false;
+ }
+ }
+ break;
+ }
+ }
+ }
+ // children
+ if ((flags & IJavaElementDelta.F_CHILDREN) != 0) {
+ IJavaElementDelta[] childDeltas = delta.getAffectedChildren();
+ if (childDeltas != null && childDeltas.length > 0) {
+ for (int i = 0; i < childDeltas.length; i++) {
+ if (!visitDelta(childDeltas[i], type, ast)) return false;
+ }
+ }
+ }
+ return true;
+ }
+
+ /**
+ * @param kind
+ * ADDED, REMOVED, CHANGED
+ * @param flags
+ * F_...
+ * @param e
+ * IJavaElement
+ * @param ast
+ * CompilationUnit AST (can be null)
+ */
+ protected boolean visit(int kind, int flags, IJavaElement e, CompilationUnit ast) {
+ return true;
+ }
+
+ /**
+ * @param flags
+ * F_...
+ * @param e
+ * IJavaElement
+ * @param cu
+ * CompilationUnit AST (can be null)
+ */
+ protected boolean visitAdd(int flags, IJavaElement e, CompilationUnit ast) {
+ return true;
+ }
+
+ /**
+ * @param flags
+ * F_...
+ * @param e
+ * IJavaElement
+ * @param cu
+ * CompilationUnit AST (can be null)
+ */
+ protected boolean visitRemove(int flags, IJavaElement e, CompilationUnit ast) {
+ return true;
+ }
+
+ /**
+ * @param flags
+ * F_...
+ * @param e
+ * IJavaElement
+ * @param cu
+ * CompilationUnit AST (can be null)
+ */
+ protected boolean visitModify(int flags, IJavaElement e, CompilationUnit ast) {
+ return true;
+ }
+
+ protected boolean visitPackageModify(int flags, IJavaElement e, CompilationUnit ast) {
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/IJavaResourceChangedListener.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/IJavaResourceChangedListener.java
index e1894384b..0e684cad5 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/IJavaResourceChangedListener.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/IJavaResourceChangedListener.java
@@ -1,24 +1,24 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.jdt;
-
-import java.util.EventListener;
-
-/**
- * <h3>{@link IJavaResourceChangedListener}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 24.11.2010
- */
-public interface IJavaResourceChangedListener extends EventListener {
-
- public void handleEvent(JdtEvent event);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.jdt;
+
+import java.util.EventListener;
+
+/**
+ * <h3>{@link IJavaResourceChangedListener}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 24.11.2010
+ */
+public interface IJavaResourceChangedListener extends EventListener {
+
+ public void handleEvent(JdtEvent event);
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/JdtEvent.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/JdtEvent.java
index 6ef780d18..b5a2856f5 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/JdtEvent.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/JdtEvent.java
@@ -1,205 +1,205 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.jdt;
-
-import java.util.EventObject;
-
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaElementDelta;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-
-/**
- * <h3>{@link JdtEvent}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 24.11.2010
- */
-public class JdtEvent extends EventObject {
- private static final long serialVersionUID = 1L;
-
- public static final int ADDED = IJavaElementDelta.ADDED;
- public static final int REMOVED = IJavaElementDelta.REMOVED;
- public static final int CHANGED = IJavaElementDelta.CHANGED;
- /**
- * event type indicating any working copy is created and is not anymore sync with the underlying resource.
- * Note that the {@link JdtEvent#BUFFER_SYNC} event is alternately with the {@link JdtEvent#BUFFER_DIRTY}.
- */
- public static final int BUFFER_DIRTY = 10;
- /**
- * event type indicating any working copy is sync with the underlying resource.
- * Note that the {@link JdtEvent#BUFFER_SYNC} event is alternately with the {@link JdtEvent#BUFFER_DIRTY}.
- */
- public static final int BUFFER_SYNC = 11;
-
- /**
- * one of {@link JdtEvent#ADDED}, {@link JdtEvent#REMOVED}, {@link JdtEvent#CHANGED}, {@link JdtEvent#BUFFER_DIRTY},
- * {@link JdtEvent#BUFFER_SYNC}
- */
- private final int m_eventType;
- private final IJavaElement m_element;
- private IType m_declaringType;
-
- private ITypeHierarchy m_superTypeHierarchy;
-
- public JdtEvent(Object source, int eventType, IJavaElement element) {
- super(source);
- m_eventType = eventType;
- m_element = element;
- }
-
- public int getEventType() {
- return m_eventType;
- }
-
- public IJavaElement getElement() {
- return m_element;
- }
-
- public int getElementType() {
- if (getElement() == null) {
- return -1;
- }
- return m_element.getElementType();
- }
-
- @Override
- public boolean equals(Object obj) {
- if (!(obj instanceof JdtEvent)) {
- return false;
- }
- JdtEvent event = (JdtEvent) obj;
- if (!CompareUtility.equals(event.getElement(), m_element)) {
- return false;
- }
- if (event.getEventType() != m_eventType) {
- return false;
- }
- if (!CompareUtility.equals(event.getSource(), getSource())) {
- return false;
- }
- return true;
- }
-
- @Override
- public int hashCode() {
- int hash = m_eventType;
- if (getSource() != null) {
- hash ^= getSource().hashCode();
- }
- if (getElement() != null) {
- hash ^= getElement().hashCode();
- }
- return hash;
- }
-
- public ITypeHierarchy getSuperTypeHierarchy() {
- if (m_superTypeHierarchy == null) {
- if (TypeUtility.exists(getElement()) && getElement().getElementType() == IJavaElement.TYPE) {
- try {
- m_superTypeHierarchy = ((IType) getElement()).newSupertypeHierarchy(null);
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("could not create super type hierarchy for '" + getElement().getElementName() + "'.");
- }
- }
- }
- return m_superTypeHierarchy;
- }
-
- public IType getDeclaringType() {
- if (m_declaringType == null) {
- if (getElement() != null) {
- if (getElementType() == IJavaElement.TYPE) {
- m_declaringType = ((IType) getElement()).getDeclaringType();
- }
- else {
- m_declaringType = (IType) getElement().getAncestor(IJavaElement.TYPE);
- }
- }
- }
- return m_declaringType;
- }
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder("JdtEvent <");
- switch (getEventType()) {
- case ADDED:
- builder.append("ADDED ");
- break;
- case CHANGED:
- builder.append("CHANGED ");
- break;
- case REMOVED:
- builder.append("REMOVED ");
- break;
- }
- builder.append(getElementType(getElement()) + " ");
- if (getElement() != null) {
- builder.append("'" + getElement().getElementName() + "' ");
- }
- else {
- builder.append("'NULL ELEMENT' ");
- }
- if (getDeclaringType() != null) {
- builder.append("declaringType='" + getDeclaringType().getElementName() + "' ");
- }
- else {
- builder.append("declaringType='NULL' ");
- }
- builder.append(">");
- return builder.toString();
- }
-
- private String getElementType(IJavaElement element) {
- switch (element.getElementType()) {
- case IJavaElement.JAVA_MODEL:
- return "JAVA_MODEL ";
- case IJavaElement.JAVA_PROJECT:
- return "JAVA_PROJECT ";
- case IJavaElement.PACKAGE_FRAGMENT_ROOT:
- return "PACKAGE_FRAGMENT_ROOT ";
- case IJavaElement.PACKAGE_FRAGMENT:
- return "PACKAGE_FRAGMENT ";
- case IJavaElement.COMPILATION_UNIT:
- return "COMPILATION_UNIT ";
- case IJavaElement.CLASS_FILE:
- return "CLASS_FILE ";
- case IJavaElement.TYPE:
- return "TYPE ";
- case IJavaElement.FIELD:
- return "FIELD ";
- case IJavaElement.METHOD:
- return "METHOD ";
- case IJavaElement.INITIALIZER:
- return "INITIALIZER ";
- case IJavaElement.PACKAGE_DECLARATION:
- return "PACKAGE_DECLARATION ";
- case IJavaElement.IMPORT_CONTAINER:
- return "IMPORT_CONTAINER ";
- case IJavaElement.IMPORT_DECLARATION:
- return "IMPORT_DECLARATION ";
- case IJavaElement.LOCAL_VARIABLE:
- return "LOCAL_VARIABLE ";
- case IJavaElement.TYPE_PARAMETER:
- return "TYPE_PARAMETER ";
- case IJavaElement.ANNOTATION:
- return "ANNOTATION ";
- default:
- return "???";
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.jdt;
+
+import java.util.EventObject;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaElementDelta;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+
+/**
+ * <h3>{@link JdtEvent}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 24.11.2010
+ */
+public class JdtEvent extends EventObject {
+ private static final long serialVersionUID = 1L;
+
+ public static final int ADDED = IJavaElementDelta.ADDED;
+ public static final int REMOVED = IJavaElementDelta.REMOVED;
+ public static final int CHANGED = IJavaElementDelta.CHANGED;
+ /**
+ * event type indicating any working copy is created and is not anymore sync with the underlying resource.
+ * Note that the {@link JdtEvent#BUFFER_SYNC} event is alternately with the {@link JdtEvent#BUFFER_DIRTY}.
+ */
+ public static final int BUFFER_DIRTY = 10;
+ /**
+ * event type indicating any working copy is sync with the underlying resource.
+ * Note that the {@link JdtEvent#BUFFER_SYNC} event is alternately with the {@link JdtEvent#BUFFER_DIRTY}.
+ */
+ public static final int BUFFER_SYNC = 11;
+
+ /**
+ * one of {@link JdtEvent#ADDED}, {@link JdtEvent#REMOVED}, {@link JdtEvent#CHANGED}, {@link JdtEvent#BUFFER_DIRTY},
+ * {@link JdtEvent#BUFFER_SYNC}
+ */
+ private final int m_eventType;
+ private final IJavaElement m_element;
+ private IType m_declaringType;
+
+ private ITypeHierarchy m_superTypeHierarchy;
+
+ public JdtEvent(Object source, int eventType, IJavaElement element) {
+ super(source);
+ m_eventType = eventType;
+ m_element = element;
+ }
+
+ public int getEventType() {
+ return m_eventType;
+ }
+
+ public IJavaElement getElement() {
+ return m_element;
+ }
+
+ public int getElementType() {
+ if (getElement() == null) {
+ return -1;
+ }
+ return m_element.getElementType();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (!(obj instanceof JdtEvent)) {
+ return false;
+ }
+ JdtEvent event = (JdtEvent) obj;
+ if (!CompareUtility.equals(event.getElement(), m_element)) {
+ return false;
+ }
+ if (event.getEventType() != m_eventType) {
+ return false;
+ }
+ if (!CompareUtility.equals(event.getSource(), getSource())) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = m_eventType;
+ if (getSource() != null) {
+ hash ^= getSource().hashCode();
+ }
+ if (getElement() != null) {
+ hash ^= getElement().hashCode();
+ }
+ return hash;
+ }
+
+ public ITypeHierarchy getSuperTypeHierarchy() {
+ if (m_superTypeHierarchy == null) {
+ if (TypeUtility.exists(getElement()) && getElement().getElementType() == IJavaElement.TYPE) {
+ try {
+ m_superTypeHierarchy = ((IType) getElement()).newSupertypeHierarchy(null);
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("could not create super type hierarchy for '" + getElement().getElementName() + "'.");
+ }
+ }
+ }
+ return m_superTypeHierarchy;
+ }
+
+ public IType getDeclaringType() {
+ if (m_declaringType == null) {
+ if (getElement() != null) {
+ if (getElementType() == IJavaElement.TYPE) {
+ m_declaringType = ((IType) getElement()).getDeclaringType();
+ }
+ else {
+ m_declaringType = (IType) getElement().getAncestor(IJavaElement.TYPE);
+ }
+ }
+ }
+ return m_declaringType;
+ }
+
+ @Override
+ public String toString() {
+ StringBuilder builder = new StringBuilder("JdtEvent <");
+ switch (getEventType()) {
+ case ADDED:
+ builder.append("ADDED ");
+ break;
+ case CHANGED:
+ builder.append("CHANGED ");
+ break;
+ case REMOVED:
+ builder.append("REMOVED ");
+ break;
+ }
+ builder.append(getElementType(getElement()) + " ");
+ if (getElement() != null) {
+ builder.append("'" + getElement().getElementName() + "' ");
+ }
+ else {
+ builder.append("'NULL ELEMENT' ");
+ }
+ if (getDeclaringType() != null) {
+ builder.append("declaringType='" + getDeclaringType().getElementName() + "' ");
+ }
+ else {
+ builder.append("declaringType='NULL' ");
+ }
+ builder.append(">");
+ return builder.toString();
+ }
+
+ private String getElementType(IJavaElement element) {
+ switch (element.getElementType()) {
+ case IJavaElement.JAVA_MODEL:
+ return "JAVA_MODEL ";
+ case IJavaElement.JAVA_PROJECT:
+ return "JAVA_PROJECT ";
+ case IJavaElement.PACKAGE_FRAGMENT_ROOT:
+ return "PACKAGE_FRAGMENT_ROOT ";
+ case IJavaElement.PACKAGE_FRAGMENT:
+ return "PACKAGE_FRAGMENT ";
+ case IJavaElement.COMPILATION_UNIT:
+ return "COMPILATION_UNIT ";
+ case IJavaElement.CLASS_FILE:
+ return "CLASS_FILE ";
+ case IJavaElement.TYPE:
+ return "TYPE ";
+ case IJavaElement.FIELD:
+ return "FIELD ";
+ case IJavaElement.METHOD:
+ return "METHOD ";
+ case IJavaElement.INITIALIZER:
+ return "INITIALIZER ";
+ case IJavaElement.PACKAGE_DECLARATION:
+ return "PACKAGE_DECLARATION ";
+ case IJavaElement.IMPORT_CONTAINER:
+ return "IMPORT_CONTAINER ";
+ case IJavaElement.IMPORT_DECLARATION:
+ return "IMPORT_DECLARATION ";
+ case IJavaElement.LOCAL_VARIABLE:
+ return "LOCAL_VARIABLE ";
+ case IJavaElement.TYPE_PARAMETER:
+ return "TYPE_PARAMETER ";
+ case IJavaElement.ANNOTATION:
+ return "ANNOTATION ";
+ default:
+ return "???";
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/JdtUtility.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/JdtUtility.java
index 9f51a34d1..572340669 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/JdtUtility.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/JdtUtility.java
@@ -1,293 +1,293 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.jdt;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.OperationCanceledException;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jdt.core.IAnnotatable;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IMemberValuePair;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.core.search.SearchPattern;
-import org.eclipse.jdt.core.search.TypeNameRequestor;
-import org.eclipse.jface.text.ITextSelection;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.osgi.framework.Bundle;
-
-public final class JdtUtility {
- private final static String DOUBLE_QUOTES = "\"";
- private final static Pattern LIT_ESC_1 = Pattern.compile("\\", Pattern.LITERAL);
- private final static String REP_1 = Matcher.quoteReplacement("\\\\");
- private final static Pattern LIT_ESC_2 = Pattern.compile("\"", Pattern.LITERAL);
- private final static String REP_2 = Matcher.quoteReplacement("\\\"");
- private final static Pattern LIT_ESC_3 = Pattern.compile("\n", Pattern.LITERAL);
- private final static String REP_3 = Matcher.quoteReplacement("\\n");
- private final static Pattern LIT_ESC_4 = Pattern.compile("\r", Pattern.LITERAL);
- private final static String REP_4 = Matcher.quoteReplacement("");
- private final static Pattern LIT_ESC_5 = Pattern.compile("\\\\", Pattern.LITERAL);
- private final static String REP_5 = Matcher.quoteReplacement("\\");
- private final static Pattern LIT_ESC_6 = Pattern.compile("\\\"", Pattern.LITERAL);
- private final static String REP_6 = Matcher.quoteReplacement("\"");
- private final static Pattern LIT_ESC_7 = Pattern.compile("([^\\\\]{1})\\\\n");
- private final static String REP_7 = "$1\n";
-
- private JdtUtility() {
- }
-
- public static IJavaElement findJavaElement(IFile javaFile, ITextSelection selection) throws JavaModelException {
- IJavaElement javaElement = JavaCore.create(javaFile);
- javaElement = findJavaElement(javaElement, selection.getOffset(), selection.getLength());
- return javaElement;
- }
-
- public static boolean hasAnnotation(IAnnotatable element, String fullyQuallifiedAnnotation) {
- return TypeUtility.exists(getAnnotation(element, fullyQuallifiedAnnotation));
- }
-
- public static Double getNumericAnnotationValue(IAnnotation annotation, String name) throws JavaModelException {
- if (TypeUtility.exists(annotation)) {
- IMemberValuePair[] memberValues = annotation.getMemberValuePairs();
- for (IMemberValuePair p : memberValues) {
- if (name.equals(p.getMemberName())) {
- switch (p.getValueKind()) {
- case IMemberValuePair.K_DOUBLE:
- return ((Double) p.getValue()).doubleValue();
- case IMemberValuePair.K_FLOAT:
- return ((Float) p.getValue()).doubleValue();
- case IMemberValuePair.K_INT:
- return ((Integer) p.getValue()).doubleValue();
- }
- break;
- }
- }
- }
- return null;
- }
-
- public static IAnnotation getAnnotation(IAnnotatable element, String fullyQuallifiedAnnotation) {
- try {
- IAnnotation annotation = element.getAnnotation(fullyQuallifiedAnnotation);
- // workaround since annotations are not cached properly from jdt
- if (TypeUtility.exists(annotation) && (annotation.getSource() == null || annotation.getSource().startsWith("@"))) {
- return annotation;
- }
- else {
- String simpleName = Signature.getSimpleName(fullyQuallifiedAnnotation);
- annotation = element.getAnnotation(simpleName);
- if (TypeUtility.exists(annotation) && (annotation.getSource() == null || annotation.getSource().startsWith("@"))) {
- return annotation;
- }
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("could not get annotation '" + fullyQuallifiedAnnotation + "' of '" + element + "'", e);
- }
- return null;
- }
-
- /**
- * converts the given string into a string literal with leading and ending double-quotes including escaping of the
- * given string.<br>
- * this is the inverse function of {@link JdtUtility#fromStringLiteral(String)}
- *
- * @param s
- * the string to convert.
- * @return the literal string ready to be directly inserted into java source or null if the input string is null.
- */
- public static String toStringLiteral(String s) {
- if (s == null) return null;
- String escaped = s;
- escaped = LIT_ESC_1.matcher(escaped).replaceAll(REP_1);
- escaped = LIT_ESC_2.matcher(escaped).replaceAll(REP_2);
- escaped = LIT_ESC_3.matcher(escaped).replaceAll(REP_3);
- escaped = LIT_ESC_4.matcher(escaped).replaceAll(REP_4);
- return DOUBLE_QUOTES + escaped + DOUBLE_QUOTES;
- }
-
- /**
- * converts the given input string literal into the representing original string.<br>
- * this is the inverse function of {@link JdtUtility#toStringLiteral(String)}
- *
- * @param l
- * the literal with leading and ending double-quotes
- * @return the original (un-escaped) string. if it is no valid literal string, null is returned.
- */
- public static String fromStringLiteral(String l) {
- if (l == null || l.length() < 2 || !l.startsWith(DOUBLE_QUOTES) || !l.endsWith(DOUBLE_QUOTES)) return null;
- String inner = l.substring(1, l.length() - 1);
- String ret = inner;
- ret = LIT_ESC_7.matcher(ret).replaceAll(REP_7);
- ret = LIT_ESC_5.matcher(ret).replaceAll(REP_5);
- ret = LIT_ESC_6.matcher(ret).replaceAll(REP_6);
- return ret;
- }
-
- public static IJavaElement findJavaElement(IJavaElement element, int offset, int lenght) throws JavaModelException {
- switch (element.getElementType()) {
- case IJavaElement.COMPILATION_UNIT:
- ICompilationUnit icu = (ICompilationUnit) element;
- IType[] icuTypes = icu.getTypes();
- for (IType t : icuTypes) {
- if (t.getSourceRange().getOffset() < offset && (t.getSourceRange().getOffset() + t.getSourceRange().getLength()) > (offset + lenght)) {
- // step in
- return findJavaElement(t, offset, lenght);
- }
- }
- if (icuTypes.length > 0) {
- return icuTypes[0];
- }
-
- break;
- case IJavaElement.TYPE:
- for (IType t : ((IType) element).getTypes()) {
- if (t.getSourceRange().getOffset() < offset && (t.getSourceRange().getOffset() + t.getSourceRange().getLength()) > (offset + lenght)) {
- // step in
- return findJavaElement(t, offset, lenght);
- }
- }
- // methods
- for (IMethod m : ((IType) element).getMethods()) {
- if (m.getSourceRange().getOffset() < offset && (m.getSourceRange().getOffset() + m.getSourceRange().getLength()) > (offset + lenght)) {
- // step in
- return findJavaElement(m, offset, lenght);
- }
- }
- break;
- }
- return element;
- }
-
- public static IType findDeclaringType(IJavaElement element) {
- if (element == null) {
- return null;
- }
- if (element.getElementType() == IJavaElement.TYPE) {
- return (IType) element;
- }
- return findDeclaringType(element.getParent());
- }
-
- public static void waitForSilentWorkspace() {
- Job worker = new Job("") {
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- return Status.OK_STATUS;
- }
- };
- worker.setRule(ResourcesPlugin.getWorkspace().getRoot());
- worker.schedule();
- try {
- worker.join();
- }
- catch (InterruptedException e) {
- }
- waitForRefresh();
- waitForBuild();
- waitForIndexesReady();
- }
-
- public static void waitForBuild() {
- waitForJobFamily(ResourcesPlugin.FAMILY_MANUAL_BUILD);
- waitForJobFamily(ResourcesPlugin.FAMILY_AUTO_BUILD);
- }
-
- public static void waitForRefresh() {
- waitForJobFamily(ResourcesPlugin.FAMILY_AUTO_REFRESH);
- waitForJobFamily(ResourcesPlugin.FAMILY_MANUAL_REFRESH);
- }
-
- public static void waitForIndexesReady() {
- // dummy query for waiting until the indexes are ready
- SearchEngine engine = new SearchEngine();
- IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
- try {
- engine.searchAllTypeNames(
- null,
- SearchPattern.R_EXACT_MATCH,
- "!@$#!@".toCharArray(),
- SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE,
- IJavaSearchConstants.CLASS,
- scope,
- new TypeNameRequestor() {
- @Override
- public void acceptType(
- int modifiers,
- char[] packageName,
- char[] simpleTypeName,
- char[][] enclosingTypeNames,
- String path) {
- }
- },
- IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
- null);
- }
- catch (CoreException e) {
- }
- }
-
- public static void waitForManualRefresh() {
- waitForJobFamily(ResourcesPlugin.FAMILY_MANUAL_REFRESH);
- }
-
- public static void waitForJobFamily(final Object family) {
- boolean wasInterrupted = false;
- do {
- try {
- Job.getJobManager().join(family, null);
- wasInterrupted = false;
- }
- catch (OperationCanceledException e) {
- e.printStackTrace();
- }
- catch (InterruptedException e) {
- wasInterrupted = true;
- }
- }
- while (wasInterrupted);
- }
-
- /**
- * checks whether all of the given plugins are installed in the current platform
- *
- * @param pluginIds
- * the plugin Ids to search
- * @return true if every plugin passed exists in the given platform, false otherwise.
- */
- public static boolean areAllPluginsInstalled(String... pluginIds) {
- for (String pluginId : pluginIds) {
- Bundle b = Platform.getBundle(pluginId);
- if (b == null) {
- return false;
- }
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.jdt;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jdt.core.IAnnotatable;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMemberValuePair;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.core.search.SearchPattern;
+import org.eclipse.jdt.core.search.TypeNameRequestor;
+import org.eclipse.jface.text.ITextSelection;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.osgi.framework.Bundle;
+
+public final class JdtUtility {
+ private final static String DOUBLE_QUOTES = "\"";
+ private final static Pattern LIT_ESC_1 = Pattern.compile("\\", Pattern.LITERAL);
+ private final static String REP_1 = Matcher.quoteReplacement("\\\\");
+ private final static Pattern LIT_ESC_2 = Pattern.compile("\"", Pattern.LITERAL);
+ private final static String REP_2 = Matcher.quoteReplacement("\\\"");
+ private final static Pattern LIT_ESC_3 = Pattern.compile("\n", Pattern.LITERAL);
+ private final static String REP_3 = Matcher.quoteReplacement("\\n");
+ private final static Pattern LIT_ESC_4 = Pattern.compile("\r", Pattern.LITERAL);
+ private final static String REP_4 = Matcher.quoteReplacement("");
+ private final static Pattern LIT_ESC_5 = Pattern.compile("\\\\", Pattern.LITERAL);
+ private final static String REP_5 = Matcher.quoteReplacement("\\");
+ private final static Pattern LIT_ESC_6 = Pattern.compile("\\\"", Pattern.LITERAL);
+ private final static String REP_6 = Matcher.quoteReplacement("\"");
+ private final static Pattern LIT_ESC_7 = Pattern.compile("([^\\\\]{1})\\\\n");
+ private final static String REP_7 = "$1\n";
+
+ private JdtUtility() {
+ }
+
+ public static IJavaElement findJavaElement(IFile javaFile, ITextSelection selection) throws JavaModelException {
+ IJavaElement javaElement = JavaCore.create(javaFile);
+ javaElement = findJavaElement(javaElement, selection.getOffset(), selection.getLength());
+ return javaElement;
+ }
+
+ public static boolean hasAnnotation(IAnnotatable element, String fullyQuallifiedAnnotation) {
+ return TypeUtility.exists(getAnnotation(element, fullyQuallifiedAnnotation));
+ }
+
+ public static Double getNumericAnnotationValue(IAnnotation annotation, String name) throws JavaModelException {
+ if (TypeUtility.exists(annotation)) {
+ IMemberValuePair[] memberValues = annotation.getMemberValuePairs();
+ for (IMemberValuePair p : memberValues) {
+ if (name.equals(p.getMemberName())) {
+ switch (p.getValueKind()) {
+ case IMemberValuePair.K_DOUBLE:
+ return ((Double) p.getValue()).doubleValue();
+ case IMemberValuePair.K_FLOAT:
+ return ((Float) p.getValue()).doubleValue();
+ case IMemberValuePair.K_INT:
+ return ((Integer) p.getValue()).doubleValue();
+ }
+ break;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static IAnnotation getAnnotation(IAnnotatable element, String fullyQuallifiedAnnotation) {
+ try {
+ IAnnotation annotation = element.getAnnotation(fullyQuallifiedAnnotation);
+ // workaround since annotations are not cached properly from jdt
+ if (TypeUtility.exists(annotation) && (annotation.getSource() == null || annotation.getSource().startsWith("@"))) {
+ return annotation;
+ }
+ else {
+ String simpleName = Signature.getSimpleName(fullyQuallifiedAnnotation);
+ annotation = element.getAnnotation(simpleName);
+ if (TypeUtility.exists(annotation) && (annotation.getSource() == null || annotation.getSource().startsWith("@"))) {
+ return annotation;
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("could not get annotation '" + fullyQuallifiedAnnotation + "' of '" + element + "'", e);
+ }
+ return null;
+ }
+
+ /**
+ * converts the given string into a string literal with leading and ending double-quotes including escaping of the
+ * given string.<br>
+ * this is the inverse function of {@link JdtUtility#fromStringLiteral(String)}
+ *
+ * @param s
+ * the string to convert.
+ * @return the literal string ready to be directly inserted into java source or null if the input string is null.
+ */
+ public static String toStringLiteral(String s) {
+ if (s == null) return null;
+ String escaped = s;
+ escaped = LIT_ESC_1.matcher(escaped).replaceAll(REP_1);
+ escaped = LIT_ESC_2.matcher(escaped).replaceAll(REP_2);
+ escaped = LIT_ESC_3.matcher(escaped).replaceAll(REP_3);
+ escaped = LIT_ESC_4.matcher(escaped).replaceAll(REP_4);
+ return DOUBLE_QUOTES + escaped + DOUBLE_QUOTES;
+ }
+
+ /**
+ * converts the given input string literal into the representing original string.<br>
+ * this is the inverse function of {@link JdtUtility#toStringLiteral(String)}
+ *
+ * @param l
+ * the literal with leading and ending double-quotes
+ * @return the original (un-escaped) string. if it is no valid literal string, null is returned.
+ */
+ public static String fromStringLiteral(String l) {
+ if (l == null || l.length() < 2 || !l.startsWith(DOUBLE_QUOTES) || !l.endsWith(DOUBLE_QUOTES)) return null;
+ String inner = l.substring(1, l.length() - 1);
+ String ret = inner;
+ ret = LIT_ESC_7.matcher(ret).replaceAll(REP_7);
+ ret = LIT_ESC_5.matcher(ret).replaceAll(REP_5);
+ ret = LIT_ESC_6.matcher(ret).replaceAll(REP_6);
+ return ret;
+ }
+
+ public static IJavaElement findJavaElement(IJavaElement element, int offset, int lenght) throws JavaModelException {
+ switch (element.getElementType()) {
+ case IJavaElement.COMPILATION_UNIT:
+ ICompilationUnit icu = (ICompilationUnit) element;
+ IType[] icuTypes = icu.getTypes();
+ for (IType t : icuTypes) {
+ if (t.getSourceRange().getOffset() < offset && (t.getSourceRange().getOffset() + t.getSourceRange().getLength()) > (offset + lenght)) {
+ // step in
+ return findJavaElement(t, offset, lenght);
+ }
+ }
+ if (icuTypes.length > 0) {
+ return icuTypes[0];
+ }
+
+ break;
+ case IJavaElement.TYPE:
+ for (IType t : ((IType) element).getTypes()) {
+ if (t.getSourceRange().getOffset() < offset && (t.getSourceRange().getOffset() + t.getSourceRange().getLength()) > (offset + lenght)) {
+ // step in
+ return findJavaElement(t, offset, lenght);
+ }
+ }
+ // methods
+ for (IMethod m : ((IType) element).getMethods()) {
+ if (m.getSourceRange().getOffset() < offset && (m.getSourceRange().getOffset() + m.getSourceRange().getLength()) > (offset + lenght)) {
+ // step in
+ return findJavaElement(m, offset, lenght);
+ }
+ }
+ break;
+ }
+ return element;
+ }
+
+ public static IType findDeclaringType(IJavaElement element) {
+ if (element == null) {
+ return null;
+ }
+ if (element.getElementType() == IJavaElement.TYPE) {
+ return (IType) element;
+ }
+ return findDeclaringType(element.getParent());
+ }
+
+ public static void waitForSilentWorkspace() {
+ Job worker = new Job("") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ return Status.OK_STATUS;
+ }
+ };
+ worker.setRule(ResourcesPlugin.getWorkspace().getRoot());
+ worker.schedule();
+ try {
+ worker.join();
+ }
+ catch (InterruptedException e) {
+ }
+ waitForRefresh();
+ waitForBuild();
+ waitForIndexesReady();
+ }
+
+ public static void waitForBuild() {
+ waitForJobFamily(ResourcesPlugin.FAMILY_MANUAL_BUILD);
+ waitForJobFamily(ResourcesPlugin.FAMILY_AUTO_BUILD);
+ }
+
+ public static void waitForRefresh() {
+ waitForJobFamily(ResourcesPlugin.FAMILY_AUTO_REFRESH);
+ waitForJobFamily(ResourcesPlugin.FAMILY_MANUAL_REFRESH);
+ }
+
+ public static void waitForIndexesReady() {
+ // dummy query for waiting until the indexes are ready
+ SearchEngine engine = new SearchEngine();
+ IJavaSearchScope scope = SearchEngine.createWorkspaceScope();
+ try {
+ engine.searchAllTypeNames(
+ null,
+ SearchPattern.R_EXACT_MATCH,
+ "!@$#!@".toCharArray(),
+ SearchPattern.R_PATTERN_MATCH | SearchPattern.R_CASE_SENSITIVE,
+ IJavaSearchConstants.CLASS,
+ scope,
+ new TypeNameRequestor() {
+ @Override
+ public void acceptType(
+ int modifiers,
+ char[] packageName,
+ char[] simpleTypeName,
+ char[][] enclosingTypeNames,
+ String path) {
+ }
+ },
+ IJavaSearchConstants.WAIT_UNTIL_READY_TO_SEARCH,
+ null);
+ }
+ catch (CoreException e) {
+ }
+ }
+
+ public static void waitForManualRefresh() {
+ waitForJobFamily(ResourcesPlugin.FAMILY_MANUAL_REFRESH);
+ }
+
+ public static void waitForJobFamily(final Object family) {
+ boolean wasInterrupted = false;
+ do {
+ try {
+ Job.getJobManager().join(family, null);
+ wasInterrupted = false;
+ }
+ catch (OperationCanceledException e) {
+ e.printStackTrace();
+ }
+ catch (InterruptedException e) {
+ wasInterrupted = true;
+ }
+ }
+ while (wasInterrupted);
+ }
+
+ /**
+ * checks whether all of the given plugins are installed in the current platform
+ *
+ * @param pluginIds
+ * the plugin Ids to search
+ * @return true if every plugin passed exists in the given platform, false otherwise.
+ */
+ public static boolean areAllPluginsInstalled(String... pluginIds) {
+ for (String pluginId : pluginIds) {
+ Bundle b = Platform.getBundle(pluginId);
+ if (b == null) {
+ return false;
+ }
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/SourceRange.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/SourceRange.java
index a462ebb33..2473797db 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/SourceRange.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/SourceRange.java
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.jdt;
-
-import org.eclipse.jdt.core.ISourceRange;
-import org.eclipse.jface.text.Document;
-
-public class SourceRange implements ISourceRange {
-
- private int m_offset;
- private int m_length;
-
- public static SourceRange getFullRange(Document document) {
- return new SourceRange(0, document.getLength());
- }
-
- public SourceRange(int offset, int length) {
- m_offset = offset;
- m_length = length;
- }
-
- @Override
- public int getLength() {
- return m_length;
- }
-
- public void setLength(int length) {
- m_length = length;
- }
-
- @Override
- public int getOffset() {
- return m_offset;
- }
-
- public void setOffset(int offset) {
- m_offset = offset;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.jdt;
+
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jface.text.Document;
+
+public class SourceRange implements ISourceRange {
+
+ private int m_offset;
+ private int m_length;
+
+ public static SourceRange getFullRange(Document document) {
+ return new SourceRange(0, document.getLength());
+ }
+
+ public SourceRange(int offset, int length) {
+ m_offset = offset;
+ m_length = length;
+ }
+
+ @Override
+ public int getLength() {
+ return m_length;
+ }
+
+ public void setLength(int length) {
+ m_length = length;
+ }
+
+ @Override
+ public int getOffset() {
+ return m_offset;
+ }
+
+ public void setOffset(int offset) {
+ m_offset = offset;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedAstAnalyzer.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedAstAnalyzer.java
index fe39af44c..d1153b1a5 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedAstAnalyzer.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedAstAnalyzer.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.jdt.finegraned;
-
-import java.util.HashSet;
-
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaElementDelta;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.ASTParser;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.scout.commons.CompareUtility;
-
-class FineGrainedAstAnalyzer {
- private IJavaElementDelta m_delta;
- private ICompilationUnit m_icu;
-
- public FineGrainedAstAnalyzer(IJavaElementDelta delta) {
- m_delta = delta;
- m_icu = (ICompilationUnit) delta.getElement();
- }
-
- public FineGrainedJavaElementDelta[] calculateDeltas(String oldContent, String newContent) {
- if (CompareUtility.equals(oldContent, newContent)) {
- return new FineGrainedJavaElementDelta[0];
- }
- CompilationUnit oldAst = null;
- if (oldAst == null) {
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setCompilerOptions(JavaCore.getOptions());
- parser.setKind(ASTParser.K_COMPILATION_UNIT);
- parser.setSource(oldContent.toCharArray());
- oldAst = (CompilationUnit) parser.createAST(null);
- }
- CompilationUnit newAst = m_delta.getCompilationUnitAST();
- if (newAst == null) {
- ASTParser parser = ASTParser.newParser(AST.JLS3);
- parser.setCompilerOptions(JavaCore.getOptions());
- parser.setKind(ASTParser.K_COMPILATION_UNIT);
- parser.setSource(newContent.toCharArray());
- newAst = (CompilationUnit) parser.createAST(null);
- }
- return calculateDeltas(oldAst, newAst);
- }
-
- public FineGrainedJavaElementDelta[] calculateDeltas(CompilationUnit oldAst, CompilationUnit newAst) {
- final HashSet<FineGrainedJavaElementDelta> set = new HashSet<FineGrainedJavaElementDelta>();
- FineGrainedAstMatcher matcher = new FineGrainedAstMatcher() {
- @Override
- protected boolean processDelta(boolean match, ASTNode node, Object other) {
- if (!match) {
- try {
- IJavaElement e = m_icu.getElementAt(node.getStartPosition());
- if (e != null) {
- set.add(new FineGrainedJavaElementDelta(e));
- }
- }
- catch (JavaModelException e1) {
- // nop
- }
- }
- return true;
- }
- };
- newAst.subtreeMatch(matcher, oldAst);
- return set.toArray(new FineGrainedJavaElementDelta[set.size()]);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.jdt.finegraned;
+
+import java.util.HashSet;
+
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaElementDelta;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.ASTParser;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.scout.commons.CompareUtility;
+
+class FineGrainedAstAnalyzer {
+ private IJavaElementDelta m_delta;
+ private ICompilationUnit m_icu;
+
+ public FineGrainedAstAnalyzer(IJavaElementDelta delta) {
+ m_delta = delta;
+ m_icu = (ICompilationUnit) delta.getElement();
+ }
+
+ public FineGrainedJavaElementDelta[] calculateDeltas(String oldContent, String newContent) {
+ if (CompareUtility.equals(oldContent, newContent)) {
+ return new FineGrainedJavaElementDelta[0];
+ }
+ CompilationUnit oldAst = null;
+ if (oldAst == null) {
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setCompilerOptions(JavaCore.getOptions());
+ parser.setKind(ASTParser.K_COMPILATION_UNIT);
+ parser.setSource(oldContent.toCharArray());
+ oldAst = (CompilationUnit) parser.createAST(null);
+ }
+ CompilationUnit newAst = m_delta.getCompilationUnitAST();
+ if (newAst == null) {
+ ASTParser parser = ASTParser.newParser(AST.JLS3);
+ parser.setCompilerOptions(JavaCore.getOptions());
+ parser.setKind(ASTParser.K_COMPILATION_UNIT);
+ parser.setSource(newContent.toCharArray());
+ newAst = (CompilationUnit) parser.createAST(null);
+ }
+ return calculateDeltas(oldAst, newAst);
+ }
+
+ public FineGrainedJavaElementDelta[] calculateDeltas(CompilationUnit oldAst, CompilationUnit newAst) {
+ final HashSet<FineGrainedJavaElementDelta> set = new HashSet<FineGrainedJavaElementDelta>();
+ FineGrainedAstMatcher matcher = new FineGrainedAstMatcher() {
+ @Override
+ protected boolean processDelta(boolean match, ASTNode node, Object other) {
+ if (!match) {
+ try {
+ IJavaElement e = m_icu.getElementAt(node.getStartPosition());
+ if (e != null) {
+ set.add(new FineGrainedJavaElementDelta(e));
+ }
+ }
+ catch (JavaModelException e1) {
+ // nop
+ }
+ }
+ return true;
+ }
+ };
+ newAst.subtreeMatch(matcher, oldAst);
+ return set.toArray(new FineGrainedJavaElementDelta[set.size()]);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedAstMatcher.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedAstMatcher.java
index 6d428cb0e..12a7120e2 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedAstMatcher.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedAstMatcher.java
@@ -1,520 +1,520 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.jdt.finegraned;
-
-import org.eclipse.jdt.core.dom.ASTMatcher;
-import org.eclipse.jdt.core.dom.ASTNode;
-import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration;
-import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration;
-import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
-import org.eclipse.jdt.core.dom.ArrayAccess;
-import org.eclipse.jdt.core.dom.ArrayCreation;
-import org.eclipse.jdt.core.dom.ArrayInitializer;
-import org.eclipse.jdt.core.dom.ArrayType;
-import org.eclipse.jdt.core.dom.AssertStatement;
-import org.eclipse.jdt.core.dom.Assignment;
-import org.eclipse.jdt.core.dom.Block;
-import org.eclipse.jdt.core.dom.BlockComment;
-import org.eclipse.jdt.core.dom.BooleanLiteral;
-import org.eclipse.jdt.core.dom.BreakStatement;
-import org.eclipse.jdt.core.dom.CastExpression;
-import org.eclipse.jdt.core.dom.CatchClause;
-import org.eclipse.jdt.core.dom.CharacterLiteral;
-import org.eclipse.jdt.core.dom.ClassInstanceCreation;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.ConditionalExpression;
-import org.eclipse.jdt.core.dom.ConstructorInvocation;
-import org.eclipse.jdt.core.dom.ContinueStatement;
-import org.eclipse.jdt.core.dom.DoStatement;
-import org.eclipse.jdt.core.dom.EmptyStatement;
-import org.eclipse.jdt.core.dom.EnhancedForStatement;
-import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
-import org.eclipse.jdt.core.dom.EnumDeclaration;
-import org.eclipse.jdt.core.dom.ExpressionStatement;
-import org.eclipse.jdt.core.dom.FieldAccess;
-import org.eclipse.jdt.core.dom.FieldDeclaration;
-import org.eclipse.jdt.core.dom.ForStatement;
-import org.eclipse.jdt.core.dom.IfStatement;
-import org.eclipse.jdt.core.dom.ImportDeclaration;
-import org.eclipse.jdt.core.dom.InfixExpression;
-import org.eclipse.jdt.core.dom.Initializer;
-import org.eclipse.jdt.core.dom.InstanceofExpression;
-import org.eclipse.jdt.core.dom.Javadoc;
-import org.eclipse.jdt.core.dom.LabeledStatement;
-import org.eclipse.jdt.core.dom.LineComment;
-import org.eclipse.jdt.core.dom.MarkerAnnotation;
-import org.eclipse.jdt.core.dom.MemberRef;
-import org.eclipse.jdt.core.dom.MemberValuePair;
-import org.eclipse.jdt.core.dom.MethodDeclaration;
-import org.eclipse.jdt.core.dom.MethodInvocation;
-import org.eclipse.jdt.core.dom.MethodRef;
-import org.eclipse.jdt.core.dom.MethodRefParameter;
-import org.eclipse.jdt.core.dom.Modifier;
-import org.eclipse.jdt.core.dom.NormalAnnotation;
-import org.eclipse.jdt.core.dom.NullLiteral;
-import org.eclipse.jdt.core.dom.NumberLiteral;
-import org.eclipse.jdt.core.dom.PackageDeclaration;
-import org.eclipse.jdt.core.dom.ParameterizedType;
-import org.eclipse.jdt.core.dom.ParenthesizedExpression;
-import org.eclipse.jdt.core.dom.PostfixExpression;
-import org.eclipse.jdt.core.dom.PrefixExpression;
-import org.eclipse.jdt.core.dom.PrimitiveType;
-import org.eclipse.jdt.core.dom.QualifiedName;
-import org.eclipse.jdt.core.dom.QualifiedType;
-import org.eclipse.jdt.core.dom.ReturnStatement;
-import org.eclipse.jdt.core.dom.SimpleName;
-import org.eclipse.jdt.core.dom.SimpleType;
-import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
-import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
-import org.eclipse.jdt.core.dom.StringLiteral;
-import org.eclipse.jdt.core.dom.SuperConstructorInvocation;
-import org.eclipse.jdt.core.dom.SuperFieldAccess;
-import org.eclipse.jdt.core.dom.SuperMethodInvocation;
-import org.eclipse.jdt.core.dom.SwitchCase;
-import org.eclipse.jdt.core.dom.SwitchStatement;
-import org.eclipse.jdt.core.dom.SynchronizedStatement;
-import org.eclipse.jdt.core.dom.TagElement;
-import org.eclipse.jdt.core.dom.TextElement;
-import org.eclipse.jdt.core.dom.ThisExpression;
-import org.eclipse.jdt.core.dom.ThrowStatement;
-import org.eclipse.jdt.core.dom.TryStatement;
-import org.eclipse.jdt.core.dom.TypeDeclaration;
-import org.eclipse.jdt.core.dom.TypeDeclarationStatement;
-import org.eclipse.jdt.core.dom.TypeLiteral;
-import org.eclipse.jdt.core.dom.TypeParameter;
-import org.eclipse.jdt.core.dom.VariableDeclarationExpression;
-import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
-import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
-import org.eclipse.jdt.core.dom.WhileStatement;
-import org.eclipse.jdt.core.dom.WildcardType;
-
-public abstract class FineGrainedAstMatcher extends ASTMatcher {
-
- public FineGrainedAstMatcher() {
- }
-
- protected abstract boolean processDelta(boolean match, ASTNode node, Object other);
-
- @Override
- public boolean match(AnnotationTypeDeclaration node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(AnnotationTypeMemberDeclaration node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(AnonymousClassDeclaration node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ArrayAccess node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ArrayCreation node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ArrayInitializer node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ArrayType node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(AssertStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(Assignment node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(Block node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(BlockComment node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(BooleanLiteral node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(BreakStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(CastExpression node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(CatchClause node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(CharacterLiteral node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ClassInstanceCreation node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(CompilationUnit node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ConditionalExpression node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ConstructorInvocation node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ContinueStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(DoStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(EmptyStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(EnhancedForStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(EnumConstantDeclaration node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(EnumDeclaration node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ExpressionStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(FieldAccess node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(FieldDeclaration node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ForStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(IfStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ImportDeclaration node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(InfixExpression node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(Initializer node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(InstanceofExpression node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(Javadoc node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(LabeledStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(LineComment node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(MarkerAnnotation node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(MemberRef node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(MemberValuePair node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(MethodDeclaration node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(MethodInvocation node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(MethodRef node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(MethodRefParameter node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(Modifier node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(NormalAnnotation node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(NullLiteral node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(NumberLiteral node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(PackageDeclaration node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ParameterizedType node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ParenthesizedExpression node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(PostfixExpression node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(PrefixExpression node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(PrimitiveType node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(QualifiedName node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(QualifiedType node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ReturnStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(SimpleName node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(SimpleType node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(SingleMemberAnnotation node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(SingleVariableDeclaration node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(StringLiteral node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(SuperConstructorInvocation node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(SuperFieldAccess node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(SuperMethodInvocation node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(SwitchCase node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(SwitchStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(SynchronizedStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(TagElement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(TextElement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ThisExpression node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(ThrowStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(TryStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(TypeDeclaration node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(TypeDeclarationStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(TypeLiteral node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(TypeParameter node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(VariableDeclarationExpression node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(VariableDeclarationFragment node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(VariableDeclarationStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(WhileStatement node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-
- @Override
- public boolean match(WildcardType node, Object other) {
- return processDelta(super.match(node, other), node, other);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.jdt.finegraned;
+
+import org.eclipse.jdt.core.dom.ASTMatcher;
+import org.eclipse.jdt.core.dom.ASTNode;
+import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration;
+import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration;
+import org.eclipse.jdt.core.dom.AnonymousClassDeclaration;
+import org.eclipse.jdt.core.dom.ArrayAccess;
+import org.eclipse.jdt.core.dom.ArrayCreation;
+import org.eclipse.jdt.core.dom.ArrayInitializer;
+import org.eclipse.jdt.core.dom.ArrayType;
+import org.eclipse.jdt.core.dom.AssertStatement;
+import org.eclipse.jdt.core.dom.Assignment;
+import org.eclipse.jdt.core.dom.Block;
+import org.eclipse.jdt.core.dom.BlockComment;
+import org.eclipse.jdt.core.dom.BooleanLiteral;
+import org.eclipse.jdt.core.dom.BreakStatement;
+import org.eclipse.jdt.core.dom.CastExpression;
+import org.eclipse.jdt.core.dom.CatchClause;
+import org.eclipse.jdt.core.dom.CharacterLiteral;
+import org.eclipse.jdt.core.dom.ClassInstanceCreation;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ConditionalExpression;
+import org.eclipse.jdt.core.dom.ConstructorInvocation;
+import org.eclipse.jdt.core.dom.ContinueStatement;
+import org.eclipse.jdt.core.dom.DoStatement;
+import org.eclipse.jdt.core.dom.EmptyStatement;
+import org.eclipse.jdt.core.dom.EnhancedForStatement;
+import org.eclipse.jdt.core.dom.EnumConstantDeclaration;
+import org.eclipse.jdt.core.dom.EnumDeclaration;
+import org.eclipse.jdt.core.dom.ExpressionStatement;
+import org.eclipse.jdt.core.dom.FieldAccess;
+import org.eclipse.jdt.core.dom.FieldDeclaration;
+import org.eclipse.jdt.core.dom.ForStatement;
+import org.eclipse.jdt.core.dom.IfStatement;
+import org.eclipse.jdt.core.dom.ImportDeclaration;
+import org.eclipse.jdt.core.dom.InfixExpression;
+import org.eclipse.jdt.core.dom.Initializer;
+import org.eclipse.jdt.core.dom.InstanceofExpression;
+import org.eclipse.jdt.core.dom.Javadoc;
+import org.eclipse.jdt.core.dom.LabeledStatement;
+import org.eclipse.jdt.core.dom.LineComment;
+import org.eclipse.jdt.core.dom.MarkerAnnotation;
+import org.eclipse.jdt.core.dom.MemberRef;
+import org.eclipse.jdt.core.dom.MemberValuePair;
+import org.eclipse.jdt.core.dom.MethodDeclaration;
+import org.eclipse.jdt.core.dom.MethodInvocation;
+import org.eclipse.jdt.core.dom.MethodRef;
+import org.eclipse.jdt.core.dom.MethodRefParameter;
+import org.eclipse.jdt.core.dom.Modifier;
+import org.eclipse.jdt.core.dom.NormalAnnotation;
+import org.eclipse.jdt.core.dom.NullLiteral;
+import org.eclipse.jdt.core.dom.NumberLiteral;
+import org.eclipse.jdt.core.dom.PackageDeclaration;
+import org.eclipse.jdt.core.dom.ParameterizedType;
+import org.eclipse.jdt.core.dom.ParenthesizedExpression;
+import org.eclipse.jdt.core.dom.PostfixExpression;
+import org.eclipse.jdt.core.dom.PrefixExpression;
+import org.eclipse.jdt.core.dom.PrimitiveType;
+import org.eclipse.jdt.core.dom.QualifiedName;
+import org.eclipse.jdt.core.dom.QualifiedType;
+import org.eclipse.jdt.core.dom.ReturnStatement;
+import org.eclipse.jdt.core.dom.SimpleName;
+import org.eclipse.jdt.core.dom.SimpleType;
+import org.eclipse.jdt.core.dom.SingleMemberAnnotation;
+import org.eclipse.jdt.core.dom.SingleVariableDeclaration;
+import org.eclipse.jdt.core.dom.StringLiteral;
+import org.eclipse.jdt.core.dom.SuperConstructorInvocation;
+import org.eclipse.jdt.core.dom.SuperFieldAccess;
+import org.eclipse.jdt.core.dom.SuperMethodInvocation;
+import org.eclipse.jdt.core.dom.SwitchCase;
+import org.eclipse.jdt.core.dom.SwitchStatement;
+import org.eclipse.jdt.core.dom.SynchronizedStatement;
+import org.eclipse.jdt.core.dom.TagElement;
+import org.eclipse.jdt.core.dom.TextElement;
+import org.eclipse.jdt.core.dom.ThisExpression;
+import org.eclipse.jdt.core.dom.ThrowStatement;
+import org.eclipse.jdt.core.dom.TryStatement;
+import org.eclipse.jdt.core.dom.TypeDeclaration;
+import org.eclipse.jdt.core.dom.TypeDeclarationStatement;
+import org.eclipse.jdt.core.dom.TypeLiteral;
+import org.eclipse.jdt.core.dom.TypeParameter;
+import org.eclipse.jdt.core.dom.VariableDeclarationExpression;
+import org.eclipse.jdt.core.dom.VariableDeclarationFragment;
+import org.eclipse.jdt.core.dom.VariableDeclarationStatement;
+import org.eclipse.jdt.core.dom.WhileStatement;
+import org.eclipse.jdt.core.dom.WildcardType;
+
+public abstract class FineGrainedAstMatcher extends ASTMatcher {
+
+ public FineGrainedAstMatcher() {
+ }
+
+ protected abstract boolean processDelta(boolean match, ASTNode node, Object other);
+
+ @Override
+ public boolean match(AnnotationTypeDeclaration node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(AnnotationTypeMemberDeclaration node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(AnonymousClassDeclaration node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ArrayAccess node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ArrayCreation node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ArrayInitializer node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ArrayType node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(AssertStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(Assignment node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(Block node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(BlockComment node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(BooleanLiteral node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(BreakStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(CastExpression node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(CatchClause node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(CharacterLiteral node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ClassInstanceCreation node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(CompilationUnit node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ConditionalExpression node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ConstructorInvocation node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ContinueStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(DoStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(EmptyStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(EnhancedForStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(EnumConstantDeclaration node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(EnumDeclaration node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ExpressionStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(FieldAccess node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(FieldDeclaration node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ForStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(IfStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ImportDeclaration node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(InfixExpression node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(Initializer node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(InstanceofExpression node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(Javadoc node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(LabeledStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(LineComment node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(MarkerAnnotation node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(MemberRef node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(MemberValuePair node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(MethodDeclaration node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(MethodInvocation node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(MethodRef node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(MethodRefParameter node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(Modifier node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(NormalAnnotation node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(NullLiteral node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(NumberLiteral node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(PackageDeclaration node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ParameterizedType node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ParenthesizedExpression node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(PostfixExpression node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(PrefixExpression node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(PrimitiveType node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(QualifiedName node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(QualifiedType node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ReturnStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(SimpleName node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(SimpleType node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(SingleMemberAnnotation node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(SingleVariableDeclaration node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(StringLiteral node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(SuperConstructorInvocation node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(SuperFieldAccess node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(SuperMethodInvocation node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(SwitchCase node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(SwitchStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(SynchronizedStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(TagElement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(TextElement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ThisExpression node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(ThrowStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(TryStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(TypeDeclaration node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(TypeDeclarationStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(TypeLiteral node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(TypeParameter node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(VariableDeclarationExpression node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(VariableDeclarationFragment node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(VariableDeclarationStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(WhileStatement node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+
+ @Override
+ public boolean match(WildcardType node, Object other) {
+ return processDelta(super.match(node, other), node, other);
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedJavaElementDelta.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedJavaElementDelta.java
index 5e0546c3d..3ba6ce891 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedJavaElementDelta.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedJavaElementDelta.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.jdt.finegraned;
-
-import org.eclipse.jdt.core.IJavaElement;
-
-public class FineGrainedJavaElementDelta {
- private IJavaElement m_element;
-
- public FineGrainedJavaElementDelta(IJavaElement element) {
- m_element = element;
- }
-
- public IJavaElement getElement() {
- return m_element;
- }
-
- @Override
- public int hashCode() {
- return m_element.hashCode();
- }
-
- @Override
- public boolean equals(Object o) {
- return this.m_element == ((FineGrainedJavaElementDelta) o).m_element;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.jdt.finegraned;
+
+import org.eclipse.jdt.core.IJavaElement;
+
+public class FineGrainedJavaElementDelta {
+ private IJavaElement m_element;
+
+ public FineGrainedJavaElementDelta(IJavaElement element) {
+ m_element = element;
+ }
+
+ public IJavaElement getElement() {
+ return m_element;
+ }
+
+ @Override
+ public int hashCode() {
+ return m_element.hashCode();
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ return this.m_element == ((FineGrainedJavaElementDelta) o).m_element;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedJavaElementDeltaManager.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedJavaElementDeltaManager.java
index de7b24ca5..61fe3aee1 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedJavaElementDeltaManager.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/jdt/finegraned/FineGrainedJavaElementDeltaManager.java
@@ -1,94 +1,94 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.jdt.finegraned;
-
-import java.io.InputStreamReader;
-import java.util.HashMap;
-import java.util.WeakHashMap;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jdt.core.BufferChangedEvent;
-import org.eclipse.jdt.core.IBufferChangedListener;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElementDelta;
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-
-/**
- * Caches the source of {@link ICompilationUnit}s that are not in sync with their buffer
- */
-public class FineGrainedJavaElementDeltaManager {
- private static FineGrainedJavaElementDeltaManager instance = new FineGrainedJavaElementDeltaManager();
-
- public static FineGrainedJavaElementDeltaManager getInstance() {
- return instance;
- }
-
- private Object m_cacheLock = new Object();
- private WeakHashMap<IJavaElementDelta, FineGrainedJavaElementDelta[]> m_deltaCache = new WeakHashMap<IJavaElementDelta, FineGrainedJavaElementDelta[]>();
- private HashMap<String/* path */, String/* source */> m_sourceCache = new HashMap<String, String>();
- private IBufferChangedListener m_bufferListener;
-
- private FineGrainedJavaElementDeltaManager() {
- m_bufferListener = new IBufferChangedListener() {
- @Override
- public void bufferChanged(BufferChangedEvent e) {
- if (e.getBuffer().isClosed()) {
- if (e.getBuffer().getOwner() instanceof ICompilationUnit) {
- ICompilationUnit icu = (ICompilationUnit) e.getBuffer().getOwner();
- synchronized (m_cacheLock) {
- String path = icu.getPath().toString();
- m_sourceCache.remove(path);
- }
- }
- }
- }
- };
- }
-
- public FineGrainedJavaElementDelta[] getDelta(IJavaElementDelta delta) {
- FineGrainedJavaElementDelta[] astDeltas;
- synchronized (m_cacheLock) {
- astDeltas = m_deltaCache.get(delta);
- if (astDeltas == null) {
- try {
- ICompilationUnit icu = (ICompilationUnit) delta.getElement();
- String path = icu.getPath().toString();
- String oldContent = m_sourceCache.get(path);
- IFile file = (IFile) icu.getResource();
- String bufferContent = null;
- if (file.exists()) bufferContent = IOUtility.getContent(new InputStreamReader(file.getContents(true), file.getCharset()));
- String newContent = icu.getSource();
- // update source cache
- if (oldContent == null) {
- oldContent = bufferContent;
- }
- if (newContent.equals(bufferContent)) {
- m_sourceCache.remove(path);
- }
- else {
- m_sourceCache.put(path, newContent);
- icu.getBuffer().removeBufferChangedListener(m_bufferListener);
- icu.getBuffer().addBufferChangedListener(m_bufferListener);
- }
- //
- astDeltas = new FineGrainedAstAnalyzer(delta).calculateDeltas(oldContent, newContent);
- }
- catch (Exception e) {
- SdkUtilActivator.logWarning(e);
- astDeltas = new FineGrainedJavaElementDelta[0];
- }
- m_deltaCache.put(delta, astDeltas);
- }
- }
- return astDeltas;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.jdt.finegraned;
+
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.WeakHashMap;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jdt.core.BufferChangedEvent;
+import org.eclipse.jdt.core.IBufferChangedListener;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElementDelta;
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+
+/**
+ * Caches the source of {@link ICompilationUnit}s that are not in sync with their buffer
+ */
+public class FineGrainedJavaElementDeltaManager {
+ private static FineGrainedJavaElementDeltaManager instance = new FineGrainedJavaElementDeltaManager();
+
+ public static FineGrainedJavaElementDeltaManager getInstance() {
+ return instance;
+ }
+
+ private Object m_cacheLock = new Object();
+ private WeakHashMap<IJavaElementDelta, FineGrainedJavaElementDelta[]> m_deltaCache = new WeakHashMap<IJavaElementDelta, FineGrainedJavaElementDelta[]>();
+ private HashMap<String/* path */, String/* source */> m_sourceCache = new HashMap<String, String>();
+ private IBufferChangedListener m_bufferListener;
+
+ private FineGrainedJavaElementDeltaManager() {
+ m_bufferListener = new IBufferChangedListener() {
+ @Override
+ public void bufferChanged(BufferChangedEvent e) {
+ if (e.getBuffer().isClosed()) {
+ if (e.getBuffer().getOwner() instanceof ICompilationUnit) {
+ ICompilationUnit icu = (ICompilationUnit) e.getBuffer().getOwner();
+ synchronized (m_cacheLock) {
+ String path = icu.getPath().toString();
+ m_sourceCache.remove(path);
+ }
+ }
+ }
+ }
+ };
+ }
+
+ public FineGrainedJavaElementDelta[] getDelta(IJavaElementDelta delta) {
+ FineGrainedJavaElementDelta[] astDeltas;
+ synchronized (m_cacheLock) {
+ astDeltas = m_deltaCache.get(delta);
+ if (astDeltas == null) {
+ try {
+ ICompilationUnit icu = (ICompilationUnit) delta.getElement();
+ String path = icu.getPath().toString();
+ String oldContent = m_sourceCache.get(path);
+ IFile file = (IFile) icu.getResource();
+ String bufferContent = null;
+ if (file.exists()) bufferContent = IOUtility.getContent(new InputStreamReader(file.getContents(true), file.getCharset()));
+ String newContent = icu.getSource();
+ // update source cache
+ if (oldContent == null) {
+ oldContent = bufferContent;
+ }
+ if (newContent.equals(bufferContent)) {
+ m_sourceCache.remove(path);
+ }
+ else {
+ m_sourceCache.put(path, newContent);
+ icu.getBuffer().removeBufferChangedListener(m_bufferListener);
+ icu.getBuffer().addBufferChangedListener(m_bufferListener);
+ }
+ //
+ astDeltas = new FineGrainedAstAnalyzer(delta).calculateDeltas(oldContent, newContent);
+ }
+ catch (Exception e) {
+ SdkUtilActivator.logWarning(e);
+ astDeltas = new FineGrainedJavaElementDelta[0];
+ }
+ m_deltaCache.put(delta, astDeltas);
+ }
+ }
+ return astDeltas;
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/LogStatus.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/LogStatus.java
index f8f08b32e..2cd2426ed 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/LogStatus.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/LogStatus.java
@@ -1,94 +1,94 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.log;
-
-import java.util.HashSet;
-
-import org.eclipse.core.runtime.Status;
-
-/**
- * <h3>{@link LogStatus}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 1.0.8 24.11.2010
- */
-public class LogStatus extends Status {
-
- private StackTraceElement m_callerElement;
-
- public LogStatus(Class<?> wrapperClazz, int severity, String pluginId, int code, String message, Throwable exception) {
- super(severity, pluginId, code, message, exception);
- setWrapperClass(wrapperClazz);
- }
-
- public LogStatus(Class<?> wrapperClazz, int severity, String pluginId, String message, Throwable exception) {
- super(severity, pluginId, message, exception);
- setWrapperClass(wrapperClazz);
- }
-
- public LogStatus(Class<?> wrapperClazz, int severity, String pluginId, String message) {
- super(severity, pluginId, message);
- setWrapperClass(wrapperClazz);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.core.runtime.Status#getMessage()
- */
- @Override
- public String getMessage() {
- StringBuilder message = new StringBuilder();
- if (m_callerElement != null) {
- message.append(m_callerElement + "\n\t");
- }
- message.append(super.getMessage());
- return message.toString();
- }
-
- private void setWrapperClass(Class<?> wrapperClazz) {
- if (m_callerElement == null) {
- m_callerElement = getCallerLine(wrapperClazz);
- }
- }
-
- private StackTraceElement getCallerLine(Class wrapperClass) {
- try {
- StackTraceElement[] trace = new Exception().getStackTrace();
- int traceIndex = 0;
- HashSet<String> ignoredPackagePrefixes = new HashSet<String>();
- ignoredPackagePrefixes.add(LogStatus.class.getName());
- ignoredPackagePrefixes.add(SdkLogManager.class.getName());
- if (wrapperClass != null) {
- ignoredPackagePrefixes.add(wrapperClass.getName());
- }
- while (traceIndex < trace.length) {
- boolean found = true;
- for (String prefix : ignoredPackagePrefixes) {
- if (trace[traceIndex].getClassName().startsWith(prefix)) {
- found = false;
- break;
- }
- }
- if (found) {
- break;
- }
- traceIndex++;
- }
- if (traceIndex >= trace.length) {
- traceIndex = trace.length - 1;
- }
- return trace[traceIndex];
- }
- catch (Throwable t) {
- return null;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.log;
+
+import java.util.HashSet;
+
+import org.eclipse.core.runtime.Status;
+
+/**
+ * <h3>{@link LogStatus}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 1.0.8 24.11.2010
+ */
+public class LogStatus extends Status {
+
+ private StackTraceElement m_callerElement;
+
+ public LogStatus(Class<?> wrapperClazz, int severity, String pluginId, int code, String message, Throwable exception) {
+ super(severity, pluginId, code, message, exception);
+ setWrapperClass(wrapperClazz);
+ }
+
+ public LogStatus(Class<?> wrapperClazz, int severity, String pluginId, String message, Throwable exception) {
+ super(severity, pluginId, message, exception);
+ setWrapperClass(wrapperClazz);
+ }
+
+ public LogStatus(Class<?> wrapperClazz, int severity, String pluginId, String message) {
+ super(severity, pluginId, message);
+ setWrapperClass(wrapperClazz);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.core.runtime.Status#getMessage()
+ */
+ @Override
+ public String getMessage() {
+ StringBuilder message = new StringBuilder();
+ if (m_callerElement != null) {
+ message.append(m_callerElement + "\n\t");
+ }
+ message.append(super.getMessage());
+ return message.toString();
+ }
+
+ private void setWrapperClass(Class<?> wrapperClazz) {
+ if (m_callerElement == null) {
+ m_callerElement = getCallerLine(wrapperClazz);
+ }
+ }
+
+ private StackTraceElement getCallerLine(Class wrapperClass) {
+ try {
+ StackTraceElement[] trace = new Exception().getStackTrace();
+ int traceIndex = 0;
+ HashSet<String> ignoredPackagePrefixes = new HashSet<String>();
+ ignoredPackagePrefixes.add(LogStatus.class.getName());
+ ignoredPackagePrefixes.add(SdkLogManager.class.getName());
+ if (wrapperClass != null) {
+ ignoredPackagePrefixes.add(wrapperClass.getName());
+ }
+ while (traceIndex < trace.length) {
+ boolean found = true;
+ for (String prefix : ignoredPackagePrefixes) {
+ if (trace[traceIndex].getClassName().startsWith(prefix)) {
+ found = false;
+ break;
+ }
+ }
+ if (found) {
+ break;
+ }
+ traceIndex++;
+ }
+ if (traceIndex >= trace.length) {
+ traceIndex = trace.length - 1;
+ }
+ return trace[traceIndex];
+ }
+ catch (Throwable t) {
+ return null;
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/ScoutStatus.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/ScoutStatus.java
index c1f56e220..618335cac 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/ScoutStatus.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/ScoutStatus.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.log;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-
-public class ScoutStatus extends Status {
-
- public ScoutStatus(String message) {
- this(message, null);
- }
-
- public ScoutStatus(Throwable exception) {
- this(null, exception);
- }
-
- public ScoutStatus(String message, Throwable exception) {
- super(IStatus.ERROR, SdkUtilActivator.PLUGIN_ID, 0, message != null ? message : "", exception);
- }
-
- public ScoutStatus(IStatus status) {
- super(status.getSeverity(), status.getPlugin(), status.getMessage(), status.getException());
- }
-
- public ScoutStatus(int severity, String message, Throwable exception) {
- super(severity, SdkUtilActivator.PLUGIN_ID, 0, message, exception);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.log;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+
+public class ScoutStatus extends Status {
+
+ public ScoutStatus(String message) {
+ this(message, null);
+ }
+
+ public ScoutStatus(Throwable exception) {
+ this(null, exception);
+ }
+
+ public ScoutStatus(String message, Throwable exception) {
+ super(IStatus.ERROR, SdkUtilActivator.PLUGIN_ID, 0, message != null ? message : "", exception);
+ }
+
+ public ScoutStatus(IStatus status) {
+ super(status.getSeverity(), status.getPlugin(), status.getMessage(), status.getException());
+ }
+
+ public ScoutStatus(int severity, String message, Throwable exception) {
+ super(severity, SdkUtilActivator.PLUGIN_ID, 0, message, exception);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/SdkLogManager.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/SdkLogManager.java
index 23aa682bc..5526c4724 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/SdkLogManager.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/log/SdkLogManager.java
@@ -1,153 +1,153 @@
-package org.eclipse.scout.sdk.util.log;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.scout.commons.StringUtility;
-import org.osgi.framework.BundleContext;
-
-public class SdkLogManager {
-
- private static final String LOG_LEVEL_SUFFIX = ".loglevel";
-
- private int m_loglevel;
- private final Plugin m_plugin;
-
- public SdkLogManager(Plugin p) {
- this(p, getLogLevelProperty(p));
- }
-
- public SdkLogManager(Plugin p, String logLevel) {
- this(p, parseLogLevel(logLevel));
- }
-
- public SdkLogManager(Plugin p, int logLevel) {
- m_plugin = p;
- m_loglevel = logLevel;
- }
-
- private LogStatus createLogStatus(int severity, String message, Throwable t) {
- return new LogStatus(m_plugin.getClass(), severity, m_plugin.getBundle().getSymbolicName(), message, t);
- }
-
- private LogStatus createLogStatus(IStatus log) {
- if (log instanceof LogStatus) {
- return (LogStatus) log;
- }
- else {
- return new LogStatus(m_plugin.getClass(), log.getSeverity(), log.getPlugin(), log.getMessage(), log.getException());
- }
- }
-
- private void logImpl(LogStatus log) {
- if ((log.getSeverity() & m_loglevel) != 0) {
- m_plugin.getLog().log(log);
- }
- }
-
- public void log(IStatus log) {
- logImpl(createLogStatus(log));
- }
-
- public void logInfo(Throwable t) {
- logInfo(null, t);
- }
-
- public void logInfo(String message) {
- logInfo(message, null);
- }
-
- public void logInfo(String message, Throwable t) {
- if (message == null) {
- message = "";
- }
- logImpl(createLogStatus(IStatus.INFO, message, t));
- }
-
- public void logWarning(String message) {
- logWarning(message, null);
- }
-
- public void logWarning(Throwable t) {
- logWarning(null, t);
- }
-
- public void logWarning(String message, Throwable t) {
- if (message == null) {
- message = "";
- }
- logImpl(createLogStatus(IStatus.WARNING, message, t));
- }
-
- public void logError(Throwable t) {
- logError("", t);
- }
-
- public void logError(String message) {
- logError(message, null);
- }
-
- public void logError(String message, Throwable t) {
- if (message == null) {
- message = "";
- }
- logImpl(createLogStatus(IStatus.ERROR, message, t));
- }
-
- /**
- * @see SdkLogManager#log(int, String, Throwable)
- */
- public void log(int logLevel, Throwable t) {
- log(logLevel, "", t);
- }
-
- /**
- * @see SdkLogManager#log(int, String, Throwable)
- */
- public void log(int logLevel, String message) {
- log(logLevel, message, null);
- }
-
- /**
- * @param logLevel
- * one of {@link IStatus#INFO}, {@link IStatus#WARNING} or {@link IStatus#ERROR}
- * @param message
- * @param t
- */
- public void log(int logLevel, String message, Throwable t) {
- if (message == null) {
- message = "";
- }
- logImpl(createLogStatus(logLevel, message, t));
- }
-
- private static String getLogLevelProperty(Plugin p) {
- if (p != null && p.getBundle() != null) {
- return getLogLevelProperty(p.getBundle().getBundleContext());
- }
- else {
- return null;
- }
- }
-
- private static String getLogLevelProperty(BundleContext context) {
- if (context == null) return null;
- else return context.getProperty(context.getBundle().getSymbolicName() + LOG_LEVEL_SUFFIX);
- }
-
- private static int parseLogLevel(String loglevel) {
- int level = IStatus.INFO | IStatus.WARNING | IStatus.ERROR | IStatus.CANCEL;
- if (!StringUtility.isNullOrEmpty(loglevel)) {
- String lowerLoglevel = loglevel.toLowerCase();
- if (lowerLoglevel.equals("warning")) {
- level = IStatus.WARNING | IStatus.ERROR | IStatus.CANCEL;
- }
- else if (lowerLoglevel.equals("error")) {
- level = IStatus.ERROR | IStatus.CANCEL;
- }
- else if (lowerLoglevel.equals("cancel")) {
- level = IStatus.CANCEL;
- }
- }
- return level;
- }
-}
+package org.eclipse.scout.sdk.util.log;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Plugin;
+import org.eclipse.scout.commons.StringUtility;
+import org.osgi.framework.BundleContext;
+
+public class SdkLogManager {
+
+ private static final String LOG_LEVEL_SUFFIX = ".loglevel";
+
+ private int m_loglevel;
+ private final Plugin m_plugin;
+
+ public SdkLogManager(Plugin p) {
+ this(p, getLogLevelProperty(p));
+ }
+
+ public SdkLogManager(Plugin p, String logLevel) {
+ this(p, parseLogLevel(logLevel));
+ }
+
+ public SdkLogManager(Plugin p, int logLevel) {
+ m_plugin = p;
+ m_loglevel = logLevel;
+ }
+
+ private LogStatus createLogStatus(int severity, String message, Throwable t) {
+ return new LogStatus(m_plugin.getClass(), severity, m_plugin.getBundle().getSymbolicName(), message, t);
+ }
+
+ private LogStatus createLogStatus(IStatus log) {
+ if (log instanceof LogStatus) {
+ return (LogStatus) log;
+ }
+ else {
+ return new LogStatus(m_plugin.getClass(), log.getSeverity(), log.getPlugin(), log.getMessage(), log.getException());
+ }
+ }
+
+ private void logImpl(LogStatus log) {
+ if ((log.getSeverity() & m_loglevel) != 0) {
+ m_plugin.getLog().log(log);
+ }
+ }
+
+ public void log(IStatus log) {
+ logImpl(createLogStatus(log));
+ }
+
+ public void logInfo(Throwable t) {
+ logInfo(null, t);
+ }
+
+ public void logInfo(String message) {
+ logInfo(message, null);
+ }
+
+ public void logInfo(String message, Throwable t) {
+ if (message == null) {
+ message = "";
+ }
+ logImpl(createLogStatus(IStatus.INFO, message, t));
+ }
+
+ public void logWarning(String message) {
+ logWarning(message, null);
+ }
+
+ public void logWarning(Throwable t) {
+ logWarning(null, t);
+ }
+
+ public void logWarning(String message, Throwable t) {
+ if (message == null) {
+ message = "";
+ }
+ logImpl(createLogStatus(IStatus.WARNING, message, t));
+ }
+
+ public void logError(Throwable t) {
+ logError("", t);
+ }
+
+ public void logError(String message) {
+ logError(message, null);
+ }
+
+ public void logError(String message, Throwable t) {
+ if (message == null) {
+ message = "";
+ }
+ logImpl(createLogStatus(IStatus.ERROR, message, t));
+ }
+
+ /**
+ * @see SdkLogManager#log(int, String, Throwable)
+ */
+ public void log(int logLevel, Throwable t) {
+ log(logLevel, "", t);
+ }
+
+ /**
+ * @see SdkLogManager#log(int, String, Throwable)
+ */
+ public void log(int logLevel, String message) {
+ log(logLevel, message, null);
+ }
+
+ /**
+ * @param logLevel
+ * one of {@link IStatus#INFO}, {@link IStatus#WARNING} or {@link IStatus#ERROR}
+ * @param message
+ * @param t
+ */
+ public void log(int logLevel, String message, Throwable t) {
+ if (message == null) {
+ message = "";
+ }
+ logImpl(createLogStatus(logLevel, message, t));
+ }
+
+ private static String getLogLevelProperty(Plugin p) {
+ if (p != null && p.getBundle() != null) {
+ return getLogLevelProperty(p.getBundle().getBundleContext());
+ }
+ else {
+ return null;
+ }
+ }
+
+ private static String getLogLevelProperty(BundleContext context) {
+ if (context == null) return null;
+ else return context.getProperty(context.getBundle().getSymbolicName() + LOG_LEVEL_SUFFIX);
+ }
+
+ private static int parseLogLevel(String loglevel) {
+ int level = IStatus.INFO | IStatus.WARNING | IStatus.ERROR | IStatus.CANCEL;
+ if (!StringUtility.isNullOrEmpty(loglevel)) {
+ String lowerLoglevel = loglevel.toLowerCase();
+ if (lowerLoglevel.equals("warning")) {
+ level = IStatus.WARNING | IStatus.ERROR | IStatus.CANCEL;
+ }
+ else if (lowerLoglevel.equals("error")) {
+ level = IStatus.ERROR | IStatus.CANCEL;
+ }
+ else if (lowerLoglevel.equals("cancel")) {
+ level = IStatus.CANCEL;
+ }
+ }
+ return level;
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/LazyPluginModel.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/LazyPluginModel.java
index 86d9b3c3c..11cbfd3a5 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/LazyPluginModel.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/LazyPluginModel.java
@@ -1,166 +1,166 @@
-package org.eclipse.scout.sdk.util.pde;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.pde.core.build.IBuildModel;
-import org.eclipse.pde.core.plugin.IPluginBase;
-import org.eclipse.pde.core.plugin.IPluginModelBase;
-import org.eclipse.pde.internal.core.ICoreConstants;
-import org.eclipse.pde.internal.core.PDECore;
-import org.eclipse.pde.internal.core.PDEState;
-import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
-import org.eclipse.pde.internal.core.bundle.BundlePluginModel;
-import org.eclipse.pde.internal.core.bundle.BundlePluginModelBase;
-import org.eclipse.pde.internal.core.bundle.WorkspaceBundleModel;
-import org.eclipse.pde.internal.core.ibundle.IBundle;
-import org.eclipse.pde.internal.core.plugin.WorkspaceExtensionsModel;
-
-/**
- * Base class for PDE model access of workspace plugins.<br>
- * This implementation uses lazy initialization of the PDE models.<br>
- * This class is thread safe.
- *
- * @author mvi
- * @since 3.8.0
- */
-@SuppressWarnings("restriction")
-public final class LazyPluginModel {
- private final IProject m_project;
- private final IFile m_manifestFile;
- private final IFile m_pluginXmlFile;
- private final IFile m_buildPropertiesFile;
-
- // lazily instantiated models
- private BundleDescription m_desc;
- private BundlePluginModelBase m_bundlePluginModel;
- private IPluginBase m_pluginBase;
- private IBundle m_bundle;
- private WorkspaceBundleModel m_bundleModel;
- private WorkspaceBuildModel m_buildModel;
- private WorkspaceExtensionsModel m_extensionsModel;
-
- public LazyPluginModel(IProject project) {
- if (project == null) throw new IllegalArgumentException("null project not allowed.");
- m_project = project;
- m_manifestFile = getProject().getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
- m_pluginXmlFile = getProject().getFile(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR);
- m_buildPropertiesFile = getProject().getFile(ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
-
- if (!isInteresting()) throw new IllegalArgumentException("the passed project is not a valid plugin.");
- }
-
- private boolean isInteresting() {
- return getProject() != null && getProject().isOpen() && getProject().exists() &&
- getManifestFile() != null && getManifestFile().exists() &&
- getPluginXmlFile() != null && /* plugin.xml must not exist yet */
- getBuildPropertiesFile() != null && getBuildPropertiesFile().exists();
- }
-
- public synchronized BundlePluginModelBase getBundlePluginModel() {
- if (m_bundlePluginModel == null) {
- m_bundlePluginModel = new BundlePluginModel();
- m_bundlePluginModel.setEnabled(true);
- m_bundlePluginModel.setBundleDescription(getBundleDescription());
- m_bundlePluginModel.setBundleModel(getBundleModel());
- m_bundlePluginModel.setExtensionsModel(getExtensionsModel());
- m_bundlePluginModel.setBuildModel(getBuildModel());
- }
- return m_bundlePluginModel;
- }
-
- public synchronized WorkspaceExtensionsModel getExtensionsModel() {
- if (m_extensionsModel == null) {
- m_extensionsModel = new WorkspaceExtensionsModel(getPluginXmlFile());
- m_extensionsModel.setBundleModel(getBundlePluginModel());
- m_extensionsModel.load(getBundleDescription(), getPdeState());
- m_extensionsModel.setDirty(false); // the model is marked dirty after a fresh load
- }
- return m_extensionsModel;
- }
-
- public synchronized IPluginBase getPluginBase() {
- if (m_pluginBase == null) {
- m_pluginBase = getBundlePluginModel().getPluginBase(true);
- }
- return m_pluginBase;
- }
-
- public synchronized IBuildModel getBuildModel() {
- if (m_buildModel == null) {
- m_buildModel = new WorkspaceBuildModel(getBuildPropertiesFile());
- m_buildModel.load();
- m_buildModel.setDirty(false); // the model is marked dirty after a fresh load
- }
- return m_buildModel;
- }
-
- public synchronized IBundle getBundle() {
- if (m_bundle == null) {
- m_bundle = getBundleModel().getBundle();
- }
- return m_bundle;
- }
-
- public synchronized WorkspaceBundleModel getBundleModel() {
- if (m_bundleModel == null) {
- m_bundleModel = new WorkspaceBundleModel(getManifestFile());
- m_bundleModel.load();
- m_bundleModel.setDirty(false); // the model is marked dirty after a fresh load
- }
- return m_bundleModel;
- }
-
- public final static PDEState getPdeState() {
- return PDECore.getDefault().getModelManager().getState();
- }
-
- public synchronized BundleDescription getBundleDescription() {
- if (m_desc == null) {
- IPluginModelBase pluginBase = PDECore.getDefault().getModelManager().findModel(getProject());
- if (pluginBase != null) {
- m_desc = pluginBase.getBundleDescription();
- }
-
- if (m_desc == null) {
- throw new IllegalArgumentException("project '" + getProject().getName() + "' could not be found in the workspace.");
- }
- }
- return m_desc;
- }
-
- public synchronized void save() {
- if (m_bundlePluginModel != null && m_bundlePluginModel.isDirty()) {
- // if available: saves bundle model and extensions model
- m_bundlePluginModel.save();
- }
- else {
- if (m_bundleModel != null && m_bundleModel.isDirty()) {
- m_bundleModel.save();
- }
- if (m_extensionsModel != null && m_extensionsModel.isDirty()) {
- m_extensionsModel.save();
- }
- }
-
- if (m_buildModel != null && m_buildModel.isDirty()) {
- m_buildModel.save();
- }
- }
-
- public IProject getProject() {
- return m_project;
- }
-
- public IFile getManifestFile() {
- return m_manifestFile;
- }
-
- public IFile getPluginXmlFile() {
- return m_pluginXmlFile;
- }
-
- public IFile getBuildPropertiesFile() {
- return m_buildPropertiesFile;
- }
-}
+package org.eclipse.scout.sdk.util.pde;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.osgi.service.resolver.BundleDescription;
+import org.eclipse.pde.core.build.IBuildModel;
+import org.eclipse.pde.core.plugin.IPluginBase;
+import org.eclipse.pde.core.plugin.IPluginModelBase;
+import org.eclipse.pde.internal.core.ICoreConstants;
+import org.eclipse.pde.internal.core.PDECore;
+import org.eclipse.pde.internal.core.PDEState;
+import org.eclipse.pde.internal.core.build.WorkspaceBuildModel;
+import org.eclipse.pde.internal.core.bundle.BundlePluginModel;
+import org.eclipse.pde.internal.core.bundle.BundlePluginModelBase;
+import org.eclipse.pde.internal.core.bundle.WorkspaceBundleModel;
+import org.eclipse.pde.internal.core.ibundle.IBundle;
+import org.eclipse.pde.internal.core.plugin.WorkspaceExtensionsModel;
+
+/**
+ * Base class for PDE model access of workspace plugins.<br>
+ * This implementation uses lazy initialization of the PDE models.<br>
+ * This class is thread safe.
+ *
+ * @author mvi
+ * @since 3.8.0
+ */
+@SuppressWarnings("restriction")
+public final class LazyPluginModel {
+ private final IProject m_project;
+ private final IFile m_manifestFile;
+ private final IFile m_pluginXmlFile;
+ private final IFile m_buildPropertiesFile;
+
+ // lazily instantiated models
+ private BundleDescription m_desc;
+ private BundlePluginModelBase m_bundlePluginModel;
+ private IPluginBase m_pluginBase;
+ private IBundle m_bundle;
+ private WorkspaceBundleModel m_bundleModel;
+ private WorkspaceBuildModel m_buildModel;
+ private WorkspaceExtensionsModel m_extensionsModel;
+
+ public LazyPluginModel(IProject project) {
+ if (project == null) throw new IllegalArgumentException("null project not allowed.");
+ m_project = project;
+ m_manifestFile = getProject().getFile(ICoreConstants.BUNDLE_FILENAME_DESCRIPTOR);
+ m_pluginXmlFile = getProject().getFile(ICoreConstants.PLUGIN_FILENAME_DESCRIPTOR);
+ m_buildPropertiesFile = getProject().getFile(ICoreConstants.BUILD_FILENAME_DESCRIPTOR);
+
+ if (!isInteresting()) throw new IllegalArgumentException("the passed project is not a valid plugin.");
+ }
+
+ private boolean isInteresting() {
+ return getProject() != null && getProject().isOpen() && getProject().exists() &&
+ getManifestFile() != null && getManifestFile().exists() &&
+ getPluginXmlFile() != null && /* plugin.xml must not exist yet */
+ getBuildPropertiesFile() != null && getBuildPropertiesFile().exists();
+ }
+
+ public synchronized BundlePluginModelBase getBundlePluginModel() {
+ if (m_bundlePluginModel == null) {
+ m_bundlePluginModel = new BundlePluginModel();
+ m_bundlePluginModel.setEnabled(true);
+ m_bundlePluginModel.setBundleDescription(getBundleDescription());
+ m_bundlePluginModel.setBundleModel(getBundleModel());
+ m_bundlePluginModel.setExtensionsModel(getExtensionsModel());
+ m_bundlePluginModel.setBuildModel(getBuildModel());
+ }
+ return m_bundlePluginModel;
+ }
+
+ public synchronized WorkspaceExtensionsModel getExtensionsModel() {
+ if (m_extensionsModel == null) {
+ m_extensionsModel = new WorkspaceExtensionsModel(getPluginXmlFile());
+ m_extensionsModel.setBundleModel(getBundlePluginModel());
+ m_extensionsModel.load(getBundleDescription(), getPdeState());
+ m_extensionsModel.setDirty(false); // the model is marked dirty after a fresh load
+ }
+ return m_extensionsModel;
+ }
+
+ public synchronized IPluginBase getPluginBase() {
+ if (m_pluginBase == null) {
+ m_pluginBase = getBundlePluginModel().getPluginBase(true);
+ }
+ return m_pluginBase;
+ }
+
+ public synchronized IBuildModel getBuildModel() {
+ if (m_buildModel == null) {
+ m_buildModel = new WorkspaceBuildModel(getBuildPropertiesFile());
+ m_buildModel.load();
+ m_buildModel.setDirty(false); // the model is marked dirty after a fresh load
+ }
+ return m_buildModel;
+ }
+
+ public synchronized IBundle getBundle() {
+ if (m_bundle == null) {
+ m_bundle = getBundleModel().getBundle();
+ }
+ return m_bundle;
+ }
+
+ public synchronized WorkspaceBundleModel getBundleModel() {
+ if (m_bundleModel == null) {
+ m_bundleModel = new WorkspaceBundleModel(getManifestFile());
+ m_bundleModel.load();
+ m_bundleModel.setDirty(false); // the model is marked dirty after a fresh load
+ }
+ return m_bundleModel;
+ }
+
+ public final static PDEState getPdeState() {
+ return PDECore.getDefault().getModelManager().getState();
+ }
+
+ public synchronized BundleDescription getBundleDescription() {
+ if (m_desc == null) {
+ IPluginModelBase pluginBase = PDECore.getDefault().getModelManager().findModel(getProject());
+ if (pluginBase != null) {
+ m_desc = pluginBase.getBundleDescription();
+ }
+
+ if (m_desc == null) {
+ throw new IllegalArgumentException("project '" + getProject().getName() + "' could not be found in the workspace.");
+ }
+ }
+ return m_desc;
+ }
+
+ public synchronized void save() {
+ if (m_bundlePluginModel != null && m_bundlePluginModel.isDirty()) {
+ // if available: saves bundle model and extensions model
+ m_bundlePluginModel.save();
+ }
+ else {
+ if (m_bundleModel != null && m_bundleModel.isDirty()) {
+ m_bundleModel.save();
+ }
+ if (m_extensionsModel != null && m_extensionsModel.isDirty()) {
+ m_extensionsModel.save();
+ }
+ }
+
+ if (m_buildModel != null && m_buildModel.isDirty()) {
+ m_buildModel.save();
+ }
+ }
+
+ public IProject getProject() {
+ return m_project;
+ }
+
+ public IFile getManifestFile() {
+ return m_manifestFile;
+ }
+
+ public IFile getPluginXmlFile() {
+ return m_pluginXmlFile;
+ }
+
+ public IFile getBuildPropertiesFile() {
+ return m_buildPropertiesFile;
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/LazyProductFileModel.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/LazyProductFileModel.java
index b984819da..80fa5793b 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/LazyProductFileModel.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/LazyProductFileModel.java
@@ -1,204 +1,204 @@
-package org.eclipse.scout.sdk.util.pde;
-
-import java.io.BufferedOutputStream;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.PrintWriter;
-import java.util.Hashtable;
-import java.util.Map.Entry;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.pde.internal.core.iproduct.IConfigurationFileInfo;
-import org.eclipse.pde.internal.core.product.WorkspaceProductModel;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-
-@SuppressWarnings("restriction")
-public final class LazyProductFileModel {
-
- private final static Pattern FRAGMENT_PATTERN = Pattern.compile("^(\\sfragment\\=\\\")([^\\\"]*)(\\\")");
-
- private final IFile m_productFile;
-
- //lazily instantiated models
- private WorkspaceProductModel m_productModel;
- private IConfigurationFileInfo m_configFileInfo;
- private Properties m_configFileProperties;
- private Hashtable<Object, Object> m_origConfigFileProperties;
- private IFile m_configIniFile;
-
- public LazyProductFileModel(IFile productFile) {
- if (productFile == null || !productFile.exists()) throw new IllegalArgumentException("invalid product file passed");
- m_productFile = productFile;
- }
-
- public synchronized WorkspaceProductModel getWorkspaceProductModel() throws CoreException {
- if (m_productModel == null) {
- m_productModel = new WorkspaceProductModel(m_productFile, true);
- m_productModel.load();
- m_productModel.setDirty(false);
- }
- return m_productModel;
- }
-
- public synchronized IConfigurationFileInfo getConfigurationFileInfo() throws CoreException {
- if (m_configFileInfo == null) {
- m_configFileInfo = getWorkspaceProductModel().getProduct().getConfigurationFileInfo();
- }
- return m_configFileInfo;
- }
-
- /**
- * gets the config.ini file specified in the product.
- *
- * @return the config file or null if no file is specified.
- * @throws CoreException
- */
- public synchronized IFile getConfigIniFile() throws CoreException {
- if (m_configIniFile == null) {
- String osPath = getConfigurationFileInfo().getPath(Platform.getOS());
- if (osPath != null) {
- IPath path = new Path(osPath).removeFirstSegments(1);
- m_configIniFile = m_productFile.getProject().getFile(path);
- if (m_configIniFile == null || !m_configIniFile.exists()) {
- m_configIniFile = null;
- throw new CoreException(new ScoutStatus("could not find product configuration file: " + path.toOSString()));
- }
- }
- }
- return m_configIniFile;
- }
-
- @SuppressWarnings("unchecked")
- public synchronized Properties getConfigFileProperties() throws CoreException {
- if (m_configFileProperties == null) {
- m_configFileProperties = new Properties();
- IFile configIni = getConfigIniFile();
- if (configIni == null) {
- return new Properties(); // no config.ini, no properties
- }
-
- InputStream is = null;
- try {
- is = configIni.getContents();
- m_configFileProperties.load(is);
-
- // remember all entries at the moment of property loading.
- // this allows to check if the config file is dirty later on.
- // shallow copy is sufficient as the properties map can only store Strings which are immutable.
- m_origConfigFileProperties = (Hashtable<Object, Object>) m_configFileProperties.clone();
- }
- catch (IOException e) {
- m_configFileProperties = null; // throw away the empty unloaded instance so that we can try again next time.
- throw new CoreException(new ScoutStatus("unable to load product configuration file: " + configIni.getFullPath().toOSString(), e));
- }
- finally {
- if (is != null) {
- try {
- is.close();
- }
- catch (IOException e) {
- SdkUtilActivator.logWarning("could not close input stream of file '" + configIni.getFullPath() + "'.", e);
- }
- }
- }
- }
- return m_configFileProperties;
- }
-
- public synchronized void save() throws CoreException {
- if (m_productModel != null && m_productModel.isDirty()) {
- saveProductModel();
- }
-
- if (isConfigFileDirty()) {
- saveConfigIni();
- }
- }
-
- private void saveConfigIni() throws CoreException {
- IFile configIni = getConfigIniFile();
- if (configIni == null) {
- return;
- }
-
- OutputStream stream = null;
- try {
- stream = new BufferedOutputStream(new FileOutputStream(configIni.getRawLocation().toFile()));
- m_configFileProperties.store(stream, null);
- stream.flush();
- }
- catch (IOException e) {
- throw new CoreException(new ScoutStatus("unable to save product configuration file: " + configIni.getRawLocation().toOSString(), e));
- }
- finally {
- if (stream != null) {
- try {
- stream.close();
- }
- catch (IOException e) {
- }
- }
- configIni.refreshLocal(IFile.DEPTH_ONE, null);
- }
- }
-
- private boolean isConfigFileDirty() {
- if (m_configFileProperties == null || m_origConfigFileProperties == null) return false;
- if (m_configFileProperties.size() != m_origConfigFileProperties.size()) return true;
-
- for (Entry<Object, Object> entry : m_configFileProperties.entrySet()) {
- if (CompareUtility.notEquals(m_origConfigFileProperties.get(entry.getKey()), entry.getValue())) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * TODO can be eliminated when <b>BUG 362398</b> is fixed.<br>
- * When the bug is fixed call m_model.save() directly instead of calling this method.
- *
- * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=362398">Bugzilla #362398</a>
- */
- private void saveProductModel() throws CoreException {
- // save product file into byte array not writing empty fragment parts (fragment="").
- ByteArrayOutputStream out = new ByteArrayOutputStream(8192);
- PrintWriter writer = new PrintWriter(out, false) {
- @Override
- public void print(String s) {
- // overwrite writer.print(" fragment=\"true\""); //$NON-NLS-1$
- Matcher matcher = FRAGMENT_PATTERN.matcher(s);
- if (matcher.matches()) {
- if (StringUtility.isNullOrEmpty(matcher.group(2))) {
- return;
- }
- }
- super.print(s);
- }
- };
- m_productModel.save(writer);
- writer.flush();
- writer.close();
-
- // get corrected contents from ByteArrayOutputStream and write it to the file.
- IFile file = (IFile) m_productModel.getUnderlyingResource();
- ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
- file.setContents(in, true, false, null);
- file.refreshLocal(IFile.DEPTH_ONE, null);
- // no need to close a ByteArrayInputStream
- }
-}
+package org.eclipse.scout.sdk.util.pde;
+
+import java.io.BufferedOutputStream;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.io.PrintWriter;
+import java.util.Hashtable;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.pde.internal.core.iproduct.IConfigurationFileInfo;
+import org.eclipse.pde.internal.core.product.WorkspaceProductModel;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+
+@SuppressWarnings("restriction")
+public final class LazyProductFileModel {
+
+ private final static Pattern FRAGMENT_PATTERN = Pattern.compile("^(\\sfragment\\=\\\")([^\\\"]*)(\\\")");
+
+ private final IFile m_productFile;
+
+ //lazily instantiated models
+ private WorkspaceProductModel m_productModel;
+ private IConfigurationFileInfo m_configFileInfo;
+ private Properties m_configFileProperties;
+ private Hashtable<Object, Object> m_origConfigFileProperties;
+ private IFile m_configIniFile;
+
+ public LazyProductFileModel(IFile productFile) {
+ if (productFile == null || !productFile.exists()) throw new IllegalArgumentException("invalid product file passed");
+ m_productFile = productFile;
+ }
+
+ public synchronized WorkspaceProductModel getWorkspaceProductModel() throws CoreException {
+ if (m_productModel == null) {
+ m_productModel = new WorkspaceProductModel(m_productFile, true);
+ m_productModel.load();
+ m_productModel.setDirty(false);
+ }
+ return m_productModel;
+ }
+
+ public synchronized IConfigurationFileInfo getConfigurationFileInfo() throws CoreException {
+ if (m_configFileInfo == null) {
+ m_configFileInfo = getWorkspaceProductModel().getProduct().getConfigurationFileInfo();
+ }
+ return m_configFileInfo;
+ }
+
+ /**
+ * gets the config.ini file specified in the product.
+ *
+ * @return the config file or null if no file is specified.
+ * @throws CoreException
+ */
+ public synchronized IFile getConfigIniFile() throws CoreException {
+ if (m_configIniFile == null) {
+ String osPath = getConfigurationFileInfo().getPath(Platform.getOS());
+ if (osPath != null) {
+ IPath path = new Path(osPath).removeFirstSegments(1);
+ m_configIniFile = m_productFile.getProject().getFile(path);
+ if (m_configIniFile == null || !m_configIniFile.exists()) {
+ m_configIniFile = null;
+ throw new CoreException(new ScoutStatus("could not find product configuration file: " + path.toOSString()));
+ }
+ }
+ }
+ return m_configIniFile;
+ }
+
+ @SuppressWarnings("unchecked")
+ public synchronized Properties getConfigFileProperties() throws CoreException {
+ if (m_configFileProperties == null) {
+ m_configFileProperties = new Properties();
+ IFile configIni = getConfigIniFile();
+ if (configIni == null) {
+ return new Properties(); // no config.ini, no properties
+ }
+
+ InputStream is = null;
+ try {
+ is = configIni.getContents();
+ m_configFileProperties.load(is);
+
+ // remember all entries at the moment of property loading.
+ // this allows to check if the config file is dirty later on.
+ // shallow copy is sufficient as the properties map can only store Strings which are immutable.
+ m_origConfigFileProperties = (Hashtable<Object, Object>) m_configFileProperties.clone();
+ }
+ catch (IOException e) {
+ m_configFileProperties = null; // throw away the empty unloaded instance so that we can try again next time.
+ throw new CoreException(new ScoutStatus("unable to load product configuration file: " + configIni.getFullPath().toOSString(), e));
+ }
+ finally {
+ if (is != null) {
+ try {
+ is.close();
+ }
+ catch (IOException e) {
+ SdkUtilActivator.logWarning("could not close input stream of file '" + configIni.getFullPath() + "'.", e);
+ }
+ }
+ }
+ }
+ return m_configFileProperties;
+ }
+
+ public synchronized void save() throws CoreException {
+ if (m_productModel != null && m_productModel.isDirty()) {
+ saveProductModel();
+ }
+
+ if (isConfigFileDirty()) {
+ saveConfigIni();
+ }
+ }
+
+ private void saveConfigIni() throws CoreException {
+ IFile configIni = getConfigIniFile();
+ if (configIni == null) {
+ return;
+ }
+
+ OutputStream stream = null;
+ try {
+ stream = new BufferedOutputStream(new FileOutputStream(configIni.getRawLocation().toFile()));
+ m_configFileProperties.store(stream, null);
+ stream.flush();
+ }
+ catch (IOException e) {
+ throw new CoreException(new ScoutStatus("unable to save product configuration file: " + configIni.getRawLocation().toOSString(), e));
+ }
+ finally {
+ if (stream != null) {
+ try {
+ stream.close();
+ }
+ catch (IOException e) {
+ }
+ }
+ configIni.refreshLocal(IFile.DEPTH_ONE, null);
+ }
+ }
+
+ private boolean isConfigFileDirty() {
+ if (m_configFileProperties == null || m_origConfigFileProperties == null) return false;
+ if (m_configFileProperties.size() != m_origConfigFileProperties.size()) return true;
+
+ for (Entry<Object, Object> entry : m_configFileProperties.entrySet()) {
+ if (CompareUtility.notEquals(m_origConfigFileProperties.get(entry.getKey()), entry.getValue())) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * TODO can be eliminated when <b>BUG 362398</b> is fixed.<br>
+ * When the bug is fixed call m_model.save() directly instead of calling this method.
+ *
+ * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=362398">Bugzilla #362398</a>
+ */
+ private void saveProductModel() throws CoreException {
+ // save product file into byte array not writing empty fragment parts (fragment="").
+ ByteArrayOutputStream out = new ByteArrayOutputStream(8192);
+ PrintWriter writer = new PrintWriter(out, false) {
+ @Override
+ public void print(String s) {
+ // overwrite writer.print(" fragment=\"true\""); //$NON-NLS-1$
+ Matcher matcher = FRAGMENT_PATTERN.matcher(s);
+ if (matcher.matches()) {
+ if (StringUtility.isNullOrEmpty(matcher.group(2))) {
+ return;
+ }
+ }
+ super.print(s);
+ }
+ };
+ m_productModel.save(writer);
+ writer.flush();
+ writer.close();
+
+ // get corrected contents from ByteArrayOutputStream and write it to the file.
+ IFile file = (IFile) m_productModel.getUnderlyingResource();
+ ByteArrayInputStream in = new ByteArrayInputStream(out.toByteArray());
+ file.setContents(in, true, false, null);
+ file.refreshLocal(IFile.DEPTH_ONE, null);
+ // no need to close a ByteArrayInputStream
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/PluginModelHelper.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/PluginModelHelper.java
index 1f5e3b4d1..428a844d9 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/PluginModelHelper.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/PluginModelHelper.java
@@ -1,960 +1,960 @@
-package org.eclipse.scout.sdk.util.pde;
-
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Vector;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.pde.core.build.IBuildEntry;
-import org.eclipse.pde.core.plugin.IPluginAttribute;
-import org.eclipse.pde.core.plugin.IPluginElement;
-import org.eclipse.pde.core.plugin.IPluginExtension;
-import org.eclipse.pde.core.plugin.IPluginImport;
-import org.eclipse.pde.core.plugin.IPluginModelBase;
-import org.eclipse.pde.core.plugin.IPluginObject;
-import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
-import org.eclipse.pde.internal.core.text.bundle.BundleClasspathHeader;
-import org.eclipse.pde.internal.core.text.bundle.ExportPackageHeader;
-import org.eclipse.pde.internal.core.text.bundle.RequireBundleHeader;
-import org.eclipse.scout.commons.CompareUtility;
-import org.osgi.framework.Constants;
-import org.osgi.framework.Version;
-
-/**
- * Helper class for basic plugin model operations.
- *
- * @author mvi
- * @since 3.8.0
- */
-@SuppressWarnings("restriction")
-public class PluginModelHelper {
-
- /**
- * Class for operations executed on the MANIFEST.MF part of a plugin model.
- */
- public final ManifestPart Manifest;
-
- /**
- * Class for operations executed on the plugin.xml part of a plugin model.
- */
- public final PluginXmlPart PluginXml;
-
- /**
- * Class for operations executed on the build.properties part of a plugin model.
- */
- public final BuildPropertiesPart BuildProperties;
-
- /**
- * Creates a new helper that operates on the workspace project with the same name as denoted by the given model base.
- *
- * @param pluginModelBase
- * The model base that defines the project name.
- * @throws IllegalArgumentException
- * when no project with the same name as denoted by the given model description can be found in the
- * workspace or is not a valid plugin project.
- */
- public PluginModelHelper(IPluginModelBase pluginModelBase) {
- this(pluginModelBase.getBundleDescription().getName());
- }
-
- /**
- * Creates a new helper that operates on the workspace project with given name.
- *
- * @param projectName
- * The name of the project.
- * @throws IllegalArgumentException
- * when no project with the given name can be found in the workspace or is not a valid plugin project.
- */
- public PluginModelHelper(String projectName) {
- this(ResourcesPlugin.getWorkspace().getRoot().getProject(projectName));
- }
-
- /**
- * Creates a new helper that operates on the given project.
- *
- * @param project
- * The project to modify.
- * @throws IllegalArgumentException
- * when the project is null or is not a valid plugin project.
- */
- public PluginModelHelper(IProject project) {
- LazyPluginModel model = new LazyPluginModel(project);
- Manifest = new ManifestPart(model);
- PluginXml = new PluginXmlPart(model);
- BuildProperties = new BuildPropertiesPart(model);
- }
-
- /**
- * Gets the project associated with this helper.
- *
- * @return The project this helper was created with.
- */
- public IProject getProject() {
- return Manifest.m_model.getProject();
- }
-
- private static String getProjectRelativeResourcePath(IResource r) {
- if (r == null) return null;
- String entry = r.getProjectRelativePath().toString();
- if (r.getType() == IResource.FOLDER) {
- if (!entry.endsWith("/")) {
- entry = entry + "/";
- }
- }
- return entry;
- }
-
- public static class ManifestPart {
-
- private final LazyPluginModel m_model;
-
- private ManifestPart(LazyPluginModel m) {
- m_model = m;
- }
-
- /**
- * Adds the given plugin to the dependencies of the project associated with this helper.<br>
- * The dependency is not re-exported and marked as non-optional.<br>
- * If a dependency for the given plugin already exists (even if the existing dependency has different options), this
- * method does nothing.<br>
- * This method is thread safe.
- *
- * @param pluginId
- * The plugin ID
- * @throws CoreException
- */
- public void addDependency(String pluginId) throws CoreException {
- addDependency(pluginId, false);
- }
-
- /**
- * Adds the given plugin to the dependencies of the project associated with this helper.<br>
- * The dependency is marked as non-optional.<br>
- * If a dependency for the given plugin already exists (even if the existing dependency has different options), this
- * method does nothing.<br>
- * This method is thread safe.
- *
- * @param pluginId
- * The plugin ID
- * @param reexport
- * If the dependency should be re-exported.
- * @throws CoreException
- */
- public void addDependency(String pluginId, boolean reexport) throws CoreException {
- addDependency(pluginId, false, false);
- }
-
- /**
- * Adds the given plugin to the dependencies of the project associated with this helper.<br>
- * If the given plugin is null, empty or a dependency for the given plugin already exists
- * (even if the existing dependency has different options), this method does nothing.<br>
- * This method is thread safe.
- *
- * @param pluginId
- * The plugin ID
- * @param reexport
- * If the dependency should be re-exported.
- * @param optional
- * If the dependency should be optional
- * @return the new created import for the given pluginId if it did not exist or the already existing import.
- * @throws CoreException
- */
- public void addDependency(String pluginId, boolean reexport, boolean optional) throws CoreException {
- if (pluginId == null || pluginId.length() < 1) return;
- synchronized (m_model.getProject()) {
- if (!existsDependency(pluginId)) {
- IPluginImport imp = m_model.getBundlePluginModel().createImport(pluginId);
- imp.setReexported(reexport);
- imp.setOptional(optional);
- m_model.getPluginBase().add(imp);
- }
- }
- }
-
- /**
- * Removes the given plugin from the dependency list of the project associated with this helper.<br>
- *
- * @param pluginId
- * The plugin id to remove.
- * @throws CoreException
- */
- public void removeDependency(String pluginId) throws CoreException {
- synchronized (m_model.getProject()) {
- IPluginImport existing = getDependency(pluginId);
- if (existing != null) {
- m_model.getPluginBase().remove(existing);
-
- RequireBundleHeader reqHeader = getRequireBundleHeader();
- reqHeader.removeBundle(pluginId);
- setEntryValue(Constants.REQUIRE_BUNDLE, reqHeader.getValue());
- }
- }
- }
-
- private RequireBundleHeader getRequireBundleHeader() {
- IManifestHeader header = m_model.getBundle().getManifestHeader(Constants.REQUIRE_BUNDLE);
- return (RequireBundleHeader) m_model.getBundleModel().getFactory().createHeader(Constants.REQUIRE_BUNDLE, header.getValue() == null ? "" : header.getValue());
- }
-
- /**
- * Checks whether the given plugin id is already in the dependency list of the project associated with this helper.
- *
- * @param pluginId
- * The plugin id to check
- * @return true if the given plugin is already in the dependency list, false otherwise.
- */
- public boolean existsDependency(String pluginId) {
- IPluginImport existing = getDependency(pluginId);
- return existing != null;
- }
-
- /**
- * Returns all dependencies defined in the plug-in project associated with this helper.
- *
- * @return an array of import objects
- */
- public IPluginImport[] getAllDependencies() {
- return m_model.getPluginBase().getImports();
- }
-
- private IPluginImport getDependency(String pluginId) {
- if (pluginId == null || pluginId.length() < 1) return null;
- for (IPluginImport existing : m_model.getPluginBase().getImports()) {
- if (existing.getId().equals(pluginId)) {
- return existing;
- }
- }
- return null;
- }
-
- /**
- * Checks whether the given package is already exported.
- *
- * @param pck
- * The package name to check.
- * @return true, if the given package is exported, false otherwise.
- */
- public boolean existsExportPackage(IPackageFragment pck) {
- if (pck == null) return false;
- return existsExportPackage(pck.getElementName());
- }
-
- /**
- * Checks whether the given package name is already exported.
- *
- * @param packageName
- * The package name to check.
- * @return true, if the given package is exported, false otherwise.
- */
- public boolean existsExportPackage(String packageName) {
- if (packageName == null || packageName.length() < 1) return false;
- ExportPackageHeader expHeader = getExportPackageHeader();
- return existsExportPackage(packageName, expHeader);
- }
-
- private boolean existsExportPackage(String packageName, ExportPackageHeader expHeader) {
- return expHeader.getPackage(packageName) != null;
- }
-
- /**
- * Adds the given package to the exported packages of the project associated with this helper.<br>
- * If the given package is null, empty or already in the exported list, this method does nothing.<br>
- * This method is thread safe.
- *
- * @param packageName
- * The fully qualified name of the package.
- */
- public void addExportPackage(String packageName) {
- if (packageName == null || packageName.length() < 1) return;
- synchronized (m_model.getProject()) {
- ExportPackageHeader expHeader = getExportPackageHeader();
- if (!existsExportPackage(packageName, expHeader)) {
- expHeader.addPackage(packageName);
- setEntryValue(Constants.EXPORT_PACKAGE, expHeader.getValue());
- }
- }
- }
-
- /**
- * Adds the given package to the exported packages of the project associated with this helper.<br>
- * If the given package is already in the exported list, this method does nothing.
- *
- * @param pck
- * The package to add
- */
- public void addExportPackage(IPackageFragment pck) {
- addExportPackage(pck.getElementName());
- }
-
- /**
- * Removes the given package from the exported packages list of the project associated with this helper.<br>
- * This method does nothing if the give package is null.
- *
- * @param pck
- * The package to remove
- */
- public void removeExportPackage(IPackageFragment pck) {
- if (pck == null) return;
- removeExportPackage(pck.getElementName());
- }
-
- /**
- * Removes the given package from the exported packages list of the project associated with this helper.<br>
- * This method does nothing if the give package is null or empty.
- *
- * @param packageName
- * The fully qualified name of the package
- */
- public void removeExportPackage(String packageName) {
- if (packageName == null || packageName.length() < 1) return;
- ExportPackageHeader expHeader = getExportPackageHeader();
- expHeader.removePackage(packageName);
- setEntryValue(Constants.EXPORT_PACKAGE, expHeader.getValue());
- }
-
- private ExportPackageHeader getExportPackageHeader() {
- IManifestHeader header = m_model.getBundle().getManifestHeader(Constants.EXPORT_PACKAGE);
- return (ExportPackageHeader) m_model.getBundleModel().getFactory().createHeader(Constants.EXPORT_PACKAGE, header.getValue() == null ? "" : header.getValue());
- }
-
- private BundleClasspathHeader getBundleClasspathHeader() {
- IManifestHeader header = m_model.getBundle().getManifestHeader(Constants.BUNDLE_CLASSPATH);
- return (BundleClasspathHeader) m_model.getBundleModel().getFactory().createHeader(Constants.BUNDLE_CLASSPATH, header.getValue() == null ? "" : header.getValue());
- }
-
- /**
- * Creates or updates the given manifest header key to the given value.<br>
- * This method does nothing if the given key is null or empty.
- *
- * @param key
- * The key. Will be created if it does not exist.
- * @param value
- * The value that should be set for the given key. if value is null, the key is removed from the manifest.
- */
- public void setEntryValue(String key, String value) {
- if (key == null || key.length() < 1) return;
- m_model.getBundle().setHeader(key, value);
- }
-
- /**
- * Removes the given key from the manifest.<br>
- * This method does nothing if the given key is null or empty.
- *
- * @param key
- * The key to remove.
- */
- public void removeEntry(String key) {
- setEntryValue(key, null);
- }
-
- /**
- * Gets the value of the given manifest header key.
- *
- * @param key
- * The property name.
- * @return The value (or null if it does not exist) of the given key.
- */
- public String getEntry(String key) {
- return m_model.getBundle().getHeader(key);
- }
-
- /**
- * Gets all classpath entries of the project associated with this helper.
- *
- * @return an array with all entries.
- */
- @SuppressWarnings("unchecked")
- public String[] getClasspathEntries() {
- BundleClasspathHeader h = getBundleClasspathHeader();
- Vector<String> names = h.getElementNames();
- return names.toArray(new String[names.size()]);
- }
-
- /**
- * Removes the given entry from the classpath.<br>
- * If a null resource is passed, this method does nothing.
- *
- * @param resource
- * The entry to remove.
- */
- public void removeClasspathEntry(IResource resource) {
- if (resource == null) return;
- removeClasspathEntry(getProjectRelativeResourcePath(resource));
- }
-
- /**
- * Removes the given entry from the classpath.<br>
- * If a null entry or empty entry is passed, this method does nothing.
- *
- * @param entry
- * The entry to remove.
- */
- public void removeClasspathEntry(String entry) {
- if (entry == null || entry.length() < 1) return;
-
- BundleClasspathHeader h = getBundleClasspathHeader();
- h.removeLibrary(entry);
- setEntryValue(Constants.BUNDLE_CLASSPATH, h.getValue());
- }
-
- /**
- * Adds the default classpath entry (".") to the classpath list.<br>
- * If the default entry does already exist, this method does nothing.
- */
- public void addClasspathDefaultEntry() {
- addClasspathEntry(".");
- }
-
- /**
- * Checks whether the given entry is already in the classpath entries of the project associated with this helper.
- *
- * @param resource
- * The entry to search
- * @return false if the resource is null or does not exist, true otherwise.
- */
- public boolean existsClasspathEntry(IResource resource) {
- if (resource == null) return false;
- return existsClasspathEntry(getProjectRelativeResourcePath(resource));
- }
-
- /**
- * Checks whether the given entry is already in the classpath entries of the project associated with this helper.
- *
- * @param entry
- * The entry to search.
- * @return true if the given entry already exists, false otherwise.
- */
- public boolean existsClasspathEntry(String entry) {
- if (entry == null || entry.length() < 1) return false;
- for (String e : getClasspathEntries()) {
- if (e.equals(entry)) return true;
- }
- return false;
- }
-
- /**
- * Adds the given classpath entry to the classpath of the project associated with this helper.<br>
- * If the resource is null, does not exist in the project or is already in the classpath, this method does nothing.<br>
- * This method is thread safe.
- *
- * @param resource
- * The classpath entry to add.
- */
- public void addClasspathEntry(IResource resource) {
- if (resource == null) return;
- if (!resource.exists()) return;
- addClasspathEntry(getProjectRelativeResourcePath(resource));
- }
-
- /**
- * Adds the given classpath entry to the classpath of the project associated with this helper.<br>
- * If the given entry is null, an empty string or already exists in the classpath, this method does nothing.<br>
- * This method is thread safe.
- *
- * @param entry
- * The classpath entry to add.
- */
- public void addClasspathEntry(String entry) {
- if (entry == null || entry.length() < 1) return;
- synchronized (m_model.getProject()) {
- if (!existsClasspathEntry(entry)) {
- BundleClasspathHeader h = getBundleClasspathHeader();
- h.addLibrary(entry);
- setEntryValue(Constants.BUNDLE_CLASSPATH, h.getValue());
- }
- }
- }
-
- /**
- * Sets the version of the plugin to the given value.<br>
- * If the given value is null, this method does nothing.
- *
- * @param newVersion
- * the new version
- */
- public void setVersion(Version newVersion) {
- if (newVersion == null) return;
- setVersion(newVersion.toString());
- }
-
- /**
- * Sets the version of the plugin to the given value.<br>
- * If the given value is empty or null, this method does nothing.
- *
- * @param newVersion
- * the new version
- */
- public void setVersion(String newVersion) {
- if (newVersion == null || newVersion.length() < 1) return;
- setEntryValue(Constants.BUNDLE_VERSION, newVersion);
- }
-
- /**
- * Gets the version of the plugin.
- *
- * @return The version of this plugin.
- */
- public Version getVersion() {
- return Version.parseVersion(getVersionAsString());
- }
-
- /**
- * Gets the version of the plugin.
- *
- * @return The version of the plugin.
- */
- public String getVersionAsString() {
- return getEntry(Constants.BUNDLE_VERSION);
- }
-
- /**
- * Gets the MANIFEST.MF file of the plugin.
- *
- * @return
- */
- public IFile getFile() {
- return m_model.getManifestFile();
- }
- }
-
- /**
- * saves all changes of all underlying models that require saving.
- */
- public void save() {
- // same lazy model instance for all parts -> does not matter which one is saved.
- Manifest.m_model.save();
- }
-
- public static class PluginXmlPart {
- private final LazyPluginModel m_model;
-
- private PluginXmlPart(LazyPluginModel m) {
- m_model = m;
- }
-
- /**
- * Adds a simple extension to the project associated with this helper.<br>
- * If exactly the same extension already exists, it is added another time.<br>
- * A simple extension is of the following format:<br>
- * <code>
- * &lt;extension point="extensionPointId"&gt;<br>
- * &nbsp;&nbsp;&lt;elementName attribute1="value1" attribute2="value2"&gt;&lt;/elementName&gt;<br>
- * &lt;/extension&gt;<br>
- * </code>
- *
- * @param extensionPointId
- * The full id of the extension point for which the extension should be added.
- * @param elementName
- * The tag name of the extension.
- * @param attributes
- * The attribute (name-value-pairs) that should be added to the element.
- * @throws CoreException
- */
- public void addSimpleExtension(String extensionPointId, String elementName, Map<String, String> attributes) throws CoreException {
- IPluginExtension pe = null;
- // find existing extension
- for (IPluginExtension existing : m_model.getExtensionsModel().getExtensions().getExtensions()) {
- if (existing.getPoint().equals(extensionPointId)) {
- pe = existing;
- break;
- }
- }
- if (pe == null) {
- // no extension for given extension point exists: create new
- pe = m_model.getExtensionsModel().createExtension();
- pe.setPoint(extensionPointId);
- m_model.getExtensionsModel().getExtensions().add(pe);
- }
-
- IPluginElement extension = m_model.getExtensionsModel().createElement(pe);
- extension.setName(elementName);
- if (attributes != null && attributes.size() > 0) {
- for (Map.Entry<String, String> entry : attributes.entrySet()) {
- extension.setAttribute(entry.getKey(), entry.getValue());
- }
- }
- pe.add(extension);
- }
-
- /**
- * Adds a simple extension to the project associated with this helper.<br>
- * If exactly the same extension already exists, it is added another time.<br>
- * A simple extension is of the following format:<br>
- * <code>
- * &lt;extension point="extensionPointId"&gt;<br>
- * &nbsp;&nbsp;&lt;elementName&gt;&lt;/elementName&gt;<br>
- * &lt;/extension&gt;<br>
- * </code>
- *
- * @param extensionPointId
- * The full id of the extension point for which the extension should be added.
- * @param elementName
- * The tag name of the extension.
- * @throws CoreException
- */
- public void addSimpleExtension(String extensionPointId, String elementName) throws CoreException {
- addSimpleExtension(extensionPointId, elementName, null);
- }
-
- /**
- * Removes the simple extension from this plugin. An existing extension must match in <code>extensionPointId</code>,
- * <code>elementName</code> and all <code>attributes</code> given.<br>
- * A simple extension is of the following format:<br>
- * <code>
- * &lt;extension point="extensionPointId"&gt;<br>
- * &nbsp;&nbsp;&lt;elementName attribute1="value1" attribute2="value2"&gt;&lt;/elementName&gt;<br>
- * &lt;/extension&gt;<br>
- * </code>
- *
- * @param extensionPointId
- * The full extension point id.
- * @param elementName
- * the tag name
- * @param attributes
- * key-value-pairs of the attributes.
- * @throws CoreException
- */
- public void removeSimpleExtension(String extensionPointId, String elementName, Map<String, String> attributes) throws CoreException {
- IPluginElement[] toDeleteList = getSimpleExtensions(extensionPointId, elementName, attributes);
- for (IPluginElement toDelete : toDeleteList) {
- if (toDelete.getParent() instanceof IPluginExtension) {
- ((IPluginExtension) toDelete.getParent()).remove(toDelete);
- }
- }
- }
-
- /**
- * Removes the simple extension from this plugin. An existing extension must match in <code>extensionPointId</code>
- * and <code>elementName</code>.<br>
- * A simple extension is of the following format:<br>
- * <code>
- * &lt;extension point="extensionPointId"&gt;<br>
- * &nbsp;&nbsp;&lt;elementName&gt;&lt;/elementName&gt;<br>
- * &lt;/extension&gt;<br>
- * </code>
- *
- * @param extensionPointId
- * The full extension point id.
- * @param elementName
- * @throws CoreException
- */
- public void removeSimpleExtension(String extensionPointId, String elementName) throws CoreException {
- removeSimpleExtension(extensionPointId, elementName, null);
- }
-
- /**
- * Gets all simple extensions with given <code>extensionPointId</code>, <code>elementName</code> and
- * <code>attributes</code>.<br>
- * A simple extension is of the following format:<br>
- * <code>
- * &lt;extension point="extensionPointId"&gt;<br>
- * &nbsp;&nbsp;&lt;elementName attribute1="value1" attribute2="value2"&gt;&lt;/elementName&gt;<br>
- * &lt;/extension&gt;<br>
- * </code>
- *
- * @param extensionPointId
- * The full extension point id.
- * @param elementName
- * The tag name
- * @param attributes
- * the attributes that must match.
- * @return an array containing all extensions that match the given criteria.
- */
- public IPluginElement[] getSimpleExtensions(String extensionPointId, String elementName, Map<String, String> attributes) {
- List<IPluginElement> candidates = getPluginExtensions(extensionPointId);
- Iterator<IPluginElement> it = candidates.iterator();
- while (it.hasNext()) {
- IPluginElement candidate = it.next();
- if (!elementName.equals(candidate.getName())) {
- it.remove(); // element name does not match -> no candidate (remove from list)
- }
- else if (attributes != null && attributes.size() > 0) {
- // name matches. check also for the attributes
- for (Entry<String, String> entry : attributes.entrySet()) {
- IPluginAttribute a = candidate.getAttribute(entry.getKey());
- if (a == null) {
- it.remove(); // search attribute does not exist -> no candidate (remove from list)
- break;
- }
- else if (CompareUtility.notEquals(entry.getValue(), a.getValue())) {
- it.remove(); // search attribute does not contain the requested value -> no candidate (remove from list)
- break;
- }
- }
- }
- }
- return candidates.toArray(new IPluginElement[candidates.size()]);
- }
-
- /**
- * Gets all simple extensions with given <code>extensionPointId</code> and <code>elementName</code>.<br>
- * A simple extension is of the following format:<br>
- * <code>
- * &lt;extension point="extensionPointId"&gt;<br>
- * &nbsp;&nbsp;&lt;elementName&gt;&lt;/elementName&gt;<br>
- * &lt;/extension&gt;<br>
- * </code>
- *
- * @param extensionPointId
- * The full extension point id.
- * @param elementName
- * The tag name
- * @return an array containing all extensions that match the given criteria.
- */
- public IPluginElement[] getSimpleExtensions(String extensionPointId, String elementName) {
- return getSimpleExtensions(extensionPointId, elementName, null);
- }
-
- private List<IPluginElement> getPluginExtensions(String extensionPointId) {
- LinkedList<IPluginElement> result = new LinkedList<IPluginElement>();
- for (IPluginExtension extPoint : m_model.getExtensionsModel().getExtensions().getExtensions()) {
- if (extPoint.getPoint().equals(extensionPointId)) {
- for (IPluginObject element : extPoint.getChildren()) {
- if (element instanceof IPluginElement) {
- result.add((IPluginElement) element);
- }
- }
- }
- }
- return result;
- }
-
- /**
- * Gets the first simple extension with given <code>extensionPointId</code>, <code>elementName</code> and
- * <code>attributes</code>.<br>
- * A simple extension is of the following format:<br>
- * <code>
- * &lt;extension point="extensionPointId"&gt;<br>
- * &nbsp;&nbsp;&lt;elementName attribute1="value1" attribute2="value2"&gt;&lt;/elementName&gt;<br>
- * &lt;/extension&gt;<br>
- * </code>
- *
- * @param extensionPointId
- * The full extension point id
- * @param elementName
- * The tag name
- * @param attributes
- * The attributes
- * @return the first extension that matches all criteria.
- */
- public IPluginElement getSimpleExtension(String extensionPointId, String elementName, Map<String, String> attributes) {
- IPluginElement[] matches = getSimpleExtensions(extensionPointId, elementName, attributes);
- if (matches != null && matches.length > 0) return matches[0];
- return null;
- }
-
- /**
- * Gets the first simple extension with given <code>extensionPointId</code> and <code>elementName</code>.<br>
- * A simple extension is of the following format:<br>
- * <code>
- * &lt;extension point="extensionPointId"&gt;<br>
- * &nbsp;&nbsp;&lt;elementName&gt;&lt;/elementName&gt;<br>
- * &lt;/extension&gt;<br>
- * </code>
- *
- * @param extensionPointId
- * The full extension point id
- * @param elementName
- * The tag name
- * @return the first extension that matches all criteria.
- */
- public IPluginElement getSimpleExtension(String extensionPointId, String elementName) {
- return getSimpleExtension(extensionPointId, elementName, null);
- }
-
- /**
- * Checks if a simple extension with given <code>extensionPointId</code>, <code>elementName</code> and
- * <code>attributes</code> already exists.<br>
- * A simple extension is of the following format:<br>
- * <code>
- * &lt;extension point="extensionPointId"&gt;<br>
- * &nbsp;&nbsp;&lt;elementName attribute1="value1" attribute2="value2"&gt;&lt;/elementName&gt;<br>
- * &lt;/extension&gt;<br>
- * </code>
- *
- * @param extensionPointId
- * The full extension point id
- * @param elementName
- * The tag name
- * @param attributes
- * The attributes
- * @return true if such an extension exists, false otherwise.
- */
- public boolean existsSimpleExtension(String extensionPointId, String elementName, Map<String, String> attributes) {
- IPluginElement[] matches = getSimpleExtensions(extensionPointId, elementName, attributes);
- return matches != null && matches.length > 0;
- }
-
- /**
- * Checks if a simple extension with given <code>extensionPointId</code> and <code>elementName</code> already
- * exists.<br>
- * A simple extension is of the following format:<br>
- * <code>
- * &lt;extension point="extensionPointId"&gt;<br>
- * &nbsp;&nbsp;&lt;elementName&gt;&lt;/elementName&gt;<br>
- * &lt;/extension&gt;<br>
- * </code>
- *
- * @param extensionPointId
- * The full extension point id
- * @param elementName
- * The tag name
- * @return true if such an extension exists, false otherwise.
- */
- public boolean existsSimpleExtension(String extensionPointId, String elementName) {
- return existsSimpleExtension(extensionPointId, elementName, null);
- }
-
- /**
- * Gets the plugin.xml file of the plugin.
- *
- * @return
- */
- public IFile getFile() {
- return m_model.getPluginXmlFile();
- }
- }
-
- public static class BuildPropertiesPart {
- private final static String BINARY_BUILD_INCLUDES = "bin.includes";
-
- private final LazyPluginModel m_model;
-
- private BuildPropertiesPart(LazyPluginModel m) {
- m_model = m;
- }
-
- /**
- * Removes the given resource from the binary build includes list.<br>
- * If the resource is null, this method does nothing.
- *
- * @param resource
- * The resource to remove.
- * @throws CoreException
- */
- public void removeBinaryBuildEntry(IResource resource) throws CoreException {
- if (resource == null) return;
- removeBinaryBuildEntry(getProjectRelativeResourcePath(resource));
- }
-
- /**
- * Removes the given token from the binary build includes list.<br>
- * If the token is null or empty, this method does nothing.
- *
- * @param token
- * The token to remove.
- * @throws CoreException
- */
- public void removeBinaryBuildEntry(String token) throws CoreException {
- if (token == null || token.length() < 1) return;
- IBuildEntry entry = m_model.getBuildModel().getBuild().getEntry(BINARY_BUILD_INCLUDES);
- if (entry != null) {
- entry.removeToken(token);
- }
- }
-
- /**
- * Gets all binary build includes.
- *
- * @return An array containing all binary build includes of the plugin.
- */
- public String[] getBinaryBuildEntries() {
- IBuildEntry entry = m_model.getBuildModel().getBuild().getEntry(BINARY_BUILD_INCLUDES);
- if (entry != null) {
- return entry.getTokens();
- }
- return new String[]{};
- }
-
- private IBuildEntry getBuildEntry(String name) throws CoreException {
- IBuildEntry entry = m_model.getBuildModel().getBuild().getEntry(name);
- if (entry == null) {
- entry = m_model.getBuildModel().getFactory().createEntry(name);
- m_model.getBuildModel().getBuild().add(entry);
- }
- return entry;
- }
-
- /**
- * Checks whether the given resource exists in the binary build includes list of the project associated with this
- * helper.
- *
- * @param resource
- * The resource to search.
- * @return true if the given resource is already in the binary build includes list, false otherwise.
- * @throws CoreException
- */
- public boolean existsBinaryBuildEntry(IResource resource) throws CoreException {
- if (resource == null) return false;
- return existsBinaryBuildEntry(getProjectRelativeResourcePath(resource));
- }
-
- /**
- * Checks whether the given token exists in the binary build includes list of the project associated with this
- * helper.
- *
- * @param token
- * The token to search.
- * @return true if the given token is already in the binary build includes list, false otherwise.
- * @throws CoreException
- */
- public boolean existsBinaryBuildEntry(String token) throws CoreException {
- if (token == null || token.length() < 1) return false;
- IBuildEntry entry = getBuildEntry(BINARY_BUILD_INCLUDES);
- return entry.contains(token);
- }
-
- /**
- * Adds the given token to the binary build includes.<br>
- * If no "bin.includes" exists, it is created.<br>
- * If the token is null, does not exist or is already in the list, this method does nothing.<br>
- * This method is thread safe.
- *
- * @param resource
- * The resource to add.
- * @throws CoreException
- */
- public void addBinaryBuildEntry(IResource resource) throws CoreException {
- if (resource == null) return;
- if (!resource.exists()) return;
- addBinaryBuildEntry(getProjectRelativeResourcePath(resource));
- }
-
- /**
- * Adds the given token to the binary build includes.<br>
- * If no "bin.includes" exists, it is created.<br>
- * If the token is null, empty or is already in the list, this method does nothing.<br>
- * This method is thread safe.
- *
- * @param token
- * The token to add.
- * @throws CoreException
- */
- public void addBinaryBuildEntry(String token) throws CoreException {
- if (token == null || token.length() < 1) return;
- synchronized (m_model.getProject()) {
- IBuildEntry entry = getBuildEntry(BINARY_BUILD_INCLUDES);
- if (!entry.contains(token)) {
- entry.addToken(token);
- }
- }
- }
-
- /**
- * Gets the build.properties file of the plugin.
- *
- * @return
- */
- public IFile getFile() {
- return m_model.getBuildPropertiesFile();
- }
- }
-}
+package org.eclipse.scout.sdk.util.pde;
+
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Vector;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.pde.core.build.IBuildEntry;
+import org.eclipse.pde.core.plugin.IPluginAttribute;
+import org.eclipse.pde.core.plugin.IPluginElement;
+import org.eclipse.pde.core.plugin.IPluginExtension;
+import org.eclipse.pde.core.plugin.IPluginImport;
+import org.eclipse.pde.core.plugin.IPluginModelBase;
+import org.eclipse.pde.core.plugin.IPluginObject;
+import org.eclipse.pde.internal.core.ibundle.IManifestHeader;
+import org.eclipse.pde.internal.core.text.bundle.BundleClasspathHeader;
+import org.eclipse.pde.internal.core.text.bundle.ExportPackageHeader;
+import org.eclipse.pde.internal.core.text.bundle.RequireBundleHeader;
+import org.eclipse.scout.commons.CompareUtility;
+import org.osgi.framework.Constants;
+import org.osgi.framework.Version;
+
+/**
+ * Helper class for basic plugin model operations.
+ *
+ * @author mvi
+ * @since 3.8.0
+ */
+@SuppressWarnings("restriction")
+public class PluginModelHelper {
+
+ /**
+ * Class for operations executed on the MANIFEST.MF part of a plugin model.
+ */
+ public final ManifestPart Manifest;
+
+ /**
+ * Class for operations executed on the plugin.xml part of a plugin model.
+ */
+ public final PluginXmlPart PluginXml;
+
+ /**
+ * Class for operations executed on the build.properties part of a plugin model.
+ */
+ public final BuildPropertiesPart BuildProperties;
+
+ /**
+ * Creates a new helper that operates on the workspace project with the same name as denoted by the given model base.
+ *
+ * @param pluginModelBase
+ * The model base that defines the project name.
+ * @throws IllegalArgumentException
+ * when no project with the same name as denoted by the given model description can be found in the
+ * workspace or is not a valid plugin project.
+ */
+ public PluginModelHelper(IPluginModelBase pluginModelBase) {
+ this(pluginModelBase.getBundleDescription().getName());
+ }
+
+ /**
+ * Creates a new helper that operates on the workspace project with given name.
+ *
+ * @param projectName
+ * The name of the project.
+ * @throws IllegalArgumentException
+ * when no project with the given name can be found in the workspace or is not a valid plugin project.
+ */
+ public PluginModelHelper(String projectName) {
+ this(ResourcesPlugin.getWorkspace().getRoot().getProject(projectName));
+ }
+
+ /**
+ * Creates a new helper that operates on the given project.
+ *
+ * @param project
+ * The project to modify.
+ * @throws IllegalArgumentException
+ * when the project is null or is not a valid plugin project.
+ */
+ public PluginModelHelper(IProject project) {
+ LazyPluginModel model = new LazyPluginModel(project);
+ Manifest = new ManifestPart(model);
+ PluginXml = new PluginXmlPart(model);
+ BuildProperties = new BuildPropertiesPart(model);
+ }
+
+ /**
+ * Gets the project associated with this helper.
+ *
+ * @return The project this helper was created with.
+ */
+ public IProject getProject() {
+ return Manifest.m_model.getProject();
+ }
+
+ private static String getProjectRelativeResourcePath(IResource r) {
+ if (r == null) return null;
+ String entry = r.getProjectRelativePath().toString();
+ if (r.getType() == IResource.FOLDER) {
+ if (!entry.endsWith("/")) {
+ entry = entry + "/";
+ }
+ }
+ return entry;
+ }
+
+ public static class ManifestPart {
+
+ private final LazyPluginModel m_model;
+
+ private ManifestPart(LazyPluginModel m) {
+ m_model = m;
+ }
+
+ /**
+ * Adds the given plugin to the dependencies of the project associated with this helper.<br>
+ * The dependency is not re-exported and marked as non-optional.<br>
+ * If a dependency for the given plugin already exists (even if the existing dependency has different options), this
+ * method does nothing.<br>
+ * This method is thread safe.
+ *
+ * @param pluginId
+ * The plugin ID
+ * @throws CoreException
+ */
+ public void addDependency(String pluginId) throws CoreException {
+ addDependency(pluginId, false);
+ }
+
+ /**
+ * Adds the given plugin to the dependencies of the project associated with this helper.<br>
+ * The dependency is marked as non-optional.<br>
+ * If a dependency for the given plugin already exists (even if the existing dependency has different options), this
+ * method does nothing.<br>
+ * This method is thread safe.
+ *
+ * @param pluginId
+ * The plugin ID
+ * @param reexport
+ * If the dependency should be re-exported.
+ * @throws CoreException
+ */
+ public void addDependency(String pluginId, boolean reexport) throws CoreException {
+ addDependency(pluginId, false, false);
+ }
+
+ /**
+ * Adds the given plugin to the dependencies of the project associated with this helper.<br>
+ * If the given plugin is null, empty or a dependency for the given plugin already exists
+ * (even if the existing dependency has different options), this method does nothing.<br>
+ * This method is thread safe.
+ *
+ * @param pluginId
+ * The plugin ID
+ * @param reexport
+ * If the dependency should be re-exported.
+ * @param optional
+ * If the dependency should be optional
+ * @return the new created import for the given pluginId if it did not exist or the already existing import.
+ * @throws CoreException
+ */
+ public void addDependency(String pluginId, boolean reexport, boolean optional) throws CoreException {
+ if (pluginId == null || pluginId.length() < 1) return;
+ synchronized (m_model.getProject()) {
+ if (!existsDependency(pluginId)) {
+ IPluginImport imp = m_model.getBundlePluginModel().createImport(pluginId);
+ imp.setReexported(reexport);
+ imp.setOptional(optional);
+ m_model.getPluginBase().add(imp);
+ }
+ }
+ }
+
+ /**
+ * Removes the given plugin from the dependency list of the project associated with this helper.<br>
+ *
+ * @param pluginId
+ * The plugin id to remove.
+ * @throws CoreException
+ */
+ public void removeDependency(String pluginId) throws CoreException {
+ synchronized (m_model.getProject()) {
+ IPluginImport existing = getDependency(pluginId);
+ if (existing != null) {
+ m_model.getPluginBase().remove(existing);
+
+ RequireBundleHeader reqHeader = getRequireBundleHeader();
+ reqHeader.removeBundle(pluginId);
+ setEntryValue(Constants.REQUIRE_BUNDLE, reqHeader.getValue());
+ }
+ }
+ }
+
+ private RequireBundleHeader getRequireBundleHeader() {
+ IManifestHeader header = m_model.getBundle().getManifestHeader(Constants.REQUIRE_BUNDLE);
+ return (RequireBundleHeader) m_model.getBundleModel().getFactory().createHeader(Constants.REQUIRE_BUNDLE, header.getValue() == null ? "" : header.getValue());
+ }
+
+ /**
+ * Checks whether the given plugin id is already in the dependency list of the project associated with this helper.
+ *
+ * @param pluginId
+ * The plugin id to check
+ * @return true if the given plugin is already in the dependency list, false otherwise.
+ */
+ public boolean existsDependency(String pluginId) {
+ IPluginImport existing = getDependency(pluginId);
+ return existing != null;
+ }
+
+ /**
+ * Returns all dependencies defined in the plug-in project associated with this helper.
+ *
+ * @return an array of import objects
+ */
+ public IPluginImport[] getAllDependencies() {
+ return m_model.getPluginBase().getImports();
+ }
+
+ private IPluginImport getDependency(String pluginId) {
+ if (pluginId == null || pluginId.length() < 1) return null;
+ for (IPluginImport existing : m_model.getPluginBase().getImports()) {
+ if (existing.getId().equals(pluginId)) {
+ return existing;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Checks whether the given package is already exported.
+ *
+ * @param pck
+ * The package name to check.
+ * @return true, if the given package is exported, false otherwise.
+ */
+ public boolean existsExportPackage(IPackageFragment pck) {
+ if (pck == null) return false;
+ return existsExportPackage(pck.getElementName());
+ }
+
+ /**
+ * Checks whether the given package name is already exported.
+ *
+ * @param packageName
+ * The package name to check.
+ * @return true, if the given package is exported, false otherwise.
+ */
+ public boolean existsExportPackage(String packageName) {
+ if (packageName == null || packageName.length() < 1) return false;
+ ExportPackageHeader expHeader = getExportPackageHeader();
+ return existsExportPackage(packageName, expHeader);
+ }
+
+ private boolean existsExportPackage(String packageName, ExportPackageHeader expHeader) {
+ return expHeader.getPackage(packageName) != null;
+ }
+
+ /**
+ * Adds the given package to the exported packages of the project associated with this helper.<br>
+ * If the given package is null, empty or already in the exported list, this method does nothing.<br>
+ * This method is thread safe.
+ *
+ * @param packageName
+ * The fully qualified name of the package.
+ */
+ public void addExportPackage(String packageName) {
+ if (packageName == null || packageName.length() < 1) return;
+ synchronized (m_model.getProject()) {
+ ExportPackageHeader expHeader = getExportPackageHeader();
+ if (!existsExportPackage(packageName, expHeader)) {
+ expHeader.addPackage(packageName);
+ setEntryValue(Constants.EXPORT_PACKAGE, expHeader.getValue());
+ }
+ }
+ }
+
+ /**
+ * Adds the given package to the exported packages of the project associated with this helper.<br>
+ * If the given package is already in the exported list, this method does nothing.
+ *
+ * @param pck
+ * The package to add
+ */
+ public void addExportPackage(IPackageFragment pck) {
+ addExportPackage(pck.getElementName());
+ }
+
+ /**
+ * Removes the given package from the exported packages list of the project associated with this helper.<br>
+ * This method does nothing if the give package is null.
+ *
+ * @param pck
+ * The package to remove
+ */
+ public void removeExportPackage(IPackageFragment pck) {
+ if (pck == null) return;
+ removeExportPackage(pck.getElementName());
+ }
+
+ /**
+ * Removes the given package from the exported packages list of the project associated with this helper.<br>
+ * This method does nothing if the give package is null or empty.
+ *
+ * @param packageName
+ * The fully qualified name of the package
+ */
+ public void removeExportPackage(String packageName) {
+ if (packageName == null || packageName.length() < 1) return;
+ ExportPackageHeader expHeader = getExportPackageHeader();
+ expHeader.removePackage(packageName);
+ setEntryValue(Constants.EXPORT_PACKAGE, expHeader.getValue());
+ }
+
+ private ExportPackageHeader getExportPackageHeader() {
+ IManifestHeader header = m_model.getBundle().getManifestHeader(Constants.EXPORT_PACKAGE);
+ return (ExportPackageHeader) m_model.getBundleModel().getFactory().createHeader(Constants.EXPORT_PACKAGE, header.getValue() == null ? "" : header.getValue());
+ }
+
+ private BundleClasspathHeader getBundleClasspathHeader() {
+ IManifestHeader header = m_model.getBundle().getManifestHeader(Constants.BUNDLE_CLASSPATH);
+ return (BundleClasspathHeader) m_model.getBundleModel().getFactory().createHeader(Constants.BUNDLE_CLASSPATH, header.getValue() == null ? "" : header.getValue());
+ }
+
+ /**
+ * Creates or updates the given manifest header key to the given value.<br>
+ * This method does nothing if the given key is null or empty.
+ *
+ * @param key
+ * The key. Will be created if it does not exist.
+ * @param value
+ * The value that should be set for the given key. if value is null, the key is removed from the manifest.
+ */
+ public void setEntryValue(String key, String value) {
+ if (key == null || key.length() < 1) return;
+ m_model.getBundle().setHeader(key, value);
+ }
+
+ /**
+ * Removes the given key from the manifest.<br>
+ * This method does nothing if the given key is null or empty.
+ *
+ * @param key
+ * The key to remove.
+ */
+ public void removeEntry(String key) {
+ setEntryValue(key, null);
+ }
+
+ /**
+ * Gets the value of the given manifest header key.
+ *
+ * @param key
+ * The property name.
+ * @return The value (or null if it does not exist) of the given key.
+ */
+ public String getEntry(String key) {
+ return m_model.getBundle().getHeader(key);
+ }
+
+ /**
+ * Gets all classpath entries of the project associated with this helper.
+ *
+ * @return an array with all entries.
+ */
+ @SuppressWarnings("unchecked")
+ public String[] getClasspathEntries() {
+ BundleClasspathHeader h = getBundleClasspathHeader();
+ Vector<String> names = h.getElementNames();
+ return names.toArray(new String[names.size()]);
+ }
+
+ /**
+ * Removes the given entry from the classpath.<br>
+ * If a null resource is passed, this method does nothing.
+ *
+ * @param resource
+ * The entry to remove.
+ */
+ public void removeClasspathEntry(IResource resource) {
+ if (resource == null) return;
+ removeClasspathEntry(getProjectRelativeResourcePath(resource));
+ }
+
+ /**
+ * Removes the given entry from the classpath.<br>
+ * If a null entry or empty entry is passed, this method does nothing.
+ *
+ * @param entry
+ * The entry to remove.
+ */
+ public void removeClasspathEntry(String entry) {
+ if (entry == null || entry.length() < 1) return;
+
+ BundleClasspathHeader h = getBundleClasspathHeader();
+ h.removeLibrary(entry);
+ setEntryValue(Constants.BUNDLE_CLASSPATH, h.getValue());
+ }
+
+ /**
+ * Adds the default classpath entry (".") to the classpath list.<br>
+ * If the default entry does already exist, this method does nothing.
+ */
+ public void addClasspathDefaultEntry() {
+ addClasspathEntry(".");
+ }
+
+ /**
+ * Checks whether the given entry is already in the classpath entries of the project associated with this helper.
+ *
+ * @param resource
+ * The entry to search
+ * @return false if the resource is null or does not exist, true otherwise.
+ */
+ public boolean existsClasspathEntry(IResource resource) {
+ if (resource == null) return false;
+ return existsClasspathEntry(getProjectRelativeResourcePath(resource));
+ }
+
+ /**
+ * Checks whether the given entry is already in the classpath entries of the project associated with this helper.
+ *
+ * @param entry
+ * The entry to search.
+ * @return true if the given entry already exists, false otherwise.
+ */
+ public boolean existsClasspathEntry(String entry) {
+ if (entry == null || entry.length() < 1) return false;
+ for (String e : getClasspathEntries()) {
+ if (e.equals(entry)) return true;
+ }
+ return false;
+ }
+
+ /**
+ * Adds the given classpath entry to the classpath of the project associated with this helper.<br>
+ * If the resource is null, does not exist in the project or is already in the classpath, this method does nothing.<br>
+ * This method is thread safe.
+ *
+ * @param resource
+ * The classpath entry to add.
+ */
+ public void addClasspathEntry(IResource resource) {
+ if (resource == null) return;
+ if (!resource.exists()) return;
+ addClasspathEntry(getProjectRelativeResourcePath(resource));
+ }
+
+ /**
+ * Adds the given classpath entry to the classpath of the project associated with this helper.<br>
+ * If the given entry is null, an empty string or already exists in the classpath, this method does nothing.<br>
+ * This method is thread safe.
+ *
+ * @param entry
+ * The classpath entry to add.
+ */
+ public void addClasspathEntry(String entry) {
+ if (entry == null || entry.length() < 1) return;
+ synchronized (m_model.getProject()) {
+ if (!existsClasspathEntry(entry)) {
+ BundleClasspathHeader h = getBundleClasspathHeader();
+ h.addLibrary(entry);
+ setEntryValue(Constants.BUNDLE_CLASSPATH, h.getValue());
+ }
+ }
+ }
+
+ /**
+ * Sets the version of the plugin to the given value.<br>
+ * If the given value is null, this method does nothing.
+ *
+ * @param newVersion
+ * the new version
+ */
+ public void setVersion(Version newVersion) {
+ if (newVersion == null) return;
+ setVersion(newVersion.toString());
+ }
+
+ /**
+ * Sets the version of the plugin to the given value.<br>
+ * If the given value is empty or null, this method does nothing.
+ *
+ * @param newVersion
+ * the new version
+ */
+ public void setVersion(String newVersion) {
+ if (newVersion == null || newVersion.length() < 1) return;
+ setEntryValue(Constants.BUNDLE_VERSION, newVersion);
+ }
+
+ /**
+ * Gets the version of the plugin.
+ *
+ * @return The version of this plugin.
+ */
+ public Version getVersion() {
+ return Version.parseVersion(getVersionAsString());
+ }
+
+ /**
+ * Gets the version of the plugin.
+ *
+ * @return The version of the plugin.
+ */
+ public String getVersionAsString() {
+ return getEntry(Constants.BUNDLE_VERSION);
+ }
+
+ /**
+ * Gets the MANIFEST.MF file of the plugin.
+ *
+ * @return
+ */
+ public IFile getFile() {
+ return m_model.getManifestFile();
+ }
+ }
+
+ /**
+ * saves all changes of all underlying models that require saving.
+ */
+ public void save() {
+ // same lazy model instance for all parts -> does not matter which one is saved.
+ Manifest.m_model.save();
+ }
+
+ public static class PluginXmlPart {
+ private final LazyPluginModel m_model;
+
+ private PluginXmlPart(LazyPluginModel m) {
+ m_model = m;
+ }
+
+ /**
+ * Adds a simple extension to the project associated with this helper.<br>
+ * If exactly the same extension already exists, it is added another time.<br>
+ * A simple extension is of the following format:<br>
+ * <code>
+ * &lt;extension point="extensionPointId"&gt;<br>
+ * &nbsp;&nbsp;&lt;elementName attribute1="value1" attribute2="value2"&gt;&lt;/elementName&gt;<br>
+ * &lt;/extension&gt;<br>
+ * </code>
+ *
+ * @param extensionPointId
+ * The full id of the extension point for which the extension should be added.
+ * @param elementName
+ * The tag name of the extension.
+ * @param attributes
+ * The attribute (name-value-pairs) that should be added to the element.
+ * @throws CoreException
+ */
+ public void addSimpleExtension(String extensionPointId, String elementName, Map<String, String> attributes) throws CoreException {
+ IPluginExtension pe = null;
+ // find existing extension
+ for (IPluginExtension existing : m_model.getExtensionsModel().getExtensions().getExtensions()) {
+ if (existing.getPoint().equals(extensionPointId)) {
+ pe = existing;
+ break;
+ }
+ }
+ if (pe == null) {
+ // no extension for given extension point exists: create new
+ pe = m_model.getExtensionsModel().createExtension();
+ pe.setPoint(extensionPointId);
+ m_model.getExtensionsModel().getExtensions().add(pe);
+ }
+
+ IPluginElement extension = m_model.getExtensionsModel().createElement(pe);
+ extension.setName(elementName);
+ if (attributes != null && attributes.size() > 0) {
+ for (Map.Entry<String, String> entry : attributes.entrySet()) {
+ extension.setAttribute(entry.getKey(), entry.getValue());
+ }
+ }
+ pe.add(extension);
+ }
+
+ /**
+ * Adds a simple extension to the project associated with this helper.<br>
+ * If exactly the same extension already exists, it is added another time.<br>
+ * A simple extension is of the following format:<br>
+ * <code>
+ * &lt;extension point="extensionPointId"&gt;<br>
+ * &nbsp;&nbsp;&lt;elementName&gt;&lt;/elementName&gt;<br>
+ * &lt;/extension&gt;<br>
+ * </code>
+ *
+ * @param extensionPointId
+ * The full id of the extension point for which the extension should be added.
+ * @param elementName
+ * The tag name of the extension.
+ * @throws CoreException
+ */
+ public void addSimpleExtension(String extensionPointId, String elementName) throws CoreException {
+ addSimpleExtension(extensionPointId, elementName, null);
+ }
+
+ /**
+ * Removes the simple extension from this plugin. An existing extension must match in <code>extensionPointId</code>,
+ * <code>elementName</code> and all <code>attributes</code> given.<br>
+ * A simple extension is of the following format:<br>
+ * <code>
+ * &lt;extension point="extensionPointId"&gt;<br>
+ * &nbsp;&nbsp;&lt;elementName attribute1="value1" attribute2="value2"&gt;&lt;/elementName&gt;<br>
+ * &lt;/extension&gt;<br>
+ * </code>
+ *
+ * @param extensionPointId
+ * The full extension point id.
+ * @param elementName
+ * the tag name
+ * @param attributes
+ * key-value-pairs of the attributes.
+ * @throws CoreException
+ */
+ public void removeSimpleExtension(String extensionPointId, String elementName, Map<String, String> attributes) throws CoreException {
+ IPluginElement[] toDeleteList = getSimpleExtensions(extensionPointId, elementName, attributes);
+ for (IPluginElement toDelete : toDeleteList) {
+ if (toDelete.getParent() instanceof IPluginExtension) {
+ ((IPluginExtension) toDelete.getParent()).remove(toDelete);
+ }
+ }
+ }
+
+ /**
+ * Removes the simple extension from this plugin. An existing extension must match in <code>extensionPointId</code>
+ * and <code>elementName</code>.<br>
+ * A simple extension is of the following format:<br>
+ * <code>
+ * &lt;extension point="extensionPointId"&gt;<br>
+ * &nbsp;&nbsp;&lt;elementName&gt;&lt;/elementName&gt;<br>
+ * &lt;/extension&gt;<br>
+ * </code>
+ *
+ * @param extensionPointId
+ * The full extension point id.
+ * @param elementName
+ * @throws CoreException
+ */
+ public void removeSimpleExtension(String extensionPointId, String elementName) throws CoreException {
+ removeSimpleExtension(extensionPointId, elementName, null);
+ }
+
+ /**
+ * Gets all simple extensions with given <code>extensionPointId</code>, <code>elementName</code> and
+ * <code>attributes</code>.<br>
+ * A simple extension is of the following format:<br>
+ * <code>
+ * &lt;extension point="extensionPointId"&gt;<br>
+ * &nbsp;&nbsp;&lt;elementName attribute1="value1" attribute2="value2"&gt;&lt;/elementName&gt;<br>
+ * &lt;/extension&gt;<br>
+ * </code>
+ *
+ * @param extensionPointId
+ * The full extension point id.
+ * @param elementName
+ * The tag name
+ * @param attributes
+ * the attributes that must match.
+ * @return an array containing all extensions that match the given criteria.
+ */
+ public IPluginElement[] getSimpleExtensions(String extensionPointId, String elementName, Map<String, String> attributes) {
+ List<IPluginElement> candidates = getPluginExtensions(extensionPointId);
+ Iterator<IPluginElement> it = candidates.iterator();
+ while (it.hasNext()) {
+ IPluginElement candidate = it.next();
+ if (!elementName.equals(candidate.getName())) {
+ it.remove(); // element name does not match -> no candidate (remove from list)
+ }
+ else if (attributes != null && attributes.size() > 0) {
+ // name matches. check also for the attributes
+ for (Entry<String, String> entry : attributes.entrySet()) {
+ IPluginAttribute a = candidate.getAttribute(entry.getKey());
+ if (a == null) {
+ it.remove(); // search attribute does not exist -> no candidate (remove from list)
+ break;
+ }
+ else if (CompareUtility.notEquals(entry.getValue(), a.getValue())) {
+ it.remove(); // search attribute does not contain the requested value -> no candidate (remove from list)
+ break;
+ }
+ }
+ }
+ }
+ return candidates.toArray(new IPluginElement[candidates.size()]);
+ }
+
+ /**
+ * Gets all simple extensions with given <code>extensionPointId</code> and <code>elementName</code>.<br>
+ * A simple extension is of the following format:<br>
+ * <code>
+ * &lt;extension point="extensionPointId"&gt;<br>
+ * &nbsp;&nbsp;&lt;elementName&gt;&lt;/elementName&gt;<br>
+ * &lt;/extension&gt;<br>
+ * </code>
+ *
+ * @param extensionPointId
+ * The full extension point id.
+ * @param elementName
+ * The tag name
+ * @return an array containing all extensions that match the given criteria.
+ */
+ public IPluginElement[] getSimpleExtensions(String extensionPointId, String elementName) {
+ return getSimpleExtensions(extensionPointId, elementName, null);
+ }
+
+ private List<IPluginElement> getPluginExtensions(String extensionPointId) {
+ LinkedList<IPluginElement> result = new LinkedList<IPluginElement>();
+ for (IPluginExtension extPoint : m_model.getExtensionsModel().getExtensions().getExtensions()) {
+ if (extPoint.getPoint().equals(extensionPointId)) {
+ for (IPluginObject element : extPoint.getChildren()) {
+ if (element instanceof IPluginElement) {
+ result.add((IPluginElement) element);
+ }
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * Gets the first simple extension with given <code>extensionPointId</code>, <code>elementName</code> and
+ * <code>attributes</code>.<br>
+ * A simple extension is of the following format:<br>
+ * <code>
+ * &lt;extension point="extensionPointId"&gt;<br>
+ * &nbsp;&nbsp;&lt;elementName attribute1="value1" attribute2="value2"&gt;&lt;/elementName&gt;<br>
+ * &lt;/extension&gt;<br>
+ * </code>
+ *
+ * @param extensionPointId
+ * The full extension point id
+ * @param elementName
+ * The tag name
+ * @param attributes
+ * The attributes
+ * @return the first extension that matches all criteria.
+ */
+ public IPluginElement getSimpleExtension(String extensionPointId, String elementName, Map<String, String> attributes) {
+ IPluginElement[] matches = getSimpleExtensions(extensionPointId, elementName, attributes);
+ if (matches != null && matches.length > 0) return matches[0];
+ return null;
+ }
+
+ /**
+ * Gets the first simple extension with given <code>extensionPointId</code> and <code>elementName</code>.<br>
+ * A simple extension is of the following format:<br>
+ * <code>
+ * &lt;extension point="extensionPointId"&gt;<br>
+ * &nbsp;&nbsp;&lt;elementName&gt;&lt;/elementName&gt;<br>
+ * &lt;/extension&gt;<br>
+ * </code>
+ *
+ * @param extensionPointId
+ * The full extension point id
+ * @param elementName
+ * The tag name
+ * @return the first extension that matches all criteria.
+ */
+ public IPluginElement getSimpleExtension(String extensionPointId, String elementName) {
+ return getSimpleExtension(extensionPointId, elementName, null);
+ }
+
+ /**
+ * Checks if a simple extension with given <code>extensionPointId</code>, <code>elementName</code> and
+ * <code>attributes</code> already exists.<br>
+ * A simple extension is of the following format:<br>
+ * <code>
+ * &lt;extension point="extensionPointId"&gt;<br>
+ * &nbsp;&nbsp;&lt;elementName attribute1="value1" attribute2="value2"&gt;&lt;/elementName&gt;<br>
+ * &lt;/extension&gt;<br>
+ * </code>
+ *
+ * @param extensionPointId
+ * The full extension point id
+ * @param elementName
+ * The tag name
+ * @param attributes
+ * The attributes
+ * @return true if such an extension exists, false otherwise.
+ */
+ public boolean existsSimpleExtension(String extensionPointId, String elementName, Map<String, String> attributes) {
+ IPluginElement[] matches = getSimpleExtensions(extensionPointId, elementName, attributes);
+ return matches != null && matches.length > 0;
+ }
+
+ /**
+ * Checks if a simple extension with given <code>extensionPointId</code> and <code>elementName</code> already
+ * exists.<br>
+ * A simple extension is of the following format:<br>
+ * <code>
+ * &lt;extension point="extensionPointId"&gt;<br>
+ * &nbsp;&nbsp;&lt;elementName&gt;&lt;/elementName&gt;<br>
+ * &lt;/extension&gt;<br>
+ * </code>
+ *
+ * @param extensionPointId
+ * The full extension point id
+ * @param elementName
+ * The tag name
+ * @return true if such an extension exists, false otherwise.
+ */
+ public boolean existsSimpleExtension(String extensionPointId, String elementName) {
+ return existsSimpleExtension(extensionPointId, elementName, null);
+ }
+
+ /**
+ * Gets the plugin.xml file of the plugin.
+ *
+ * @return
+ */
+ public IFile getFile() {
+ return m_model.getPluginXmlFile();
+ }
+ }
+
+ public static class BuildPropertiesPart {
+ private final static String BINARY_BUILD_INCLUDES = "bin.includes";
+
+ private final LazyPluginModel m_model;
+
+ private BuildPropertiesPart(LazyPluginModel m) {
+ m_model = m;
+ }
+
+ /**
+ * Removes the given resource from the binary build includes list.<br>
+ * If the resource is null, this method does nothing.
+ *
+ * @param resource
+ * The resource to remove.
+ * @throws CoreException
+ */
+ public void removeBinaryBuildEntry(IResource resource) throws CoreException {
+ if (resource == null) return;
+ removeBinaryBuildEntry(getProjectRelativeResourcePath(resource));
+ }
+
+ /**
+ * Removes the given token from the binary build includes list.<br>
+ * If the token is null or empty, this method does nothing.
+ *
+ * @param token
+ * The token to remove.
+ * @throws CoreException
+ */
+ public void removeBinaryBuildEntry(String token) throws CoreException {
+ if (token == null || token.length() < 1) return;
+ IBuildEntry entry = m_model.getBuildModel().getBuild().getEntry(BINARY_BUILD_INCLUDES);
+ if (entry != null) {
+ entry.removeToken(token);
+ }
+ }
+
+ /**
+ * Gets all binary build includes.
+ *
+ * @return An array containing all binary build includes of the plugin.
+ */
+ public String[] getBinaryBuildEntries() {
+ IBuildEntry entry = m_model.getBuildModel().getBuild().getEntry(BINARY_BUILD_INCLUDES);
+ if (entry != null) {
+ return entry.getTokens();
+ }
+ return new String[]{};
+ }
+
+ private IBuildEntry getBuildEntry(String name) throws CoreException {
+ IBuildEntry entry = m_model.getBuildModel().getBuild().getEntry(name);
+ if (entry == null) {
+ entry = m_model.getBuildModel().getFactory().createEntry(name);
+ m_model.getBuildModel().getBuild().add(entry);
+ }
+ return entry;
+ }
+
+ /**
+ * Checks whether the given resource exists in the binary build includes list of the project associated with this
+ * helper.
+ *
+ * @param resource
+ * The resource to search.
+ * @return true if the given resource is already in the binary build includes list, false otherwise.
+ * @throws CoreException
+ */
+ public boolean existsBinaryBuildEntry(IResource resource) throws CoreException {
+ if (resource == null) return false;
+ return existsBinaryBuildEntry(getProjectRelativeResourcePath(resource));
+ }
+
+ /**
+ * Checks whether the given token exists in the binary build includes list of the project associated with this
+ * helper.
+ *
+ * @param token
+ * The token to search.
+ * @return true if the given token is already in the binary build includes list, false otherwise.
+ * @throws CoreException
+ */
+ public boolean existsBinaryBuildEntry(String token) throws CoreException {
+ if (token == null || token.length() < 1) return false;
+ IBuildEntry entry = getBuildEntry(BINARY_BUILD_INCLUDES);
+ return entry.contains(token);
+ }
+
+ /**
+ * Adds the given token to the binary build includes.<br>
+ * If no "bin.includes" exists, it is created.<br>
+ * If the token is null, does not exist or is already in the list, this method does nothing.<br>
+ * This method is thread safe.
+ *
+ * @param resource
+ * The resource to add.
+ * @throws CoreException
+ */
+ public void addBinaryBuildEntry(IResource resource) throws CoreException {
+ if (resource == null) return;
+ if (!resource.exists()) return;
+ addBinaryBuildEntry(getProjectRelativeResourcePath(resource));
+ }
+
+ /**
+ * Adds the given token to the binary build includes.<br>
+ * If no "bin.includes" exists, it is created.<br>
+ * If the token is null, empty or is already in the list, this method does nothing.<br>
+ * This method is thread safe.
+ *
+ * @param token
+ * The token to add.
+ * @throws CoreException
+ */
+ public void addBinaryBuildEntry(String token) throws CoreException {
+ if (token == null || token.length() < 1) return;
+ synchronized (m_model.getProject()) {
+ IBuildEntry entry = getBuildEntry(BINARY_BUILD_INCLUDES);
+ if (!entry.contains(token)) {
+ entry.addToken(token);
+ }
+ }
+ }
+
+ /**
+ * Gets the build.properties file of the plugin.
+ *
+ * @return
+ */
+ public IFile getFile() {
+ return m_model.getBuildPropertiesFile();
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/ProductFileModelHelper.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/ProductFileModelHelper.java
index b39fda69b..7e868db4a 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/ProductFileModelHelper.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/pde/ProductFileModelHelper.java
@@ -1,382 +1,382 @@
-package org.eclipse.scout.sdk.util.pde;
-
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-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.adaptor.EclipseStarter;
-import org.eclipse.osgi.service.resolver.BundleDescription;
-import org.eclipse.osgi.service.resolver.State;
-import org.eclipse.pde.core.plugin.IPluginModelBase;
-import org.eclipse.pde.core.plugin.PluginRegistry;
-import org.eclipse.pde.internal.core.TargetPlatformHelper;
-import org.eclipse.pde.internal.core.iproduct.IProduct;
-import org.eclipse.pde.internal.core.iproduct.IProductModel;
-import org.eclipse.pde.internal.core.iproduct.IProductPlugin;
-import org.eclipse.pde.internal.core.product.ProductPlugin;
-import org.osgi.framework.Version;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- * Helper class for basic product file operations.
- *
- * @author mvi
- * @since 3.8.0
- */
-@SuppressWarnings("restriction")
-public final class ProductFileModelHelper {
- private final LazyProductFileModel m_model;
-
- /**
- * Class for operations executed on the configuration file of the product.
- */
- public final ConfigurationFilePart ConfigurationFile;
-
- /**
- * Class for operations executed on the product file.
- */
- public final ProductFilePart ProductFile;
-
- /**
- * Creates a new helper that operates on the given product file.
- *
- * @param project
- * The project in which the given path should be used.
- * @param projRelPathToProduct
- * The path relative to the given project root pointing to the product file
- * @throws CoreException
- * @throws IllegalArgumentException
- * when the given path is not valid or the file does not exist
- */
- public ProductFileModelHelper(IProject project, IPath projRelPathToProduct) throws CoreException {
- this(project.getFile(projRelPathToProduct));
- }
-
- /**
- * Creates a new helper that operates on the given product file.
- *
- * @param project
- * The project in which the given path should be used.
- * @param projRelPathToProduct
- * The path relative to the given project root pointing to the product file
- * @throws CoreException
- * @throws IllegalArgumentException
- * when the given path is not valid or the file does not exist
- */
- public ProductFileModelHelper(IProject project, String projRelPathToProduct) throws CoreException {
- this(project.getFile(projRelPathToProduct));
- }
-
- /**
- * Creates a new helper that operates on the given product file.
- *
- * @param productFile
- * The product file
- * @throws CoreException
- * @throws IllegalArgumentException
- * when the given path is not valid or the file does not exist
- */
- public ProductFileModelHelper(IFile productFile) throws CoreException {
- m_model = new LazyProductFileModel(productFile);
-
- ConfigurationFile = new ConfigurationFilePart(m_model);
- ProductFile = new ProductFilePart(m_model);
- }
-
- public static class ProductFilePart {
- private final LazyProductFileModel m_model;
-
- private ProductFilePart(LazyProductFileModel model) {
- m_model = model;
- }
-
- /**
- * Adds the given plugin id to the dependencies of this product.<br>
- * If the given plugin is already in the list, this method does nothing.
- *
- * @param pluginId
- * The plugin id.
- * @throws CoreException
- */
- public void addDependency(String pluginId) throws CoreException {
- addDependency(pluginId, false);
- }
-
- /**
- * Adds the given plugin id to the dependencies of this product.<br>
- * If the given plugin is already in the list, this method does nothing.
- *
- * @param pluginId
- * The plugin id.
- * @param isFragment
- * specifies if the given plugin id identifies a fragment.
- * @throws CoreException
- */
- public synchronized void addDependency(String pluginId, boolean isFragment) throws CoreException {
- if (!existsDependency(pluginId)) {
- P_ProductPlugin newPlugin = createPlugin(pluginId, isFragment);
- m_model.getWorkspaceProductModel().getProduct().addPlugins(new IProductPlugin[]{newPlugin});
- }
- }
-
- /**
- * TODO can be eliminated when <b>BUG 362398</b> is fixed.<br>
- * When the bug is fixed use m_model.getWorkspaceProductModel().getFactory().createPlugin() to create instances.
- *
- * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=362398">Bugzilla #362398</a>
- */
- private P_ProductPlugin createPlugin(String pluginId, boolean isFragment) throws CoreException {
- return new P_ProductPlugin(m_model.getWorkspaceProductModel(), pluginId, isFragment);
- }
-
- /**
- * Checks if the given plugin id is already in the dependencies of this product.
- *
- * @param pluginId
- * The plugin id.
- * @return true if the given plugin id is already in the list, false otherwise.
- * @throws CoreException
- */
- public boolean existsDependency(String pluginId) throws CoreException {
- for (IProductPlugin p : m_model.getWorkspaceProductModel().getProduct().getPlugins()) {
- if (p.getId().equals(pluginId)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * Removes the given plugin id from the dependency list of this product.
- *
- * @param pluginId
- * The plugin id.
- * @throws CoreException
- */
- public void removeDependency(String pluginId) throws CoreException {
- m_model.getWorkspaceProductModel().getProduct().removePlugins(new IProductPlugin[]{createPlugin(pluginId, false)});
- }
-
- /**
- * Checks if the product is valid or not.
- *
- * @return true if the product is valid, false otherwise.
- * @throws CoreException
- */
- public boolean isValid() throws CoreException {
- return m_model.getWorkspaceProductModel().isValid();
- }
-
- /**
- * Gets the plugin models of all plugins of the product associated with this helper.
- *
- * @return the plugin models of all plugins this product is dependent of.
- * @throws CoreException
- */
- public BundleDescription[] getPluginModels() throws CoreException {
- ArrayList<BundleDescription> list = new ArrayList<BundleDescription>();
- State state = TargetPlatformHelper.getState();
-
- IProductPlugin[] plugins = m_model.getWorkspaceProductModel().getProduct().getPlugins();
- for (int i = 0; i < plugins.length; i++) {
- BundleDescription bundle = null;
-
- String v = plugins[i].getVersion();
- if (v != null && v.length() > 0) {
- bundle = state.getBundle(plugins[i].getId(), Version.parseVersion(v));
- }
- if (bundle == null) {
- bundle = state.getBundle(plugins[i].getId(), null);
- }
- if (bundle != null) {
- list.add(bundle);
- }
- }
-
- return list.toArray(new BundleDescription[list.size()]);
- }
-
- /**
- * Gets the {@link IProduct} model for this product.
- *
- * @return the product model.
- * @throws CoreException
- */
- public IProduct getProduct() throws CoreException {
- return m_model.getWorkspaceProductModel().getProduct();
- }
-
- }
-
- /**
- * saves all changes of all underlying models that require saving.
- *
- * @throws CoreException
- */
- public void save() throws CoreException {
- m_model.save();
- }
-
- public static class ConfigurationFilePart {
- private final LazyProductFileModel m_model;
-
- private ConfigurationFilePart(LazyProductFileModel model) {
- m_model = model;
- }
-
- /**
- * Gets the value of the config file entry with the given key.
- *
- * @param key
- * The key to search.
- * @return The value of the given key in the config file (or null if it does not exist).
- * @throws CoreException
- */
- public String getEntry(String key) throws CoreException {
- return m_model.getConfigFileProperties().getProperty(key, null);
- }
-
- /**
- * Checks if the given key exists in the config file.
- *
- * @param key
- * The key to search.
- * @return true if the key exists, false otherwise.
- * @throws CoreException
- */
- public boolean existsEntry(String key) throws CoreException {
- return m_model.getConfigFileProperties().containsKey(key);
- }
-
- /**
- * Sets the value of the entry with the given key.<br>
- * If the key does not exist, it is created.
- *
- * @param key
- * The key to create or update.
- * @param value
- * The value associated with the given key.
- * @throws CoreException
- */
- public void setEntry(String key, String value) throws CoreException {
- m_model.getConfigFileProperties().setProperty(key, value);
- }
-
- /**
- * Removes the given key from the configuration file.
- *
- * @param key
- * The key to remove
- * @throws CoreException
- */
- public void removeEntry(String key) throws CoreException {
- m_model.getConfigFileProperties().remove(key);
- }
-
- /**
- * Gets the value of the "osgi.bundles" entry of the config file.
- *
- * @return The value of the "osgi.bundles" entry.
- * @throws CoreException
- */
- public String getOsgiBundlesEntry() throws CoreException {
- return getEntry(EclipseStarter.PROP_BUNDLES);
- }
-
- /**
- * Sets the value of the "osgi.bundles" entry of the config file.
- *
- * @param value
- * The new value of the entry.
- * @throws CoreException
- */
- public void setOsgiBundlesEntry(String value) throws CoreException {
- setEntry(EclipseStarter.PROP_BUNDLES, value);
- }
-
- /**
- * Gets the configuration file of this product.
- *
- * @return The config file or null if this product has no config file specified.
- * @throws CoreException
- */
- public IFile getFile() throws CoreException {
- return m_model.getConfigIniFile();
- }
-
- /**
- * Gets a map of all key-value-pairs that exist in the config file.<br>
- * Changes to the map have no effect to the config file.
- *
- * @return A map with all key-value-pairs.
- * @throws CoreException
- */
- public Map<String, String> getEntries() throws CoreException {
- HashMap<String, String> entries = new HashMap<String, String>();
- for (Entry<Object, Object> entry : m_model.getConfigFileProperties().entrySet()) {
- if (entry.getKey() instanceof String && entry.getValue() instanceof String) {
- entries.put((String) entry.getKey(), (String) entry.getValue());
- }
- }
- return entries;
- }
- }
-
- /**
- * TODO can be eliminated when <b>BUG 362398</b> is fixed.
- *
- * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=362398">Bugzilla #362398</a>
- */
- private static class P_ProductPlugin extends ProductPlugin {
- private static final long serialVersionUID = 1L;
- private boolean m_fragment;
-
- private P_ProductPlugin(IProductModel model, String id) {
- this(model, id, false);
- }
-
- private P_ProductPlugin(IProductModel model, String id, boolean isFragment) {
- super(model);
- m_fragment = isFragment;
- setId(id);
- }
-
- @Override
- public void parse(Node node) {
- super.parse(node);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element element = (Element) node;
- setFragment(Boolean.parseBoolean(element.getAttribute("fragment")));
- }
- }
-
- @Override
- public void write(String indent, PrintWriter writer) {
- writer.print(indent + "<plugin id=\"" + getId() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
- if (getVersion() != null && getVersion().length() > 0 && !getVersion().equals("0.0.0")) { //$NON-NLS-1$
- writer.print(" version=\"" + getVersion() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- IPluginModelBase modBase = PluginRegistry.findModel(getId());
- if (isFragment() || (modBase != null && modBase.isFragmentModel())) {
- writer.print(" fragment=\"true\""); //$NON-NLS-1$
- }
- writer.println("/>"); //$NON-NLS-1$
- }
-
- public boolean isFragment() {
- return m_fragment;
- }
-
- public void setFragment(boolean isFragment) {
- m_fragment = isFragment;
- }
- }
-}
+package org.eclipse.scout.sdk.util.pde;
+
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+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.adaptor.EclipseStarter;
+import org.eclipse.osgi.service.resolver.BundleDescription;
+import org.eclipse.osgi.service.resolver.State;
+import org.eclipse.pde.core.plugin.IPluginModelBase;
+import org.eclipse.pde.core.plugin.PluginRegistry;
+import org.eclipse.pde.internal.core.TargetPlatformHelper;
+import org.eclipse.pde.internal.core.iproduct.IProduct;
+import org.eclipse.pde.internal.core.iproduct.IProductModel;
+import org.eclipse.pde.internal.core.iproduct.IProductPlugin;
+import org.eclipse.pde.internal.core.product.ProductPlugin;
+import org.osgi.framework.Version;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ * Helper class for basic product file operations.
+ *
+ * @author mvi
+ * @since 3.8.0
+ */
+@SuppressWarnings("restriction")
+public final class ProductFileModelHelper {
+ private final LazyProductFileModel m_model;
+
+ /**
+ * Class for operations executed on the configuration file of the product.
+ */
+ public final ConfigurationFilePart ConfigurationFile;
+
+ /**
+ * Class for operations executed on the product file.
+ */
+ public final ProductFilePart ProductFile;
+
+ /**
+ * Creates a new helper that operates on the given product file.
+ *
+ * @param project
+ * The project in which the given path should be used.
+ * @param projRelPathToProduct
+ * The path relative to the given project root pointing to the product file
+ * @throws CoreException
+ * @throws IllegalArgumentException
+ * when the given path is not valid or the file does not exist
+ */
+ public ProductFileModelHelper(IProject project, IPath projRelPathToProduct) throws CoreException {
+ this(project.getFile(projRelPathToProduct));
+ }
+
+ /**
+ * Creates a new helper that operates on the given product file.
+ *
+ * @param project
+ * The project in which the given path should be used.
+ * @param projRelPathToProduct
+ * The path relative to the given project root pointing to the product file
+ * @throws CoreException
+ * @throws IllegalArgumentException
+ * when the given path is not valid or the file does not exist
+ */
+ public ProductFileModelHelper(IProject project, String projRelPathToProduct) throws CoreException {
+ this(project.getFile(projRelPathToProduct));
+ }
+
+ /**
+ * Creates a new helper that operates on the given product file.
+ *
+ * @param productFile
+ * The product file
+ * @throws CoreException
+ * @throws IllegalArgumentException
+ * when the given path is not valid or the file does not exist
+ */
+ public ProductFileModelHelper(IFile productFile) throws CoreException {
+ m_model = new LazyProductFileModel(productFile);
+
+ ConfigurationFile = new ConfigurationFilePart(m_model);
+ ProductFile = new ProductFilePart(m_model);
+ }
+
+ public static class ProductFilePart {
+ private final LazyProductFileModel m_model;
+
+ private ProductFilePart(LazyProductFileModel model) {
+ m_model = model;
+ }
+
+ /**
+ * Adds the given plugin id to the dependencies of this product.<br>
+ * If the given plugin is already in the list, this method does nothing.
+ *
+ * @param pluginId
+ * The plugin id.
+ * @throws CoreException
+ */
+ public void addDependency(String pluginId) throws CoreException {
+ addDependency(pluginId, false);
+ }
+
+ /**
+ * Adds the given plugin id to the dependencies of this product.<br>
+ * If the given plugin is already in the list, this method does nothing.
+ *
+ * @param pluginId
+ * The plugin id.
+ * @param isFragment
+ * specifies if the given plugin id identifies a fragment.
+ * @throws CoreException
+ */
+ public synchronized void addDependency(String pluginId, boolean isFragment) throws CoreException {
+ if (!existsDependency(pluginId)) {
+ P_ProductPlugin newPlugin = createPlugin(pluginId, isFragment);
+ m_model.getWorkspaceProductModel().getProduct().addPlugins(new IProductPlugin[]{newPlugin});
+ }
+ }
+
+ /**
+ * TODO can be eliminated when <b>BUG 362398</b> is fixed.<br>
+ * When the bug is fixed use m_model.getWorkspaceProductModel().getFactory().createPlugin() to create instances.
+ *
+ * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=362398">Bugzilla #362398</a>
+ */
+ private P_ProductPlugin createPlugin(String pluginId, boolean isFragment) throws CoreException {
+ return new P_ProductPlugin(m_model.getWorkspaceProductModel(), pluginId, isFragment);
+ }
+
+ /**
+ * Checks if the given plugin id is already in the dependencies of this product.
+ *
+ * @param pluginId
+ * The plugin id.
+ * @return true if the given plugin id is already in the list, false otherwise.
+ * @throws CoreException
+ */
+ public boolean existsDependency(String pluginId) throws CoreException {
+ for (IProductPlugin p : m_model.getWorkspaceProductModel().getProduct().getPlugins()) {
+ if (p.getId().equals(pluginId)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Removes the given plugin id from the dependency list of this product.
+ *
+ * @param pluginId
+ * The plugin id.
+ * @throws CoreException
+ */
+ public void removeDependency(String pluginId) throws CoreException {
+ m_model.getWorkspaceProductModel().getProduct().removePlugins(new IProductPlugin[]{createPlugin(pluginId, false)});
+ }
+
+ /**
+ * Checks if the product is valid or not.
+ *
+ * @return true if the product is valid, false otherwise.
+ * @throws CoreException
+ */
+ public boolean isValid() throws CoreException {
+ return m_model.getWorkspaceProductModel().isValid();
+ }
+
+ /**
+ * Gets the plugin models of all plugins of the product associated with this helper.
+ *
+ * @return the plugin models of all plugins this product is dependent of.
+ * @throws CoreException
+ */
+ public BundleDescription[] getPluginModels() throws CoreException {
+ ArrayList<BundleDescription> list = new ArrayList<BundleDescription>();
+ State state = TargetPlatformHelper.getState();
+
+ IProductPlugin[] plugins = m_model.getWorkspaceProductModel().getProduct().getPlugins();
+ for (int i = 0; i < plugins.length; i++) {
+ BundleDescription bundle = null;
+
+ String v = plugins[i].getVersion();
+ if (v != null && v.length() > 0) {
+ bundle = state.getBundle(plugins[i].getId(), Version.parseVersion(v));
+ }
+ if (bundle == null) {
+ bundle = state.getBundle(plugins[i].getId(), null);
+ }
+ if (bundle != null) {
+ list.add(bundle);
+ }
+ }
+
+ return list.toArray(new BundleDescription[list.size()]);
+ }
+
+ /**
+ * Gets the {@link IProduct} model for this product.
+ *
+ * @return the product model.
+ * @throws CoreException
+ */
+ public IProduct getProduct() throws CoreException {
+ return m_model.getWorkspaceProductModel().getProduct();
+ }
+
+ }
+
+ /**
+ * saves all changes of all underlying models that require saving.
+ *
+ * @throws CoreException
+ */
+ public void save() throws CoreException {
+ m_model.save();
+ }
+
+ public static class ConfigurationFilePart {
+ private final LazyProductFileModel m_model;
+
+ private ConfigurationFilePart(LazyProductFileModel model) {
+ m_model = model;
+ }
+
+ /**
+ * Gets the value of the config file entry with the given key.
+ *
+ * @param key
+ * The key to search.
+ * @return The value of the given key in the config file (or null if it does not exist).
+ * @throws CoreException
+ */
+ public String getEntry(String key) throws CoreException {
+ return m_model.getConfigFileProperties().getProperty(key, null);
+ }
+
+ /**
+ * Checks if the given key exists in the config file.
+ *
+ * @param key
+ * The key to search.
+ * @return true if the key exists, false otherwise.
+ * @throws CoreException
+ */
+ public boolean existsEntry(String key) throws CoreException {
+ return m_model.getConfigFileProperties().containsKey(key);
+ }
+
+ /**
+ * Sets the value of the entry with the given key.<br>
+ * If the key does not exist, it is created.
+ *
+ * @param key
+ * The key to create or update.
+ * @param value
+ * The value associated with the given key.
+ * @throws CoreException
+ */
+ public void setEntry(String key, String value) throws CoreException {
+ m_model.getConfigFileProperties().setProperty(key, value);
+ }
+
+ /**
+ * Removes the given key from the configuration file.
+ *
+ * @param key
+ * The key to remove
+ * @throws CoreException
+ */
+ public void removeEntry(String key) throws CoreException {
+ m_model.getConfigFileProperties().remove(key);
+ }
+
+ /**
+ * Gets the value of the "osgi.bundles" entry of the config file.
+ *
+ * @return The value of the "osgi.bundles" entry.
+ * @throws CoreException
+ */
+ public String getOsgiBundlesEntry() throws CoreException {
+ return getEntry(EclipseStarter.PROP_BUNDLES);
+ }
+
+ /**
+ * Sets the value of the "osgi.bundles" entry of the config file.
+ *
+ * @param value
+ * The new value of the entry.
+ * @throws CoreException
+ */
+ public void setOsgiBundlesEntry(String value) throws CoreException {
+ setEntry(EclipseStarter.PROP_BUNDLES, value);
+ }
+
+ /**
+ * Gets the configuration file of this product.
+ *
+ * @return The config file or null if this product has no config file specified.
+ * @throws CoreException
+ */
+ public IFile getFile() throws CoreException {
+ return m_model.getConfigIniFile();
+ }
+
+ /**
+ * Gets a map of all key-value-pairs that exist in the config file.<br>
+ * Changes to the map have no effect to the config file.
+ *
+ * @return A map with all key-value-pairs.
+ * @throws CoreException
+ */
+ public Map<String, String> getEntries() throws CoreException {
+ HashMap<String, String> entries = new HashMap<String, String>();
+ for (Entry<Object, Object> entry : m_model.getConfigFileProperties().entrySet()) {
+ if (entry.getKey() instanceof String && entry.getValue() instanceof String) {
+ entries.put((String) entry.getKey(), (String) entry.getValue());
+ }
+ }
+ return entries;
+ }
+ }
+
+ /**
+ * TODO can be eliminated when <b>BUG 362398</b> is fixed.
+ *
+ * @see <a href="http://bugs.eclipse.org/bugs/show_bug.cgi?id=362398">Bugzilla #362398</a>
+ */
+ private static class P_ProductPlugin extends ProductPlugin {
+ private static final long serialVersionUID = 1L;
+ private boolean m_fragment;
+
+ private P_ProductPlugin(IProductModel model, String id) {
+ this(model, id, false);
+ }
+
+ private P_ProductPlugin(IProductModel model, String id, boolean isFragment) {
+ super(model);
+ m_fragment = isFragment;
+ setId(id);
+ }
+
+ @Override
+ public void parse(Node node) {
+ super.parse(node);
+ if (node.getNodeType() == Node.ELEMENT_NODE) {
+ Element element = (Element) node;
+ setFragment(Boolean.parseBoolean(element.getAttribute("fragment")));
+ }
+ }
+
+ @Override
+ public void write(String indent, PrintWriter writer) {
+ writer.print(indent + "<plugin id=\"" + getId() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (getVersion() != null && getVersion().length() > 0 && !getVersion().equals("0.0.0")) { //$NON-NLS-1$
+ writer.print(" version=\"" + getVersion() + "\""); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ IPluginModelBase modBase = PluginRegistry.findModel(getId());
+ if (isFragment() || (modBase != null && modBase.isFragmentModel())) {
+ writer.print(" fragment=\"true\""); //$NON-NLS-1$
+ }
+ writer.println("/>"); //$NON-NLS-1$
+ }
+
+ public boolean isFragment() {
+ return m_fragment;
+ }
+
+ public void setFragment(boolean isFragment) {
+ m_fragment = isFragment;
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/IResourceFilter.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/IResourceFilter.java
index 00dbf84ef..48748d28f 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/IResourceFilter.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/IResourceFilter.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.resources;
-
-import org.eclipse.core.resources.IResource;
-
-/**
- * <h3>{@link IResourceFilter}</h3> ...
- *
- * @author aho
- * @since 3.8.0 14.03.2012
- */
-public interface IResourceFilter {
-
- boolean accept(IResource resource);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.resources;
+
+import org.eclipse.core.resources.IResource;
+
+/**
+ * <h3>{@link IResourceFilter}</h3> ...
+ *
+ * @author aho
+ * @since 3.8.0 14.03.2012
+ */
+public interface IResourceFilter {
+
+ boolean accept(IResource resource);
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/ResourceFilters.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/ResourceFilters.java
index c873d66be..f3420325f 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/ResourceFilters.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/ResourceFilters.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.resources;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.scout.commons.StringUtility;
-
-/**
- * <h3>{@link ResourceFilters}</h3> ...
- *
- * @author aho
- * @since 3.8.0 14.03.2012
- */
-public class ResourceFilters {
-
- public static IResourceFilter getMultifilterAnd(final IResourceFilter... filters) {
- return new IResourceFilter() {
- @Override
- public boolean accept(IResource candidate) {
- if (filters == null) {
- return true;
- }
- else {
- for (IResourceFilter f : filters) {
- if (!f.accept(candidate)) {
- return false;
- }
- }
- return true;
- }
- }
- };
- }
-
- public static IResourceFilter getMultifilterOr(final IResourceFilter... filters) {
- return new IResourceFilter() {
- @Override
- public boolean accept(IResource candidate) {
- if (filters == null) {
- return true;
- }
- else {
- for (IResourceFilter f : filters) {
- if (f.accept(candidate)) {
- return true;
- }
- }
- return false;
- }
- }
- };
- }
-
- public static IResourceFilter getProductFilter() {
- return new IResourceFilter() {
-
- @Override
- public boolean accept(IResource resource) {
- return ResourceUtility.exists(resource) && resource.getType() == IResource.FILE
- && StringUtility.equalsIgnoreCase(((IFile) resource).getFileExtension(), "product");
- }
- };
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.resources;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.scout.commons.StringUtility;
+
+/**
+ * <h3>{@link ResourceFilters}</h3> ...
+ *
+ * @author aho
+ * @since 3.8.0 14.03.2012
+ */
+public class ResourceFilters {
+
+ public static IResourceFilter getMultifilterAnd(final IResourceFilter... filters) {
+ return new IResourceFilter() {
+ @Override
+ public boolean accept(IResource candidate) {
+ if (filters == null) {
+ return true;
+ }
+ else {
+ for (IResourceFilter f : filters) {
+ if (!f.accept(candidate)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ };
+ }
+
+ public static IResourceFilter getMultifilterOr(final IResourceFilter... filters) {
+ return new IResourceFilter() {
+ @Override
+ public boolean accept(IResource candidate) {
+ if (filters == null) {
+ return true;
+ }
+ else {
+ for (IResourceFilter f : filters) {
+ if (f.accept(candidate)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+ };
+ }
+
+ public static IResourceFilter getProductFilter() {
+ return new IResourceFilter() {
+
+ @Override
+ public boolean accept(IResource resource) {
+ return ResourceUtility.exists(resource) && resource.getType() == IResource.FILE
+ && StringUtility.equalsIgnoreCase(((IFile) resource).getFileExtension(), "product");
+ }
+ };
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/ResourceUtility.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/ResourceUtility.java
index af986c966..645591922 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/ResourceUtility.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/resources/ResourceUtility.java
@@ -1,383 +1,383 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.resources;
-
-import java.awt.Desktop;
-import java.io.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.OutputStream;
-import java.net.URI;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipOutputStream;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ProjectScope;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.preferences.IScopeContext;
-import org.eclipse.jdt.core.IOpenable;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.core.util.Util;
-import org.eclipse.jface.text.Document;
-import org.eclipse.osgi.service.datalocation.Location;
-import org.eclipse.scout.commons.FileUtility;
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-
-/**
- * <h3>{@link ResourceUtility}</h3> ...
- *
- * @author aho
- * @since 3.8.0 14.03.2012
- */
-@SuppressWarnings("restriction")
-public final class ResourceUtility {
-
- public final static int BUF_SIZE = 8192;
-
- private ResourceUtility() {
- }
-
- public static IResource[] getAllResources(IResourceFilter filter) throws CoreException {
- return getAllResources(ResourcesPlugin.getWorkspace().getRoot(), filter);
- }
-
- public static IResource[] getAllResources(IResource startResource, IResourceFilter filter) throws CoreException {
- List<IResource> collector = new LinkedList<IResource>();
- collectResourcesRec(startResource, collector, filter);
- return collector.toArray(new IResource[collector.size()]);
- }
-
- private static void collectResourcesRec(IResource resource, Collection<IResource> collector, IResourceFilter filter) throws CoreException {
- if (exists(resource)) {
- if (filter.accept(resource)) {
- collector.add(resource);
- }
- if (resource instanceof IContainer) {
- for (IResource child : ((IContainer) resource).members()) {
- collectResourcesRec(child, collector, filter);
- }
- }
- }
- }
-
- /**
- * Tries to open the given url in the system default browser.
- *
- * @param url
- * the url to show
- */
- public static void showUrlInBrowser(String url) {
- try {
- if (Desktop.isDesktopSupported()) {
- Desktop d = Desktop.getDesktop();
- if (d.isSupported(Desktop.Action.BROWSE)) {
- d.browse(new URI(url));
- }
- }
- }
- catch (Throwable e) {
- SdkUtilActivator.logWarning("Could not open web browser. ", e);
- }
- }
-
- public static boolean exists(IResource resource) {
- return resource != null && resource.exists();
- }
-
- /**
- * Returns this document's default line delimiter.
- * <p>
- * This default line delimiter should be used by clients who want unique delimiters (e.g. 'CR's) in the document.
- * </p>
- *
- * @return the default line delimiter or <code>null</code> if none.
- */
- public static String getLineSeparator(Document doc) {
- if (doc != null) {
- String delim = doc.getDefaultLineDelimiter();
- if (delim != null) {
- return delim;
- }
- }
- return getLineSeparator();
- }
-
- /**
- * Gets the content of the given file as string.
- *
- * @param f
- * the file to get the content from
- * @return a string containing the content of the given file
- */
- public static String getContent(IFile f) throws CoreException {
- InputStream is = null;
- try {
- is = f.getContents();
- BufferedReader reader = new BufferedReader(new InputStreamReader(is));
- StringBuilder sb = new StringBuilder();
- String line = null;
- String nl = getLineSeparator(f);
- while ((line = reader.readLine()) != null) {
- sb.append(line);
- sb.append(nl);
- }
- return sb.toString();
- }
- catch (IOException e) {
- throw new CoreException(new ScoutStatus(e));
- }
- finally {
- if (is != null) {
- try {
- is.close();
- }
- catch (IOException e) {
- //nop
- }
- }
- }
- }
-
- /**
- * gets the install location of the running eclipse.
- *
- * @return the location or null if no location could be found.
- */
- public static File getEclipseInstallLocation() {
- Location l = Platform.getInstallLocation();
- File ret = null;
- if (l != null) {
- ret = new File(l.getURL().getPath());
- }
- return ret;
- }
-
- /**
- * Adds all files below the given baseDir into the zip stream.
- *
- * @param baseDir
- * The base dir. All files (recursively) in this folder will be added to the zip.
- * @param zOut
- * The zip where the files will be added.
- * @throws IOException
- */
- public static void addFolderToZip(File baseDir, ZipOutputStream zOut) throws IOException {
- addFolderToZipRec(baseDir, baseDir, zOut);
- }
-
- private static void addFolderToZipRec(File baseDir, File file, ZipOutputStream zOut) throws IOException {
- if ((!file.exists()) || (!file.isDirectory())) {
- throw new IOException("source directory " + file + " does not exist or is not a folder");
- }
- for (File f : file.listFiles()) {
- if (f.exists() && (!f.isHidden())) {
- if (f.isDirectory()) {
- addFolderToZipRec(baseDir, f, zOut);
- }
- else {
- String name = f.getAbsolutePath();
- String prefix = baseDir.getAbsolutePath();
- if (prefix.endsWith("/") || prefix.endsWith("\\")) {
- prefix = prefix.substring(0, prefix.length() - 1);
- }
- name = name.substring(prefix.length() + 1);
- name = name.replace('\\', '/');
-
- zOut.putNextEntry(new ZipEntry(name));
- copy(f, zOut);
- zOut.closeEntry();
- }
- }
- }
- }
-
- /**
- * returns the line separator defined in preference {@link org.eclipse.core.runtime.Platform#PREF_LINE_SEPARATOR} on
- * the workspace.
- * If this is null, returns the system line separator.
- *
- * @return The line separator to use.
- */
- public static String getLineSeparator() {
- return Util.getLineSeparator(null, null);
- }
-
- /**
- * returns the line separator defined in preference {@link org.eclipse.core.runtime.Platform#PREF_LINE_SEPARATOR} on
- * the project or workspace of the given resource.
- * If this is null, returns the platform separator.
- *
- * @return The line separator to use.
- */
- public static String getLineSeparator(IResource r) {
- if (r != null) {
- IScopeContext[] scopeContext = new IScopeContext[]{new ProjectScope(r.getProject())};
- String lineSeparator = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
- if (lineSeparator != null) return lineSeparator;
- }
- return getLineSeparator();
- }
-
- /**
- * Finds and returns the recommended line separator for this element.
- * The element's buffer is first searched and the first line separator in this buffer is returned if any.
- * Otherwise the preference {@link org.eclipse.core.runtime.Platform#PREF_LINE_SEPARATOR} on this element's project or
- * workspace is returned.
- * Finally if no such preference is set, the system line separator is returned.
- *
- * @return the recommended line separator for this element
- */
- public static String getLineSeparator(IOpenable o) {
- try {
- return o.findRecommendedLineSeparator();
- }
- catch (JavaModelException e) {
- return getLineSeparator();
- }
- }
-
- /**
- * copies all data from the given file to the output stream
- *
- * @param from
- * source file
- * @param to
- * data target
- * @throws IOException
- */
- public static void copy(File from, OutputStream to) throws IOException {
- InputStream input = null;
- try {
- input = new BufferedInputStream(new FileInputStream(from), BUF_SIZE);
- copy(input, to);
- }
- finally {
- if (input != null) {
- try {
- input.close();
- }
- catch (IOException e) {
- }
- }
- }
- }
-
- /**
- * recursively creates all parent directories of the given file
- *
- * @param toCreate
- * The file for which the parent directories should be created.
- * @param monitor
- * @throws CoreException
- */
- public static void mkdirs(IFile toCreate, IProgressMonitor monitor) throws CoreException {
- if (toCreate == null || toCreate.exists()) {
- return;
- }
- mkdirs(toCreate.getParent(), monitor);
- }
-
- /**
- * create the given directory and all of its parents.
- *
- * @param toCreate
- * the directory to create.
- * @param monitor
- * @throws CoreException
- */
- public static void mkdirs(IContainer toCreate, IProgressMonitor monitor) throws CoreException {
- if (toCreate == null || toCreate.exists()) {
- return;
- }
- else {
- IContainer parent = toCreate.getParent();
- if (parent instanceof IFolder) {
- mkdirs(parent, monitor);
- }
- if (toCreate instanceof IFolder) {
- ((IFolder) toCreate).create(true, true, monitor);
- }
- }
- }
-
- /**
- * move the given file into the given folder.
- *
- * @param from
- * the file to move
- * @param destFolder
- * the destination folder.
- * @throws IOException
- */
- public static void moveFile(File from, File destFolder) throws IOException {
- if (from == null || !from.isFile()) {
- throw new IOException("source file is not valid");
- }
- if (destFolder == null) {
- throw new IOException("destination folder is not valid");
- }
- destFolder.mkdirs();
- boolean success = from.renameTo(destFolder);
- if (!success) {
- // fallback: copy file
- FileUtility.copyFile(from, new File(destFolder, from.getName()));
- IOUtility.deleteFile(from.getAbsolutePath());
- }
- }
-
- /**
- * copies all data from the input stream to the output stream.
- *
- * @param from
- * data source
- * @param to
- * data target
- * @throws IOException
- */
- public static void copy(InputStream from, OutputStream to) throws IOException {
- copy(from, to, BUF_SIZE);
- }
-
- /**
- * copies all data from the input stream to the output stream.
- *
- * @param from
- * data source
- * @param to
- * data target
- * @param bufferSize
- * buffer size to use
- * @throws IOException
- */
- public static void copy(InputStream from, OutputStream to, int bufferSize) throws IOException {
- byte[] b = new byte[bufferSize];
- int len;
- while ((len = from.read(b, 0, b.length)) != -1) {
- to.write(b, 0, len);
- }
- to.flush();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.resources;
+
+import java.awt.Desktop;
+import java.io.BufferedInputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.net.URI;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipOutputStream;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ProjectScope;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.jdt.core.IOpenable;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.core.util.Util;
+import org.eclipse.jface.text.Document;
+import org.eclipse.osgi.service.datalocation.Location;
+import org.eclipse.scout.commons.FileUtility;
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+
+/**
+ * <h3>{@link ResourceUtility}</h3> ...
+ *
+ * @author aho
+ * @since 3.8.0 14.03.2012
+ */
+@SuppressWarnings("restriction")
+public final class ResourceUtility {
+
+ public final static int BUF_SIZE = 8192;
+
+ private ResourceUtility() {
+ }
+
+ public static IResource[] getAllResources(IResourceFilter filter) throws CoreException {
+ return getAllResources(ResourcesPlugin.getWorkspace().getRoot(), filter);
+ }
+
+ public static IResource[] getAllResources(IResource startResource, IResourceFilter filter) throws CoreException {
+ List<IResource> collector = new LinkedList<IResource>();
+ collectResourcesRec(startResource, collector, filter);
+ return collector.toArray(new IResource[collector.size()]);
+ }
+
+ private static void collectResourcesRec(IResource resource, Collection<IResource> collector, IResourceFilter filter) throws CoreException {
+ if (exists(resource)) {
+ if (filter.accept(resource)) {
+ collector.add(resource);
+ }
+ if (resource instanceof IContainer) {
+ for (IResource child : ((IContainer) resource).members()) {
+ collectResourcesRec(child, collector, filter);
+ }
+ }
+ }
+ }
+
+ /**
+ * Tries to open the given url in the system default browser.
+ *
+ * @param url
+ * the url to show
+ */
+ public static void showUrlInBrowser(String url) {
+ try {
+ if (Desktop.isDesktopSupported()) {
+ Desktop d = Desktop.getDesktop();
+ if (d.isSupported(Desktop.Action.BROWSE)) {
+ d.browse(new URI(url));
+ }
+ }
+ }
+ catch (Throwable e) {
+ SdkUtilActivator.logWarning("Could not open web browser. ", e);
+ }
+ }
+
+ public static boolean exists(IResource resource) {
+ return resource != null && resource.exists();
+ }
+
+ /**
+ * Returns this document's default line delimiter.
+ * <p>
+ * This default line delimiter should be used by clients who want unique delimiters (e.g. 'CR's) in the document.
+ * </p>
+ *
+ * @return the default line delimiter or <code>null</code> if none.
+ */
+ public static String getLineSeparator(Document doc) {
+ if (doc != null) {
+ String delim = doc.getDefaultLineDelimiter();
+ if (delim != null) {
+ return delim;
+ }
+ }
+ return getLineSeparator();
+ }
+
+ /**
+ * Gets the content of the given file as string.
+ *
+ * @param f
+ * the file to get the content from
+ * @return a string containing the content of the given file
+ */
+ public static String getContent(IFile f) throws CoreException {
+ InputStream is = null;
+ try {
+ is = f.getContents();
+ BufferedReader reader = new BufferedReader(new InputStreamReader(is));
+ StringBuilder sb = new StringBuilder();
+ String line = null;
+ String nl = getLineSeparator(f);
+ while ((line = reader.readLine()) != null) {
+ sb.append(line);
+ sb.append(nl);
+ }
+ return sb.toString();
+ }
+ catch (IOException e) {
+ throw new CoreException(new ScoutStatus(e));
+ }
+ finally {
+ if (is != null) {
+ try {
+ is.close();
+ }
+ catch (IOException e) {
+ //nop
+ }
+ }
+ }
+ }
+
+ /**
+ * gets the install location of the running eclipse.
+ *
+ * @return the location or null if no location could be found.
+ */
+ public static File getEclipseInstallLocation() {
+ Location l = Platform.getInstallLocation();
+ File ret = null;
+ if (l != null) {
+ ret = new File(l.getURL().getPath());
+ }
+ return ret;
+ }
+
+ /**
+ * Adds all files below the given baseDir into the zip stream.
+ *
+ * @param baseDir
+ * The base dir. All files (recursively) in this folder will be added to the zip.
+ * @param zOut
+ * The zip where the files will be added.
+ * @throws IOException
+ */
+ public static void addFolderToZip(File baseDir, ZipOutputStream zOut) throws IOException {
+ addFolderToZipRec(baseDir, baseDir, zOut);
+ }
+
+ private static void addFolderToZipRec(File baseDir, File file, ZipOutputStream zOut) throws IOException {
+ if ((!file.exists()) || (!file.isDirectory())) {
+ throw new IOException("source directory " + file + " does not exist or is not a folder");
+ }
+ for (File f : file.listFiles()) {
+ if (f.exists() && (!f.isHidden())) {
+ if (f.isDirectory()) {
+ addFolderToZipRec(baseDir, f, zOut);
+ }
+ else {
+ String name = f.getAbsolutePath();
+ String prefix = baseDir.getAbsolutePath();
+ if (prefix.endsWith("/") || prefix.endsWith("\\")) {
+ prefix = prefix.substring(0, prefix.length() - 1);
+ }
+ name = name.substring(prefix.length() + 1);
+ name = name.replace('\\', '/');
+
+ zOut.putNextEntry(new ZipEntry(name));
+ copy(f, zOut);
+ zOut.closeEntry();
+ }
+ }
+ }
+ }
+
+ /**
+ * returns the line separator defined in preference {@link org.eclipse.core.runtime.Platform#PREF_LINE_SEPARATOR} on
+ * the workspace.
+ * If this is null, returns the system line separator.
+ *
+ * @return The line separator to use.
+ */
+ public static String getLineSeparator() {
+ return Util.getLineSeparator(null, null);
+ }
+
+ /**
+ * returns the line separator defined in preference {@link org.eclipse.core.runtime.Platform#PREF_LINE_SEPARATOR} on
+ * the project or workspace of the given resource.
+ * If this is null, returns the platform separator.
+ *
+ * @return The line separator to use.
+ */
+ public static String getLineSeparator(IResource r) {
+ if (r != null) {
+ IScopeContext[] scopeContext = new IScopeContext[]{new ProjectScope(r.getProject())};
+ String lineSeparator = Platform.getPreferencesService().getString(Platform.PI_RUNTIME, Platform.PREF_LINE_SEPARATOR, null, scopeContext);
+ if (lineSeparator != null) return lineSeparator;
+ }
+ return getLineSeparator();
+ }
+
+ /**
+ * Finds and returns the recommended line separator for this element.
+ * The element's buffer is first searched and the first line separator in this buffer is returned if any.
+ * Otherwise the preference {@link org.eclipse.core.runtime.Platform#PREF_LINE_SEPARATOR} on this element's project or
+ * workspace is returned.
+ * Finally if no such preference is set, the system line separator is returned.
+ *
+ * @return the recommended line separator for this element
+ */
+ public static String getLineSeparator(IOpenable o) {
+ try {
+ return o.findRecommendedLineSeparator();
+ }
+ catch (JavaModelException e) {
+ return getLineSeparator();
+ }
+ }
+
+ /**
+ * copies all data from the given file to the output stream
+ *
+ * @param from
+ * source file
+ * @param to
+ * data target
+ * @throws IOException
+ */
+ public static void copy(File from, OutputStream to) throws IOException {
+ InputStream input = null;
+ try {
+ input = new BufferedInputStream(new FileInputStream(from), BUF_SIZE);
+ copy(input, to);
+ }
+ finally {
+ if (input != null) {
+ try {
+ input.close();
+ }
+ catch (IOException e) {
+ }
+ }
+ }
+ }
+
+ /**
+ * recursively creates all parent directories of the given file
+ *
+ * @param toCreate
+ * The file for which the parent directories should be created.
+ * @param monitor
+ * @throws CoreException
+ */
+ public static void mkdirs(IFile toCreate, IProgressMonitor monitor) throws CoreException {
+ if (toCreate == null || toCreate.exists()) {
+ return;
+ }
+ mkdirs(toCreate.getParent(), monitor);
+ }
+
+ /**
+ * create the given directory and all of its parents.
+ *
+ * @param toCreate
+ * the directory to create.
+ * @param monitor
+ * @throws CoreException
+ */
+ public static void mkdirs(IContainer toCreate, IProgressMonitor monitor) throws CoreException {
+ if (toCreate == null || toCreate.exists()) {
+ return;
+ }
+ else {
+ IContainer parent = toCreate.getParent();
+ if (parent instanceof IFolder) {
+ mkdirs(parent, monitor);
+ }
+ if (toCreate instanceof IFolder) {
+ ((IFolder) toCreate).create(true, true, monitor);
+ }
+ }
+ }
+
+ /**
+ * move the given file into the given folder.
+ *
+ * @param from
+ * the file to move
+ * @param destFolder
+ * the destination folder.
+ * @throws IOException
+ */
+ public static void moveFile(File from, File destFolder) throws IOException {
+ if (from == null || !from.isFile()) {
+ throw new IOException("source file is not valid");
+ }
+ if (destFolder == null) {
+ throw new IOException("destination folder is not valid");
+ }
+ destFolder.mkdirs();
+ boolean success = from.renameTo(destFolder);
+ if (!success) {
+ // fallback: copy file
+ FileUtility.copyFile(from, new File(destFolder, from.getName()));
+ IOUtility.deleteFile(from.getAbsolutePath());
+ }
+ }
+
+ /**
+ * copies all data from the input stream to the output stream.
+ *
+ * @param from
+ * data source
+ * @param to
+ * data target
+ * @throws IOException
+ */
+ public static void copy(InputStream from, OutputStream to) throws IOException {
+ copy(from, to, BUF_SIZE);
+ }
+
+ /**
+ * copies all data from the input stream to the output stream.
+ *
+ * @param from
+ * data source
+ * @param to
+ * data target
+ * @param bufferSize
+ * buffer size to use
+ * @throws IOException
+ */
+ public static void copy(InputStream from, OutputStream to, int bufferSize) throws IOException {
+ byte[] b = new byte[bufferSize];
+ int len;
+ while ((len = from.read(b, 0, b.length)) != -1) {
+ to.write(b, 0, len);
+ }
+ to.flush();
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/FullyQuallifiedValidator.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/FullyQuallifiedValidator.java
index d52e4fc3d..da7f6f844 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/FullyQuallifiedValidator.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/FullyQuallifiedValidator.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.signature;
-
-import org.eclipse.jdt.core.Signature;
-
-/**
- *
- */
-public class FullyQuallifiedValidator implements IImportValidator {
-
- @Override
- public void addImport(String fqn) {
- }
-
- @Override
- public String[] getImportsToCreate() {
- return null;
- }
-
- @Override
- public String getTypeName(String singleTypeSignature) {
- String pckName = Signature.getSignatureQualifier(singleTypeSignature);
- String simpleName = Signature.getSignatureSimpleName(singleTypeSignature);
- return pckName + "." + simpleName;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.signature;
+
+import org.eclipse.jdt.core.Signature;
+
+/**
+ *
+ */
+public class FullyQuallifiedValidator implements IImportValidator {
+
+ @Override
+ public void addImport(String fqn) {
+ }
+
+ @Override
+ public String[] getImportsToCreate() {
+ return null;
+ }
+
+ @Override
+ public String getTypeName(String singleTypeSignature) {
+ String pckName = Signature.getSignatureQualifier(singleTypeSignature);
+ String simpleName = Signature.getSignatureSimpleName(singleTypeSignature);
+ return pckName + "." + simpleName;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/IImportValidator.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/IImportValidator.java
index 2369b3a33..8acade380 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/IImportValidator.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/IImportValidator.java
@@ -1,39 +1,39 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.signature;
-
-import org.eclipse.jdt.core.Signature;
-
-public interface IImportValidator {
-
- /**
- * To get the scope qualified name to use for this signature.
- *
- * @see Signature
- * @param singleTypeSignature
- * a simple type signature e.g. 'Ljava.lang.String;'
- * @return a simple name if the import is not used so far (e.g. String) or the fully qualified name if there is an
- * other type with the same simple name in the scope (e.g. java.lang.String).
- */
- String getTypeName(String singleTypeSignature);
-
- /**
- * @return the imports has to be created of this validator
- */
- String[] getImportsToCreate();
-
- /**
- * @param fqn
- * fully qualified type name
- */
- void addImport(String fqn);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.signature;
+
+import org.eclipse.jdt.core.Signature;
+
+public interface IImportValidator {
+
+ /**
+ * To get the scope qualified name to use for this signature.
+ *
+ * @see Signature
+ * @param singleTypeSignature
+ * a simple type signature e.g. 'Ljava.lang.String;'
+ * @return a simple name if the import is not used so far (e.g. String) or the fully qualified name if there is an
+ * other type with the same simple name in the scope (e.g. java.lang.String).
+ */
+ String getTypeName(String singleTypeSignature);
+
+ /**
+ * @return the imports has to be created of this validator
+ */
+ String[] getImportsToCreate();
+
+ /**
+ * @param fqn
+ * fully qualified type name
+ */
+ void addImport(String fqn);
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/SignatureUtility.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/SignatureUtility.java
index 6935a9afb..78e3dab1b 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/SignatureUtility.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/SignatureUtility.java
@@ -1,522 +1,522 @@
-package org.eclipse.scout.sdk.util.signature;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-
-public final class SignatureUtility {
-
- private final static Pattern QUALIFIED_SIG_REGEX = Pattern.compile("^([\\+\\[]*)([^\\<\\(\\;]*)(.*)$");
- private final static Pattern SIG_REPLACEMENT_REGEX = Pattern.compile("[\\.\\$]{1}");
- private final static Pattern DOL_REPLACEMENT_REGEX = Pattern.compile("\\$");
- private final static Pattern PARAM_SIG_REPLACEMENT_REGEX = Pattern.compile("^([^\\:]*)\\:(.*)$");
-
- //public final static Pattern PREF_REGEX = Pattern.compile("^([\\+\\[]+)(.*)$");
-
- /**
- * Character constant indicating an arbitrary array type in a signature.
- * Value is <code>'|'</code>.
- */
- public static final char C_ARBITRARY_ARRAY = '|';
-
- /**
- * Kind constant for a arbitrary array signature.
- *
- * @see #getTypeSignatureKind(String)
- * @since 3.0
- */
- public static final int ARBITRARY_ARRAY_SIGNATURE = 29;
-
- private SignatureUtility() {
- }
-
- /**
- * To get the signature kind of the given signature. If a signature starts with '|' it is a arbitrary array signature
- * otherwise see {@link Signature#getTypeSignatureKind(String)}.
- *
- * @return the signature kind.
- * @see Signature#getTypeSignatureKind(String)
- */
- public static int getTypeSignatureKind(String signature) {
- // need a minimum 1 char
- if (signature == null || signature.length() < 1) {
- throw new IllegalArgumentException("signature is null or less than 1 char.");
- }
- char c = signature.charAt(0);
- if (c == C_ARBITRARY_ARRAY) {
- return ARBITRARY_ARRAY_SIGNATURE;
- }
- else {
- //private final static Pattern SIMPLE_NAME_REGEX = Pattern.compile("^[\\[]*([^\\<]*).*(\\;)$");
- // signature = SIMPLE_NAME_REGEX.matcher(signature).replaceAll("$1$2");
- return Signature.getTypeSignatureKind(signature);
- }
- }
-
- private static String quoteRegexSpecialCharacters(String input) {
- input = input.replace("\\", "\\\\");
- input = input.replace(".", "\\.");
- input = input.replace("+", "\\+");
- input = input.replace("?", "\\?");
- input = input.replace("^", "\\^");
- input = input.replace("$", "\\$");
- input = input.replace("[", "\\[");
- input = input.replace("]", "\\]");
- input = input.replace("(", "\\(");
- input = input.replace(")", "\\)");
- input = input.replace("{", "\\{");
- input = input.replace("}", "\\}");
- input = input.replace("*", "\\*");
- input = input.replace("|", "\\|");
- return input;
- }
-
- public static String getResolvedSignature(String signature, IType signatureOwner) throws JavaModelException {
- return getResolvedSignature(signature, signatureOwner, null);
- }
-
- public static String getResolvedSignature(String signature, IType signatureOwner, IType contextType) throws JavaModelException {
- StringBuilder sigBuilder = new StringBuilder();
- switch (getTypeSignatureKind(signature)) {
- case Signature.WILDCARD_TYPE_SIGNATURE:
- sigBuilder.append(signature.charAt(0));
- if (signature.length() > 1) {
- sigBuilder.append(getResolvedSignature(signature.substring(1), signatureOwner, contextType));
- }
- break;
- case Signature.ARRAY_TYPE_SIGNATURE:
- sigBuilder.append("[");
- sigBuilder.append(getResolvedSignature(signature.substring(1), signatureOwner, contextType));
- break;
- case ARBITRARY_ARRAY_SIGNATURE:
- sigBuilder.append(C_ARBITRARY_ARRAY);
- sigBuilder.append(getResolvedSignature(signature.substring(1), signatureOwner, contextType));
- break;
- case Signature.BASE_TYPE_SIGNATURE:
- if (signature.endsWith(";")) {
- signature = signature.substring(0, signature.length() - 1);
- }
- sigBuilder.append(signature);
- break;
- case Signature.TYPE_VARIABLE_SIGNATURE:
- // try to resolve type
- String sig = findTypeParameterSignature(signature, signatureOwner, contextType);
- sigBuilder.append(getResolvedSignature(sig, signatureOwner, contextType));
- break;
- case Signature.CLASS_TYPE_SIGNATURE:
-
- String[] typeArguments = Signature.getTypeArguments(signature);
- signature = Signature.getTypeErasure(signature);
- signature = SIG_REPLACEMENT_REGEX.matcher(signature).replaceAll(".");
- if (signature.startsWith("Q")) {
- // unresolved
- String[][] resolvedTypeName = signatureOwner.resolveType(Signature.getSignatureSimpleName(signature));
- if (resolvedTypeName != null && resolvedTypeName.length == 1) {
- String fqName = resolvedTypeName[0][0];
- if (fqName != null && fqName.length() > 0) {
- fqName = fqName + ".";
- }
- fqName = fqName + resolvedTypeName[0][1];
- signature = Signature.createTypeSignature(fqName, true);
- }
- }
- if (signature.endsWith(";")) {
- signature = signature.substring(0, signature.length() - 1);
- }
- sigBuilder.append(signature);
- if (typeArguments != null && typeArguments.length > 0) {
- sigBuilder.append("<");
- for (int i = 0; i < typeArguments.length; i++) {
- sigBuilder.append(getResolvedSignature(typeArguments[i], signatureOwner, contextType));
- }
- sigBuilder.append(">");
- }
- sigBuilder.append(";");
- break;
- default:
- SdkUtilActivator.logWarning("unhandled signature type: '" + Signature.getTypeSignatureKind(signature) + "'");
- break;
- }
- return sigBuilder.toString();
- }
-
- public static boolean isEqualSignature(String signature1, String signature2) {
- if (signature1 == null && signature2 == null) {
- return true;
- }
- else if (signature1 == null || signature2 == null) {
- return false;
- }
- signature1 = DOL_REPLACEMENT_REGEX.matcher(signature1).replaceAll(".");
- signature2 = DOL_REPLACEMENT_REGEX.matcher(signature2).replaceAll(".");
- return signature1.equals(signature2);
- }
-
- /**
- * To get the simple type reference name within a context represented by the given importValidator. Every fully
- * qualified type name will be passed to the importValidator to decide if the import is already in use.
- *
- * @param fullyQuallifiedTypeName
- * e.g. java.lang.String (not a signature).
- * @param importValidator
- * to evaluate all fully qualified names for create an import and use simple names.
- * @return the simple reference type name in the given validator scope.
- * @see ScoutSdkUtility#getSimpleTypeRefName(String, IImportValidator)
- */
- public static String getTypeReferenceFromFqn(String fullyQualifiedTypeName, IImportValidator importValidator) throws JavaModelException {
- return getTypeReference(Signature.createTypeSignature(fullyQualifiedTypeName, true), importValidator);
- }
-
- /**
- * @see {@link ScoutSignature#getTypeReference(String, IType, IType, IImportValidator)}
- */
- public static String getTypeReference(String signature) throws JavaModelException {
- return getTypeReference(signature, null, null, new FullyQuallifiedValidator());
- }
-
- /**
- * @see {@link ScoutSignature#getTypeReference(String, IType, IType, IImportValidator)}
- */
- public static String getTypeReference(String signature, IImportValidator importValidator) throws JavaModelException {
- return getTypeReference(signature, null, null, importValidator);
- }
-
- /**
- * @see {@link ScoutSignature#getTypeReference(String, IType, IType, IImportValidator)}
- */
- /*public static String getTypeReference(String signature, IType signatureOwner) throws JavaModelException {
- return getTypeReference(signature, signatureOwner, null, new FullyQuallifiedValidator());
- }*/
-
- /**
- * @see {@link ScoutSignature#getTypeReference(String, IType, IType, IImportValidator)}
- */
- public static String getTypeReference(String signature, IType signatureOwner, IImportValidator validator) throws JavaModelException {
- return getTypeReference(signature, signatureOwner, null, validator);
- }
-
- /**
- * @see {@link ScoutSignature#getTypeReference(String, IType, IType, IImportValidator)}
- */
- /*public static String getTypeReference(String signature, IType signatureOwner, IType contextType) throws JavaModelException {
- return getTypeReference(signature, signatureOwner, contextType, new FullyQuallifiedValidator());
- }*/
-
- /**
- * <h4>Examples</h4> <xmp>
- * getTypeReferenceImpl("Ljava.lang.String;", typeA, typeA, fullyQuallifiedImpValidator)
- * -> java.lang.String
- * getTypeReferenceImpl("QList<?QString>;", typeA, typeA, fullyQuallifiedImpValidator)
- * -> java.util.List<? extends java.lang.String>
- * </xmp>
- *
- * @param signature
- * fully parameterized signature
- * @param signatureOwner
- * the owner of the signature used to lookup unresolved types.
- * @param contextType
- * must be a subtype of signature owner or the owner itself. Used to find generic variables as T. If null and
- * signature contains generic types the supertype closest to java.lang.Object with the given type parameter
- * is calculated.
- * @param validator
- * an import validator to decide simple name vs. fully qualified name.
- * @return the type reference
- * @see {@link FullyQuallifiedValidator}, {@link IImportValidator}, {@link SimpleImportValidator}
- * @throws JavaModelException
- */
- private static String getTypeReference(String signature, IType signatureOwner, IType contextType, IImportValidator validator) throws JavaModelException {
- StringBuilder sigBuilder = new StringBuilder();
- int arrayCount = 0;
- boolean isArbitraryArray = false;
- switch (getTypeSignatureKind(signature)) {
- case Signature.WILDCARD_TYPE_SIGNATURE:
- sigBuilder.append("?");
- if (signature.length() > 1) {
- sigBuilder.append(" extends ");
- sigBuilder.append(getTypeReference(signature.substring(1), signatureOwner, contextType, validator));
- }
- break;
- case Signature.ARRAY_TYPE_SIGNATURE:
- arrayCount = Signature.getArrayCount(signature);
- sigBuilder.append(getTypeReference(signature.substring(arrayCount), signatureOwner, contextType, validator));
- break;
- case ARBITRARY_ARRAY_SIGNATURE:
- isArbitraryArray = true;
- sigBuilder.append(getTypeReference(signature.substring(1), signatureOwner, contextType, validator));
- break;
- case Signature.BASE_TYPE_SIGNATURE:
- sigBuilder.append(Signature.getSignatureSimpleName(signature));
- break;
- case Signature.TYPE_VARIABLE_SIGNATURE:
- // try to resolve type
- String sig = findTypeParameterSignature(signature, signatureOwner, contextType);
- sigBuilder.append(getTypeReference(sig, signatureOwner, contextType, validator));
- break;
- default:
- String[] typeArguments = Signature.getTypeArguments(signature);
- signature = Signature.getTypeErasure(signature);
- signature = SIG_REPLACEMENT_REGEX.matcher(signature).replaceAll(".");
- if (signature.startsWith("Q")) {
- if (signatureOwner != null) {
- // unresolved
- String[][] resolvedTypeName = signatureOwner.resolveType(Signature.getSignatureSimpleName(signature));
- if (resolvedTypeName != null && resolvedTypeName.length == 1) {
- String fqName = resolvedTypeName[0][0];
- if (fqName != null && fqName.length() > 0) {
- fqName = fqName + ".";
- }
- fqName = fqName + resolvedTypeName[0][1];
- sigBuilder.append(validator.getTypeName(Signature.createTypeSignature(fqName, true)));
- }
- }
- else {
- sigBuilder.append(Signature.toString(signature));
- }
- }
- else {
- // resolved
- sigBuilder.append(validator.getTypeName(signature));
- }
- if (typeArguments != null && typeArguments.length > 0) {
- sigBuilder.append("<");
- for (int i = 0; i < typeArguments.length; i++) {
- if (i > 0) {
- sigBuilder.append(", ");
- }
- sigBuilder.append(getTypeReference(typeArguments[i], signatureOwner, contextType, validator));
- }
- sigBuilder.append(">");
- }
- break;
- }
- for (int i = 0; i < arrayCount; i++) {
- sigBuilder.append("[]");
- }
- if (isArbitraryArray) {
- sigBuilder.append("...");
- }
- return sigBuilder.toString();
- }
-
- /**
- * To get resolved and substituted generic parameter signatures of the method. The signature starts with
- * {@link ScoutSignature#C_ARBITRARY_ARRAY} if the parameter is a arbitrary array.
- *
- * @param method
- * a scout method
- * @return an array of the parameter signatures
- * @throws JavaModelException
- */
- public static String[] getMethodParameterSignatureResolved(IMethod method) throws JavaModelException {
- return getMethodParameterSignatureResolved(method, method.getDeclaringType());
- }
-
- /**
- * To get resolved and substituted generic parameter signatures of the method. The signature starts with
- * {@link ScoutSignature#C_ARBITRARY_ARRAY} if the parameter is a arbitrary array.
- *
- * @param jdtMethod
- * @param contextType
- * the type in what context the method appears, used for generic bindings.
- * @return an array of the parameter signatures
- * @throws JavaModelException
- */
- public static String[] getMethodParameterSignatureResolved(IMethod jdtMethod, IType contextType) throws JavaModelException {
- String[] methodParameterSignature = getMethodParameterSignature(jdtMethod);
- IType methodOwnerType = jdtMethod.getDeclaringType();
- for (int i = 0; i < methodParameterSignature.length; i++) {
- methodParameterSignature[i] = getResolvedSignature(methodParameterSignature[i], methodOwnerType, contextType);
- }
- return methodParameterSignature;
- }
-
- /**
- * The get parameter signatures of the given method. The signature starts with
- * {@link ScoutSignature#C_ARBITRARY_ARRAY} if the parameter is a arbitrary array. <h5>NOTE:</h5> <b>generic types are
- * not resolved use {@link ScoutSignature#getMethodParameterSignatureResolved(IScoutMethod)} to get resolved and
- * generic substituted parameter signature</b><br>
- * <br>
- *
- * @param method
- * @return
- * @throws JavaModelException
- */
- public static String[] getMethodParameterSignature(IMethod method) throws JavaModelException {
- String[] paramNames = method.getParameterNames();
- String[] paramSignatures = Arrays.copyOf(method.getParameterTypes(), method.getParameterTypes().length);
- // check for ... array on last parameter
- if (paramSignatures != null && paramSignatures.length > 0) {
- String lastSig = paramSignatures[paramSignatures.length - 1];
- String lastParamName = paramNames[paramNames.length - 1];
- if (Signature.getTypeSignatureKind(lastSig) == Signature.ARRAY_TYPE_SIGNATURE) {
- String source = method.getSource();
- if (source != null) {
- String regex = method.getElementName() + "\\s*\\(.*([\\.]{3})\\s*" + lastParamName + "\\s*\\)";
- if (Pattern.compile(regex, Pattern.MULTILINE).matcher(source).find()) {
- paramSignatures[paramSignatures.length - 1] = lastSig.replaceFirst("^\\[", "|");
- }
- }
- }
- }
- return paramSignatures;
- }
-
- /**
- * To get resolved return type signature of the given method. Generic types are substituted within the method context.
- *
- * @param method
- * a scout method
- * @return an array of the parameter signatures
- * @throws JavaModelException
- */
- public static String getReturnTypeSignatureResolved(IMethod method, IType contextType) throws JavaModelException {
- String returnTypeSignature = method.getReturnType();
- IType methodDeclaringType = method.getDeclaringType();
- returnTypeSignature = getResolvedSignature(returnTypeSignature, methodDeclaringType, contextType);
- return returnTypeSignature;
- }
-
- /**
- * returns a unique identifier of a scout method. The identifier looks like
- * 'methodname(param1Signature,param2Signature)'.
- *
- * @param method
- * @return an unique method identifier of the given method
- * @throws JavaModelException
- */
- public static String getMethodIdentifier(IMethod method) throws JavaModelException {
- StringBuilder methodIdBuilder = new StringBuilder(method.getElementName());
- methodIdBuilder.append("(");
- String[] resolvedParamSignatures = getMethodParameterSignatureResolved(method);
- for (int i = 0; i < resolvedParamSignatures.length; i++) {
- methodIdBuilder.append(resolvedParamSignatures[i]);
- if (i + 1 < resolvedParamSignatures.length) {
- methodIdBuilder.append(",");
- }
- }
- methodIdBuilder.append(")");
- return methodIdBuilder.toString();
- }
-
- /**
- * returns a unique identifier of a scout method. The identifier looks like
- * 'methodname(param1Signature,param2Signature)'.
- *
- * @param method
- * @param contextType
- * the type in what context the method appears, used for generic bindings.
- * @return
- * @throws JavaModelException
- */
- public static String getMethodIdentifier(IMethod method, IType contextType) throws JavaModelException {
- StringBuilder methodIdBuilder = new StringBuilder();
- methodIdBuilder.append(method.getElementName());
- methodIdBuilder.append("(");
- String[] resolvedParamSignatures = getMethodParameterSignatureResolved(method, contextType);
- for (int i = 0; i < resolvedParamSignatures.length; i++) {
- methodIdBuilder.append(resolvedParamSignatures[i]);
- if (i + 1 < resolvedParamSignatures.length) {
- methodIdBuilder.append(",");
- }
- }
- methodIdBuilder.append(")");
- return methodIdBuilder.toString();
- }
-
- private static String findTypeParameterSignature(String typeParameterSignature, IType signatureOwner, IType contextType) throws JavaModelException {
- String paramTypeName = Signature.getSignatureSimpleName(typeParameterSignature);
-
- List<IType> hierarchyList = new ArrayList<IType>();
- if (contextType != null) {
- ITypeHierarchy superTypeHierarchy = contextType.newSupertypeHierarchy(null);
- IType visitorType = contextType;
- while (visitorType != null && !visitorType.equals(signatureOwner)) {
- hierarchyList.add(0, visitorType);
- visitorType = superTypeHierarchy.getSuperclass(visitorType);
- }
- }
-
- // check requested Parameter
- String[] ownerParameterSignatures = signatureOwner.getTypeParameterSignatures();
- int parameterIndex = -1;
- for (int i = 0; i < ownerParameterSignatures.length; i++) {
- String paramSig = ownerParameterSignatures[i];
- String paramName = PARAM_SIG_REPLACEMENT_REGEX.matcher(paramSig).replaceAll("$1");
- paramSig = PARAM_SIG_REPLACEMENT_REGEX.matcher(paramSig).replaceAll("$2");
- if (contextType == null) {
- String signature = getResolvedSignature(paramSig, signatureOwner, contextType);
- return signature;
- }
- else if (paramTypeName.equals(paramName)) {
- parameterIndex = i;
- break;
- }
- }
- if (parameterIndex < 0) {
- return Signature.createTypeSignature(Object.class.getName(), true);
- }
- for (IType hType : hierarchyList) {
- String superClassSignature = hType.getSuperclassTypeSignature();
- if (StringUtility.isNullOrEmpty(superClassSignature)) {
- return Signature.createTypeSignature(Object.class.getName(), true);
- }
- String[] superClassParameterSignatures = Signature.getTypeArguments(superClassSignature);
- if (superClassParameterSignatures.length < parameterIndex + 1) {
- return Signature.createTypeSignature(Object.class.getName(), true);
- // throw new IllegalArgumentException("Lost parameter '" + typeParameterSignature + "' in hierarchy at '" + hType.getFullyQualifiedName() + "'.");
- }
- else {
- // translate
- String signature = getResolvedSignature(superClassParameterSignatures[parameterIndex], hType, contextType);
- return signature;
- }
- }
- return null;
-
- }
-
- public static String getQuallifiedSignature(String signature, IType jdtType) throws JavaModelException {
- if (getTypeSignatureKind(signature) == Signature.BASE_TYPE_SIGNATURE) {
- return signature;
- }
- else {
- Matcher m = QUALIFIED_SIG_REGEX.matcher(signature);
- if (m.find()) {
- String prefix = m.group(1);
- String simpleSignature = m.group(2);
- String postfix = m.group(3);
- if (simpleSignature.startsWith("Q")) {
- String[][] resolvedTypeName = jdtType.resolveType(Signature.getSignatureSimpleName(simpleSignature + ";"));
- if (resolvedTypeName != null && resolvedTypeName.length == 1) {
- String fqName = resolvedTypeName[0][0];
- if (fqName != null && fqName.length() > 0) {
- fqName = fqName + ".";
- }
- fqName = fqName + resolvedTypeName[0][1];
- simpleSignature = Signature.createTypeSignature(fqName, true).replaceAll("(^.*)\\;$", "$1");
- signature = prefix + simpleSignature + postfix;
- }
- }
- String[] typeArguments = Signature.getTypeArguments(signature);
-
- for (String typeArg : typeArguments) {
- signature.replaceFirst("^([^<]*\\<.*)(" + quoteRegexSpecialCharacters(typeArg) + ")(.*)$", "$1" + getQuallifiedSignature(typeArg, jdtType) + "$3");
- }
- }
- else {
- SdkUtilActivator.logWarning("could not quallify types of signature '" + signature + "'");
- }
- return signature;
- }
- }
-}
+package org.eclipse.scout.sdk.util.signature;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+
+public final class SignatureUtility {
+
+ private final static Pattern QUALIFIED_SIG_REGEX = Pattern.compile("^([\\+\\[]*)([^\\<\\(\\;]*)(.*)$");
+ private final static Pattern SIG_REPLACEMENT_REGEX = Pattern.compile("[\\.\\$]{1}");
+ private final static Pattern DOL_REPLACEMENT_REGEX = Pattern.compile("\\$");
+ private final static Pattern PARAM_SIG_REPLACEMENT_REGEX = Pattern.compile("^([^\\:]*)\\:(.*)$");
+
+ //public final static Pattern PREF_REGEX = Pattern.compile("^([\\+\\[]+)(.*)$");
+
+ /**
+ * Character constant indicating an arbitrary array type in a signature.
+ * Value is <code>'|'</code>.
+ */
+ public static final char C_ARBITRARY_ARRAY = '|';
+
+ /**
+ * Kind constant for a arbitrary array signature.
+ *
+ * @see #getTypeSignatureKind(String)
+ * @since 3.0
+ */
+ public static final int ARBITRARY_ARRAY_SIGNATURE = 29;
+
+ private SignatureUtility() {
+ }
+
+ /**
+ * To get the signature kind of the given signature. If a signature starts with '|' it is a arbitrary array signature
+ * otherwise see {@link Signature#getTypeSignatureKind(String)}.
+ *
+ * @return the signature kind.
+ * @see Signature#getTypeSignatureKind(String)
+ */
+ public static int getTypeSignatureKind(String signature) {
+ // need a minimum 1 char
+ if (signature == null || signature.length() < 1) {
+ throw new IllegalArgumentException("signature is null or less than 1 char.");
+ }
+ char c = signature.charAt(0);
+ if (c == C_ARBITRARY_ARRAY) {
+ return ARBITRARY_ARRAY_SIGNATURE;
+ }
+ else {
+ //private final static Pattern SIMPLE_NAME_REGEX = Pattern.compile("^[\\[]*([^\\<]*).*(\\;)$");
+ // signature = SIMPLE_NAME_REGEX.matcher(signature).replaceAll("$1$2");
+ return Signature.getTypeSignatureKind(signature);
+ }
+ }
+
+ private static String quoteRegexSpecialCharacters(String input) {
+ input = input.replace("\\", "\\\\");
+ input = input.replace(".", "\\.");
+ input = input.replace("+", "\\+");
+ input = input.replace("?", "\\?");
+ input = input.replace("^", "\\^");
+ input = input.replace("$", "\\$");
+ input = input.replace("[", "\\[");
+ input = input.replace("]", "\\]");
+ input = input.replace("(", "\\(");
+ input = input.replace(")", "\\)");
+ input = input.replace("{", "\\{");
+ input = input.replace("}", "\\}");
+ input = input.replace("*", "\\*");
+ input = input.replace("|", "\\|");
+ return input;
+ }
+
+ public static String getResolvedSignature(String signature, IType signatureOwner) throws JavaModelException {
+ return getResolvedSignature(signature, signatureOwner, null);
+ }
+
+ public static String getResolvedSignature(String signature, IType signatureOwner, IType contextType) throws JavaModelException {
+ StringBuilder sigBuilder = new StringBuilder();
+ switch (getTypeSignatureKind(signature)) {
+ case Signature.WILDCARD_TYPE_SIGNATURE:
+ sigBuilder.append(signature.charAt(0));
+ if (signature.length() > 1) {
+ sigBuilder.append(getResolvedSignature(signature.substring(1), signatureOwner, contextType));
+ }
+ break;
+ case Signature.ARRAY_TYPE_SIGNATURE:
+ sigBuilder.append("[");
+ sigBuilder.append(getResolvedSignature(signature.substring(1), signatureOwner, contextType));
+ break;
+ case ARBITRARY_ARRAY_SIGNATURE:
+ sigBuilder.append(C_ARBITRARY_ARRAY);
+ sigBuilder.append(getResolvedSignature(signature.substring(1), signatureOwner, contextType));
+ break;
+ case Signature.BASE_TYPE_SIGNATURE:
+ if (signature.endsWith(";")) {
+ signature = signature.substring(0, signature.length() - 1);
+ }
+ sigBuilder.append(signature);
+ break;
+ case Signature.TYPE_VARIABLE_SIGNATURE:
+ // try to resolve type
+ String sig = findTypeParameterSignature(signature, signatureOwner, contextType);
+ sigBuilder.append(getResolvedSignature(sig, signatureOwner, contextType));
+ break;
+ case Signature.CLASS_TYPE_SIGNATURE:
+
+ String[] typeArguments = Signature.getTypeArguments(signature);
+ signature = Signature.getTypeErasure(signature);
+ signature = SIG_REPLACEMENT_REGEX.matcher(signature).replaceAll(".");
+ if (signature.startsWith("Q")) {
+ // unresolved
+ String[][] resolvedTypeName = signatureOwner.resolveType(Signature.getSignatureSimpleName(signature));
+ if (resolvedTypeName != null && resolvedTypeName.length == 1) {
+ String fqName = resolvedTypeName[0][0];
+ if (fqName != null && fqName.length() > 0) {
+ fqName = fqName + ".";
+ }
+ fqName = fqName + resolvedTypeName[0][1];
+ signature = Signature.createTypeSignature(fqName, true);
+ }
+ }
+ if (signature.endsWith(";")) {
+ signature = signature.substring(0, signature.length() - 1);
+ }
+ sigBuilder.append(signature);
+ if (typeArguments != null && typeArguments.length > 0) {
+ sigBuilder.append("<");
+ for (int i = 0; i < typeArguments.length; i++) {
+ sigBuilder.append(getResolvedSignature(typeArguments[i], signatureOwner, contextType));
+ }
+ sigBuilder.append(">");
+ }
+ sigBuilder.append(";");
+ break;
+ default:
+ SdkUtilActivator.logWarning("unhandled signature type: '" + Signature.getTypeSignatureKind(signature) + "'");
+ break;
+ }
+ return sigBuilder.toString();
+ }
+
+ public static boolean isEqualSignature(String signature1, String signature2) {
+ if (signature1 == null && signature2 == null) {
+ return true;
+ }
+ else if (signature1 == null || signature2 == null) {
+ return false;
+ }
+ signature1 = DOL_REPLACEMENT_REGEX.matcher(signature1).replaceAll(".");
+ signature2 = DOL_REPLACEMENT_REGEX.matcher(signature2).replaceAll(".");
+ return signature1.equals(signature2);
+ }
+
+ /**
+ * To get the simple type reference name within a context represented by the given importValidator. Every fully
+ * qualified type name will be passed to the importValidator to decide if the import is already in use.
+ *
+ * @param fullyQuallifiedTypeName
+ * e.g. java.lang.String (not a signature).
+ * @param importValidator
+ * to evaluate all fully qualified names for create an import and use simple names.
+ * @return the simple reference type name in the given validator scope.
+ * @see ScoutSdkUtility#getSimpleTypeRefName(String, IImportValidator)
+ */
+ public static String getTypeReferenceFromFqn(String fullyQualifiedTypeName, IImportValidator importValidator) throws JavaModelException {
+ return getTypeReference(Signature.createTypeSignature(fullyQualifiedTypeName, true), importValidator);
+ }
+
+ /**
+ * @see {@link ScoutSignature#getTypeReference(String, IType, IType, IImportValidator)}
+ */
+ public static String getTypeReference(String signature) throws JavaModelException {
+ return getTypeReference(signature, null, null, new FullyQuallifiedValidator());
+ }
+
+ /**
+ * @see {@link ScoutSignature#getTypeReference(String, IType, IType, IImportValidator)}
+ */
+ public static String getTypeReference(String signature, IImportValidator importValidator) throws JavaModelException {
+ return getTypeReference(signature, null, null, importValidator);
+ }
+
+ /**
+ * @see {@link ScoutSignature#getTypeReference(String, IType, IType, IImportValidator)}
+ */
+ /*public static String getTypeReference(String signature, IType signatureOwner) throws JavaModelException {
+ return getTypeReference(signature, signatureOwner, null, new FullyQuallifiedValidator());
+ }*/
+
+ /**
+ * @see {@link ScoutSignature#getTypeReference(String, IType, IType, IImportValidator)}
+ */
+ public static String getTypeReference(String signature, IType signatureOwner, IImportValidator validator) throws JavaModelException {
+ return getTypeReference(signature, signatureOwner, null, validator);
+ }
+
+ /**
+ * @see {@link ScoutSignature#getTypeReference(String, IType, IType, IImportValidator)}
+ */
+ /*public static String getTypeReference(String signature, IType signatureOwner, IType contextType) throws JavaModelException {
+ return getTypeReference(signature, signatureOwner, contextType, new FullyQuallifiedValidator());
+ }*/
+
+ /**
+ * <h4>Examples</h4> <xmp>
+ * getTypeReferenceImpl("Ljava.lang.String;", typeA, typeA, fullyQuallifiedImpValidator)
+ * -> java.lang.String
+ * getTypeReferenceImpl("QList<?QString>;", typeA, typeA, fullyQuallifiedImpValidator)
+ * -> java.util.List<? extends java.lang.String>
+ * </xmp>
+ *
+ * @param signature
+ * fully parameterized signature
+ * @param signatureOwner
+ * the owner of the signature used to lookup unresolved types.
+ * @param contextType
+ * must be a subtype of signature owner or the owner itself. Used to find generic variables as T. If null and
+ * signature contains generic types the supertype closest to java.lang.Object with the given type parameter
+ * is calculated.
+ * @param validator
+ * an import validator to decide simple name vs. fully qualified name.
+ * @return the type reference
+ * @see {@link FullyQuallifiedValidator}, {@link IImportValidator}, {@link SimpleImportValidator}
+ * @throws JavaModelException
+ */
+ private static String getTypeReference(String signature, IType signatureOwner, IType contextType, IImportValidator validator) throws JavaModelException {
+ StringBuilder sigBuilder = new StringBuilder();
+ int arrayCount = 0;
+ boolean isArbitraryArray = false;
+ switch (getTypeSignatureKind(signature)) {
+ case Signature.WILDCARD_TYPE_SIGNATURE:
+ sigBuilder.append("?");
+ if (signature.length() > 1) {
+ sigBuilder.append(" extends ");
+ sigBuilder.append(getTypeReference(signature.substring(1), signatureOwner, contextType, validator));
+ }
+ break;
+ case Signature.ARRAY_TYPE_SIGNATURE:
+ arrayCount = Signature.getArrayCount(signature);
+ sigBuilder.append(getTypeReference(signature.substring(arrayCount), signatureOwner, contextType, validator));
+ break;
+ case ARBITRARY_ARRAY_SIGNATURE:
+ isArbitraryArray = true;
+ sigBuilder.append(getTypeReference(signature.substring(1), signatureOwner, contextType, validator));
+ break;
+ case Signature.BASE_TYPE_SIGNATURE:
+ sigBuilder.append(Signature.getSignatureSimpleName(signature));
+ break;
+ case Signature.TYPE_VARIABLE_SIGNATURE:
+ // try to resolve type
+ String sig = findTypeParameterSignature(signature, signatureOwner, contextType);
+ sigBuilder.append(getTypeReference(sig, signatureOwner, contextType, validator));
+ break;
+ default:
+ String[] typeArguments = Signature.getTypeArguments(signature);
+ signature = Signature.getTypeErasure(signature);
+ signature = SIG_REPLACEMENT_REGEX.matcher(signature).replaceAll(".");
+ if (signature.startsWith("Q")) {
+ if (signatureOwner != null) {
+ // unresolved
+ String[][] resolvedTypeName = signatureOwner.resolveType(Signature.getSignatureSimpleName(signature));
+ if (resolvedTypeName != null && resolvedTypeName.length == 1) {
+ String fqName = resolvedTypeName[0][0];
+ if (fqName != null && fqName.length() > 0) {
+ fqName = fqName + ".";
+ }
+ fqName = fqName + resolvedTypeName[0][1];
+ sigBuilder.append(validator.getTypeName(Signature.createTypeSignature(fqName, true)));
+ }
+ }
+ else {
+ sigBuilder.append(Signature.toString(signature));
+ }
+ }
+ else {
+ // resolved
+ sigBuilder.append(validator.getTypeName(signature));
+ }
+ if (typeArguments != null && typeArguments.length > 0) {
+ sigBuilder.append("<");
+ for (int i = 0; i < typeArguments.length; i++) {
+ if (i > 0) {
+ sigBuilder.append(", ");
+ }
+ sigBuilder.append(getTypeReference(typeArguments[i], signatureOwner, contextType, validator));
+ }
+ sigBuilder.append(">");
+ }
+ break;
+ }
+ for (int i = 0; i < arrayCount; i++) {
+ sigBuilder.append("[]");
+ }
+ if (isArbitraryArray) {
+ sigBuilder.append("...");
+ }
+ return sigBuilder.toString();
+ }
+
+ /**
+ * To get resolved and substituted generic parameter signatures of the method. The signature starts with
+ * {@link ScoutSignature#C_ARBITRARY_ARRAY} if the parameter is a arbitrary array.
+ *
+ * @param method
+ * a scout method
+ * @return an array of the parameter signatures
+ * @throws JavaModelException
+ */
+ public static String[] getMethodParameterSignatureResolved(IMethod method) throws JavaModelException {
+ return getMethodParameterSignatureResolved(method, method.getDeclaringType());
+ }
+
+ /**
+ * To get resolved and substituted generic parameter signatures of the method. The signature starts with
+ * {@link ScoutSignature#C_ARBITRARY_ARRAY} if the parameter is a arbitrary array.
+ *
+ * @param jdtMethod
+ * @param contextType
+ * the type in what context the method appears, used for generic bindings.
+ * @return an array of the parameter signatures
+ * @throws JavaModelException
+ */
+ public static String[] getMethodParameterSignatureResolved(IMethod jdtMethod, IType contextType) throws JavaModelException {
+ String[] methodParameterSignature = getMethodParameterSignature(jdtMethod);
+ IType methodOwnerType = jdtMethod.getDeclaringType();
+ for (int i = 0; i < methodParameterSignature.length; i++) {
+ methodParameterSignature[i] = getResolvedSignature(methodParameterSignature[i], methodOwnerType, contextType);
+ }
+ return methodParameterSignature;
+ }
+
+ /**
+ * The get parameter signatures of the given method. The signature starts with
+ * {@link ScoutSignature#C_ARBITRARY_ARRAY} if the parameter is a arbitrary array. <h5>NOTE:</h5> <b>generic types are
+ * not resolved use {@link ScoutSignature#getMethodParameterSignatureResolved(IScoutMethod)} to get resolved and
+ * generic substituted parameter signature</b><br>
+ * <br>
+ *
+ * @param method
+ * @return
+ * @throws JavaModelException
+ */
+ public static String[] getMethodParameterSignature(IMethod method) throws JavaModelException {
+ String[] paramNames = method.getParameterNames();
+ String[] paramSignatures = Arrays.copyOf(method.getParameterTypes(), method.getParameterTypes().length);
+ // check for ... array on last parameter
+ if (paramSignatures != null && paramSignatures.length > 0) {
+ String lastSig = paramSignatures[paramSignatures.length - 1];
+ String lastParamName = paramNames[paramNames.length - 1];
+ if (Signature.getTypeSignatureKind(lastSig) == Signature.ARRAY_TYPE_SIGNATURE) {
+ String source = method.getSource();
+ if (source != null) {
+ String regex = method.getElementName() + "\\s*\\(.*([\\.]{3})\\s*" + lastParamName + "\\s*\\)";
+ if (Pattern.compile(regex, Pattern.MULTILINE).matcher(source).find()) {
+ paramSignatures[paramSignatures.length - 1] = lastSig.replaceFirst("^\\[", "|");
+ }
+ }
+ }
+ }
+ return paramSignatures;
+ }
+
+ /**
+ * To get resolved return type signature of the given method. Generic types are substituted within the method context.
+ *
+ * @param method
+ * a scout method
+ * @return an array of the parameter signatures
+ * @throws JavaModelException
+ */
+ public static String getReturnTypeSignatureResolved(IMethod method, IType contextType) throws JavaModelException {
+ String returnTypeSignature = method.getReturnType();
+ IType methodDeclaringType = method.getDeclaringType();
+ returnTypeSignature = getResolvedSignature(returnTypeSignature, methodDeclaringType, contextType);
+ return returnTypeSignature;
+ }
+
+ /**
+ * returns a unique identifier of a scout method. The identifier looks like
+ * 'methodname(param1Signature,param2Signature)'.
+ *
+ * @param method
+ * @return an unique method identifier of the given method
+ * @throws JavaModelException
+ */
+ public static String getMethodIdentifier(IMethod method) throws JavaModelException {
+ StringBuilder methodIdBuilder = new StringBuilder(method.getElementName());
+ methodIdBuilder.append("(");
+ String[] resolvedParamSignatures = getMethodParameterSignatureResolved(method);
+ for (int i = 0; i < resolvedParamSignatures.length; i++) {
+ methodIdBuilder.append(resolvedParamSignatures[i]);
+ if (i + 1 < resolvedParamSignatures.length) {
+ methodIdBuilder.append(",");
+ }
+ }
+ methodIdBuilder.append(")");
+ return methodIdBuilder.toString();
+ }
+
+ /**
+ * returns a unique identifier of a scout method. The identifier looks like
+ * 'methodname(param1Signature,param2Signature)'.
+ *
+ * @param method
+ * @param contextType
+ * the type in what context the method appears, used for generic bindings.
+ * @return
+ * @throws JavaModelException
+ */
+ public static String getMethodIdentifier(IMethod method, IType contextType) throws JavaModelException {
+ StringBuilder methodIdBuilder = new StringBuilder();
+ methodIdBuilder.append(method.getElementName());
+ methodIdBuilder.append("(");
+ String[] resolvedParamSignatures = getMethodParameterSignatureResolved(method, contextType);
+ for (int i = 0; i < resolvedParamSignatures.length; i++) {
+ methodIdBuilder.append(resolvedParamSignatures[i]);
+ if (i + 1 < resolvedParamSignatures.length) {
+ methodIdBuilder.append(",");
+ }
+ }
+ methodIdBuilder.append(")");
+ return methodIdBuilder.toString();
+ }
+
+ private static String findTypeParameterSignature(String typeParameterSignature, IType signatureOwner, IType contextType) throws JavaModelException {
+ String paramTypeName = Signature.getSignatureSimpleName(typeParameterSignature);
+
+ List<IType> hierarchyList = new ArrayList<IType>();
+ if (contextType != null) {
+ ITypeHierarchy superTypeHierarchy = contextType.newSupertypeHierarchy(null);
+ IType visitorType = contextType;
+ while (visitorType != null && !visitorType.equals(signatureOwner)) {
+ hierarchyList.add(0, visitorType);
+ visitorType = superTypeHierarchy.getSuperclass(visitorType);
+ }
+ }
+
+ // check requested Parameter
+ String[] ownerParameterSignatures = signatureOwner.getTypeParameterSignatures();
+ int parameterIndex = -1;
+ for (int i = 0; i < ownerParameterSignatures.length; i++) {
+ String paramSig = ownerParameterSignatures[i];
+ String paramName = PARAM_SIG_REPLACEMENT_REGEX.matcher(paramSig).replaceAll("$1");
+ paramSig = PARAM_SIG_REPLACEMENT_REGEX.matcher(paramSig).replaceAll("$2");
+ if (contextType == null) {
+ String signature = getResolvedSignature(paramSig, signatureOwner, contextType);
+ return signature;
+ }
+ else if (paramTypeName.equals(paramName)) {
+ parameterIndex = i;
+ break;
+ }
+ }
+ if (parameterIndex < 0) {
+ return Signature.createTypeSignature(Object.class.getName(), true);
+ }
+ for (IType hType : hierarchyList) {
+ String superClassSignature = hType.getSuperclassTypeSignature();
+ if (StringUtility.isNullOrEmpty(superClassSignature)) {
+ return Signature.createTypeSignature(Object.class.getName(), true);
+ }
+ String[] superClassParameterSignatures = Signature.getTypeArguments(superClassSignature);
+ if (superClassParameterSignatures.length < parameterIndex + 1) {
+ return Signature.createTypeSignature(Object.class.getName(), true);
+ // throw new IllegalArgumentException("Lost parameter '" + typeParameterSignature + "' in hierarchy at '" + hType.getFullyQualifiedName() + "'.");
+ }
+ else {
+ // translate
+ String signature = getResolvedSignature(superClassParameterSignatures[parameterIndex], hType, contextType);
+ return signature;
+ }
+ }
+ return null;
+
+ }
+
+ public static String getQuallifiedSignature(String signature, IType jdtType) throws JavaModelException {
+ if (getTypeSignatureKind(signature) == Signature.BASE_TYPE_SIGNATURE) {
+ return signature;
+ }
+ else {
+ Matcher m = QUALIFIED_SIG_REGEX.matcher(signature);
+ if (m.find()) {
+ String prefix = m.group(1);
+ String simpleSignature = m.group(2);
+ String postfix = m.group(3);
+ if (simpleSignature.startsWith("Q")) {
+ String[][] resolvedTypeName = jdtType.resolveType(Signature.getSignatureSimpleName(simpleSignature + ";"));
+ if (resolvedTypeName != null && resolvedTypeName.length == 1) {
+ String fqName = resolvedTypeName[0][0];
+ if (fqName != null && fqName.length() > 0) {
+ fqName = fqName + ".";
+ }
+ fqName = fqName + resolvedTypeName[0][1];
+ simpleSignature = Signature.createTypeSignature(fqName, true).replaceAll("(^.*)\\;$", "$1");
+ signature = prefix + simpleSignature + postfix;
+ }
+ }
+ String[] typeArguments = Signature.getTypeArguments(signature);
+
+ for (String typeArg : typeArguments) {
+ signature.replaceFirst("^([^<]*\\<.*)(" + quoteRegexSpecialCharacters(typeArg) + ")(.*)$", "$1" + getQuallifiedSignature(typeArg, jdtType) + "$3");
+ }
+ }
+ else {
+ SdkUtilActivator.logWarning("could not quallify types of signature '" + signature + "'");
+ }
+ return signature;
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/SimpleImportValidator.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/SimpleImportValidator.java
index 72ba08e38..40e588313 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/SimpleImportValidator.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/signature/SimpleImportValidator.java
@@ -1,101 +1,101 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.signature;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map.Entry;
-import java.util.regex.Pattern;
-
-import org.eclipse.jdt.core.Signature;
-
-public class SimpleImportValidator implements IImportValidator {
- private HashMap<String/* simpleName */, String/* packageName */> m_newImports;
- private String m_packageName;
-
- private final static Pattern EXT_REGEX = Pattern.compile("^\\+.*$");
- private final static Pattern EXT_REPL_REGEX = Pattern.compile("^\\+");
- private final static Pattern PLAIN_REPL_REGEX = Pattern.compile("^[\\[\\+]*");
-
- public SimpleImportValidator() {
- this(null);
- }
-
- public SimpleImportValidator(String packageName) {
- m_newImports = new HashMap<String, String>();
- m_packageName = packageName;
- }
-
- @Override
- public String getTypeName(String singleTypeSignature) {
- String prefix = "";
- if (EXT_REGEX.matcher(singleTypeSignature).matches()) {
- prefix = "? extends ";
- singleTypeSignature = EXT_REPL_REGEX.matcher(singleTypeSignature).replaceAll("");
- }
- if (singleTypeSignature.charAt(0) == Signature.C_UNRESOLVED) {
- return Signature.getSignatureSimpleName(singleTypeSignature);
- }
- else {
- String pckName = Signature.getSignatureQualifier(singleTypeSignature);
- String simpleName = Signature.getSignatureSimpleName(singleTypeSignature);
- String plainSimpleName = Signature.getSignatureSimpleName(PLAIN_REPL_REGEX.matcher(singleTypeSignature).replaceAll(""));
-
- if (isAlreadyUsed(pckName, plainSimpleName)) {
- return prefix + pckName + "." + simpleName;
- }
- else {
- m_newImports.put(plainSimpleName, pckName);
- return prefix + simpleName;
- }
- }
- }
-
- protected boolean isAlreadyUsed(String packageName, String simpleName) {
- String usedPackageName = m_newImports.get(simpleName);
- if (usedPackageName != null) {
- if (!usedPackageName.equals(packageName)) {
- // fully quallified
- return true;
- }
- }
- return false;
- }
-
- protected boolean isSamePackage(String packageName) {
- if (m_packageName != null) {
- return m_packageName.equals(packageName);
- }
- return false;
- }
-
- @Override
- public void addImport(String fqn) {
- String packageName = Signature.getQualifier(fqn);
- String simpleName = Signature.getSimpleName(fqn);
- m_newImports.put(simpleName, packageName);
- }
-
- @Override
- public String[] getImportsToCreate() {
- ArrayList<String> list = new ArrayList<String>();
- for (Entry<String, String> e : m_newImports.entrySet()) {
- if (e.getValue().equals("java.lang")) {
- continue;
- }
- if (isSamePackage(e.getValue())) {
- continue;
- }
- list.add(e.getValue() + "." + e.getKey());
- }
- return list.toArray(new String[list.size()]);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.signature;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Map.Entry;
+import java.util.regex.Pattern;
+
+import org.eclipse.jdt.core.Signature;
+
+public class SimpleImportValidator implements IImportValidator {
+ private HashMap<String/* simpleName */, String/* packageName */> m_newImports;
+ private String m_packageName;
+
+ private final static Pattern EXT_REGEX = Pattern.compile("^\\+.*$");
+ private final static Pattern EXT_REPL_REGEX = Pattern.compile("^\\+");
+ private final static Pattern PLAIN_REPL_REGEX = Pattern.compile("^[\\[\\+]*");
+
+ public SimpleImportValidator() {
+ this(null);
+ }
+
+ public SimpleImportValidator(String packageName) {
+ m_newImports = new HashMap<String, String>();
+ m_packageName = packageName;
+ }
+
+ @Override
+ public String getTypeName(String singleTypeSignature) {
+ String prefix = "";
+ if (EXT_REGEX.matcher(singleTypeSignature).matches()) {
+ prefix = "? extends ";
+ singleTypeSignature = EXT_REPL_REGEX.matcher(singleTypeSignature).replaceAll("");
+ }
+ if (singleTypeSignature.charAt(0) == Signature.C_UNRESOLVED) {
+ return Signature.getSignatureSimpleName(singleTypeSignature);
+ }
+ else {
+ String pckName = Signature.getSignatureQualifier(singleTypeSignature);
+ String simpleName = Signature.getSignatureSimpleName(singleTypeSignature);
+ String plainSimpleName = Signature.getSignatureSimpleName(PLAIN_REPL_REGEX.matcher(singleTypeSignature).replaceAll(""));
+
+ if (isAlreadyUsed(pckName, plainSimpleName)) {
+ return prefix + pckName + "." + simpleName;
+ }
+ else {
+ m_newImports.put(plainSimpleName, pckName);
+ return prefix + simpleName;
+ }
+ }
+ }
+
+ protected boolean isAlreadyUsed(String packageName, String simpleName) {
+ String usedPackageName = m_newImports.get(simpleName);
+ if (usedPackageName != null) {
+ if (!usedPackageName.equals(packageName)) {
+ // fully quallified
+ return true;
+ }
+ }
+ return false;
+ }
+
+ protected boolean isSamePackage(String packageName) {
+ if (m_packageName != null) {
+ return m_packageName.equals(packageName);
+ }
+ return false;
+ }
+
+ @Override
+ public void addImport(String fqn) {
+ String packageName = Signature.getQualifier(fqn);
+ String simpleName = Signature.getSimpleName(fqn);
+ m_newImports.put(simpleName, packageName);
+ }
+
+ @Override
+ public String[] getImportsToCreate() {
+ ArrayList<String> list = new ArrayList<String>();
+ for (Entry<String, String> e : m_newImports.entrySet()) {
+ if (e.getValue().equals("java.lang")) {
+ continue;
+ }
+ if (isSamePackage(e.getValue())) {
+ continue;
+ }
+ list.add(e.getValue() + "." + e.getKey());
+ }
+ return list.toArray(new String[list.size()]);
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/FieldFilters.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/FieldFilters.java
index 998829d72..feaba2386 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/FieldFilters.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/FieldFilters.java
@@ -1,79 +1,79 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.type;
-
-import java.util.regex.Pattern;
-
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-
-/**
- *
- */
-public class FieldFilters {
-
- public static IFieldFilter getFlagsFilter(final int flags) {
- return new IFieldFilter() {
- @Override
- public boolean accept(IField field) {
- try {
- return (flags & field.getFlags()) == flags;
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not filter field '" + field.getElementName() + "' on '" + field.getDeclaringType().getFullyQualifiedName() + "'.", e);
- }
- return false;
- }
- };
- }
-
- public static IFieldFilter getNameRegexFilter(final Pattern regex) {
- return new IFieldFilter() {
- @Override
- public boolean accept(IField field) {
- return regex.matcher(field.getElementName()).matches();
- }
- };
- }
-
- public static IFieldFilter getPrivateNotStaticNotFinalNotAbstract() {
- return new IFieldFilter() {
- @Override
- public boolean accept(IField field) {
- try {
- int flags = field.getFlags();
- return Flags.isPrivate(flags) && !Flags.isStatic(flags) && !Flags.isFinal(flags) && !Flags.isAbstract(flags);
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not filter field '" + field.getElementName() + "' on '" + field.getDeclaringType().getFullyQualifiedName() + "'.", e);
- }
- return false;
- }
- };
- }
-
- public static IFieldFilter getCompositeFilter(final IFieldFilter... filters) {
- return new IFieldFilter() {
-
- @Override
- public boolean accept(IField field) {
- for (IFieldFilter f : filters) {
- if (!f.accept(field)) {
- return false;
- }
- }
- return true;
- }
- };
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.type;
+
+import java.util.regex.Pattern;
+
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+
+/**
+ *
+ */
+public class FieldFilters {
+
+ public static IFieldFilter getFlagsFilter(final int flags) {
+ return new IFieldFilter() {
+ @Override
+ public boolean accept(IField field) {
+ try {
+ return (flags & field.getFlags()) == flags;
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not filter field '" + field.getElementName() + "' on '" + field.getDeclaringType().getFullyQualifiedName() + "'.", e);
+ }
+ return false;
+ }
+ };
+ }
+
+ public static IFieldFilter getNameRegexFilter(final Pattern regex) {
+ return new IFieldFilter() {
+ @Override
+ public boolean accept(IField field) {
+ return regex.matcher(field.getElementName()).matches();
+ }
+ };
+ }
+
+ public static IFieldFilter getPrivateNotStaticNotFinalNotAbstract() {
+ return new IFieldFilter() {
+ @Override
+ public boolean accept(IField field) {
+ try {
+ int flags = field.getFlags();
+ return Flags.isPrivate(flags) && !Flags.isStatic(flags) && !Flags.isFinal(flags) && !Flags.isAbstract(flags);
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not filter field '" + field.getElementName() + "' on '" + field.getDeclaringType().getFullyQualifiedName() + "'.", e);
+ }
+ return false;
+ }
+ };
+ }
+
+ public static IFieldFilter getCompositeFilter(final IFieldFilter... filters) {
+ return new IFieldFilter() {
+
+ @Override
+ public boolean accept(IField field) {
+ for (IFieldFilter f : filters) {
+ if (!f.accept(field)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ };
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IFieldFilter.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IFieldFilter.java
index 1b0f81930..c19d3790f 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IFieldFilter.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IFieldFilter.java
@@ -1,21 +1,21 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.type;
-
-import org.eclipse.jdt.core.IField;
-
-/**
- *
- */
-public interface IFieldFilter {
- boolean accept(IField field);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.type;
+
+import org.eclipse.jdt.core.IField;
+
+/**
+ *
+ */
+public interface IFieldFilter {
+ boolean accept(IField field);
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IMethodFilter.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IMethodFilter.java
index a23abf980..a609ae345 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IMethodFilter.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IMethodFilter.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.type;
-
-import org.eclipse.jdt.core.IMethod;
-
-/**
- *
- */
-public interface IMethodFilter {
-
- /**
- * @param candidate
- * @return true if the method is accepted by the filter
- */
- boolean accept(IMethod candidate);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.type;
+
+import org.eclipse.jdt.core.IMethod;
+
+/**
+ *
+ */
+public interface IMethodFilter {
+
+ /**
+ * @param candidate
+ * @return true if the method is accepted by the filter
+ */
+ boolean accept(IMethod candidate);
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IPropertyBean.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IPropertyBean.java
index 5459cfca2..afb1321b5 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IPropertyBean.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IPropertyBean.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.type;
-
-import java.beans.PropertyDescriptor;
-
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-
-/**
- * Description of a Java bean property. This is a dual class to Java's {@link PropertyDescriptor}.
- */
-public interface IPropertyBean {
- /**
- * @return Returns the declaring type that is hosting this property bean.
- */
- IType getDeclaringType();
-
- /**
- * @return Returns the property's getter method or <code>null</code> if it is write-only.
- */
- IMethod getReadMethod();
-
- /**
- * @return Returns the property's setter method or <code>null</code> if it is read-only.
- */
- IMethod getWriteMethod();
-
- /**
- * Property inspectors try to determine a bean property's field. Since the JavaBeans specification defines bean
- * properties by their access methods it is possible, that a property is not based on a field at all. This method
- * returns <code>null</code> in such a case.
- *
- * @return The field this property is based on or <code>null</code> if it can not be determined.
- */
- IField getField();
-
- /**
- * @return the read, write method and the field if not null.
- */
- IMember[] getAllMembers();
-
- /**
- * @return Returns the bean's name.
- */
- String getBeanName();
-
- String getBeanSignature();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.type;
+
+import java.beans.PropertyDescriptor;
+
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+
+/**
+ * Description of a Java bean property. This is a dual class to Java's {@link PropertyDescriptor}.
+ */
+public interface IPropertyBean {
+ /**
+ * @return Returns the declaring type that is hosting this property bean.
+ */
+ IType getDeclaringType();
+
+ /**
+ * @return Returns the property's getter method or <code>null</code> if it is write-only.
+ */
+ IMethod getReadMethod();
+
+ /**
+ * @return Returns the property's setter method or <code>null</code> if it is read-only.
+ */
+ IMethod getWriteMethod();
+
+ /**
+ * Property inspectors try to determine a bean property's field. Since the JavaBeans specification defines bean
+ * properties by their access methods it is possible, that a property is not based on a field at all. This method
+ * returns <code>null</code> in such a case.
+ *
+ * @return The field this property is based on or <code>null</code> if it can not be determined.
+ */
+ IField getField();
+
+ /**
+ * @return the read, write method and the field if not null.
+ */
+ IMember[] getAllMembers();
+
+ /**
+ * @return Returns the bean's name.
+ */
+ String getBeanName();
+
+ String getBeanSignature();
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IPropertyBeanFilter.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IPropertyBeanFilter.java
index 92fc92e48..50664de84 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IPropertyBeanFilter.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/IPropertyBeanFilter.java
@@ -1,26 +1,26 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.type;
-
-/**
- * Interface implemented by filters for {@link PropertyBean} objects.
- */
-public interface IPropertyBeanFilter {
-
- /**
- * Determines whether the given property is accepted.
- *
- * @param property
- * the property to analyze.
- * @return Returns <code>true</code> if the property is accepted.
- */
- boolean accept(IPropertyBean property);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.type;
+
+/**
+ * Interface implemented by filters for {@link PropertyBean} objects.
+ */
+public interface IPropertyBeanFilter {
+
+ /**
+ * Determines whether the given property is accepted.
+ *
+ * @param property
+ * the property to analyze.
+ * @return Returns <code>true</code> if the property is accepted.
+ */
+ boolean accept(IPropertyBean property);
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/ITypeFilter.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/ITypeFilter.java
index 6f70be54a..d11e80301 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/ITypeFilter.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/ITypeFilter.java
@@ -1,22 +1,22 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.type;
-
-import org.eclipse.jdt.core.IType;
-
-/**
- *
- */
-public interface ITypeFilter {
-
- boolean accept(IType type);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.type;
+
+import org.eclipse.jdt.core.IType;
+
+/**
+ *
+ */
+public interface ITypeFilter {
+
+ boolean accept(IType type);
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/JavaElementComparator.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/JavaElementComparator.java
index 66ca7d487..139bbdb15 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/JavaElementComparator.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/JavaElementComparator.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.type;
-
-import java.util.Comparator;
-
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.scout.commons.CompareUtility;
-
-/**
- * <h3>{@link JavaElementComparator}</h3> ...
- *
- * @author Andreas Hoegger
- * @since 3.8.0 06.03.2012
- */
-public class JavaElementComparator implements Comparator<IJavaElement> {
-
- @Override
- public int compare(IJavaElement o1, IJavaElement o2) {
- if (o1 == null && o2 == null) {
- return 0;
- }
- else if (o1 == null) {
- return 1;
- }
- else if (o2 == null) {
- return -1;
- }
- if (o1.getElementType() != o2.getElementType()) {
- return o2.getElementType() - o1.getElementType();
- }
- int diff = CompareUtility.compareTo(o1.getElementName(), o2.getElementName());
- return diff;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.type;
+
+import java.util.Comparator;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.scout.commons.CompareUtility;
+
+/**
+ * <h3>{@link JavaElementComparator}</h3> ...
+ *
+ * @author Andreas Hoegger
+ * @since 3.8.0 06.03.2012
+ */
+public class JavaElementComparator implements Comparator<IJavaElement> {
+
+ @Override
+ public int compare(IJavaElement o1, IJavaElement o2) {
+ if (o1 == null && o2 == null) {
+ return 0;
+ }
+ else if (o1 == null) {
+ return 1;
+ }
+ else if (o2 == null) {
+ return -1;
+ }
+ if (o1.getElementType() != o2.getElementType()) {
+ return o2.getElementType() - o1.getElementType();
+ }
+ int diff = CompareUtility.compareTo(o1.getElementName(), o2.getElementName());
+ return diff;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/MethodComparators.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/MethodComparators.java
index afcedd10f..66ddc085c 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/MethodComparators.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/MethodComparators.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.type;
-
-import java.util.Comparator;
-
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.scout.commons.CompositeObject;
-
-/**
- *
- */
-public final class MethodComparators {
-
- private MethodComparators() {
- }
-
- public static Comparator<IMethod> getNameComparator() {
- return new Comparator<IMethod>() {
- @Override
- public int compare(IMethod m1, IMethod m2) {
- CompositeObject m1c = new CompositeObject(m1.getElementName(), m1);
- CompositeObject m2c = new CompositeObject(m2.getElementName(), m2);
- return m1c.compareTo(m2c);
- }
- };
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.type;
+
+import java.util.Comparator;
+
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.scout.commons.CompositeObject;
+
+/**
+ *
+ */
+public final class MethodComparators {
+
+ private MethodComparators() {
+ }
+
+ public static Comparator<IMethod> getNameComparator() {
+ return new Comparator<IMethod>() {
+ @Override
+ public int compare(IMethod m1, IMethod m2) {
+ CompositeObject m1c = new CompositeObject(m1.getElementName(), m1);
+ CompositeObject m2c = new CompositeObject(m2.getElementName(), m2);
+ return m1c.compareTo(m2c);
+ }
+ };
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/MethodFilters.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/MethodFilters.java
index 2b90c522e..1a8f9fe52 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/MethodFilters.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/MethodFilters.java
@@ -1,139 +1,139 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.type;
-
-import java.util.regex.Pattern;
-
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-
-/**
- *
- */
-public final class MethodFilters {
-
- private MethodFilters() {
- }
-
- public static IMethodFilter getFilterWithAnnotation(final IType annotationType) {
- return new IMethodFilter() {
- @Override
- public boolean accept(IMethod method) {
- IAnnotation annotation = method.getAnnotation(annotationType.getElementName());
- if (TypeUtility.exists(annotation)) {
- return true;
- }
- annotation = method.getAnnotation(annotationType.getFullyQualifiedName());
- return TypeUtility.exists(annotation);
- }
- };
- }
-
- /**
- * @param methodName
- * @return a filter stop iterating after the first method name match
- */
- public static IMethodFilter getNameFilter(final String methodName) {
- return new IMethodFilter() {
- @Override
- public boolean accept(IMethod method) {
- return method.getElementName().equals(methodName);
- }
- };
- }
-
- public static IMethodFilter getNameRegexFilter(final Pattern regex) {
- return new IMethodFilter() {
- @Override
- public boolean accept(IMethod method) {
- return regex.matcher(method.getElementName()).matches();
- }
- };
- }
-
- public static IMethodFilter getFlagsFilter(final int flags) {
- return new IMethodFilter() {
- @Override
- public boolean accept(IMethod method) {
- try {
- return (method.getFlags() & flags) == flags;
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("could not get flags of method '" + method.getElementName() + "' in type '" + method.getDeclaringType().getFullyQualifiedName() + "'.", e);
- return false;
- }
- }
- };
- }
-
- public static IMethodFilter getSuperMethodFilter(final IMethod method) {
- return new IMethodFilter() {
- @Override
- public boolean accept(IMethod candidate) {
- if (TypeUtility.exists(candidate)) {
- if (candidate.getElementName().equals(method.getElementName())) {
- String[] candidateParameters = candidate.getParameterTypes();
- String[] methodParameters = method.getParameterTypes();
- if (methodParameters.length == candidateParameters.length) {
- for (int i = 0; i < candidateParameters.length; i++) {
- String cParam = candidateParameters[i];
- String mParam = methodParameters[i];
- int cArrCount = Signature.getArrayCount(cParam);
- int mArrCount = Signature.getArrayCount(mParam);
- if (cArrCount != mArrCount) {
- return false;
- }
- cParam = cParam.substring(cArrCount);
- mParam = mParam.substring(mArrCount);
- mParam = Signature.getTypeErasure(mParam);
- cParam = Signature.getTypeErasure(cParam);
- if (Signature.getTypeSignatureKind(cParam) == Signature.TYPE_VARIABLE_SIGNATURE ||
- Signature.getTypeSignatureKind(mParam) == Signature.TYPE_VARIABLE_SIGNATURE) {
- continue;
- }
- else if (!Signature.getSignatureSimpleName(mParam).equals(Signature.getSignatureSimpleName(cParam))) {
- return false;
-
- }
- }
- return true;
- }
- }
- }
- return false;
- }
- };
- }
-
- public static IMethodFilter getMultiMethodFilter(final IMethodFilter... filters) {
- return new IMethodFilter() {
- @Override
- public boolean accept(IMethod method) {
- if (filters == null) {
- return true;
- }
- else {
- for (IMethodFilter f : filters) {
- if (!f.accept(method)) {
- return false;
- }
- }
- return true;
- }
- }
- };
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.type;
+
+import java.util.regex.Pattern;
+
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+
+/**
+ *
+ */
+public final class MethodFilters {
+
+ private MethodFilters() {
+ }
+
+ public static IMethodFilter getFilterWithAnnotation(final IType annotationType) {
+ return new IMethodFilter() {
+ @Override
+ public boolean accept(IMethod method) {
+ IAnnotation annotation = method.getAnnotation(annotationType.getElementName());
+ if (TypeUtility.exists(annotation)) {
+ return true;
+ }
+ annotation = method.getAnnotation(annotationType.getFullyQualifiedName());
+ return TypeUtility.exists(annotation);
+ }
+ };
+ }
+
+ /**
+ * @param methodName
+ * @return a filter stop iterating after the first method name match
+ */
+ public static IMethodFilter getNameFilter(final String methodName) {
+ return new IMethodFilter() {
+ @Override
+ public boolean accept(IMethod method) {
+ return method.getElementName().equals(methodName);
+ }
+ };
+ }
+
+ public static IMethodFilter getNameRegexFilter(final Pattern regex) {
+ return new IMethodFilter() {
+ @Override
+ public boolean accept(IMethod method) {
+ return regex.matcher(method.getElementName()).matches();
+ }
+ };
+ }
+
+ public static IMethodFilter getFlagsFilter(final int flags) {
+ return new IMethodFilter() {
+ @Override
+ public boolean accept(IMethod method) {
+ try {
+ return (method.getFlags() & flags) == flags;
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("could not get flags of method '" + method.getElementName() + "' in type '" + method.getDeclaringType().getFullyQualifiedName() + "'.", e);
+ return false;
+ }
+ }
+ };
+ }
+
+ public static IMethodFilter getSuperMethodFilter(final IMethod method) {
+ return new IMethodFilter() {
+ @Override
+ public boolean accept(IMethod candidate) {
+ if (TypeUtility.exists(candidate)) {
+ if (candidate.getElementName().equals(method.getElementName())) {
+ String[] candidateParameters = candidate.getParameterTypes();
+ String[] methodParameters = method.getParameterTypes();
+ if (methodParameters.length == candidateParameters.length) {
+ for (int i = 0; i < candidateParameters.length; i++) {
+ String cParam = candidateParameters[i];
+ String mParam = methodParameters[i];
+ int cArrCount = Signature.getArrayCount(cParam);
+ int mArrCount = Signature.getArrayCount(mParam);
+ if (cArrCount != mArrCount) {
+ return false;
+ }
+ cParam = cParam.substring(cArrCount);
+ mParam = mParam.substring(mArrCount);
+ mParam = Signature.getTypeErasure(mParam);
+ cParam = Signature.getTypeErasure(cParam);
+ if (Signature.getTypeSignatureKind(cParam) == Signature.TYPE_VARIABLE_SIGNATURE ||
+ Signature.getTypeSignatureKind(mParam) == Signature.TYPE_VARIABLE_SIGNATURE) {
+ continue;
+ }
+ else if (!Signature.getSignatureSimpleName(mParam).equals(Signature.getSignatureSimpleName(cParam))) {
+ return false;
+
+ }
+ }
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ };
+ }
+
+ public static IMethodFilter getMultiMethodFilter(final IMethodFilter... filters) {
+ return new IMethodFilter() {
+ @Override
+ public boolean accept(IMethod method) {
+ if (filters == null) {
+ return true;
+ }
+ else {
+ for (IMethodFilter f : filters) {
+ if (!f.accept(method)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ };
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/PropertyBean.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/PropertyBean.java
index d1d9dd678..8a9a9e3d8 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/PropertyBean.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/PropertyBean.java
@@ -1,126 +1,126 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.type;
-
-import java.util.ArrayList;
-
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.signature.SignatureUtility;
-
-/**
- * Default description of a Java bean property.
- */
-public class PropertyBean implements IPropertyBean {
-
- private IField m_field;
- private IMethod m_readMethod;
- private IMethod m_writeMethod;
- private String m_beanName;
- private final IType m_declaringType;
-
- public PropertyBean(IType declaringType, String beanName) {
- m_declaringType = declaringType;
- m_beanName = beanName;
- }
-
- @Override
- public IType getDeclaringType() {
- return m_declaringType;
- }
-
- @Override
- public IMember[] getAllMembers() {
- ArrayList<IMember> members = new ArrayList<IMember>();
- if (TypeUtility.exists(m_field)) {
- members.add(m_field);
- }
- if (TypeUtility.exists(m_readMethod)) {
- members.add(m_readMethod);
- }
- if (TypeUtility.exists(m_writeMethod)) {
- members.add(m_writeMethod);
- }
- return members.toArray(new IMember[members.size()]);
- }
-
- public void setBeanName(String beanName) {
- m_beanName = beanName;
- }
-
- @Override
- public String getBeanName() {
- return m_beanName;
- }
-
- @Override
- public String getBeanSignature() {
- String beanSignature = null;
- if (TypeUtility.exists(getReadMethod())) {
- try {
- String methodSig = getReadMethod().getSignature();
- beanSignature = Signature.getReturnType(methodSig);
- beanSignature = SignatureUtility.getQuallifiedSignature(beanSignature, getReadMethod().getDeclaringType());
- return beanSignature;
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not parse signature of '" + getReadMethod().getElementName() + "' in type '" + getReadMethod().getDeclaringType().getFullyQualifiedName() + "'.", e);
- }
- }
- if (TypeUtility.exists(getWriteMethod())) {
- try {
- String methodSig = getReadMethod().getSignature();
- String[] paramSignature = Signature.getParameterTypes(methodSig);
- if (paramSignature != null && paramSignature.length == 1) {
- beanSignature = paramSignature[0];
- beanSignature = SignatureUtility.getQuallifiedSignature(beanSignature, getWriteMethod().getDeclaringType());
- return beanSignature;
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not parse signature of '" + getWriteMethod().getElementName() + "' in type '" + getWriteMethod().getDeclaringType().getFullyQualifiedName() + "'.", e);
- }
- }
- return null;
- }
-
- @Override
- public IField getField() {
- return m_field;
- }
-
- public void setField(IField field) {
- m_field = field;
- }
-
- @Override
- public IMethod getReadMethod() {
- return m_readMethod;
- }
-
- public void setReadMethod(IMethod readMethod) {
- m_readMethod = readMethod;
- }
-
- @Override
- public IMethod getWriteMethod() {
- return m_writeMethod;
- }
-
- public void setWriteMethod(IMethod writeMethod) {
- m_writeMethod = writeMethod;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.type;
+
+import java.util.ArrayList;
+
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.signature.SignatureUtility;
+
+/**
+ * Default description of a Java bean property.
+ */
+public class PropertyBean implements IPropertyBean {
+
+ private IField m_field;
+ private IMethod m_readMethod;
+ private IMethod m_writeMethod;
+ private String m_beanName;
+ private final IType m_declaringType;
+
+ public PropertyBean(IType declaringType, String beanName) {
+ m_declaringType = declaringType;
+ m_beanName = beanName;
+ }
+
+ @Override
+ public IType getDeclaringType() {
+ return m_declaringType;
+ }
+
+ @Override
+ public IMember[] getAllMembers() {
+ ArrayList<IMember> members = new ArrayList<IMember>();
+ if (TypeUtility.exists(m_field)) {
+ members.add(m_field);
+ }
+ if (TypeUtility.exists(m_readMethod)) {
+ members.add(m_readMethod);
+ }
+ if (TypeUtility.exists(m_writeMethod)) {
+ members.add(m_writeMethod);
+ }
+ return members.toArray(new IMember[members.size()]);
+ }
+
+ public void setBeanName(String beanName) {
+ m_beanName = beanName;
+ }
+
+ @Override
+ public String getBeanName() {
+ return m_beanName;
+ }
+
+ @Override
+ public String getBeanSignature() {
+ String beanSignature = null;
+ if (TypeUtility.exists(getReadMethod())) {
+ try {
+ String methodSig = getReadMethod().getSignature();
+ beanSignature = Signature.getReturnType(methodSig);
+ beanSignature = SignatureUtility.getQuallifiedSignature(beanSignature, getReadMethod().getDeclaringType());
+ return beanSignature;
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not parse signature of '" + getReadMethod().getElementName() + "' in type '" + getReadMethod().getDeclaringType().getFullyQualifiedName() + "'.", e);
+ }
+ }
+ if (TypeUtility.exists(getWriteMethod())) {
+ try {
+ String methodSig = getReadMethod().getSignature();
+ String[] paramSignature = Signature.getParameterTypes(methodSig);
+ if (paramSignature != null && paramSignature.length == 1) {
+ beanSignature = paramSignature[0];
+ beanSignature = SignatureUtility.getQuallifiedSignature(beanSignature, getWriteMethod().getDeclaringType());
+ return beanSignature;
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not parse signature of '" + getWriteMethod().getElementName() + "' in type '" + getWriteMethod().getDeclaringType().getFullyQualifiedName() + "'.", e);
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public IField getField() {
+ return m_field;
+ }
+
+ public void setField(IField field) {
+ m_field = field;
+ }
+
+ @Override
+ public IMethod getReadMethod() {
+ return m_readMethod;
+ }
+
+ public void setReadMethod(IMethod readMethod) {
+ m_readMethod = readMethod;
+ }
+
+ @Override
+ public IMethod getWriteMethod() {
+ return m_writeMethod;
+ }
+
+ public void setWriteMethod(IMethod writeMethod) {
+ m_writeMethod = writeMethod;
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/PropertyBeanComparators.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/PropertyBeanComparators.java
index ce1b8bc8b..3e0dde384 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/PropertyBeanComparators.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/PropertyBeanComparators.java
@@ -1,47 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.type;
-
-import java.util.Comparator;
-
-import org.eclipse.scout.commons.CompositeObject;
-
-/**
- * Convenience class for commonly used {@link IPropertyBean} comparators.
- */
-public final class PropertyBeanComparators {
-
- private PropertyBeanComparators() {
- }
-
- /**
- * @return Returns a new instance of a name-based {@link IPropertyBean} comparator.
- */
- public static Comparator<IPropertyBean> getNameComparator() {
- return new Comparator<IPropertyBean>() {
- @Override
- public int compare(IPropertyBean p1, IPropertyBean p2) {
- if (p1 == null && p2 == null) {
- return 0;
- }
- else if (p1 == null) {
- return 1;
- }
- else if (p2 == null) {
- return -1;
- }
- CompositeObject m1c = new CompositeObject(p1.getBeanName(), p1);
- CompositeObject m2c = new CompositeObject(p2.getBeanName(), p2);
- return m1c.compareTo(m2c);
- }
- };
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.type;
+
+import java.util.Comparator;
+
+import org.eclipse.scout.commons.CompositeObject;
+
+/**
+ * Convenience class for commonly used {@link IPropertyBean} comparators.
+ */
+public final class PropertyBeanComparators {
+
+ private PropertyBeanComparators() {
+ }
+
+ /**
+ * @return Returns a new instance of a name-based {@link IPropertyBean} comparator.
+ */
+ public static Comparator<IPropertyBean> getNameComparator() {
+ return new Comparator<IPropertyBean>() {
+ @Override
+ public int compare(IPropertyBean p1, IPropertyBean p2) {
+ if (p1 == null && p2 == null) {
+ return 0;
+ }
+ else if (p1 == null) {
+ return 1;
+ }
+ else if (p2 == null) {
+ return -1;
+ }
+ CompositeObject m1c = new CompositeObject(p1.getBeanName(), p1);
+ CompositeObject m2c = new CompositeObject(p2.getBeanName(), p2);
+ return m1c.compareTo(m2c);
+ }
+ };
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeComparators.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeComparators.java
index d4603d5f7..3540566f1 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeComparators.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeComparators.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.type;
-
-import java.util.Comparator;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.commons.CompositeObject;
-
-/**
- *
- */
-public class TypeComparators {
- public static Comparator<IType> getTypeNameComparator() {
- return new Comparator<IType>() {
- @Override
- public int compare(IType t1, IType t2) {
- CompositeObject ct1 = new CompositeObject(t1.getElementName(), t1.getFullyQualifiedName(), t1);
- CompositeObject ct2 = new CompositeObject(t2.getElementName(), t2.getFullyQualifiedName(), t2);
- return ct1.compareTo(ct2);
- }
- };
- }
-
- public static Comparator<IType> getHashCodeComparator() {
- return new Comparator<IType>() {
- @Override
- public int compare(IType t1, IType t2) {
- if (t1 == null && t2 == null) {
- return 0;
- }
- else if (t1 == null) {
- return -1;
- }
- else if (t2 == null) {
- return 1;
- }
- else {
- return t1.hashCode() - t2.hashCode();
- }
- }
- };
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.type;
+
+import java.util.Comparator;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.commons.CompositeObject;
+
+/**
+ *
+ */
+public class TypeComparators {
+ public static Comparator<IType> getTypeNameComparator() {
+ return new Comparator<IType>() {
+ @Override
+ public int compare(IType t1, IType t2) {
+ CompositeObject ct1 = new CompositeObject(t1.getElementName(), t1.getFullyQualifiedName(), t1);
+ CompositeObject ct2 = new CompositeObject(t2.getElementName(), t2.getFullyQualifiedName(), t2);
+ return ct1.compareTo(ct2);
+ }
+ };
+ }
+
+ public static Comparator<IType> getHashCodeComparator() {
+ return new Comparator<IType>() {
+ @Override
+ public int compare(IType t1, IType t2) {
+ if (t1 == null && t2 == null) {
+ return 0;
+ }
+ else if (t1 == null) {
+ return -1;
+ }
+ else if (t2 == null) {
+ return 1;
+ }
+ else {
+ return t1.hashCode() - t2.hashCode();
+ }
+ }
+ };
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeFilters.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeFilters.java
index cf008324d..170354d39 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeFilters.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeFilters.java
@@ -1,343 +1,343 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.type;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.typecache.ITypeHierarchy;
-
-/**
- *
- */
-public class TypeFilters {
-
- public static ITypeFilter invertFilter(final ITypeFilter filter) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType type) {
- return !filter.accept(type);
- }
- };
- }
-
- /**
- * @param type
- * @return
- * @note this filter is expensive - for every candidate a super type hierarchy will be created. Use
- * {@link TypeFilters#getSubtypeFilter(IType, ITypeHierarchy)} when ever possible.
- */
- public static ITypeFilter getSubtypeFilter(final IType type) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType candidate) {
- try {
- org.eclipse.jdt.core.ITypeHierarchy hierarchy = candidate.newSupertypeHierarchy(null);
- return hierarchy.contains(type);
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not create super hierarchy of '" + candidate.getElementName() + "'.", e);
- return false;
- }
- }
- };
- }
-
- public static ITypeFilter getSubtypeFilter(final IType type, final ITypeHierarchy hierarchy) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType candidate) {
- return hierarchy.isSubtype(type, candidate);
- }
- };
- }
-
- public static ITypeFilter getElementNameFilter(final String typeName) {
- return new ITypeFilter() {
-
- @Override
- public boolean accept(IType type) {
- return type.getElementName().equals(typeName);
- }
- };
- }
-
- public static ITypeFilter getRegexSimpleNameFilter(final String regex) {
- return new ITypeFilter() {
-
- @Override
- public boolean accept(IType type) {
- return type.getElementName().matches(regex);
- }
- };
- }
-
- public static ITypeFilter getCompilationUnitFilter(final ICompilationUnit icu) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType type) {
- if (!type.isBinary()) {
- return icu.equals(type.getCompilationUnit());
- }
- return false;
- }
- };
- }
-
- public static ITypeFilter getInnterTypeFilter(final IType type) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType t) {
- if (t != null) {
- if (t.equals(type)) {
- return true;
- }
- else {
- return accept(t.getDeclaringType());
- }
- }
- return false;
- }
- };
- }
-
- public static ITypeFilter getPackageFilter(final IPackageFragment packageFragment) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType type) {
- return type.getPackageFragment().equals(packageFragment);
- }
- };
- }
-
- public static ITypeFilter getTypesInProjects(IJavaProject[] projects) {
- final HashSet<IJavaProject> finalProjects = new HashSet<IJavaProject>(Arrays.asList(projects));
- return new ITypeFilter() {
-
- @Override
- public boolean accept(IType candidate) {
- if (!TypeUtility.exists(candidate) || candidate.isBinary()) {
- return false;
- }
- return finalProjects.contains(candidate.getJavaProject()) && isClass(candidate);
- }
- };
- }
-
- public static ITypeFilter getClassesInProject(final IJavaProject project) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType candidate) {
- if (candidate == null || !candidate.exists() || candidate.isBinary()) {
- return false;
- }
- return candidate.getJavaProject().equals(project) && isClass(candidate);
- }
- };
- }
-
- public static ITypeFilter getTypesOnClasspath(final IJavaProject project) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType candidate) {
- if (!TypeUtility.exists(candidate)) {
- return false;
- }
- return TypeUtility.isOnClasspath(candidate, project);
- }
- };
- }
-
- public static ITypeFilter getInWorkspaceFilter() {
- return new ITypeFilter() {
-
- @Override
- public boolean accept(IType type) {
- return !type.isBinary() && !type.isReadOnly();
- }
- };
- }
-
- public static ITypeFilter getToplevelTypeFilter() {
- return new ITypeFilter() {
-
- @Override
- public boolean accept(IType type) {
- return TypeUtility.exists(type) && !TypeUtility.exists(type.getDeclaringType());
- }
- };
- }
-
- public static ITypeFilter getInnerClasses(final IType declaringType) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType candidate) {
- if (candidate == null || !candidate.exists() || candidate.isBinary()) {
- return false;
- }
- IType candidateDeclaringType = candidate.getDeclaringType();
- return candidateDeclaringType != null && candidateDeclaringType.equals(declaringType) && isClass(candidate);
- }
- };
- }
-
- public static ITypeFilter getInHierarchyFilter(final ITypeHierarchy hierarchy) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType type) {
- return hierarchy.contains(type);
- }
- };
- }
-
- public static ITypeFilter getAbstractOnClasspath(final IJavaProject project) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType type) {
- try {
- int flags = type.getFlags();
- return !Flags.isInterface(flags) && Flags.isAbstract(flags) && !Flags.isDeprecated(flags) && TypeUtility.isOnClasspath(type, project);
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("could not filter type '" + type.getFullyQualifiedName() + "'.", e);
- return false;
- }
- }
- };
- }
-
- public static ITypeFilter getFlagsFilter(final int flags) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType type) {
- try {
- int typeFlags = type.getFlags();
- return ((typeFlags & flags) == flags);
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("could not filter type '" + type.getFullyQualifiedName() + "'.", e);
- return false;
- }
- }
- };
- }
-
- public static ITypeFilter getClassFilter() {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType candidate) {
- return isClass(candidate);
- }
- };
- }
-
- public static ITypeFilter getExistingFilter() {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType type) {
- return type != null && type.exists();
- }
- };
- }
-
- public static ITypeFilter getNotInTypes(IType... excludedTypes) {
- HashSet<IType> excludedSet = new HashSet<IType>();
- if (excludedTypes != null) {
- excludedSet.addAll(Arrays.asList(excludedTypes));
- }
- return getNotInTypes(excludedSet);
- }
-
- public static ITypeFilter getNotInTypes(final Set<IType> excludedTypes) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType type) {
- if (excludedTypes == null) {
- return true;
- }
- return !excludedTypes.contains(type);
- }
- };
- }
-
- public static ITypeFilter getInterfaceFilter() {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType candidate) {
- try {
- int flags = candidate.getFlags();
- return Flags.isInterface(flags) && !Flags.isDeprecated(flags);
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not evalutate flags of type '" + candidate.getFullyQualifiedName() + "'.", e);
- return false;
- }
- }
- };
- }
-
- protected static boolean isClass(IType type) {
- try {
- int flags = type.getFlags();
- return !Flags.isAbstract(flags) && !Flags.isInterface(flags) && !Flags.isDeprecated(flags);
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not evalutate flags of type '" + type.getFullyQualifiedName() + "'.", e);
- return false;
- }
- }
-
- public static ITypeFilter getMultiTypeFilterOr(final ITypeFilter... filters) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType candidate) {
- if (filters == null) {
- return true;
- }
- else {
- for (ITypeFilter f : filters) {
- if (f.accept(candidate)) {
- return true;
- }
- }
- return false;
- }
- }
- };
- }
-
- public static ITypeFilter getMultiTypeFilter(final ITypeFilter... filters) {
- return new ITypeFilter() {
- @Override
- public boolean accept(IType candidate) {
- if (filters == null) {
- return true;
- }
- else {
- for (ITypeFilter f : filters) {
- if (!f.accept(candidate)) {
- return false;
- }
- }
- return true;
- }
- }
- };
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.type;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.typecache.ITypeHierarchy;
+
+/**
+ *
+ */
+public class TypeFilters {
+
+ public static ITypeFilter invertFilter(final ITypeFilter filter) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType type) {
+ return !filter.accept(type);
+ }
+ };
+ }
+
+ /**
+ * @param type
+ * @return
+ * @note this filter is expensive - for every candidate a super type hierarchy will be created. Use
+ * {@link TypeFilters#getSubtypeFilter(IType, ITypeHierarchy)} when ever possible.
+ */
+ public static ITypeFilter getSubtypeFilter(final IType type) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType candidate) {
+ try {
+ org.eclipse.jdt.core.ITypeHierarchy hierarchy = candidate.newSupertypeHierarchy(null);
+ return hierarchy.contains(type);
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not create super hierarchy of '" + candidate.getElementName() + "'.", e);
+ return false;
+ }
+ }
+ };
+ }
+
+ public static ITypeFilter getSubtypeFilter(final IType type, final ITypeHierarchy hierarchy) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType candidate) {
+ return hierarchy.isSubtype(type, candidate);
+ }
+ };
+ }
+
+ public static ITypeFilter getElementNameFilter(final String typeName) {
+ return new ITypeFilter() {
+
+ @Override
+ public boolean accept(IType type) {
+ return type.getElementName().equals(typeName);
+ }
+ };
+ }
+
+ public static ITypeFilter getRegexSimpleNameFilter(final String regex) {
+ return new ITypeFilter() {
+
+ @Override
+ public boolean accept(IType type) {
+ return type.getElementName().matches(regex);
+ }
+ };
+ }
+
+ public static ITypeFilter getCompilationUnitFilter(final ICompilationUnit icu) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType type) {
+ if (!type.isBinary()) {
+ return icu.equals(type.getCompilationUnit());
+ }
+ return false;
+ }
+ };
+ }
+
+ public static ITypeFilter getInnterTypeFilter(final IType type) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType t) {
+ if (t != null) {
+ if (t.equals(type)) {
+ return true;
+ }
+ else {
+ return accept(t.getDeclaringType());
+ }
+ }
+ return false;
+ }
+ };
+ }
+
+ public static ITypeFilter getPackageFilter(final IPackageFragment packageFragment) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType type) {
+ return type.getPackageFragment().equals(packageFragment);
+ }
+ };
+ }
+
+ public static ITypeFilter getTypesInProjects(IJavaProject[] projects) {
+ final HashSet<IJavaProject> finalProjects = new HashSet<IJavaProject>(Arrays.asList(projects));
+ return new ITypeFilter() {
+
+ @Override
+ public boolean accept(IType candidate) {
+ if (!TypeUtility.exists(candidate) || candidate.isBinary()) {
+ return false;
+ }
+ return finalProjects.contains(candidate.getJavaProject()) && isClass(candidate);
+ }
+ };
+ }
+
+ public static ITypeFilter getClassesInProject(final IJavaProject project) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType candidate) {
+ if (candidate == null || !candidate.exists() || candidate.isBinary()) {
+ return false;
+ }
+ return candidate.getJavaProject().equals(project) && isClass(candidate);
+ }
+ };
+ }
+
+ public static ITypeFilter getTypesOnClasspath(final IJavaProject project) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType candidate) {
+ if (!TypeUtility.exists(candidate)) {
+ return false;
+ }
+ return TypeUtility.isOnClasspath(candidate, project);
+ }
+ };
+ }
+
+ public static ITypeFilter getInWorkspaceFilter() {
+ return new ITypeFilter() {
+
+ @Override
+ public boolean accept(IType type) {
+ return !type.isBinary() && !type.isReadOnly();
+ }
+ };
+ }
+
+ public static ITypeFilter getToplevelTypeFilter() {
+ return new ITypeFilter() {
+
+ @Override
+ public boolean accept(IType type) {
+ return TypeUtility.exists(type) && !TypeUtility.exists(type.getDeclaringType());
+ }
+ };
+ }
+
+ public static ITypeFilter getInnerClasses(final IType declaringType) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType candidate) {
+ if (candidate == null || !candidate.exists() || candidate.isBinary()) {
+ return false;
+ }
+ IType candidateDeclaringType = candidate.getDeclaringType();
+ return candidateDeclaringType != null && candidateDeclaringType.equals(declaringType) && isClass(candidate);
+ }
+ };
+ }
+
+ public static ITypeFilter getInHierarchyFilter(final ITypeHierarchy hierarchy) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType type) {
+ return hierarchy.contains(type);
+ }
+ };
+ }
+
+ public static ITypeFilter getAbstractOnClasspath(final IJavaProject project) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType type) {
+ try {
+ int flags = type.getFlags();
+ return !Flags.isInterface(flags) && Flags.isAbstract(flags) && !Flags.isDeprecated(flags) && TypeUtility.isOnClasspath(type, project);
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("could not filter type '" + type.getFullyQualifiedName() + "'.", e);
+ return false;
+ }
+ }
+ };
+ }
+
+ public static ITypeFilter getFlagsFilter(final int flags) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType type) {
+ try {
+ int typeFlags = type.getFlags();
+ return ((typeFlags & flags) == flags);
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("could not filter type '" + type.getFullyQualifiedName() + "'.", e);
+ return false;
+ }
+ }
+ };
+ }
+
+ public static ITypeFilter getClassFilter() {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType candidate) {
+ return isClass(candidate);
+ }
+ };
+ }
+
+ public static ITypeFilter getExistingFilter() {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType type) {
+ return type != null && type.exists();
+ }
+ };
+ }
+
+ public static ITypeFilter getNotInTypes(IType... excludedTypes) {
+ HashSet<IType> excludedSet = new HashSet<IType>();
+ if (excludedTypes != null) {
+ excludedSet.addAll(Arrays.asList(excludedTypes));
+ }
+ return getNotInTypes(excludedSet);
+ }
+
+ public static ITypeFilter getNotInTypes(final Set<IType> excludedTypes) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType type) {
+ if (excludedTypes == null) {
+ return true;
+ }
+ return !excludedTypes.contains(type);
+ }
+ };
+ }
+
+ public static ITypeFilter getInterfaceFilter() {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType candidate) {
+ try {
+ int flags = candidate.getFlags();
+ return Flags.isInterface(flags) && !Flags.isDeprecated(flags);
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not evalutate flags of type '" + candidate.getFullyQualifiedName() + "'.", e);
+ return false;
+ }
+ }
+ };
+ }
+
+ protected static boolean isClass(IType type) {
+ try {
+ int flags = type.getFlags();
+ return !Flags.isAbstract(flags) && !Flags.isInterface(flags) && !Flags.isDeprecated(flags);
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not evalutate flags of type '" + type.getFullyQualifiedName() + "'.", e);
+ return false;
+ }
+ }
+
+ public static ITypeFilter getMultiTypeFilterOr(final ITypeFilter... filters) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType candidate) {
+ if (filters == null) {
+ return true;
+ }
+ else {
+ for (ITypeFilter f : filters) {
+ if (f.accept(candidate)) {
+ return true;
+ }
+ }
+ return false;
+ }
+ }
+ };
+ }
+
+ public static ITypeFilter getMultiTypeFilter(final ITypeFilter... filters) {
+ return new ITypeFilter() {
+ @Override
+ public boolean accept(IType candidate) {
+ if (filters == null) {
+ return true;
+ }
+ else {
+ for (ITypeFilter f : filters) {
+ if (!f.accept(candidate)) {
+ return false;
+ }
+ }
+ return true;
+ }
+ }
+ };
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeUtility.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeUtility.java
index 537c166f3..a028e157e 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeUtility.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/type/TypeUtility.java
@@ -1,766 +1,766 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.type;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.TreeSet;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IImportDeclaration;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IMember;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IRegion;
-import org.eclipse.jdt.core.ISourceRange;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.internal.codeassist.impl.AssistOptions;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
-import org.eclipse.scout.sdk.util.jdt.SourceRange;
-import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
-import org.eclipse.scout.sdk.util.typecache.ITypeHierarchy;
-import org.eclipse.scout.sdk.util.typecache.TypeCacheAccessor;
-
-@SuppressWarnings("restriction")
-public class TypeUtility {
-
- private static final Pattern BEAN_METHOD_NAME = Pattern.compile("(get|set|is)([A-Z].*)");
-
- protected TypeUtility() {
- }
-
- public static IType getType(String fullyQualifiedName) {
- return TypeCacheAccessor.getTypeCache().getType(fullyQualifiedName);
- }
-
- public static IType[] getTypes(String fullyQualifiedName) {
- return TypeCacheAccessor.getTypeCache().getTypes(fullyQualifiedName);
- }
-
- public static boolean existsType(String fullyQualifiedName) {
- return TypeCacheAccessor.getTypeCache().existsType(fullyQualifiedName);
- }
-
- public static IType[] getAllCachedTypes() {
- return TypeCacheAccessor.getTypeCache().getAllCachedTypes();
- }
-
- public static IJavaSearchScope newSearchScope(IJavaElement element) {
- return newSearchScope(new IJavaElement[]{element});
- }
-
- public static IJavaSearchScope newSearchScope(IJavaElement[] elements) {
- return SearchEngine.createJavaSearchScope(elements);
- }
-
- public static IPackageFragment[] getSubPackages(IPackageFragment packageFragment) {
- ArrayList<IPackageFragment> subPackages = new ArrayList<IPackageFragment>();
- String prefix = packageFragment.getElementName() + ".";
- IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot) packageFragment.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
- if (TypeUtility.exists(packageFragmentRoot)) {
- try {
- for (IJavaElement candidate : packageFragmentRoot.getChildren()) {
- if (TypeUtility.exists(candidate) && candidate.getElementType() == IJavaElement.PACKAGE_FRAGMENT && candidate.getElementName().startsWith(prefix)) {
- subPackages.add((IPackageFragment) candidate);
- }
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("could not get subpackages of '" + packageFragment.getElementName() + "'.", e);
- }
- }
-
- return subPackages.toArray(new IPackageFragment[subPackages.size()]);
- }
-
- public static boolean isSubtype(IType type, IType potentialSubtype, org.eclipse.jdt.core.ITypeHierarchy hierarchy) {
- HashSet<IType> allSubtypes = new HashSet<IType>(Arrays.asList(hierarchy.getAllSubtypes(type)));
- return allSubtypes.contains(potentialSubtype);
- }
-
- public static IType[] toArray(IType... types) {
- if (types == null) {
- return new IType[0];
- }
- return types;
- }
-
- public static IType[] getInnerTypes(IType type) {
- return getInnerTypes(type, null);
- }
-
- public static IType[] getInnerTypes(IType type, ITypeFilter filter) {
- return getInnerTypes(type, filter, null);
- }
-
- public static IType[] getInnerTypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
- Collection<IType> unsortedTypes = new ArrayList<IType>();
- try {
- for (IType subType : type.getTypes()) {
- if (filter == null || filter.accept(subType)) {
- unsortedTypes.add(subType);
- }
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not get inner types of '" + type.getFullyQualifiedName() + "'", e);
- }
- if (comparator == null) {
- return unsortedTypes.toArray(new IType[unsortedTypes.size()]);
- }
- else {
- TreeSet<IType> sortedTypes = new TreeSet<IType>(comparator);
- sortedTypes.addAll(unsortedTypes);
- return sortedTypes.toArray(new IType[sortedTypes.size()]);
- }
- }
-
- public static IType[] getInnerTypesOrdered(IType declaringType, IType superType, Comparator<IType> comparator) {
- ITypeHierarchy combinedTypeHierarchy = getLocalTypeHierarchy(declaringType);
- IType[] allSubtypes = TypeUtility.getInnerTypes(declaringType, TypeFilters.getSubtypeFilter(superType, combinedTypeHierarchy), comparator);
- return allSubtypes;
- }
-
- public static IType getTypeBySignature(String signature) {
- signature = Signature.getTypeErasure(signature);
- int arrayCount = Signature.getArrayCount(signature);
- if (arrayCount > 0) {
- signature = signature.substring(arrayCount);
- }
- String fqn = Signature.toString(signature);
- return getType(fqn);
- }
-
- /**
- * To get a type hierarchy with the given elements as scope.
- *
- * @param elements
- * @return
- */
- public static ITypeHierarchy getLocalTypeHierarchy(IJavaElement... elements) {
- IRegion region = JavaCore.newRegion();
- if (elements != null) {
- for (IJavaElement e : elements) {
- region.add(e);
- }
- }
- return TypeCacheAccessor.getHierarchyCache().getLocalHierarchy(region);
- }
-
- public static ITypeHierarchy getLocalTypeHierarchy(IRegion region) {
- return TypeCacheAccessor.getHierarchyCache().getLocalHierarchy(region);
- }
-
- public static ITypeHierarchy getSuperTypeHierarchy(IType type) {
- return TypeCacheAccessor.getHierarchyCache().getSuperHierarchy(type);
- }
-
- public static IPrimaryTypeTypeHierarchy[] getAllCachedPrimaryTypeHierarchies() throws IllegalArgumentException {
- return TypeCacheAccessor.getHierarchyCache().getAllCachedHierarchies();
- }
-
- /**
- * To get a type hierarchy containing no inner types and tracking changes of all primary types in the hierarchy. <br>
- * <br>
- * <b> Note: </b> the listener reference is a weak reference. If users do not keep the reference the type hierarchy
- * will be removed from cache and released.
- *
- * @param type
- * the type to get the primary type hierarchy for must be a primary type
- * @return the cached type hierarchy or null if type does not exist or hierarchy could not be created.
- * @throws IllegalArgumentException
- * if the given type is not a primary type.
- */
- public static IPrimaryTypeTypeHierarchy getPrimaryTypeHierarchy(IType type) throws IllegalArgumentException {
- return TypeCacheAccessor.getHierarchyCache().getPrimaryTypeHierarchy(type);
- }
-
- public static boolean hasInnerType(IType declaringType, String typeName) {
- IType candidate = declaringType.getType(typeName);
- return candidate != null && candidate.exists();
- }
-
- public static ISourceRange getContentRange(IMethod method) throws JavaModelException {
- SourceRange contentRange = null;
- if (TypeUtility.exists(method)) {
- ISourceRange methodRange = method.getSourceRange();
- ISourceRange nameRange = method.getNameRange();
- int contentOffset = nameRange.getOffset() - methodRange.getOffset();
- contentRange = new SourceRange(contentOffset, methodRange.getLength() - contentOffset);
- String regex = "\\A" + method.getElementName() + "[^{]*\\{(.*)\\}\\s*\\z";
- CharSequence source = method.getSource().subSequence(contentRange.getOffset(), contentRange.getOffset() + contentRange.getLength());
- Matcher matcher = Pattern.compile(regex, Pattern.DOTALL | Pattern.MULTILINE).matcher(source);
- if (matcher.find()) {
- contentRange.setOffset(methodRange.getOffset() + contentRange.getOffset() + matcher.start(1));
- contentRange.setLength(matcher.end(1) - matcher.start(1));
- }
- else {
- contentRange = null;
- }
- }
- return contentRange;
- }
-
- public static IMethod findMethodInHierarchy(IType type, IMethodFilter filter) {
- try {
- return findMethodInHierarchy(type, type.newSupertypeHierarchy(null), filter);
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not create super type hierarchy of '" + type.getFullyQualifiedName() + "'.", e);
- return null;
- }
- }
-
- public static IMethod findMethodInHierarchy(IType type, org.eclipse.jdt.core.ITypeHierarchy hierarchy, IMethodFilter filter) {
- if (exists(type)) {
- IMethod method = getFirstMethod(type, filter);
- if (TypeUtility.exists(method)) {
- return method;
- }
- else {
- findMethodInHierarchy(hierarchy.getSuperclass(type), hierarchy, filter);
- }
- }
- return null;
- }
-
- public static IMethod getFirstMethod(IType type, IMethodFilter filter) {
- try {
- for (IMethod method : type.getMethods()) {
- if (filter == null || filter.accept(method)) {
- return method;
- }
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not get methods of '" + type.getFullyQualifiedName() + "'.", e);
- }
- return null;
- }
-
- public static IMethod getMethod(IType type, final String methodName) {
- IMethod[] methods = getMethods(type, new IMethodFilter() {
- @Override
- public boolean accept(IMethod method) {
- return method.getElementName().equals(methodName);
- }
- });
- if (methods.length > 0) {
- return methods[0];
- }
- return null;
- }
-
- public static IMethod[] getMethods(IType type) {
- return getMethods(type, null);
- }
-
- public static IMethod[] getMethods(IType type, IMethodFilter filter) {
- return getMethods(type, filter, null);
- }
-
- public static IMethod[] getMethods(IType type, IMethodFilter filter, Comparator<IMethod> comparator) {
- Collection<IMethod> unsortedMethods = new ArrayList<IMethod>();
- try {
- for (IMethod method : type.getMethods()) {
- if (filter == null || filter.accept(method)) {
- unsortedMethods.add(method);
- }
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not get methods of '" + type.getFullyQualifiedName() + "'.", e);
- }
- if (comparator == null) {
- return unsortedMethods.toArray(new IMethod[unsortedMethods.size()]);
- }
- else {
- TreeSet<IMethod> sortedMethods = new TreeSet<IMethod>(comparator);
- sortedMethods.addAll(unsortedMethods);
- return sortedMethods.toArray(new IMethod[sortedMethods.size()]);
- }
- }
-
- public static IType getAncestor(IType type, ITypeFilter filter) {
- IType ancestorType = type;
- while (TypeUtility.exists(ancestorType)) {
- if (filter.accept(ancestorType)) {
- return ancestorType;
- }
- ancestorType = ancestorType.getDeclaringType();
- }
- return null;
- }
-
- public static IField[] getFields(IType declaringType) {
- return getFields(declaringType, null);
- }
-
- public static IField[] getFields(IType declaringType, IFieldFilter filter) {
- return getFields(declaringType, filter, null);
- }
-
- public static IField[] getFields(IType declaringType, IFieldFilter filter, Comparator<IField> comparator) {
- ArrayList<IField> unsortedFields = new ArrayList<IField>();
- try {
- for (IField candidate : declaringType.getFields()) {
- if (filter == null || filter.accept(candidate)) {
- unsortedFields.add(candidate);
- }
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not get fields of '" + declaringType.getElementName() + "'.", e);
- }
- if (comparator == null) {
- return unsortedFields.toArray(new IField[unsortedFields.size()]);
- }
- else {
- TreeSet<IField> sortedFields = new TreeSet<IField>(comparator);
- sortedFields.addAll(unsortedFields);
- return sortedFields.toArray(new IField[sortedFields.size()]);
- }
- }
-
- public static IField getFirstField(IType type, IFieldFilter filter) {
- try {
- for (IField method : type.getFields()) {
- if (filter == null || filter.accept(method)) {
- return method;
- }
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not get methods of '" + type.getFullyQualifiedName() + "'.", e);
- }
- return null;
- }
-
- public static boolean equalTypes(IType[] arr1, IType[] arr2) {
- if (arr1 == null && arr2 == null) {
- return true;
- }
- else if (arr1 == null) {
- return false;
- }
- else if (arr2 == null) {
- return false;
- }
- else if (arr1.length != arr2.length) {
- return false;
- }
- else {
- Arrays.sort(arr1, TypeComparators.getHashCodeComparator());
- Arrays.sort(arr2, TypeComparators.getHashCodeComparator());
- return Arrays.equals(arr1, arr2);
- }
- }
-
- public static IMethod getOverwrittenMethod(IMethod method, org.eclipse.jdt.core.ITypeHierarchy superTypeHierarchy) {
- IType superType = superTypeHierarchy.getSuperclass(method.getDeclaringType());
- IMethodFilter overrideFilter = MethodFilters.getSuperMethodFilter(method);
- while (superType != null) {
- IMethod superMethod = TypeUtility.getFirstMethod(superType, overrideFilter);
- if (superMethod != null) {
- return superMethod;
- }
- superType = superTypeHierarchy.getSuperclass(superType);
- }
- return null;
- }
-
- /**
- * <xmp>
- * class A{
- * class B{
- * class C{
- * }
- * class D{
- * }
- * }
- * }
- * // A.getTopLevelType() returns A
- * // D.getTopLevelType() returns A
- * </xmp>
- *
- * @return the primary type of the compilation unit this type is declared in.
- */
- public static IType getToplevelType(IType type) {
- if (type == null) {
- return null;
- }
- if (type.getParent().getElementType() != IJavaElement.TYPE) {
- return type;
- }
- return getToplevelType(type.getDeclaringType());
- }
-
- public static IType[] getTypesInPackage(IPackageFragment pck) {
- return getTypesInPackage(pck, null);
- }
-
- public static IType[] getTypesInPackage(IPackageFragment pck, ITypeFilter filter) {
- return getTypesInPackage(pck, filter, null);
- }
-
- public static IType[] getTypesInPackage(IPackageFragment pck, ITypeFilter filter, Comparator<IType> comparator) {
- return getTypesInPackage(pck, filter, comparator, false);
- }
-
- public static IType[] getTypesInPackage(IPackageFragment pck, ITypeFilter filter, Comparator<IType> comparator, boolean includeSubpackages) {
-
- Collection<IType> unsortedTypes = new ArrayList<IType>();
- collectTypesInPackage(pck, filter, includeSubpackages, unsortedTypes);
-
- if (comparator == null) {
- return unsortedTypes.toArray(new IType[unsortedTypes.size()]);
- }
- else {
- TreeSet<IType> sortedTypes = new TreeSet<IType>(comparator);
- sortedTypes.addAll(unsortedTypes);
- return sortedTypes.toArray(new IType[sortedTypes.size()]);
- }
- }
-
- private static void collectTypesInPackage(IPackageFragment pck, ITypeFilter filter, boolean includeSubPackages, Collection<IType> collector) {
- try {
- if (pck != null && pck.exists()) {
- for (IJavaElement element : pck.getChildren()) {
- if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
- if (includeSubPackages) {
- collectTypesInPackage((IPackageFragment) element, filter, includeSubPackages, collector);
- }
- }
- else if (element.getElementType() == IJavaElement.COMPILATION_UNIT) {
- ICompilationUnit icu = (ICompilationUnit) element;
- IType[] types = icu.getTypes();
- if (types != null && types.length > 0) {
- collector.add(types[0]);
- }
- }
- }
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not get types of package '" + pck.getElementName() + "'", e);
- }
-
- }
-
- public static boolean exists(IJavaElement element) {
- return element != null && element.exists();
- }
-
- public static IType findInnerType(IType type, String innerTypeName) {
- if (type == null) {
- return null;
- }
- else if (StringUtility.equalsIgnoreCase(type.getElementName(), innerTypeName)) {
- return type;
- }
- else {
- try {
- for (IType innerType : type.getTypes()) {
- IType found = findInnerType(innerType, innerTypeName);
- if (found != null) {
- return found;
- }
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("could not find inner type named '" + innerTypeName + "' in type '" + type.getFullyQualifiedName() + "'.", e);
- }
- }
- return null;
- }
-
- public static IType getReferencedType(IType declaringType, String typeName) throws JavaModelException {
- ICompilationUnit compilationUnit = declaringType.getCompilationUnit();
- if (compilationUnit != null) {
- IImportDeclaration[] imports = compilationUnit.getImports();
- for (IImportDeclaration imp : imports) {
- if (imp.getElementName().endsWith("." + typeName)) {
- IType foundType = TypeUtility.getType(imp.getElementName());
- if (foundType != null) {
- return foundType;
- }
- }
- }
- }
- String[][] resolvedTypeName = declaringType.resolveType(typeName);
- if (resolvedTypeName != null && resolvedTypeName.length == 1) {
- String fqName = resolvedTypeName[0][0];
- if (fqName != null && fqName.length() > 0) {
- fqName = fqName + ".";
- }
- fqName = fqName + resolvedTypeName[0][1];
- IType foundType = getType(fqName);
- if (foundType != null) {
- return foundType;
- }
- }
- SdkUtilActivator.logWarning("could not find referenced type '" + typeName + "' in '" + declaringType.getFullyQualifiedName() + "'.");
- return null;
- }
-
- public static boolean isGenericType(IType type) {
- try {
- return exists(type) && (type.getTypeParameters().length > 0);
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logWarning("could not get generic information of type: " + type.getFullyQualifiedName(), e);
- return false;
- }
- }
-
- public static boolean isOnClasspath(IMember member, IJavaProject project) {
- if (member == null) {
- return false;
- }
- if (member.isBinary()) {
- return project.isOnClasspath(member);
- }
- else if (member.getJavaProject() != null) {
- if (member.getJavaProject().equals(project)) {
- return true;
- }
- else {
- return project.isOnClasspath(member.getJavaProject());
- }
- }
- return false;
- }
-
- /**
- * Collects all property beans declared directly in the given type by search methods with the following naming
- * convention:
- *
- * <pre>
- * public <em>&lt;PropertyType&gt;</em> get<em>&lt;PropertyType&gt;</em>();
- * public void set<em>&lt;PropertyType&gt;</em>(<em>&lt;PropertyType&gt;</em> a);
- * </pre>
- *
- * If <code>PropertyType</code> is a boolean property, the following getter is expected
- *
- * <pre>
- * public boolean is<em>&lt;PropertyType&gt;</em>();
- * </pre>
- * <p>
- * This implementation tries to determine the field by using the JDT code style settings stored in the Eclipse
- * preferences. Prefixes and suffixes used for fields must be declared. The default prefix Scout uses for fields (
- * <code>m_</code>) is added by default.
- *
- * @param type
- * the type within properties are searched
- * @param propertyFilter
- * optional property bean filter used to filter the result
- * @param comparator
- * optional property bean comparator used to sort the result
- * @return Returns an array of property bean descriptions. The array is empty if the given class does not contain any
- * bean properties.
- * @see <a href="http://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html">JavaBeans Spec</a>
- */
- public static IPropertyBean[] getPropertyBeans(IType type, IPropertyBeanFilter propertyFilter, Comparator<IPropertyBean> comparator) {
- HashMap<String, PropertyBean> beans = new HashMap<String, PropertyBean>();
- IMethodFilter filter = MethodFilters.getMultiMethodFilter(
- MethodFilters.getFlagsFilter(Flags.AccPublic),
- MethodFilters.getNameRegexFilter(BEAN_METHOD_NAME));
- IMethod[] methods = TypeUtility.getMethods(type, filter);
- for (IMethod m : methods) {
- Matcher matcher = BEAN_METHOD_NAME.matcher(m.getElementName());
- if (matcher.matches()) {
- try {
- String kind = matcher.group(1);
- String name = matcher.group(2);
- //
- String[] parameterTypes = m.getParameterTypes();
- String returnType = m.getReturnType();
- if (kind.equals("get") && parameterTypes.length == 0 && !returnType.equals(Signature.SIG_VOID)) {
- PropertyBean desc = beans.get(name);
- if (desc == null) {
- desc = new PropertyBean(type, name);
- beans.put(name, desc);
- }
- if (desc.getReadMethod() == null) {
- desc.setReadMethod(m);
- }
- }
- else if (kind.equals("is") && parameterTypes.length == 0 && returnType.equals(Signature.SIG_BOOLEAN)) {
- PropertyBean desc = beans.get(name);
- if (desc == null) {
- desc = new PropertyBean(type, name);
- beans.put(name, desc);
- }
- if (desc.getReadMethod() == null) {
- desc.setReadMethod(m);
- }
- }
- else if (kind.equals("set") && parameterTypes.length == 1 && returnType.equals(Signature.SIG_VOID)) {
- PropertyBean desc = beans.get(name);
- if (desc == null) {
- desc = new PropertyBean(type, name);
- beans.put(name, desc);
- }
- if (desc.getWriteMethod() == null) {
- desc.setWriteMethod(m);
- }
- }
- }
- catch (JavaModelException e) {
- SdkUtilActivator.logError("Error while collectiong property beans of type [" + type + "]", e);
- }
- }
- }
-
- // filter
- if (propertyFilter == null) {
- propertyFilter = new IPropertyBeanFilter() {
- @Override
- public boolean accept(IPropertyBean property) {
- return true;
- }
- };
- }
- ArrayList<PropertyBean> filteredBeans = new ArrayList<PropertyBean>();
- for (PropertyBean bean : beans.values()) {
- if (propertyFilter.accept(bean)) {
- filteredBeans.add(bean);
- }
- }
-
- // fields
- IField[] fieldCandidates = TypeUtility.getFields(type, FieldFilters.getPrivateNotStaticNotFinalNotAbstract(), null);
- HashMap<String, IField> fields = new HashMap<String, IField>();
- for (IField field : fieldCandidates) {
- fields.put(field.getElementName(), field);
- }
- AssistOptions assistOptions = new AssistOptions(type.getJavaProject().getOptions(true));
- String[] fieldPrefixes = toStringArray(assistOptions.fieldPrefixes, "m_", "");
- String[] fieldSuffixes = toStringArray(assistOptions.fieldSuffixes, "");
- for (PropertyBean bean : filteredBeans) {
- IField field = findFieldForPropertyBean(bean.getBeanName(), fields, fieldPrefixes, fieldSuffixes);
- if (field != null) {
- bean.setField(field);
- }
- else {
- SdkUtilActivator.logWarning("Unable to find field for property bean [" + bean + "]");
- }
- }
-
- // sort
- if (comparator != null) {
- Collections.sort(filteredBeans, comparator);
- }
-
- return filteredBeans.toArray(new IPropertyBean[filteredBeans.size()]);
- }
-
- /**
- * To find out if the given child element is a ancestor of the given parent element. If parent and child is the same
- * element true is returned.
- *
- * @param parent
- * @param chlid
- * @return
- */
- public static boolean isAncestor(IJavaElement parent, IJavaElement chlid) {
- if (parent == null || chlid == null) {
- return false;
- }
- if (parent.equals(chlid)) {
- return true;
- }
- else if (chlid.getParent() != null && chlid.getParent().getElementType() >= parent.getElementType()) {
- return isAncestor(parent, chlid.getParent().getAncestor(parent.getElementType()));
- }
- else {
- return false;
- }
- }
-
- /**
- * Tries to determine the field the given property is based on. All combinations of the given pre- and suffixes are
- * used to find the field. If none of them matches with a method <code>null</code> is returned.
- *
- * @param beanName
- * @param fields
- * @param fieldPrefixes
- * @param fieldSuffixes
- * @return Returns the field the property is based on or <code>null</code>.
- */
- private static IField findFieldForPropertyBean(String beanName, HashMap<String, IField> fields, String[] fieldPrefixes, String[] fieldSuffixes) {
- for (String prefix : fieldPrefixes) {
- for (String suffix : fieldSuffixes) {
- IField field = fields.get(prefix + decapitalize(beanName) + suffix);
- if (field != null) {
- return field;
- }
- }
- }
- return null;
- }
-
- /**
- * Converts the given two-dimensional array of chars into an array of strings and adds the given additional values.
- *
- * @param arrayOfChars
- * @param additionalValues
- * @return
- */
- private static String[] toStringArray(char[][] arrayOfChars, String... additionalValues) {
- HashSet<String> result = new HashSet<String>();
- if (additionalValues != null) {
- for (String s : additionalValues) {
- result.add(s);
- }
- }
- if (arrayOfChars != null) {
- for (char[] cs : arrayOfChars) {
- if (cs != null && cs.length > 0) {
- result.add(String.valueOf(cs));
- }
- }
- }
- return result.toArray(new String[result.size()]);
- }
-
- /**
- * Converts the given property name to its field name (according to JavaBeans spec).
- *
- * @param s
- * @return
- */
- private static String decapitalize(String s) {
- if (s == null || s.length() == 0) return "";
- if (s.length() >= 2 && Character.isUpperCase(s.charAt(0)) && Character.isUpperCase(s.charAt(1))) {
- return s;
- }
- return Character.toLowerCase(s.charAt(0)) + s.substring(1);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.type;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.TreeSet;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IImportDeclaration;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IRegion;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.internal.codeassist.impl.AssistOptions;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.util.internal.SdkUtilActivator;
+import org.eclipse.scout.sdk.util.jdt.SourceRange;
+import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
+import org.eclipse.scout.sdk.util.typecache.ITypeHierarchy;
+import org.eclipse.scout.sdk.util.typecache.TypeCacheAccessor;
+
+@SuppressWarnings("restriction")
+public class TypeUtility {
+
+ private static final Pattern BEAN_METHOD_NAME = Pattern.compile("(get|set|is)([A-Z].*)");
+
+ protected TypeUtility() {
+ }
+
+ public static IType getType(String fullyQualifiedName) {
+ return TypeCacheAccessor.getTypeCache().getType(fullyQualifiedName);
+ }
+
+ public static IType[] getTypes(String fullyQualifiedName) {
+ return TypeCacheAccessor.getTypeCache().getTypes(fullyQualifiedName);
+ }
+
+ public static boolean existsType(String fullyQualifiedName) {
+ return TypeCacheAccessor.getTypeCache().existsType(fullyQualifiedName);
+ }
+
+ public static IType[] getAllCachedTypes() {
+ return TypeCacheAccessor.getTypeCache().getAllCachedTypes();
+ }
+
+ public static IJavaSearchScope newSearchScope(IJavaElement element) {
+ return newSearchScope(new IJavaElement[]{element});
+ }
+
+ public static IJavaSearchScope newSearchScope(IJavaElement[] elements) {
+ return SearchEngine.createJavaSearchScope(elements);
+ }
+
+ public static IPackageFragment[] getSubPackages(IPackageFragment packageFragment) {
+ ArrayList<IPackageFragment> subPackages = new ArrayList<IPackageFragment>();
+ String prefix = packageFragment.getElementName() + ".";
+ IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot) packageFragment.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
+ if (TypeUtility.exists(packageFragmentRoot)) {
+ try {
+ for (IJavaElement candidate : packageFragmentRoot.getChildren()) {
+ if (TypeUtility.exists(candidate) && candidate.getElementType() == IJavaElement.PACKAGE_FRAGMENT && candidate.getElementName().startsWith(prefix)) {
+ subPackages.add((IPackageFragment) candidate);
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("could not get subpackages of '" + packageFragment.getElementName() + "'.", e);
+ }
+ }
+
+ return subPackages.toArray(new IPackageFragment[subPackages.size()]);
+ }
+
+ public static boolean isSubtype(IType type, IType potentialSubtype, org.eclipse.jdt.core.ITypeHierarchy hierarchy) {
+ HashSet<IType> allSubtypes = new HashSet<IType>(Arrays.asList(hierarchy.getAllSubtypes(type)));
+ return allSubtypes.contains(potentialSubtype);
+ }
+
+ public static IType[] toArray(IType... types) {
+ if (types == null) {
+ return new IType[0];
+ }
+ return types;
+ }
+
+ public static IType[] getInnerTypes(IType type) {
+ return getInnerTypes(type, null);
+ }
+
+ public static IType[] getInnerTypes(IType type, ITypeFilter filter) {
+ return getInnerTypes(type, filter, null);
+ }
+
+ public static IType[] getInnerTypes(IType type, ITypeFilter filter, Comparator<IType> comparator) {
+ Collection<IType> unsortedTypes = new ArrayList<IType>();
+ try {
+ for (IType subType : type.getTypes()) {
+ if (filter == null || filter.accept(subType)) {
+ unsortedTypes.add(subType);
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not get inner types of '" + type.getFullyQualifiedName() + "'", e);
+ }
+ if (comparator == null) {
+ return unsortedTypes.toArray(new IType[unsortedTypes.size()]);
+ }
+ else {
+ TreeSet<IType> sortedTypes = new TreeSet<IType>(comparator);
+ sortedTypes.addAll(unsortedTypes);
+ return sortedTypes.toArray(new IType[sortedTypes.size()]);
+ }
+ }
+
+ public static IType[] getInnerTypesOrdered(IType declaringType, IType superType, Comparator<IType> comparator) {
+ ITypeHierarchy combinedTypeHierarchy = getLocalTypeHierarchy(declaringType);
+ IType[] allSubtypes = TypeUtility.getInnerTypes(declaringType, TypeFilters.getSubtypeFilter(superType, combinedTypeHierarchy), comparator);
+ return allSubtypes;
+ }
+
+ public static IType getTypeBySignature(String signature) {
+ signature = Signature.getTypeErasure(signature);
+ int arrayCount = Signature.getArrayCount(signature);
+ if (arrayCount > 0) {
+ signature = signature.substring(arrayCount);
+ }
+ String fqn = Signature.toString(signature);
+ return getType(fqn);
+ }
+
+ /**
+ * To get a type hierarchy with the given elements as scope.
+ *
+ * @param elements
+ * @return
+ */
+ public static ITypeHierarchy getLocalTypeHierarchy(IJavaElement... elements) {
+ IRegion region = JavaCore.newRegion();
+ if (elements != null) {
+ for (IJavaElement e : elements) {
+ region.add(e);
+ }
+ }
+ return TypeCacheAccessor.getHierarchyCache().getLocalHierarchy(region);
+ }
+
+ public static ITypeHierarchy getLocalTypeHierarchy(IRegion region) {
+ return TypeCacheAccessor.getHierarchyCache().getLocalHierarchy(region);
+ }
+
+ public static ITypeHierarchy getSuperTypeHierarchy(IType type) {
+ return TypeCacheAccessor.getHierarchyCache().getSuperHierarchy(type);
+ }
+
+ public static IPrimaryTypeTypeHierarchy[] getAllCachedPrimaryTypeHierarchies() throws IllegalArgumentException {
+ return TypeCacheAccessor.getHierarchyCache().getAllCachedHierarchies();
+ }
+
+ /**
+ * To get a type hierarchy containing no inner types and tracking changes of all primary types in the hierarchy. <br>
+ * <br>
+ * <b> Note: </b> the listener reference is a weak reference. If users do not keep the reference the type hierarchy
+ * will be removed from cache and released.
+ *
+ * @param type
+ * the type to get the primary type hierarchy for must be a primary type
+ * @return the cached type hierarchy or null if type does not exist or hierarchy could not be created.
+ * @throws IllegalArgumentException
+ * if the given type is not a primary type.
+ */
+ public static IPrimaryTypeTypeHierarchy getPrimaryTypeHierarchy(IType type) throws IllegalArgumentException {
+ return TypeCacheAccessor.getHierarchyCache().getPrimaryTypeHierarchy(type);
+ }
+
+ public static boolean hasInnerType(IType declaringType, String typeName) {
+ IType candidate = declaringType.getType(typeName);
+ return candidate != null && candidate.exists();
+ }
+
+ public static ISourceRange getContentRange(IMethod method) throws JavaModelException {
+ SourceRange contentRange = null;
+ if (TypeUtility.exists(method)) {
+ ISourceRange methodRange = method.getSourceRange();
+ ISourceRange nameRange = method.getNameRange();
+ int contentOffset = nameRange.getOffset() - methodRange.getOffset();
+ contentRange = new SourceRange(contentOffset, methodRange.getLength() - contentOffset);
+ String regex = "\\A" + method.getElementName() + "[^{]*\\{(.*)\\}\\s*\\z";
+ CharSequence source = method.getSource().subSequence(contentRange.getOffset(), contentRange.getOffset() + contentRange.getLength());
+ Matcher matcher = Pattern.compile(regex, Pattern.DOTALL | Pattern.MULTILINE).matcher(source);
+ if (matcher.find()) {
+ contentRange.setOffset(methodRange.getOffset() + contentRange.getOffset() + matcher.start(1));
+ contentRange.setLength(matcher.end(1) - matcher.start(1));
+ }
+ else {
+ contentRange = null;
+ }
+ }
+ return contentRange;
+ }
+
+ public static IMethod findMethodInHierarchy(IType type, IMethodFilter filter) {
+ try {
+ return findMethodInHierarchy(type, type.newSupertypeHierarchy(null), filter);
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not create super type hierarchy of '" + type.getFullyQualifiedName() + "'.", e);
+ return null;
+ }
+ }
+
+ public static IMethod findMethodInHierarchy(IType type, org.eclipse.jdt.core.ITypeHierarchy hierarchy, IMethodFilter filter) {
+ if (exists(type)) {
+ IMethod method = getFirstMethod(type, filter);
+ if (TypeUtility.exists(method)) {
+ return method;
+ }
+ else {
+ findMethodInHierarchy(hierarchy.getSuperclass(type), hierarchy, filter);
+ }
+ }
+ return null;
+ }
+
+ public static IMethod getFirstMethod(IType type, IMethodFilter filter) {
+ try {
+ for (IMethod method : type.getMethods()) {
+ if (filter == null || filter.accept(method)) {
+ return method;
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not get methods of '" + type.getFullyQualifiedName() + "'.", e);
+ }
+ return null;
+ }
+
+ public static IMethod getMethod(IType type, final String methodName) {
+ IMethod[] methods = getMethods(type, new IMethodFilter() {
+ @Override
+ public boolean accept(IMethod method) {
+ return method.getElementName().equals(methodName);
+ }
+ });
+ if (methods.length > 0) {
+ return methods[0];
+ }
+ return null;
+ }
+
+ public static IMethod[] getMethods(IType type) {
+ return getMethods(type, null);
+ }
+
+ public static IMethod[] getMethods(IType type, IMethodFilter filter) {
+ return getMethods(type, filter, null);
+ }
+
+ public static IMethod[] getMethods(IType type, IMethodFilter filter, Comparator<IMethod> comparator) {
+ Collection<IMethod> unsortedMethods = new ArrayList<IMethod>();
+ try {
+ for (IMethod method : type.getMethods()) {
+ if (filter == null || filter.accept(method)) {
+ unsortedMethods.add(method);
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not get methods of '" + type.getFullyQualifiedName() + "'.", e);
+ }
+ if (comparator == null) {
+ return unsortedMethods.toArray(new IMethod[unsortedMethods.size()]);
+ }
+ else {
+ TreeSet<IMethod> sortedMethods = new TreeSet<IMethod>(comparator);
+ sortedMethods.addAll(unsortedMethods);
+ return sortedMethods.toArray(new IMethod[sortedMethods.size()]);
+ }
+ }
+
+ public static IType getAncestor(IType type, ITypeFilter filter) {
+ IType ancestorType = type;
+ while (TypeUtility.exists(ancestorType)) {
+ if (filter.accept(ancestorType)) {
+ return ancestorType;
+ }
+ ancestorType = ancestorType.getDeclaringType();
+ }
+ return null;
+ }
+
+ public static IField[] getFields(IType declaringType) {
+ return getFields(declaringType, null);
+ }
+
+ public static IField[] getFields(IType declaringType, IFieldFilter filter) {
+ return getFields(declaringType, filter, null);
+ }
+
+ public static IField[] getFields(IType declaringType, IFieldFilter filter, Comparator<IField> comparator) {
+ ArrayList<IField> unsortedFields = new ArrayList<IField>();
+ try {
+ for (IField candidate : declaringType.getFields()) {
+ if (filter == null || filter.accept(candidate)) {
+ unsortedFields.add(candidate);
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not get fields of '" + declaringType.getElementName() + "'.", e);
+ }
+ if (comparator == null) {
+ return unsortedFields.toArray(new IField[unsortedFields.size()]);
+ }
+ else {
+ TreeSet<IField> sortedFields = new TreeSet<IField>(comparator);
+ sortedFields.addAll(unsortedFields);
+ return sortedFields.toArray(new IField[sortedFields.size()]);
+ }
+ }
+
+ public static IField getFirstField(IType type, IFieldFilter filter) {
+ try {
+ for (IField method : type.getFields()) {
+ if (filter == null || filter.accept(method)) {
+ return method;
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not get methods of '" + type.getFullyQualifiedName() + "'.", e);
+ }
+ return null;
+ }
+
+ public static boolean equalTypes(IType[] arr1, IType[] arr2) {
+ if (arr1 == null && arr2 == null) {
+ return true;
+ }
+ else if (arr1 == null) {
+ return false;
+ }
+ else if (arr2 == null) {
+ return false;
+ }
+ else if (arr1.length != arr2.length) {
+ return false;
+ }
+ else {
+ Arrays.sort(arr1, TypeComparators.getHashCodeComparator());
+ Arrays.sort(arr2, TypeComparators.getHashCodeComparator());
+ return Arrays.equals(arr1, arr2);
+ }
+ }
+
+ public static IMethod getOverwrittenMethod(IMethod method, org.eclipse.jdt.core.ITypeHierarchy superTypeHierarchy) {
+ IType superType = superTypeHierarchy.getSuperclass(method.getDeclaringType());
+ IMethodFilter overrideFilter = MethodFilters.getSuperMethodFilter(method);
+ while (superType != null) {
+ IMethod superMethod = TypeUtility.getFirstMethod(superType, overrideFilter);
+ if (superMethod != null) {
+ return superMethod;
+ }
+ superType = superTypeHierarchy.getSuperclass(superType);
+ }
+ return null;
+ }
+
+ /**
+ * <xmp>
+ * class A{
+ * class B{
+ * class C{
+ * }
+ * class D{
+ * }
+ * }
+ * }
+ * // A.getTopLevelType() returns A
+ * // D.getTopLevelType() returns A
+ * </xmp>
+ *
+ * @return the primary type of the compilation unit this type is declared in.
+ */
+ public static IType getToplevelType(IType type) {
+ if (type == null) {
+ return null;
+ }
+ if (type.getParent().getElementType() != IJavaElement.TYPE) {
+ return type;
+ }
+ return getToplevelType(type.getDeclaringType());
+ }
+
+ public static IType[] getTypesInPackage(IPackageFragment pck) {
+ return getTypesInPackage(pck, null);
+ }
+
+ public static IType[] getTypesInPackage(IPackageFragment pck, ITypeFilter filter) {
+ return getTypesInPackage(pck, filter, null);
+ }
+
+ public static IType[] getTypesInPackage(IPackageFragment pck, ITypeFilter filter, Comparator<IType> comparator) {
+ return getTypesInPackage(pck, filter, comparator, false);
+ }
+
+ public static IType[] getTypesInPackage(IPackageFragment pck, ITypeFilter filter, Comparator<IType> comparator, boolean includeSubpackages) {
+
+ Collection<IType> unsortedTypes = new ArrayList<IType>();
+ collectTypesInPackage(pck, filter, includeSubpackages, unsortedTypes);
+
+ if (comparator == null) {
+ return unsortedTypes.toArray(new IType[unsortedTypes.size()]);
+ }
+ else {
+ TreeSet<IType> sortedTypes = new TreeSet<IType>(comparator);
+ sortedTypes.addAll(unsortedTypes);
+ return sortedTypes.toArray(new IType[sortedTypes.size()]);
+ }
+ }
+
+ private static void collectTypesInPackage(IPackageFragment pck, ITypeFilter filter, boolean includeSubPackages, Collection<IType> collector) {
+ try {
+ if (pck != null && pck.exists()) {
+ for (IJavaElement element : pck.getChildren()) {
+ if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT) {
+ if (includeSubPackages) {
+ collectTypesInPackage((IPackageFragment) element, filter, includeSubPackages, collector);
+ }
+ }
+ else if (element.getElementType() == IJavaElement.COMPILATION_UNIT) {
+ ICompilationUnit icu = (ICompilationUnit) element;
+ IType[] types = icu.getTypes();
+ if (types != null && types.length > 0) {
+ collector.add(types[0]);
+ }
+ }
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not get types of package '" + pck.getElementName() + "'", e);
+ }
+
+ }
+
+ public static boolean exists(IJavaElement element) {
+ return element != null && element.exists();
+ }
+
+ public static IType findInnerType(IType type, String innerTypeName) {
+ if (type == null) {
+ return null;
+ }
+ else if (StringUtility.equalsIgnoreCase(type.getElementName(), innerTypeName)) {
+ return type;
+ }
+ else {
+ try {
+ for (IType innerType : type.getTypes()) {
+ IType found = findInnerType(innerType, innerTypeName);
+ if (found != null) {
+ return found;
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("could not find inner type named '" + innerTypeName + "' in type '" + type.getFullyQualifiedName() + "'.", e);
+ }
+ }
+ return null;
+ }
+
+ public static IType getReferencedType(IType declaringType, String typeName) throws JavaModelException {
+ ICompilationUnit compilationUnit = declaringType.getCompilationUnit();
+ if (compilationUnit != null) {
+ IImportDeclaration[] imports = compilationUnit.getImports();
+ for (IImportDeclaration imp : imports) {
+ if (imp.getElementName().endsWith("." + typeName)) {
+ IType foundType = TypeUtility.getType(imp.getElementName());
+ if (foundType != null) {
+ return foundType;
+ }
+ }
+ }
+ }
+ String[][] resolvedTypeName = declaringType.resolveType(typeName);
+ if (resolvedTypeName != null && resolvedTypeName.length == 1) {
+ String fqName = resolvedTypeName[0][0];
+ if (fqName != null && fqName.length() > 0) {
+ fqName = fqName + ".";
+ }
+ fqName = fqName + resolvedTypeName[0][1];
+ IType foundType = getType(fqName);
+ if (foundType != null) {
+ return foundType;
+ }
+ }
+ SdkUtilActivator.logWarning("could not find referenced type '" + typeName + "' in '" + declaringType.getFullyQualifiedName() + "'.");
+ return null;
+ }
+
+ public static boolean isGenericType(IType type) {
+ try {
+ return exists(type) && (type.getTypeParameters().length > 0);
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logWarning("could not get generic information of type: " + type.getFullyQualifiedName(), e);
+ return false;
+ }
+ }
+
+ public static boolean isOnClasspath(IMember member, IJavaProject project) {
+ if (member == null) {
+ return false;
+ }
+ if (member.isBinary()) {
+ return project.isOnClasspath(member);
+ }
+ else if (member.getJavaProject() != null) {
+ if (member.getJavaProject().equals(project)) {
+ return true;
+ }
+ else {
+ return project.isOnClasspath(member.getJavaProject());
+ }
+ }
+ return false;
+ }
+
+ /**
+ * Collects all property beans declared directly in the given type by search methods with the following naming
+ * convention:
+ *
+ * <pre>
+ * public <em>&lt;PropertyType&gt;</em> get<em>&lt;PropertyType&gt;</em>();
+ * public void set<em>&lt;PropertyType&gt;</em>(<em>&lt;PropertyType&gt;</em> a);
+ * </pre>
+ *
+ * If <code>PropertyType</code> is a boolean property, the following getter is expected
+ *
+ * <pre>
+ * public boolean is<em>&lt;PropertyType&gt;</em>();
+ * </pre>
+ * <p>
+ * This implementation tries to determine the field by using the JDT code style settings stored in the Eclipse
+ * preferences. Prefixes and suffixes used for fields must be declared. The default prefix Scout uses for fields (
+ * <code>m_</code>) is added by default.
+ *
+ * @param type
+ * the type within properties are searched
+ * @param propertyFilter
+ * optional property bean filter used to filter the result
+ * @param comparator
+ * optional property bean comparator used to sort the result
+ * @return Returns an array of property bean descriptions. The array is empty if the given class does not contain any
+ * bean properties.
+ * @see <a href="http://www.oracle.com/technetwork/java/javase/documentation/spec-136004.html">JavaBeans Spec</a>
+ */
+ public static IPropertyBean[] getPropertyBeans(IType type, IPropertyBeanFilter propertyFilter, Comparator<IPropertyBean> comparator) {
+ HashMap<String, PropertyBean> beans = new HashMap<String, PropertyBean>();
+ IMethodFilter filter = MethodFilters.getMultiMethodFilter(
+ MethodFilters.getFlagsFilter(Flags.AccPublic),
+ MethodFilters.getNameRegexFilter(BEAN_METHOD_NAME));
+ IMethod[] methods = TypeUtility.getMethods(type, filter);
+ for (IMethod m : methods) {
+ Matcher matcher = BEAN_METHOD_NAME.matcher(m.getElementName());
+ if (matcher.matches()) {
+ try {
+ String kind = matcher.group(1);
+ String name = matcher.group(2);
+ //
+ String[] parameterTypes = m.getParameterTypes();
+ String returnType = m.getReturnType();
+ if (kind.equals("get") && parameterTypes.length == 0 && !returnType.equals(Signature.SIG_VOID)) {
+ PropertyBean desc = beans.get(name);
+ if (desc == null) {
+ desc = new PropertyBean(type, name);
+ beans.put(name, desc);
+ }
+ if (desc.getReadMethod() == null) {
+ desc.setReadMethod(m);
+ }
+ }
+ else if (kind.equals("is") && parameterTypes.length == 0 && returnType.equals(Signature.SIG_BOOLEAN)) {
+ PropertyBean desc = beans.get(name);
+ if (desc == null) {
+ desc = new PropertyBean(type, name);
+ beans.put(name, desc);
+ }
+ if (desc.getReadMethod() == null) {
+ desc.setReadMethod(m);
+ }
+ }
+ else if (kind.equals("set") && parameterTypes.length == 1 && returnType.equals(Signature.SIG_VOID)) {
+ PropertyBean desc = beans.get(name);
+ if (desc == null) {
+ desc = new PropertyBean(type, name);
+ beans.put(name, desc);
+ }
+ if (desc.getWriteMethod() == null) {
+ desc.setWriteMethod(m);
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ SdkUtilActivator.logError("Error while collectiong property beans of type [" + type + "]", e);
+ }
+ }
+ }
+
+ // filter
+ if (propertyFilter == null) {
+ propertyFilter = new IPropertyBeanFilter() {
+ @Override
+ public boolean accept(IPropertyBean property) {
+ return true;
+ }
+ };
+ }
+ ArrayList<PropertyBean> filteredBeans = new ArrayList<PropertyBean>();
+ for (PropertyBean bean : beans.values()) {
+ if (propertyFilter.accept(bean)) {
+ filteredBeans.add(bean);
+ }
+ }
+
+ // fields
+ IField[] fieldCandidates = TypeUtility.getFields(type, FieldFilters.getPrivateNotStaticNotFinalNotAbstract(), null);
+ HashMap<String, IField> fields = new HashMap<String, IField>();
+ for (IField field : fieldCandidates) {
+ fields.put(field.getElementName(), field);
+ }
+ AssistOptions assistOptions = new AssistOptions(type.getJavaProject().getOptions(true));
+ String[] fieldPrefixes = toStringArray(assistOptions.fieldPrefixes, "m_", "");
+ String[] fieldSuffixes = toStringArray(assistOptions.fieldSuffixes, "");
+ for (PropertyBean bean : filteredBeans) {
+ IField field = findFieldForPropertyBean(bean.getBeanName(), fields, fieldPrefixes, fieldSuffixes);
+ if (field != null) {
+ bean.setField(field);
+ }
+ else {
+ SdkUtilActivator.logWarning("Unable to find field for property bean [" + bean + "]");
+ }
+ }
+
+ // sort
+ if (comparator != null) {
+ Collections.sort(filteredBeans, comparator);
+ }
+
+ return filteredBeans.toArray(new IPropertyBean[filteredBeans.size()]);
+ }
+
+ /**
+ * To find out if the given child element is a ancestor of the given parent element. If parent and child is the same
+ * element true is returned.
+ *
+ * @param parent
+ * @param chlid
+ * @return
+ */
+ public static boolean isAncestor(IJavaElement parent, IJavaElement chlid) {
+ if (parent == null || chlid == null) {
+ return false;
+ }
+ if (parent.equals(chlid)) {
+ return true;
+ }
+ else if (chlid.getParent() != null && chlid.getParent().getElementType() >= parent.getElementType()) {
+ return isAncestor(parent, chlid.getParent().getAncestor(parent.getElementType()));
+ }
+ else {
+ return false;
+ }
+ }
+
+ /**
+ * Tries to determine the field the given property is based on. All combinations of the given pre- and suffixes are
+ * used to find the field. If none of them matches with a method <code>null</code> is returned.
+ *
+ * @param beanName
+ * @param fields
+ * @param fieldPrefixes
+ * @param fieldSuffixes
+ * @return Returns the field the property is based on or <code>null</code>.
+ */
+ private static IField findFieldForPropertyBean(String beanName, HashMap<String, IField> fields, String[] fieldPrefixes, String[] fieldSuffixes) {
+ for (String prefix : fieldPrefixes) {
+ for (String suffix : fieldSuffixes) {
+ IField field = fields.get(prefix + decapitalize(beanName) + suffix);
+ if (field != null) {
+ return field;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Converts the given two-dimensional array of chars into an array of strings and adds the given additional values.
+ *
+ * @param arrayOfChars
+ * @param additionalValues
+ * @return
+ */
+ private static String[] toStringArray(char[][] arrayOfChars, String... additionalValues) {
+ HashSet<String> result = new HashSet<String>();
+ if (additionalValues != null) {
+ for (String s : additionalValues) {
+ result.add(s);
+ }
+ }
+ if (arrayOfChars != null) {
+ for (char[] cs : arrayOfChars) {
+ if (cs != null && cs.length > 0) {
+ result.add(String.valueOf(cs));
+ }
+ }
+ }
+ return result.toArray(new String[result.size()]);
+ }
+
+ /**
+ * Converts the given property name to its field name (according to JavaBeans spec).
+ *
+ * @param s
+ * @return
+ */
+ private static String decapitalize(String s) {
+ if (s == null || s.length() == 0) return "";
+ if (s.length() >= 2 && Character.isUpperCase(s.charAt(0)) && Character.isUpperCase(s.charAt(1))) {
+ return s;
+ }
+ return Character.toLowerCase(s.charAt(0)) + s.substring(1);
+ }
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ICachedTypeHierarchy.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ICachedTypeHierarchy.java
index 012ba8875..3e60616c0 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ICachedTypeHierarchy.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ICachedTypeHierarchy.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.typecache;
-
-/**
- *
- */
-public interface ICachedTypeHierarchy extends ITypeHierarchy {
- /**
- * @param listener
- */
- void addHierarchyListener(ITypeHierarchyChangedListener listener);
-
- /**
- * @param listener
- */
- void removeHierarchyListener(ITypeHierarchyChangedListener listener);
-
- /**
- * @return true if the hierarchy is created false otherwise
- */
- boolean isCreated();
-
- /**
- * invalidates the hierarchy, next call reloads the type hierarchy. Reloads of large hierarchies are expensive.
- */
- void invalidate();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.typecache;
+
+/**
+ *
+ */
+public interface ICachedTypeHierarchy extends ITypeHierarchy {
+ /**
+ * @param listener
+ */
+ void addHierarchyListener(ITypeHierarchyChangedListener listener);
+
+ /**
+ * @param listener
+ */
+ void removeHierarchyListener(ITypeHierarchyChangedListener listener);
+
+ /**
+ * @return true if the hierarchy is created false otherwise
+ */
+ boolean isCreated();
+
+ /**
+ * invalidates the hierarchy, next call reloads the type hierarchy. Reloads of large hierarchies are expensive.
+ */
+ void invalidate();
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IHierarchyCache.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IHierarchyCache.java
index e577690af..e2d46d058 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IHierarchyCache.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IHierarchyCache.java
@@ -1,27 +1,27 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.typecache;
-
-import org.eclipse.jdt.core.IRegion;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.util.internal.typecache.TypeHierarchy;
-
-public interface IHierarchyCache {
- IPrimaryTypeTypeHierarchy getPrimaryTypeHierarchy(IType type) throws IllegalArgumentException;
-
- TypeHierarchy getSuperHierarchy(IType type);
-
- TypeHierarchy getLocalHierarchy(IRegion region);
-
- IPrimaryTypeTypeHierarchy[] getAllCachedHierarchies();
-
- void dispose();
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.typecache;
+
+import org.eclipse.jdt.core.IRegion;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.util.internal.typecache.TypeHierarchy;
+
+public interface IHierarchyCache {
+ IPrimaryTypeTypeHierarchy getPrimaryTypeHierarchy(IType type) throws IllegalArgumentException;
+
+ TypeHierarchy getSuperHierarchy(IType type);
+
+ TypeHierarchy getLocalHierarchy(IRegion region);
+
+ IPrimaryTypeTypeHierarchy[] getAllCachedHierarchies();
+
+ void dispose();
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IJavaResourceChangedEmitter.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IJavaResourceChangedEmitter.java
index a628892b7..87e47353f 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IJavaResourceChangedEmitter.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IJavaResourceChangedEmitter.java
@@ -1,20 +1,20 @@
-package org.eclipse.scout.sdk.util.typecache;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.util.jdt.IJavaResourceChangedListener;
-
-public interface IJavaResourceChangedEmitter {
- void addInnerTypeChangedListener(IType type, IJavaResourceChangedListener listener);
-
- void removeInnerTypeChangedListener(IType type, IJavaResourceChangedListener listener);
-
- void addJavaResourceChangedListener(IJavaResourceChangedListener listener);
-
- void removeJavaResourceChangedListener(IJavaResourceChangedListener listener);
-
- void addMethodChangedListener(IType type, IJavaResourceChangedListener listener);
-
- void removeMethodChangedListener(IType type, IJavaResourceChangedListener listener);
-
- void dispose();
-}
+package org.eclipse.scout.sdk.util.typecache;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.util.jdt.IJavaResourceChangedListener;
+
+public interface IJavaResourceChangedEmitter {
+ void addInnerTypeChangedListener(IType type, IJavaResourceChangedListener listener);
+
+ void removeInnerTypeChangedListener(IType type, IJavaResourceChangedListener listener);
+
+ void addJavaResourceChangedListener(IJavaResourceChangedListener listener);
+
+ void removeJavaResourceChangedListener(IJavaResourceChangedListener listener);
+
+ void addMethodChangedListener(IType type, IJavaResourceChangedListener listener);
+
+ void removeMethodChangedListener(IType type, IJavaResourceChangedListener listener);
+
+ void dispose();
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IPrimaryTypeTypeHierarchy.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IPrimaryTypeTypeHierarchy.java
index 328ce3bf7..836813573 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IPrimaryTypeTypeHierarchy.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IPrimaryTypeTypeHierarchy.java
@@ -1,29 +1,29 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.typecache;
-
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IRegion;
-
-/**
- *
- */
-public interface IPrimaryTypeTypeHierarchy extends ICachedTypeHierarchy {
-
- /**
- * @param additionalRegion
- * an additional reason <b> not null</b>.
- * @return a type hierarchy combined out of the additional region and the current hierarchy.
- */
- ITypeHierarchy combinedTypeHierarchy(IRegion additionalRegion);
-
- ITypeHierarchy combinedTypeHierarchy(IJavaElement... additionalElements);
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.typecache;
+
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IRegion;
+
+/**
+ *
+ */
+public interface IPrimaryTypeTypeHierarchy extends ICachedTypeHierarchy {
+
+ /**
+ * @param additionalRegion
+ * an additional reason <b> not null</b>.
+ * @return a type hierarchy combined out of the additional region and the current hierarchy.
+ */
+ ITypeHierarchy combinedTypeHierarchy(IRegion additionalRegion);
+
+ ITypeHierarchy combinedTypeHierarchy(IJavaElement... additionalElements);
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeCache.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeCache.java
index afca5e345..35d499d7e 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeCache.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeCache.java
@@ -1,15 +1,15 @@
-package org.eclipse.scout.sdk.util.typecache;
-
-import org.eclipse.jdt.core.IType;
-
-public interface ITypeCache {
- boolean existsType(String fullyQualifiedName);
-
- IType getType(String fullyQualifiedName);
-
- IType[] getTypes(String fullyQualifiedName);
-
- IType[] getAllCachedTypes();
-
- void dispose();
-}
+package org.eclipse.scout.sdk.util.typecache;
+
+import org.eclipse.jdt.core.IType;
+
+public interface ITypeCache {
+ boolean existsType(String fullyQualifiedName);
+
+ IType getType(String fullyQualifiedName);
+
+ IType[] getTypes(String fullyQualifiedName);
+
+ IType[] getAllCachedTypes();
+
+ void dispose();
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeHierarchy.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeHierarchy.java
index 52dc0febd..718072ce6 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeHierarchy.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeHierarchy.java
@@ -1,286 +1,286 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.typecache;
-
-import java.util.Comparator;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.util.type.ITypeFilter;
-
-/**
- *
- */
-public interface ITypeHierarchy {
-
- /**
- * @return the type the hierarchy was created for (origin).
- */
- IType getType();
-
- /**
- * @param type
- * @return true if the given type is part of the hierarchy false otherwise
- */
- boolean contains(IType type);
-
- /**
- * @see ITypeHierarchy#getAllSubtypes(IType, ITypeFilter, Comparator)
- */
- IType[] getAllSubtypes(IType type);
-
- /**
- * @see ITypeHierarchy#getAllSubtypes(IType, ITypeFilter, Comparator)
- */
- IType[] getAllSubtypes(IType type, ITypeFilter typeFilter);
-
- /**
- * @param type
- * the context type to get sub types.
- * @param typeFilter
- * a type filter to reduce the result types or null.
- * @param typeComparator
- * a comparator to order the result types or null.
- * @return all subtypes of the given type accepted by the type filter ordered according the type comparator.
- */
- IType[] getAllSubtypes(IType type, ITypeFilter typeFilter, Comparator<IType> typeComparator);
-
- /**
- * @see ITypeHierarchy#getAllClasses(ITypeFilter, Comparator)
- */
- IType[] getAllClasses();
-
- /**
- * @see ITypeHierarchy#getAllClasses(ITypeFilter, Comparator)
- */
- IType[] getAllClasses(ITypeFilter filter);
-
- /**
- * @param typeFilter
- * a type filter to reduce the result types or null.
- * @param comparator
- * a comparator to order the result types or null.
- * @return all classes in the hierarchy graph accepted by the type filter ordered according the type comparator.
- * @see org.eclipse.jdt.core.ITypeHierarchy#getAllClasses()
- */
- IType[] getAllClasses(ITypeFilter filter, Comparator<IType> comparator);
-
- /**
- * @see ITypeHierarchy#getAllInterfaces(ITypeFilter, Comparator)
- */
- IType[] getAllInterfaces();
-
- /**
- * @see ITypeHierarchy#getAllInterfaces(ITypeFilter, Comparator)
- */
- IType[] getAllInterfaces(ITypeFilter filter);
-
- /**
- * @param typeFilter
- * a type filter to reduce the result types or null.
- * @param comparator
- * a comparator to order the result types or null.
- * @return all interfaces in the hierarchy graph accepted by the type filter ordered according the type comparator.
- * @see org.eclipse.jdt.core.ITypeHierarchy#getAllInterfaces()
- */
- IType[] getAllInterfaces(ITypeFilter filter, Comparator<IType> comparator);
-
- /**
- * @param type
- * @param potentialSubtype
- * @return true if the potentialSubtype is in the sub hierarchy of the given type.
- */
- boolean isSubtype(IType type, IType potentialSubtype);
-
- /**
- * @param type
- * @param potentialSubtypes
- * @return true if one of the potentialSubtypes is a subtype of the given type
- */
- boolean containsInSubhierarchy(IType type, IType[] potentialSubtypes);
-
- /**
- * @see ITypeHierarchy#getAllSuperclasses(IType, ITypeFilter, Comparator)
- */
- IType[] getAllSuperclasses(IType type);
-
- /**
- * @see ITypeHierarchy#getAllSuperclasses(IType, ITypeFilter, Comparator)
- */
- IType[] getAllSuperclasses(IType type, ITypeFilter filter);
-
- /**
- * @param type
- * the context type.
- * @param typeFilter
- * a type filter to reduce the result types or null.
- * @param comparator
- * a comparator to order the result types or null.
- * @return all subclasses of the given type accepted by the type filter ordered according the type comparator.
- * @see org.eclipse.jdt.core.ITypeHierarchy#getAllSuperclasses(org.eclipse.jdt.core.IType)
- */
- IType[] getAllSuperclasses(IType type, ITypeFilter filter, Comparator<IType> comparator);
-
- /**
- * @see ITypeHierarchy#getAllSuperInterfaces(IType, ITypeFilter, Comparator)
- */
- IType[] getAllSuperInterfaces(IType type);
-
- /**
- * @see ITypeHierarchy#getAllSuperInterfaces(IType, ITypeFilter, Comparator)
- */
- IType[] getAllSuperInterfaces(IType type, ITypeFilter filter);
-
- /**
- * @param type
- * the context type.
- * @param typeFilter
- * a type filter to reduce the result types or null.
- * @param comparator
- * a comparator to order the result types or null.
- * @return all interfaces of the given type accepted by the type filter ordered according the type comparator.
- * @see org.eclipse.jdt.core.ITypeHierarchy#getAllSuperInterfaces(IType)
- */
- IType[] getAllSuperInterfaces(IType type, ITypeFilter filter, Comparator<IType> comparator);
-
- /**
- * @see ITypeHierarchy#getAllSupertypes(IType, ITypeFilter, Comparator)
- */
- IType[] getAllSupertypes(IType type);
-
- /**
- * @see ITypeHierarchy#getAllSupertypes(IType, ITypeFilter, Comparator)
- */
- IType[] getAllSupertypes(IType type, ITypeFilter filter);
-
- /**
- * @param type
- * the context type.
- * @param typeFilter
- * a type filter to reduce the result types or null.
- * @param comparator
- * a comparator to order the result types or null.
- * @return all super types of the given type accepted by the type filter ordered according the type comparator.
- * @see org.eclipse.jdt.core.ITypeHierarchy#getAllSupertypes(IType)
- */
- IType[] getAllSupertypes(IType type, ITypeFilter filter, Comparator<IType> comparator);
-
- /**
- * @see ITypeHierarchy#getAllTypes(ITypeFilter, Comparator)
- */
- IType[] getAllTypes();
-
- /**
- * @see ITypeHierarchy#getAllTypes(ITypeFilter, Comparator)
- */
- IType[] getAllTypes(ITypeFilter filter);
-
- /**
- * @param typeFilter
- * a type filter to reduce the result types or null.
- * @param comparator
- * a comparator to order the result types or null.
- * @return all types in the hierarchy graph accepted by the type filter ordered according the type comparator.
- * @see org.eclipse.jdt.core.ITypeHierarchy#getAllTypes()
- */
- IType[] getAllTypes(ITypeFilter filter, Comparator<IType> comparator);
-
- /**
- * @see ITypeHierarchy#getSubclasses(IType, ITypeFilter, Comparator)
- */
- IType[] getSubclasses(IType type);
-
- /**
- * @see ITypeHierarchy#getSubclasses(IType, ITypeFilter, Comparator)
- */
- IType[] getSubclasses(IType type, ITypeFilter filter);
-
- /**
- * @param type
- * the context type.
- * @param typeFilter
- * a type filter to reduce the result types or null.
- * @param comparator
- * a comparator to order the result types or null.
- * @return all <b>direct</b> sub classes of the given type accepted by the type filter ordered according the type
- * comparator.
- * @see org.eclipse.jdt.core.ITypeHierarchy#getSubclasses(IType)
- */
- IType[] getSubclasses(IType type, ITypeFilter filter, Comparator<IType> comparator);
-
- /**
- * @see ITypeHierarchy#getSubtypes(IType, ITypeFilter, Comparator)
- */
- IType[] getSubtypes(IType type);
-
- /**
- * @see ITypeHierarchy#getSubtypes(IType, ITypeFilter, Comparator)
- */
- IType[] getSubtypes(IType type, ITypeFilter filter);
-
- /**
- * @param type
- * the context type.
- * @param typeFilter
- * a type filter to reduce the result types or null.
- * @param comparator
- * a comparator to order the result types or null.
- * @return all <b>direct</b> sub types of the given type accepted by the type filter ordered according the type
- * comparator.
- * @see org.eclipse.jdt.core.ITypeHierarchy#getSubtypes(IType)
- */
- IType[] getSubtypes(IType type, ITypeFilter filter, Comparator<IType> comparator);
-
- /**
- * @param type
- * @return
- * @see org.eclipse.jdt.core.ITypeHierarchy#getSuperclass(org.eclipse.jdt.core.IType)
- */
- IType getSuperclass(IType type);
-
- /**
- * @param type
- * @return
- * @see org.eclipse.jdt.core.ITypeHierarchy#getSuperInterfaces(org.eclipse.jdt.core.IType)
- */
- IType[] getSuperInterfaces(IType type);
-
- IType[] getSuperInterfaces(IType type, ITypeFilter filter);
-
- IType[] getSuperInterfaces(IType type, ITypeFilter filter, Comparator<IType> comparator);
-
- /**
- * @return
- */
- org.eclipse.jdt.core.ITypeHierarchy getJdtHierarchy();
-
- /**
- * @param type
- * @return
- * @see org.eclipse.jdt.core.ITypeHierarchy#getSupertypes(org.eclipse.jdt.core.IType)
- */
- IType[] getSupertypes(IType type);
-
- /**
- * @param type
- * @param filter
- * @return
- */
- IType[] getSupertypes(IType type, ITypeFilter filter);
-
- /**
- * @param type
- * @param filter
- * @param comparator
- * @return
- */
- IType[] getSupertypes(IType type, ITypeFilter filter, Comparator<IType> comparator);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.typecache;
+
+import java.util.Comparator;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.util.type.ITypeFilter;
+
+/**
+ *
+ */
+public interface ITypeHierarchy {
+
+ /**
+ * @return the type the hierarchy was created for (origin).
+ */
+ IType getType();
+
+ /**
+ * @param type
+ * @return true if the given type is part of the hierarchy false otherwise
+ */
+ boolean contains(IType type);
+
+ /**
+ * @see ITypeHierarchy#getAllSubtypes(IType, ITypeFilter, Comparator)
+ */
+ IType[] getAllSubtypes(IType type);
+
+ /**
+ * @see ITypeHierarchy#getAllSubtypes(IType, ITypeFilter, Comparator)
+ */
+ IType[] getAllSubtypes(IType type, ITypeFilter typeFilter);
+
+ /**
+ * @param type
+ * the context type to get sub types.
+ * @param typeFilter
+ * a type filter to reduce the result types or null.
+ * @param typeComparator
+ * a comparator to order the result types or null.
+ * @return all subtypes of the given type accepted by the type filter ordered according the type comparator.
+ */
+ IType[] getAllSubtypes(IType type, ITypeFilter typeFilter, Comparator<IType> typeComparator);
+
+ /**
+ * @see ITypeHierarchy#getAllClasses(ITypeFilter, Comparator)
+ */
+ IType[] getAllClasses();
+
+ /**
+ * @see ITypeHierarchy#getAllClasses(ITypeFilter, Comparator)
+ */
+ IType[] getAllClasses(ITypeFilter filter);
+
+ /**
+ * @param typeFilter
+ * a type filter to reduce the result types or null.
+ * @param comparator
+ * a comparator to order the result types or null.
+ * @return all classes in the hierarchy graph accepted by the type filter ordered according the type comparator.
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getAllClasses()
+ */
+ IType[] getAllClasses(ITypeFilter filter, Comparator<IType> comparator);
+
+ /**
+ * @see ITypeHierarchy#getAllInterfaces(ITypeFilter, Comparator)
+ */
+ IType[] getAllInterfaces();
+
+ /**
+ * @see ITypeHierarchy#getAllInterfaces(ITypeFilter, Comparator)
+ */
+ IType[] getAllInterfaces(ITypeFilter filter);
+
+ /**
+ * @param typeFilter
+ * a type filter to reduce the result types or null.
+ * @param comparator
+ * a comparator to order the result types or null.
+ * @return all interfaces in the hierarchy graph accepted by the type filter ordered according the type comparator.
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getAllInterfaces()
+ */
+ IType[] getAllInterfaces(ITypeFilter filter, Comparator<IType> comparator);
+
+ /**
+ * @param type
+ * @param potentialSubtype
+ * @return true if the potentialSubtype is in the sub hierarchy of the given type.
+ */
+ boolean isSubtype(IType type, IType potentialSubtype);
+
+ /**
+ * @param type
+ * @param potentialSubtypes
+ * @return true if one of the potentialSubtypes is a subtype of the given type
+ */
+ boolean containsInSubhierarchy(IType type, IType[] potentialSubtypes);
+
+ /**
+ * @see ITypeHierarchy#getAllSuperclasses(IType, ITypeFilter, Comparator)
+ */
+ IType[] getAllSuperclasses(IType type);
+
+ /**
+ * @see ITypeHierarchy#getAllSuperclasses(IType, ITypeFilter, Comparator)
+ */
+ IType[] getAllSuperclasses(IType type, ITypeFilter filter);
+
+ /**
+ * @param type
+ * the context type.
+ * @param typeFilter
+ * a type filter to reduce the result types or null.
+ * @param comparator
+ * a comparator to order the result types or null.
+ * @return all subclasses of the given type accepted by the type filter ordered according the type comparator.
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getAllSuperclasses(org.eclipse.jdt.core.IType)
+ */
+ IType[] getAllSuperclasses(IType type, ITypeFilter filter, Comparator<IType> comparator);
+
+ /**
+ * @see ITypeHierarchy#getAllSuperInterfaces(IType, ITypeFilter, Comparator)
+ */
+ IType[] getAllSuperInterfaces(IType type);
+
+ /**
+ * @see ITypeHierarchy#getAllSuperInterfaces(IType, ITypeFilter, Comparator)
+ */
+ IType[] getAllSuperInterfaces(IType type, ITypeFilter filter);
+
+ /**
+ * @param type
+ * the context type.
+ * @param typeFilter
+ * a type filter to reduce the result types or null.
+ * @param comparator
+ * a comparator to order the result types or null.
+ * @return all interfaces of the given type accepted by the type filter ordered according the type comparator.
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getAllSuperInterfaces(IType)
+ */
+ IType[] getAllSuperInterfaces(IType type, ITypeFilter filter, Comparator<IType> comparator);
+
+ /**
+ * @see ITypeHierarchy#getAllSupertypes(IType, ITypeFilter, Comparator)
+ */
+ IType[] getAllSupertypes(IType type);
+
+ /**
+ * @see ITypeHierarchy#getAllSupertypes(IType, ITypeFilter, Comparator)
+ */
+ IType[] getAllSupertypes(IType type, ITypeFilter filter);
+
+ /**
+ * @param type
+ * the context type.
+ * @param typeFilter
+ * a type filter to reduce the result types or null.
+ * @param comparator
+ * a comparator to order the result types or null.
+ * @return all super types of the given type accepted by the type filter ordered according the type comparator.
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getAllSupertypes(IType)
+ */
+ IType[] getAllSupertypes(IType type, ITypeFilter filter, Comparator<IType> comparator);
+
+ /**
+ * @see ITypeHierarchy#getAllTypes(ITypeFilter, Comparator)
+ */
+ IType[] getAllTypes();
+
+ /**
+ * @see ITypeHierarchy#getAllTypes(ITypeFilter, Comparator)
+ */
+ IType[] getAllTypes(ITypeFilter filter);
+
+ /**
+ * @param typeFilter
+ * a type filter to reduce the result types or null.
+ * @param comparator
+ * a comparator to order the result types or null.
+ * @return all types in the hierarchy graph accepted by the type filter ordered according the type comparator.
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getAllTypes()
+ */
+ IType[] getAllTypes(ITypeFilter filter, Comparator<IType> comparator);
+
+ /**
+ * @see ITypeHierarchy#getSubclasses(IType, ITypeFilter, Comparator)
+ */
+ IType[] getSubclasses(IType type);
+
+ /**
+ * @see ITypeHierarchy#getSubclasses(IType, ITypeFilter, Comparator)
+ */
+ IType[] getSubclasses(IType type, ITypeFilter filter);
+
+ /**
+ * @param type
+ * the context type.
+ * @param typeFilter
+ * a type filter to reduce the result types or null.
+ * @param comparator
+ * a comparator to order the result types or null.
+ * @return all <b>direct</b> sub classes of the given type accepted by the type filter ordered according the type
+ * comparator.
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getSubclasses(IType)
+ */
+ IType[] getSubclasses(IType type, ITypeFilter filter, Comparator<IType> comparator);
+
+ /**
+ * @see ITypeHierarchy#getSubtypes(IType, ITypeFilter, Comparator)
+ */
+ IType[] getSubtypes(IType type);
+
+ /**
+ * @see ITypeHierarchy#getSubtypes(IType, ITypeFilter, Comparator)
+ */
+ IType[] getSubtypes(IType type, ITypeFilter filter);
+
+ /**
+ * @param type
+ * the context type.
+ * @param typeFilter
+ * a type filter to reduce the result types or null.
+ * @param comparator
+ * a comparator to order the result types or null.
+ * @return all <b>direct</b> sub types of the given type accepted by the type filter ordered according the type
+ * comparator.
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getSubtypes(IType)
+ */
+ IType[] getSubtypes(IType type, ITypeFilter filter, Comparator<IType> comparator);
+
+ /**
+ * @param type
+ * @return
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getSuperclass(org.eclipse.jdt.core.IType)
+ */
+ IType getSuperclass(IType type);
+
+ /**
+ * @param type
+ * @return
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getSuperInterfaces(org.eclipse.jdt.core.IType)
+ */
+ IType[] getSuperInterfaces(IType type);
+
+ IType[] getSuperInterfaces(IType type, ITypeFilter filter);
+
+ IType[] getSuperInterfaces(IType type, ITypeFilter filter, Comparator<IType> comparator);
+
+ /**
+ * @return
+ */
+ org.eclipse.jdt.core.ITypeHierarchy getJdtHierarchy();
+
+ /**
+ * @param type
+ * @return
+ * @see org.eclipse.jdt.core.ITypeHierarchy#getSupertypes(org.eclipse.jdt.core.IType)
+ */
+ IType[] getSupertypes(IType type);
+
+ /**
+ * @param type
+ * @param filter
+ * @return
+ */
+ IType[] getSupertypes(IType type, ITypeFilter filter);
+
+ /**
+ * @param type
+ * @param filter
+ * @param comparator
+ * @return
+ */
+ IType[] getSupertypes(IType type, ITypeFilter filter, Comparator<IType> comparator);
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeHierarchyChangedListener.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeHierarchyChangedListener.java
index 31138db1f..4fb2f1e89 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeHierarchyChangedListener.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/ITypeHierarchyChangedListener.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.typecache;
-
-import java.util.EventListener;
-
-import org.eclipse.jdt.core.IType;
-
-/**
- *
- */
-public interface ITypeHierarchyChangedListener extends EventListener {
-
- public static final int PRE_TYPE_CHANGED = 1;
- public static final int POST_TYPE_CHANGED = 2;
- public static final int PRE_TYPE_ADDING = 3;
- public static final int POST_TYPE_ADDING = 4;
- public static final int PRE_TYPE_REMOVING = 5;
- public static final int POST_TYPE_REMOVING = 6;
-
- void handleEvent(int eventType, IType type);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.typecache;
+
+import java.util.EventListener;
+
+import org.eclipse.jdt.core.IType;
+
+/**
+ *
+ */
+public interface ITypeHierarchyChangedListener extends EventListener {
+
+ public static final int PRE_TYPE_CHANGED = 1;
+ public static final int POST_TYPE_CHANGED = 2;
+ public static final int PRE_TYPE_ADDING = 3;
+ public static final int POST_TYPE_ADDING = 4;
+ public static final int PRE_TYPE_REMOVING = 5;
+ public static final int POST_TYPE_REMOVING = 6;
+
+ void handleEvent(int eventType, IType type);
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IWorkingCopyManager.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IWorkingCopyManager.java
index d78bdd970..50576f45d 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IWorkingCopyManager.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/IWorkingCopyManager.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.typecache;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.WorkingCopyOwner;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-
-public interface IWorkingCopyManager {
-
- /**
- * The working copy owner for all scout operations
- */
- public static final WorkingCopyOwner ScoutWorkingCopyOwner = new WorkingCopyOwner() {
- };
-
- /**
- * Register compilation unit BEFORE doing changes on it.
- * Creates a working copy on the first registration.
- * Compilation unit may be registered multiple times
- *
- * @param icu
- */
- void register(ICompilationUnit icu, IProgressMonitor monitor) throws JavaModelException;
-
- /**
- * Unregister compilation unit AFTER doing changes on it.
- * Commits and discards working copy at the first invokation.
- * Compilation unit may be unregistered multiple times
- *
- * @param icu
- */
- void unregister(ICompilationUnit icu, IProgressMonitor monitor);
-
- void unregisterAll(IProgressMonitor monitor);
-
- /**
- * When doing direct source changes on the compilation unit, a reconcile is required to fire element change deltas.
- * This is not required if changes are done using for example
- * {@link IType#createMethod(String, IJavaElement, boolean, IProgressMonitor)} or
- * {@link IType#createField(String, IJavaElement, boolean, IProgressMonitor)}
- *
- * @throws JavaModelException
- */
- CompilationUnit reconcile(ICompilationUnit icu, IProgressMonitor monitor) throws CoreException;
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.typecache;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.WorkingCopyOwner;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+
+public interface IWorkingCopyManager {
+
+ /**
+ * The working copy owner for all scout operations
+ */
+ public static final WorkingCopyOwner ScoutWorkingCopyOwner = new WorkingCopyOwner() {
+ };
+
+ /**
+ * Register compilation unit BEFORE doing changes on it.
+ * Creates a working copy on the first registration.
+ * Compilation unit may be registered multiple times
+ *
+ * @param icu
+ */
+ void register(ICompilationUnit icu, IProgressMonitor monitor) throws JavaModelException;
+
+ /**
+ * Unregister compilation unit AFTER doing changes on it.
+ * Commits and discards working copy at the first invokation.
+ * Compilation unit may be unregistered multiple times
+ *
+ * @param icu
+ */
+ void unregister(ICompilationUnit icu, IProgressMonitor monitor);
+
+ void unregisterAll(IProgressMonitor monitor);
+
+ /**
+ * When doing direct source changes on the compilation unit, a reconcile is required to fire element change deltas.
+ * This is not required if changes are done using for example
+ * {@link IType#createMethod(String, IJavaElement, boolean, IProgressMonitor)} or
+ * {@link IType#createField(String, IJavaElement, boolean, IProgressMonitor)}
+ *
+ * @throws JavaModelException
+ */
+ CompilationUnit reconcile(ICompilationUnit icu, IProgressMonitor monitor) throws CoreException;
+
+}
diff --git a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/TypeCacheAccessor.java b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/TypeCacheAccessor.java
index 87b7cbb70..c62b95940 100644
--- a/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/TypeCacheAccessor.java
+++ b/org.eclipse.scout.sdk.util/src/org/eclipse/scout/sdk/util/typecache/TypeCacheAccessor.java
@@ -1,34 +1,34 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.util.typecache;
-
-import org.eclipse.scout.sdk.util.internal.typecache.HierarchyCache;
-import org.eclipse.scout.sdk.util.internal.typecache.JavaResourceChangedEmitter;
-import org.eclipse.scout.sdk.util.internal.typecache.TypeCache;
-import org.eclipse.scout.sdk.util.internal.typecache.WorkingCopyManager;
-
-public class TypeCacheAccessor {
- public static IWorkingCopyManager createWorkingCopyManger() {
- return new WorkingCopyManager();
- }
-
- public static ITypeCache getTypeCache() {
- return TypeCache.getInstance();
- }
-
- public static IHierarchyCache getHierarchyCache() {
- return HierarchyCache.getInstance();
- }
-
- public static IJavaResourceChangedEmitter getJavaResourceChangedEmitter() {
- return JavaResourceChangedEmitter.getInstance();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.util.typecache;
+
+import org.eclipse.scout.sdk.util.internal.typecache.HierarchyCache;
+import org.eclipse.scout.sdk.util.internal.typecache.JavaResourceChangedEmitter;
+import org.eclipse.scout.sdk.util.internal.typecache.TypeCache;
+import org.eclipse.scout.sdk.util.internal.typecache.WorkingCopyManager;
+
+public class TypeCacheAccessor {
+ public static IWorkingCopyManager createWorkingCopyManger() {
+ return new WorkingCopyManager();
+ }
+
+ public static ITypeCache getTypeCache() {
+ return TypeCache.getInstance();
+ }
+
+ public static IHierarchyCache getHierarchyCache() {
+ return HierarchyCache.getInstance();
+ }
+
+ public static IJavaResourceChangedEmitter getJavaResourceChangedEmitter() {
+ return JavaResourceChangedEmitter.getInstance();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/.classpath b/org.eclipse.scout.sdk.ws.jaxws/.classpath
index 004c1495c..44b4b9a64 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/.classpath
+++ b/org.eclipse.scout.sdk.ws.jaxws/.classpath
@@ -1,11 +1,11 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
- <accessrules>
- <accessrule kind="accessible" pattern="com/sun/xml/internal/**"/>
- </accessrules>
- </classpathentry>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
+ <accessrules>
+ <accessrule kind="accessible" pattern="com/sun/xml/internal/**"/>
+ </accessrules>
+ </classpathentry>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.scout.sdk.ws.jaxws/.project b/org.eclipse.scout.sdk.ws.jaxws/.project
index 27f94039b..5e430b57c 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/.project
+++ b/org.eclipse.scout.sdk.ws.jaxws/.project
@@ -1,28 +1,28 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.scout.sdk.ws.jaxws</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.scout.sdk.ws.jaxws</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.jdt.core.prefs
index df2da3598..cd945ef6e 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.jdt.core.prefs
+++ b/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.jdt.core.prefs
@@ -1,353 +1,353 @@
-#Mon Aug 29 13:25:58 CEST 2011
-eclipse.preferences.version=1
-org.eclipse.jdt.core.codeComplete.argumentPrefixes=
-org.eclipse.jdt.core.codeComplete.argumentSuffixes=
-org.eclipse.jdt.core.codeComplete.fieldPrefixes=m_
-org.eclipse.jdt.core.codeComplete.fieldSuffixes=
-org.eclipse.jdt.core.codeComplete.localPrefixes=
-org.eclipse.jdt.core.codeComplete.localSuffixes=
-org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
-org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
-org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.6
-org.eclipse.jdt.core.compiler.debug.lineNumber=generate
-org.eclipse.jdt.core.compiler.debug.localVariable=generate
-org.eclipse.jdt.core.compiler.debug.sourceFile=generate
-org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
-org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
-org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
-org.eclipse.jdt.core.compiler.problem.deadCode=warning
-org.eclipse.jdt.core.compiler.problem.deprecation=warning
-org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
-org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
-org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
-org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
-org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
-org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
-org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
-org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
-org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
-org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
-org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
-org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
-org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
-org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
-org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
-org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
-org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
-org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
-org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
-org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
-org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
-org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
-org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
-org.eclipse.jdt.core.compiler.problem.nullReference=warning
-org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
-org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
-org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
-org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
-org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
-org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
-org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
-org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
-org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
-org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
-org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
-org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
-org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
-org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
-org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
-org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
-org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
-org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
-org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
-org.eclipse.jdt.core.compiler.problem.unusedImport=warning
-org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
-org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
-org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
-org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
-org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
-org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
-org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
-org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.6
-org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_assignment=0
-org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
-org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
-org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
-org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0
-org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
-org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
-org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_after_package=1
-org.eclipse.jdt.core.formatter.blank_lines_before_field=0
-org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
-org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
-org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
-org.eclipse.jdt.core.formatter.blank_lines_before_method=1
-org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
-org.eclipse.jdt.core.formatter.blank_lines_before_package=0
-org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
-org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
-org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
-org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
-org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
-org.eclipse.jdt.core.formatter.comment.format_block_comments=false
-org.eclipse.jdt.core.formatter.comment.format_header=false
-org.eclipse.jdt.core.formatter.comment.format_html=true
-org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
-org.eclipse.jdt.core.formatter.comment.format_line_comments=false
-org.eclipse.jdt.core.formatter.comment.format_source_code=true
-org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
-org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
-org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
-org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
-org.eclipse.jdt.core.formatter.comment.line_length=120
-org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
-org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
-org.eclipse.jdt.core.formatter.compact_else_if=true
-org.eclipse.jdt.core.formatter.continuation_indentation=2
-org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
-org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
-org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
-org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
-org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
-org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
-org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_empty_lines=false
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
-org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
-org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
-org.eclipse.jdt.core.formatter.indentation.size=2
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
-org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
-org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
-org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
-org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
-org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
-org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
-org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
-org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
-org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
-org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
-org.eclipse.jdt.core.formatter.join_lines_in_comments=false
-org.eclipse.jdt.core.formatter.join_wrapped_lines=false
-org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
-org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
-org.eclipse.jdt.core.formatter.lineSplit=9999
-org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true
-org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
-org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
-org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
-org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
-org.eclipse.jdt.core.formatter.tabulation.char=space
-org.eclipse.jdt.core.formatter.tabulation.size=2
-org.eclipse.jdt.core.formatter.use_on_off_tags=false
-org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
-org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
-org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
+#Mon Aug 29 13:25:58 CEST 2011
+eclipse.preferences.version=1
+org.eclipse.jdt.core.codeComplete.argumentPrefixes=
+org.eclipse.jdt.core.codeComplete.argumentSuffixes=
+org.eclipse.jdt.core.codeComplete.fieldPrefixes=m_
+org.eclipse.jdt.core.codeComplete.fieldSuffixes=
+org.eclipse.jdt.core.codeComplete.localPrefixes=
+org.eclipse.jdt.core.codeComplete.localSuffixes=
+org.eclipse.jdt.core.codeComplete.staticFieldPrefixes=
+org.eclipse.jdt.core.codeComplete.staticFieldSuffixes=
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.6
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
+org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
+org.eclipse.jdt.core.compiler.problem.comparingIdentical=warning
+org.eclipse.jdt.core.compiler.problem.deadCode=warning
+org.eclipse.jdt.core.compiler.problem.deprecation=warning
+org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=enabled
+org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
+org.eclipse.jdt.core.compiler.problem.discouragedReference=warning
+org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
+org.eclipse.jdt.core.compiler.problem.fallthroughCase=ignore
+org.eclipse.jdt.core.compiler.problem.fatalOptionalError=enabled
+org.eclipse.jdt.core.compiler.problem.fieldHiding=ignore
+org.eclipse.jdt.core.compiler.problem.finalParameterBound=warning
+org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
+org.eclipse.jdt.core.compiler.problem.forbiddenReference=error
+org.eclipse.jdt.core.compiler.problem.hiddenCatchBlock=warning
+org.eclipse.jdt.core.compiler.problem.incompatibleNonInheritedInterfaceMethod=warning
+org.eclipse.jdt.core.compiler.problem.incompleteEnumSwitch=ignore
+org.eclipse.jdt.core.compiler.problem.indirectStaticAccess=ignore
+org.eclipse.jdt.core.compiler.problem.localVariableHiding=warning
+org.eclipse.jdt.core.compiler.problem.methodWithConstructorName=warning
+org.eclipse.jdt.core.compiler.problem.missingDeprecatedAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingHashCodeMethod=ignore
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotation=warning
+org.eclipse.jdt.core.compiler.problem.missingOverrideAnnotationForInterfaceMethodImplementation=enabled
+org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning
+org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=ignore
+org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning
+org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning
+org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore
+org.eclipse.jdt.core.compiler.problem.nullReference=warning
+org.eclipse.jdt.core.compiler.problem.overridingPackageDefaultMethod=warning
+org.eclipse.jdt.core.compiler.problem.parameterAssignment=ignore
+org.eclipse.jdt.core.compiler.problem.possibleAccidentalBooleanAssignment=warning
+org.eclipse.jdt.core.compiler.problem.potentialNullReference=warning
+org.eclipse.jdt.core.compiler.problem.rawTypeReference=ignore
+org.eclipse.jdt.core.compiler.problem.redundantNullCheck=ignore
+org.eclipse.jdt.core.compiler.problem.redundantSuperinterface=ignore
+org.eclipse.jdt.core.compiler.problem.specialParameterHidingField=disabled
+org.eclipse.jdt.core.compiler.problem.staticAccessReceiver=warning
+org.eclipse.jdt.core.compiler.problem.suppressOptionalErrors=disabled
+org.eclipse.jdt.core.compiler.problem.suppressWarnings=enabled
+org.eclipse.jdt.core.compiler.problem.syntheticAccessEmulation=ignore
+org.eclipse.jdt.core.compiler.problem.typeParameterHiding=warning
+org.eclipse.jdt.core.compiler.problem.uncheckedTypeOperation=warning
+org.eclipse.jdt.core.compiler.problem.undocumentedEmptyBlock=ignore
+org.eclipse.jdt.core.compiler.problem.unhandledWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.unnecessaryElse=ignore
+org.eclipse.jdt.core.compiler.problem.unnecessaryTypeCheck=ignore
+org.eclipse.jdt.core.compiler.problem.unqualifiedFieldAccess=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownException=ignore
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionExemptExceptionAndThrowable=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionIncludeDocCommentReference=enabled
+org.eclipse.jdt.core.compiler.problem.unusedDeclaredThrownExceptionWhenOverriding=disabled
+org.eclipse.jdt.core.compiler.problem.unusedImport=warning
+org.eclipse.jdt.core.compiler.problem.unusedLabel=warning
+org.eclipse.jdt.core.compiler.problem.unusedLocal=warning
+org.eclipse.jdt.core.compiler.problem.unusedObjectAllocation=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameter=ignore
+org.eclipse.jdt.core.compiler.problem.unusedParameterIncludeDocCommentReference=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=disabled
+org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=disabled
+org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=ignore
+org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning
+org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
+org.eclipse.jdt.core.compiler.source=1.6
+org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_explicit_constructor_call=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_arguments_in_qualified_allocation_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_assignment=0
+org.eclipse.jdt.core.formatter.alignment_for_binary_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_compact_if=0
+org.eclipse.jdt.core.formatter.alignment_for_conditional_expression=0
+org.eclipse.jdt.core.formatter.alignment_for_enum_constants=0
+org.eclipse.jdt.core.formatter.alignment_for_expressions_in_array_initializer=0
+org.eclipse.jdt.core.formatter.alignment_for_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_multiple_fields=16
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_parameters_in_method_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_selector_in_method_invocation=0
+org.eclipse.jdt.core.formatter.alignment_for_superclass_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_enum_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_superinterfaces_in_type_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_constructor_declaration=0
+org.eclipse.jdt.core.formatter.alignment_for_throws_clause_in_method_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_after_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_after_package=1
+org.eclipse.jdt.core.formatter.blank_lines_before_field=0
+org.eclipse.jdt.core.formatter.blank_lines_before_first_class_body_declaration=0
+org.eclipse.jdt.core.formatter.blank_lines_before_imports=1
+org.eclipse.jdt.core.formatter.blank_lines_before_member_type=1
+org.eclipse.jdt.core.formatter.blank_lines_before_method=1
+org.eclipse.jdt.core.formatter.blank_lines_before_new_chunk=1
+org.eclipse.jdt.core.formatter.blank_lines_before_package=0
+org.eclipse.jdt.core.formatter.blank_lines_between_import_groups=1
+org.eclipse.jdt.core.formatter.blank_lines_between_type_declarations=1
+org.eclipse.jdt.core.formatter.brace_position_for_annotation_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_anonymous_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_array_initializer=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_block_in_case=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_constructor_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_constant=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_enum_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_method_declaration=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_switch=end_of_line
+org.eclipse.jdt.core.formatter.brace_position_for_type_declaration=end_of_line
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_block_comment=true
+org.eclipse.jdt.core.formatter.comment.clear_blank_lines_in_javadoc_comment=true
+org.eclipse.jdt.core.formatter.comment.format_block_comments=false
+org.eclipse.jdt.core.formatter.comment.format_header=false
+org.eclipse.jdt.core.formatter.comment.format_html=true
+org.eclipse.jdt.core.formatter.comment.format_javadoc_comments=true
+org.eclipse.jdt.core.formatter.comment.format_line_comments=false
+org.eclipse.jdt.core.formatter.comment.format_source_code=true
+org.eclipse.jdt.core.formatter.comment.indent_parameter_description=true
+org.eclipse.jdt.core.formatter.comment.indent_root_tags=true
+org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags=insert
+org.eclipse.jdt.core.formatter.comment.insert_new_line_for_parameter=insert
+org.eclipse.jdt.core.formatter.comment.line_length=120
+org.eclipse.jdt.core.formatter.comment.new_lines_at_block_boundaries=true
+org.eclipse.jdt.core.formatter.comment.new_lines_at_javadoc_boundaries=true
+org.eclipse.jdt.core.formatter.compact_else_if=true
+org.eclipse.jdt.core.formatter.continuation_indentation=2
+org.eclipse.jdt.core.formatter.continuation_indentation_for_array_initializer=2
+org.eclipse.jdt.core.formatter.disabling_tag=@formatter\:off
+org.eclipse.jdt.core.formatter.enabling_tag=@formatter\:on
+org.eclipse.jdt.core.formatter.format_guardian_clause_on_one_line=false
+org.eclipse.jdt.core.formatter.format_line_comment_starting_on_first_column=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_annotation_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_constant_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header=true
+org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_type_header=true
+org.eclipse.jdt.core.formatter.indent_breaks_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_empty_lines=false
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_block=true
+org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
+org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
+org.eclipse.jdt.core.formatter.indentation.size=2
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_local_variable=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_member=insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_annotation_on_parameter=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_label=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_else_in_if_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_finally_in_try_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_before_while_in_do_statement=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_annotation_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_block=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_method_body=insert
+org.eclipse.jdt.core.formatter.insert_new_line_in_empty_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_after_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_at_in_annotation_type_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_angle_bracket_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_closing_paren_in_cast=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_case=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_colon_in_labeled_statement=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_allocation_expression=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_annotation=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_array_initializer=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_constructor_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_constant_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_enum_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_explicitconstructorcall_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_inits=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_declaration_throws=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_method_invocation_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_field_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_multiple_local_declarations=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_parameterized_type_reference=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_superinterfaces=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_arguments=insert
+org.eclipse.jdt.core.formatter.insert_space_after_comma_in_type_parameters=insert
+org.eclipse.jdt.core.formatter.insert_space_after_ellipsis=insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_after_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_after_semicolon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_after_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_and_in_type_parameter=insert
+org.eclipse.jdt.core.formatter.insert_space_before_assignment_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_at_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_binary_operator=insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_cast=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_if=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_synchronized=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_while=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_assert=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_case=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_default=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_colon_in_labeled_statement=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_constructor_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_constant_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_enum_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_explicitconstructorcall_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_increments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_for_inits=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_declaration_throws=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_method_invocation_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_field_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_multiple_local_declarations=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_superinterfaces=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_comma_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_ellipsis=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_parameterized_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_arguments=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_angle_bracket_in_type_parameters=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_annotation_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_anonymous_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_block=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_constructor_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_constant=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_enum_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_method_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_brace_in_type_declaration=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_bracket_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_for=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_if=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_synchronized=insert
+org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_while=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_return=insert
+org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw=insert
+org.eclipse.jdt.core.formatter.insert_space_before_postfix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_conditional=insert
+org.eclipse.jdt.core.formatter.insert_space_before_question_in_wildcard=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_semicolon_in_for=do not insert
+org.eclipse.jdt.core.formatter.insert_space_before_unary_operator=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_brackets_in_array_type_reference=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_braces_in_array_initializer=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_brackets_in_array_allocation_expression=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_annotation_type_member_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_enum_constant=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_declaration=do not insert
+org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_method_invocation=do not insert
+org.eclipse.jdt.core.formatter.join_lines_in_comments=false
+org.eclipse.jdt.core.formatter.join_wrapped_lines=false
+org.eclipse.jdt.core.formatter.keep_else_statement_on_same_line=true
+org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_imple_if_on_one_line=false
+org.eclipse.jdt.core.formatter.keep_then_statement_on_same_line=true
+org.eclipse.jdt.core.formatter.lineSplit=9999
+org.eclipse.jdt.core.formatter.never_indent_block_comments_on_first_column=true
+org.eclipse.jdt.core.formatter.never_indent_line_comments_on_first_column=true
+org.eclipse.jdt.core.formatter.number_of_blank_lines_at_beginning_of_method_body=0
+org.eclipse.jdt.core.formatter.number_of_empty_lines_to_preserve=1
+org.eclipse.jdt.core.formatter.put_empty_statement_on_new_line=true
+org.eclipse.jdt.core.formatter.tabulation.char=space
+org.eclipse.jdt.core.formatter.tabulation.size=2
+org.eclipse.jdt.core.formatter.use_on_off_tags=false
+org.eclipse.jdt.core.formatter.use_tabs_only_for_leading_indentations=true
+org.eclipse.jdt.core.formatter.wrap_before_binary_operator=true
+org.eclipse.jdt.core.formatter.wrap_outer_expressions_when_nested=true
diff --git a/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.jdt.ui.prefs b/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.jdt.ui.prefs
index 51bd52485..9eafadd83 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.jdt.ui.prefs
+++ b/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.jdt.ui.prefs
@@ -1,115 +1,115 @@
-#Mon Aug 29 13:25:58 CEST 2011
-cleanup.add_default_serial_version_id=true
-cleanup.add_generated_serial_version_id=false
-cleanup.add_missing_annotations=true
-cleanup.add_missing_deprecated_annotations=false
-cleanup.add_missing_methods=false
-cleanup.add_missing_nls_tags=false
-cleanup.add_missing_override_annotations=true
-cleanup.add_serial_version_id=false
-cleanup.always_use_blocks=true
-cleanup.always_use_parentheses_in_expressions=false
-cleanup.always_use_this_for_non_static_field_access=false
-cleanup.always_use_this_for_non_static_method_access=false
-cleanup.convert_to_enhanced_for_loop=false
-cleanup.correct_indentation=true
-cleanup.format_source_code=true
-cleanup.format_source_code_changes_only=false
-cleanup.make_local_variable_final=true
-cleanup.make_parameters_final=false
-cleanup.make_private_fields_final=true
-cleanup.make_type_abstract_if_missing_method=false
-cleanup.make_variable_declarations_final=false
-cleanup.never_use_blocks=false
-cleanup.never_use_parentheses_in_expressions=true
-cleanup.organize_imports=true
-cleanup.qualify_static_field_accesses_with_declaring_class=false
-cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false
-cleanup.qualify_static_member_accesses_with_declaring_class=false
-cleanup.qualify_static_method_accesses_with_declaring_class=false
-cleanup.remove_private_constructors=true
-cleanup.remove_trailing_whitespaces=true
-cleanup.remove_trailing_whitespaces_all=true
-cleanup.remove_trailing_whitespaces_ignore_empty=false
-cleanup.remove_unnecessary_casts=false
-cleanup.remove_unnecessary_nls_tags=false
-cleanup.remove_unused_imports=true
-cleanup.remove_unused_local_variables=false
-cleanup.remove_unused_private_fields=true
-cleanup.remove_unused_private_members=false
-cleanup.remove_unused_private_methods=true
-cleanup.remove_unused_private_types=true
-cleanup.sort_members=false
-cleanup.sort_members_all=false
-cleanup.use_blocks=false
-cleanup.use_blocks_only_for_return_and_throw=false
-cleanup.use_parentheses_in_expressions=false
-cleanup.use_this_for_non_static_field_access=false
-cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-cleanup.use_this_for_non_static_method_access=false
-cleanup.use_this_for_non_static_method_access_only_if_necessary=true
-cleanup_profile=_Eclipse Scout
-cleanup_settings_version=2
-eclipse.preferences.version=1
-editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
-formatter_profile=_Eclipse Scout
-formatter_settings_version=11
-org.eclipse.jdt.ui.exception.name=e
-org.eclipse.jdt.ui.gettersetter.use.is=true
-org.eclipse.jdt.ui.javadoc=true
-org.eclipse.jdt.ui.keywordthis=false
-org.eclipse.jdt.ui.overrideannotation=true
-org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************&\#13;\r\n * Copyright (c) 2010 BSI Business Systems Integration AG.&\#13;\r\n * All rights reserved. This program and the accompanying materials&\#13;\r\n * are made available under the terms of the Eclipse Public License v1.0&\#13;\r\n * which accompanies this distribution, and is available at&\#13;\r\n * http\://www.eclipse.org/legal/epl-v10.html&\#13;\r\n * &\#13;\r\n * Contributors\:&\#13;\r\n * BSI Business Systems Integration AG - initial API and implementation&\#13;\r\n ******************************************************************************/</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
-sp_cleanup.add_default_serial_version_id=true
-sp_cleanup.add_generated_serial_version_id=false
-sp_cleanup.add_missing_annotations=true
-sp_cleanup.add_missing_deprecated_annotations=true
-sp_cleanup.add_missing_methods=false
-sp_cleanup.add_missing_nls_tags=false
-sp_cleanup.add_missing_override_annotations=true
-sp_cleanup.add_missing_override_annotations_interface_methods=true
-sp_cleanup.add_serial_version_id=false
-sp_cleanup.always_use_blocks=true
-sp_cleanup.always_use_parentheses_in_expressions=false
-sp_cleanup.always_use_this_for_non_static_field_access=false
-sp_cleanup.always_use_this_for_non_static_method_access=false
-sp_cleanup.convert_to_enhanced_for_loop=false
-sp_cleanup.correct_indentation=true
-sp_cleanup.format_source_code=true
-sp_cleanup.format_source_code_changes_only=false
-sp_cleanup.make_local_variable_final=false
-sp_cleanup.make_parameters_final=false
-sp_cleanup.make_private_fields_final=true
-sp_cleanup.make_type_abstract_if_missing_method=false
-sp_cleanup.make_variable_declarations_final=false
-sp_cleanup.never_use_blocks=false
-sp_cleanup.never_use_parentheses_in_expressions=true
-sp_cleanup.on_save_use_additional_actions=true
-sp_cleanup.organize_imports=true
-sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
-sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
-sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
-sp_cleanup.remove_private_constructors=true
-sp_cleanup.remove_trailing_whitespaces=true
-sp_cleanup.remove_trailing_whitespaces_all=true
-sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
-sp_cleanup.remove_unnecessary_casts=false
-sp_cleanup.remove_unnecessary_nls_tags=true
-sp_cleanup.remove_unused_imports=true
-sp_cleanup.remove_unused_local_variables=false
-sp_cleanup.remove_unused_private_fields=true
-sp_cleanup.remove_unused_private_members=false
-sp_cleanup.remove_unused_private_methods=true
-sp_cleanup.remove_unused_private_types=true
-sp_cleanup.sort_members=false
-sp_cleanup.sort_members_all=false
-sp_cleanup.use_blocks=true
-sp_cleanup.use_blocks_only_for_return_and_throw=false
-sp_cleanup.use_parentheses_in_expressions=false
-sp_cleanup.use_this_for_non_static_field_access=false
-sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
-sp_cleanup.use_this_for_non_static_method_access=false
-sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+#Mon Aug 29 13:25:58 CEST 2011
+cleanup.add_default_serial_version_id=true
+cleanup.add_generated_serial_version_id=false
+cleanup.add_missing_annotations=true
+cleanup.add_missing_deprecated_annotations=false
+cleanup.add_missing_methods=false
+cleanup.add_missing_nls_tags=false
+cleanup.add_missing_override_annotations=true
+cleanup.add_serial_version_id=false
+cleanup.always_use_blocks=true
+cleanup.always_use_parentheses_in_expressions=false
+cleanup.always_use_this_for_non_static_field_access=false
+cleanup.always_use_this_for_non_static_method_access=false
+cleanup.convert_to_enhanced_for_loop=false
+cleanup.correct_indentation=true
+cleanup.format_source_code=true
+cleanup.format_source_code_changes_only=false
+cleanup.make_local_variable_final=true
+cleanup.make_parameters_final=false
+cleanup.make_private_fields_final=true
+cleanup.make_type_abstract_if_missing_method=false
+cleanup.make_variable_declarations_final=false
+cleanup.never_use_blocks=false
+cleanup.never_use_parentheses_in_expressions=true
+cleanup.organize_imports=true
+cleanup.qualify_static_field_accesses_with_declaring_class=false
+cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=false
+cleanup.qualify_static_member_accesses_with_declaring_class=false
+cleanup.qualify_static_method_accesses_with_declaring_class=false
+cleanup.remove_private_constructors=true
+cleanup.remove_trailing_whitespaces=true
+cleanup.remove_trailing_whitespaces_all=true
+cleanup.remove_trailing_whitespaces_ignore_empty=false
+cleanup.remove_unnecessary_casts=false
+cleanup.remove_unnecessary_nls_tags=false
+cleanup.remove_unused_imports=true
+cleanup.remove_unused_local_variables=false
+cleanup.remove_unused_private_fields=true
+cleanup.remove_unused_private_members=false
+cleanup.remove_unused_private_methods=true
+cleanup.remove_unused_private_types=true
+cleanup.sort_members=false
+cleanup.sort_members_all=false
+cleanup.use_blocks=false
+cleanup.use_blocks_only_for_return_and_throw=false
+cleanup.use_parentheses_in_expressions=false
+cleanup.use_this_for_non_static_field_access=false
+cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+cleanup.use_this_for_non_static_method_access=false
+cleanup.use_this_for_non_static_method_access_only_if_necessary=true
+cleanup_profile=_Eclipse Scout
+cleanup_settings_version=2
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+formatter_profile=_Eclipse Scout
+formatter_settings_version=11
+org.eclipse.jdt.ui.exception.name=e
+org.eclipse.jdt.ui.gettersetter.use.is=true
+org.eclipse.jdt.ui.javadoc=true
+org.eclipse.jdt.ui.keywordthis=false
+org.eclipse.jdt.ui.overrideannotation=true
+org.eclipse.jdt.ui.text.custom_code_templates=<?xml version\="1.0" encoding\="UTF-8" standalone\="no"?><templates><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter method" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="filecomment_context" deleted\="false" description\="Comment for created Java files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.filecomment" name\="filecomment">/*******************************************************************************&\#13;\r\n * Copyright (c) 2010 BSI Business Systems Integration AG.&\#13;\r\n * All rights reserved. This program and the accompanying materials&\#13;\r\n * are made available under the terms of the Eclipse Public License v1.0&\#13;\r\n * which accompanies this distribution, and is available at&\#13;\r\n * http\://www.eclipse.org/legal/epl-v10.html&\#13;\r\n * &\#13;\r\n * Contributors\:&\#13;\r\n * BSI Business Systems Integration AG - initial API and implementation&\#13;\r\n ******************************************************************************/</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for fields" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="true" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate methods" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="true" context\="interfacebody_context" deleted\="false" description\="Code in new interface type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.interfacebody" name\="interfacebody">\r\n</template><template autoinsert\="true" context\="enumbody_context" deleted\="false" description\="Code in new enum type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.enumbody" name\="enumbody">\r\n</template><template autoinsert\="true" context\="annotationbody_context" deleted\="false" description\="Code in new annotation type bodies" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.annotationbody" name\="annotationbody">\r\n</template><template autoinsert\="true" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.catchblock" name\="catchblock">// ${todo} Auto-generated catch block\r\n${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created method stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.jdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template><template autoinsert\="false" context\="gettercomment_context" deleted\="false" description\="Comment for getter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.gettercomment" name\="gettercomment"/><template autoinsert\="false" context\="settercomment_context" deleted\="false" description\="Comment for setter function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.settercomment" name\="settercomment"/><template autoinsert\="true" context\="constructorcomment_context" deleted\="false" description\="Comment for created constructors" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorcomment" name\="constructorcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="true" context\="filecomment_context" deleted\="false" description\="Comment for created JavaScript files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.filecomment" name\="filecomment">/**\r\n * \r\n */</template><template autoinsert\="false" context\="typecomment_context" deleted\="false" description\="Comment for created types" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.typecomment" name\="typecomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="fieldcomment_context" deleted\="false" description\="Comment for vars" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.fieldcomment" name\="fieldcomment"/><template autoinsert\="false" context\="methodcomment_context" deleted\="false" description\="Comment for non-overriding function" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodcomment" name\="methodcomment">/**\r\n * ${tags}\r\n */</template><template autoinsert\="false" context\="overridecomment_context" deleted\="false" description\="Comment for overriding functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.overridecomment" name\="overridecomment"/><template autoinsert\="true" context\="delegatecomment_context" deleted\="false" description\="Comment for delegate functions" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.delegatecomment" name\="delegatecomment">/**\r\n * ${tags}\r\n * ${see_to_target}\r\n */</template><template autoinsert\="true" context\="newtype_context" deleted\="false" description\="Newly created files" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.newtype" name\="newtype">${filecomment}\r\n${package_declaration}\r\n\r\n${typecomment}\r\n${type_declaration}</template><template autoinsert\="true" context\="classbody_context" deleted\="false" description\="Code in new class type bodies" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.classbody" name\="classbody">\r\n</template><template autoinsert\="false" context\="catchblock_context" deleted\="false" description\="Code in new catch blocks" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.catchblock" name\="catchblock">${exception_var}.printStackTrace();</template><template autoinsert\="false" context\="methodbody_context" deleted\="false" description\="Code in created function stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.methodbody" name\="methodbody">${body_statement}</template><template autoinsert\="false" context\="constructorbody_context" deleted\="false" description\="Code in created constructor stubs" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.constructorbody" name\="constructorbody">${body_statement}</template><template autoinsert\="true" context\="getterbody_context" deleted\="false" description\="Code in created getters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.getterbody" name\="getterbody">return ${field};</template><template autoinsert\="true" context\="setterbody_context" deleted\="false" description\="Code in created setters" enabled\="true" id\="org.eclipse.wst.jsdt.ui.text.codetemplates.setterbody" name\="setterbody">${field} \= ${param};</template></templates>
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_missing_override_annotations_interface_methods=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=true
+sp_cleanup.format_source_code=true
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=false
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=true
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=true
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=false
+sp_cleanup.remove_unnecessary_nls_tags=true
+sp_cleanup.remove_unused_imports=true
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=true
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
diff --git a/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.pde.core.prefs b/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.pde.core.prefs
index baef13dd8..a3a50fc8d 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.pde.core.prefs
+++ b/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.pde.core.prefs
@@ -1,3 +1,3 @@
-#Mon Jul 11 16:16:00 CEST 2011
-eclipse.preferences.version=1
-pluginProject.extensions=true
+#Mon Jul 11 16:16:00 CEST 2011
+eclipse.preferences.version=1
+pluginProject.extensions=true
diff --git a/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.wst.validation.prefs b/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.wst.validation.prefs
index 3919e3457..6e019f5ad 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.wst.validation.prefs
+++ b/org.eclipse.scout.sdk.ws.jaxws/.settings/org.eclipse.wst.validation.prefs
@@ -1,10 +1,10 @@
-#Wed Feb 23 23:48:02 CET 2011
-DELEGATES_PREFERENCE=delegateValidatorList
-USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
-USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
-USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.104.v200911120201
-eclipse.preferences.version=1
-override=true
-suspend=false
-vals/org.eclipse.wst.xml.core.xml/groups=0107include05111contentType128org.eclipse.core.runtime.xmlT111contentType134org.eclipse.wst.xml.core.xmlsourceT111contentType134org.eclipse.wst.xml.core.xslsourceT111contentType134org.eclipse.jst.jsp.core.tldsourceT07fileext03xmlF0107exclude06113projectNature134org.eclipse.jst.j2ee.ejb.EJBNature113projectNature130org.eclipse.jst.j2ee.EARNature04file08.projectT0104file110.classpathT0104file110.settings/T0204file110plugin.xmlF01
-vf.version=3
+#Wed Feb 23 23:48:02 CET 2011
+DELEGATES_PREFERENCE=delegateValidatorList
+USER_BUILD_PREFERENCE=enabledBuildValidatorListorg.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
+USER_MANUAL_PREFERENCE=enabledManualValidatorListorg.eclipse.wst.wsi.ui.internal.WSIMessageValidator;
+USER_PREFERENCE=overrideGlobalPreferencestruedisableAllValidationfalseversion1.2.104.v200911120201
+eclipse.preferences.version=1
+override=true
+suspend=false
+vals/org.eclipse.wst.xml.core.xml/groups=0107include05111contentType128org.eclipse.core.runtime.xmlT111contentType134org.eclipse.wst.xml.core.xmlsourceT111contentType134org.eclipse.wst.xml.core.xslsourceT111contentType134org.eclipse.jst.jsp.core.tldsourceT07fileext03xmlF0107exclude06113projectNature134org.eclipse.jst.j2ee.ejb.EJBNature113projectNature130org.eclipse.jst.j2ee.EARNature04file08.projectT0104file110.classpathT0104file110.settings/T0204file110plugin.xmlF01
+vf.version=3
diff --git a/org.eclipse.scout.sdk.ws.jaxws/Release Notes.txt b/org.eclipse.scout.sdk.ws.jaxws/Release Notes.txt
index 6d8dcf3ad..9a123714c 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/Release Notes.txt
+++ b/org.eclipse.scout.sdk.ws.jaxws/Release Notes.txt
@@ -1,26 +1,26 @@
-27.10.2011 dwi
-Problem:
-The name of the JAR file generated by the Scout SDK should be based on the WSDL instead of the alias.
-This would solve the problem where the provider and the consumer are both part of the application and
-there are thus two seperate JAR files containing the same class (with the same package name).
-Solution:
-- The name of the stub JAR file is not derived from the alias anymore but from the WSDL filename instead.
- This behavior can be overwritten by adding the build property 'jar' with the respective stub JAR file name.
-- Phantom stub JAR files can be discovered and removed in Scout SDK on the root node 'Web Services (JAX-WS)'. There you find the link 'Cleanup phantom stub JAR files' on the property page.
-Migration:
-- rebuild the WS stubs of all providers and consumers
-- Remove phantom stub JAR files as described in solution.
-
-06.01.2012 dwi
-Bugzilla: 367994
-Problem:
-a) The WSDL file of webservice providers whose WSDL file is located in a sub-folder of '/WEB-INF/wsdl' is dynamically generated at JAX-WS bootstrap instead of the existing WSDL file to be published.
-b) Webservice consumer specific WSDL files might interfere with provider specific WSDL files, e.g. if defining same services or ports. In consequence, all webservice providers of that plugin are not published.
-c) redundant WSDL file in webservice stub JAR-file.
-Solution:
-a) changed JAX-WS resource loading to also look in subfolders for existing resources
-b) WS provider specific WSDL files should be located in the folder '/WEB-INF/wsdl/provider' whereas consumer specific WSDL files in '/WEB-INF/wsdl/consumer'. In turn, JAX-WS is instrumented to ignore all the files in the (sub-)folder '/WEB-INF/wsdl/consumer' when publishing the endpoints.
-c) WSDL file is not put into the JAR archive anymore when building the webservice stub.
-Migration:
-- Use Scout SDK (repair actions) to move WSDL files of webservice providers into folder '/WEB-INF/wsdl/provider' and of webservice consumer into folder '/WEB-INF/wsdl/consumers'
+27.10.2011 dwi
+Problem:
+The name of the JAR file generated by the Scout SDK should be based on the WSDL instead of the alias.
+This would solve the problem where the provider and the consumer are both part of the application and
+there are thus two seperate JAR files containing the same class (with the same package name).
+Solution:
+- The name of the stub JAR file is not derived from the alias anymore but from the WSDL filename instead.
+ This behavior can be overwritten by adding the build property 'jar' with the respective stub JAR file name.
+- Phantom stub JAR files can be discovered and removed in Scout SDK on the root node 'Web Services (JAX-WS)'. There you find the link 'Cleanup phantom stub JAR files' on the property page.
+Migration:
+- rebuild the WS stubs of all providers and consumers
+- Remove phantom stub JAR files as described in solution.
+
+06.01.2012 dwi
+Bugzilla: 367994
+Problem:
+a) The WSDL file of webservice providers whose WSDL file is located in a sub-folder of '/WEB-INF/wsdl' is dynamically generated at JAX-WS bootstrap instead of the existing WSDL file to be published.
+b) Webservice consumer specific WSDL files might interfere with provider specific WSDL files, e.g. if defining same services or ports. In consequence, all webservice providers of that plugin are not published.
+c) redundant WSDL file in webservice stub JAR-file.
+Solution:
+a) changed JAX-WS resource loading to also look in subfolders for existing resources
+b) WS provider specific WSDL files should be located in the folder '/WEB-INF/wsdl/provider' whereas consumer specific WSDL files in '/WEB-INF/wsdl/consumer'. In turn, JAX-WS is instrumented to ignore all the files in the (sub-)folder '/WEB-INF/wsdl/consumer' when publishing the endpoints.
+c) WSDL file is not put into the JAR archive anymore when building the webservice stub.
+Migration:
+- Use Scout SDK (repair actions) to move WSDL files of webservice providers into folder '/WEB-INF/wsdl/provider' and of webservice consumer into folder '/WEB-INF/wsdl/consumers'
- Rebuild webservice stubs (should automatically be done if using repair action) \ No newline at end of file
diff --git a/org.eclipse.scout.sdk.ws.jaxws/build.properties b/org.eclipse.scout.sdk.ws.jaxws/build.properties
index 8e80c8ffb..7bb9518ef 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/build.properties
+++ b/org.eclipse.scout.sdk.ws.jaxws/build.properties
@@ -1,8 +1,8 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- resources/,\
- about.html
-src.includes = about.html
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ resources/,\
+ about.html
+src.includes = about.html
diff --git a/org.eclipse.scout.sdk.ws.jaxws/plugin.xml b/org.eclipse.scout.sdk.ws.jaxws/plugin.xml
index ab3ea6716..8e567eb97 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/plugin.xml
+++ b/org.eclipse.scout.sdk.ws.jaxws/plugin.xml
@@ -1,202 +1,202 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.4"?>
-<plugin>
- <extension
- point="org.eclipse.core.runtime.preferences">
- <initializer
- class="org.eclipse.scout.sdk.ws.jaxws.preferences.PreferenceInitializer">
- </initializer>
- </extension>
- <extension point="org.eclipse.ui.preferencePages">
- <page category="org.eclipse.scout.sdk.ui.extensions.preferences.ScoutSdkPreferencePage"
- class="org.eclipse.scout.sdk.ws.jaxws.preferences.JaxWsPreferencePage"
- id="org.eclipse.scout.sdk.ws.jaxws.preferences.JaxWsPreferencePage"
- name="JAX-WS">
- </page>
- </extension>
- <extension
- id="jaxws"
- name="problem"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.core.resources.problemmarker" />
- </extension>
- <extension
- id="urlPattern"
- name="urlPattern"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension
- id="targetNamespace"
- name="targetNamespace"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension
- id="service"
- name="service"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension
- id="port"
- name="port"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension
- id="porttype"
- name="porttype"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension
- id="stubFolder"
- name="stubFolder"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension
- id="stubJar"
- name="stubJar"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension
- id="implementation"
- name="implementation"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension
- id="package"
- name="package"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension
- id="wsdl"
- name="wsdl"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension
- id="wsdlFolder"
- name="wsdlFolder"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension
- id="bindingFile"
- name="bindingFile"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension
- id="missingBuildJaxWsEntry"
- name="missingBuildJaxWsEntry"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension
- id="serviceType"
- name="serviceType"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension
- id="handlerClazz"
- name="handlerClazz"
- point="org.eclipse.core.resources.markers">
- <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
- </extension>
- <extension point="org.eclipse.scout.sdk.ui.propertyViewPart">
- <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderNodePage">
- <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.WebServiceProviderNodePagePropertyViewPart"/>
- </part>
- <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderCodeFirstNodePage">
- <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.WebServiceProviderCodeFirstNodePagePropertyViewPart"/>
- </part>
- <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServicesTablePage">
- <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.WebServicesTablePagePropertyViewPart"/>
- </part>
- <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderTablePage">
- <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.WebServiceProviderTablePagePropertyViewPart"/>
- </part>
- <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.ProviderTablePage">
- <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.ProviderTablePagePropertyViewPart"/>
- </part>
- <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceConsumerTablePage">
- <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.WebServiceConsumerTablePagePropertyViewPart"/>
- </part>
- <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceConsumerNodePage">
- <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.WebServiceConsumerNodePagePropertyViewPart"/>
- </part>
- <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderHandlerNodePage">
- <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.WebServiceProviderHandlerNodePagePropertyViewPart"/>
- </part>
- <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.HandlerTablePage">
- <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.HandlerTablePagePropertyViewPart"/>
- </part>
- <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.HandlerNodePage">
- <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.HandlerNodePagePropertyViewPart"/>
- </part>
- <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.SessionFactoryTablePage">
- <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.SessionFactoryTablePagePropertyViewPart"/>
- </part>
- <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.CredentialValidationStrategyTablePage">
- <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.CredentialValidationStrategyTablePagePropertyViewPart"/>
- </part>
- <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.AuthenticationHandlerTablePage">
- <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.AuthenticationHandlerTablePagePropertyViewPart"/>
- </part>
- <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.AuthenticationHandlerNodePage">
- <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.AuthenticationHandlerNodePagePropertyViewPart"/>
- </part>
- </extension>
- <extension point="org.eclipse.scout.sdk.ui.explorerPage">
- <pageFactory
- factory="org.eclipse.scout.sdk.ws.jaxws.ext.WebServicePageFactory"
- parentPageId="org.eclipse.scout.sdk.page.ServerNodePage">
- </pageFactory>
- </extension>
- <extension point="org.eclipse.scout.sdk.ui.contextMenu">
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.BindingFileNewAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.BuildPropertiesEditAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.ConsumerNewWizardAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.ProviderNewWizardAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.RefreshAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.RepairAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.StubRebuildAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.TypeOpenAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.WsConsumerDeleteAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.WsProviderDeleteAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.WsProviderCodeFirstDeleteAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.JaxWsAliasChangeWizardAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerChainFilterEditAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerChainRemoveAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerChainNewAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerNewWizardAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.SessionFactoryNewAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.CredentialValidationStrategyNewAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.AuthenticationHandlerNewWizardAction"></contextMenu>
- <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.CleanupPhantomJarFileAction"></contextMenu>
- </extension>
- <extension
- point="org.eclipse.scout.sdk.ui.technology">
- <technology
- category="Backend Features"
- id="scout.technology.ws.jaxws"
- name="Webservices with JAX-WS RI 2.1.6">
- </technology>
- <handler
- class="org.eclipse.scout.sdk.ws.jaxws.technology.JaxWsServerProdTechnologyHandler"
- technology="scout.technology.ws.jaxws">
- </handler>
- <handler
- class="org.eclipse.scout.sdk.ws.jaxws.technology.JaxWsServerManifestTechnologyHandler"
- technology="scout.technology.ws.jaxws">
- </handler>
- </extension>
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+ <extension
+ point="org.eclipse.core.runtime.preferences">
+ <initializer
+ class="org.eclipse.scout.sdk.ws.jaxws.preferences.PreferenceInitializer">
+ </initializer>
+ </extension>
+ <extension point="org.eclipse.ui.preferencePages">
+ <page category="org.eclipse.scout.sdk.ui.extensions.preferences.ScoutSdkPreferencePage"
+ class="org.eclipse.scout.sdk.ws.jaxws.preferences.JaxWsPreferencePage"
+ id="org.eclipse.scout.sdk.ws.jaxws.preferences.JaxWsPreferencePage"
+ name="JAX-WS">
+ </page>
+ </extension>
+ <extension
+ id="jaxws"
+ name="problem"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.core.resources.problemmarker" />
+ </extension>
+ <extension
+ id="urlPattern"
+ name="urlPattern"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension
+ id="targetNamespace"
+ name="targetNamespace"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension
+ id="service"
+ name="service"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension
+ id="port"
+ name="port"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension
+ id="porttype"
+ name="porttype"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension
+ id="stubFolder"
+ name="stubFolder"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension
+ id="stubJar"
+ name="stubJar"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension
+ id="implementation"
+ name="implementation"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension
+ id="package"
+ name="package"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension
+ id="wsdl"
+ name="wsdl"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension
+ id="wsdlFolder"
+ name="wsdlFolder"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension
+ id="bindingFile"
+ name="bindingFile"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension
+ id="missingBuildJaxWsEntry"
+ name="missingBuildJaxWsEntry"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension
+ id="serviceType"
+ name="serviceType"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension
+ id="handlerClazz"
+ name="handlerClazz"
+ point="org.eclipse.core.resources.markers">
+ <super type="org.eclipse.scout.sdk.ws.jaxws.jaxws" />
+ </extension>
+ <extension point="org.eclipse.scout.sdk.ui.propertyViewPart">
+ <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderNodePage">
+ <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.WebServiceProviderNodePagePropertyViewPart"/>
+ </part>
+ <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderCodeFirstNodePage">
+ <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.WebServiceProviderCodeFirstNodePagePropertyViewPart"/>
+ </part>
+ <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServicesTablePage">
+ <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.WebServicesTablePagePropertyViewPart"/>
+ </part>
+ <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderTablePage">
+ <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.WebServiceProviderTablePagePropertyViewPart"/>
+ </part>
+ <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.ProviderTablePage">
+ <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.ProviderTablePagePropertyViewPart"/>
+ </part>
+ <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceConsumerTablePage">
+ <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.WebServiceConsumerTablePagePropertyViewPart"/>
+ </part>
+ <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceConsumerNodePage">
+ <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.WebServiceConsumerNodePagePropertyViewPart"/>
+ </part>
+ <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderHandlerNodePage">
+ <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.WebServiceProviderHandlerNodePagePropertyViewPart"/>
+ </part>
+ <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.HandlerTablePage">
+ <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.HandlerTablePagePropertyViewPart"/>
+ </part>
+ <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.HandlerNodePage">
+ <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.HandlerNodePagePropertyViewPart"/>
+ </part>
+ <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.SessionFactoryTablePage">
+ <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.SessionFactoryTablePagePropertyViewPart"/>
+ </part>
+ <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.CredentialValidationStrategyTablePage">
+ <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.CredentialValidationStrategyTablePagePropertyViewPart"/>
+ </part>
+ <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.AuthenticationHandlerTablePage">
+ <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.AuthenticationHandlerTablePagePropertyViewPart"/>
+ </part>
+ <part page="org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.AuthenticationHandlerNodePage">
+ <singlePart viewPart="org.eclipse.scout.sdk.ws.jaxws.swt.view.part.AuthenticationHandlerNodePagePropertyViewPart"/>
+ </part>
+ </extension>
+ <extension point="org.eclipse.scout.sdk.ui.explorerPage">
+ <pageFactory
+ factory="org.eclipse.scout.sdk.ws.jaxws.ext.WebServicePageFactory"
+ parentPageId="org.eclipse.scout.sdk.page.ServerNodePage">
+ </pageFactory>
+ </extension>
+ <extension point="org.eclipse.scout.sdk.ui.contextMenu">
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.BindingFileNewAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.BuildPropertiesEditAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.ConsumerNewWizardAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.ProviderNewWizardAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.RefreshAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.RepairAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.StubRebuildAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.TypeOpenAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.WsConsumerDeleteAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.WsProviderDeleteAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.WsProviderCodeFirstDeleteAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.JaxWsAliasChangeWizardAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerChainFilterEditAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerChainRemoveAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerChainNewAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerNewWizardAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.SessionFactoryNewAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.CredentialValidationStrategyNewAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.AuthenticationHandlerNewWizardAction"></contextMenu>
+ <contextMenu class="org.eclipse.scout.sdk.ws.jaxws.swt.action.CleanupPhantomJarFileAction"></contextMenu>
+ </extension>
+ <extension
+ point="org.eclipse.scout.sdk.ui.technology">
+ <technology
+ category="Backend Features"
+ id="scout.technology.ws.jaxws"
+ name="Webservices with JAX-WS RI 2.1.6">
+ </technology>
+ <handler
+ class="org.eclipse.scout.sdk.ws.jaxws.technology.JaxWsServerProdTechnologyHandler"
+ technology="scout.technology.ws.jaxws">
+ </handler>
+ <handler
+ class="org.eclipse.scout.sdk.ws.jaxws.technology.JaxWsServerManifestTechnologyHandler"
+ technology="scout.technology.ws.jaxws">
+ </handler>
+ </extension>
+</plugin>
diff --git a/org.eclipse.scout.sdk.ws.jaxws/resources/texts/Texts.properties b/org.eclipse.scout.sdk.ws.jaxws/resources/texts/Texts.properties
index 9e07759c6..218311f10 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/resources/texts/Texts.properties
+++ b/org.eclipse.scout.sdk.ws.jaxws/resources/texts/Texts.properties
@@ -1,378 +1,378 @@
-Add=Add
-AddAdditionalResources1=WSDL port and binding definitions as well as schema types might be located in separate files.\n Add those related resources.
-AddAdditionalResources=Add additional resources
-AddBindingFile=Add binding file
-AddHandler=Add handler
-AddRelatedFiles=Add related files
-AdditionalResources=Additional resources
-Alias=Alias
-AliasXAlreadyExists=There already exists an alias with the name {0}.
-AnnotateImplClass=Annotate implementing class with {0} Annotation
-AnnotationXWithPropertyYRequired=Type must be annotated with '{0}' annotation with the property '{1}' set.
-Artefact=Artefact
-ArtefactPackage=Artefact package
-Authentication=Authentication
-AuthenticationAndSesDescriptionCredentialValidatinStrategysionHandling=Authentication and session handling
-AuthenticationAndSessionContext=Authentication and session context
-AuthenticationHandler=Authentication Handler
-AuthenticationHandlers=Authentication Handlers
-AuthenticationMechanism=Authentication mechanism
-Binding=Binding
-BindingFile=Binding file
-BindingFileXCouldNotBeFound=Binding file '{0}' could not be found.
-BindingFileXIsNotAValidXMLFile=Binding file '{0}' is not a valid XML file.
-Browse=Browse
-BrowseForType=Browse for a type
-BrowseForWsdlFile=Browse for a WSDL file
-BuildProperties=Build properties
-BuildStubInDebugMode=Build stub in DEBUG-mode
-ByClickingFinishHandlerIsCreated=By clicking finish, the handler is created.
-ByClickingFinishSourceFolderIsCreated=By clicking finish, the source folder is created.
-ByClickingFinishXIsCreated=By clicking finish, the {0} is created.
-ByConventionXShouldByY=By convention, the '{0}' should be '{1}'
-ByConventionXShouldStartWithY=By convention, the '{0}' should start with '{1}'
-Change=Change
-ChangeJaxWsAlias=Change webservice servlet alias
-ChangeJaxWsAliasByClicking=Change the webservice servlet alias by clicking
-ChangeJaxWsServletRegistration=Change JAX-WS servlet registration
-ChangeUrlOfWsdl=Change the URL to which the web service's WSDL is published
-ChangeUrlPatternOrJaxWsServletRegistration=Change URL pattern or JAX-WS Servlet registration
-ChooseFolder=Choose folder
-ChooseFolderForWsdlFileAndArtefacts=Choose the folder for the WSDL file and its artefacts to be copied
-ChoosePackageForHandler=Choose package for handler class
-ChoosePackageForImplementingClass=Choose package for implementing class
-ChoosePackageForWsConsumer=Choose package for webservice consumer
-ChoosePackageForX=Choose package for {0} class
-ChooseType=Choose type
-ChooseWsdlFile=Choose the WSDL file to be used
-ChooseWsdlFileFromFilesystem=Choose WSDL file from filesystem
-ChooseWsdlFromUrl=Choose WSDL from URL
-ChooseXY=Choose {0}
-CleanupPhantomStubFiles=Cleanup phantom stub JAR files
-CleanupUnreferencedJarFiles=Cleanup phantom stub JAR files
-CleanupUnreferencedJarFilesByClicking=Cleanup phantom stub JAR files by clicking
-ClearPackage=Clear package and subpackages prior to stub generation
-ClickFinishToCreateDirective=Click finish to create build directive
-ClickNextToContinue=Click next to continue
-ClickToAddAdditionalResources=Click to add related resources like XSD schemas or related WSDL files located in separate files
-ClickToBrowseForAnotherPackage=Click to browse for another package
-ClickToCreateNewSourceFolder=Click to create a new source folder
-ClickToCreatePackageXY=Click to create package '{0}'
-ClickToFixTheProblems=Click to fix the problems.
-ClickToGenerateWsStub=Click to rebuild the webservice stub
-ClickToIncreasePrecendence=Click to give the handler a higher precedence
-ClickToLowerPrecendence=Click to give the handler a lower precedence
-ConfigureFilterForHandlerChain=Configure a filter for handler chain
-ConfigureImplementingClass=Configure Webservice Implementing Class
-ConfigureJaxWsAlias=Configure the alias the webservices should be accessable at.
-ConfigureJaxWsServletRegistration=Configure JAX-WS servlet registration
-ConfigureWebServiceStub=Configure Webservice Stub
-ConfigureWebserviceProperties=Configure Webservice Properties
-ConsiderLinks=Consider the following links
-Consumer=Consumer
-ConventionPackageNameEqualsToTargetNamespaceX=By specifying a custom package name, JAX-WS is instrumented to not apply the default package name algorithm and to ignore any WSDL and schema binding customization for package name.
-CorruptWSDLFileAtLocationX=Corrupt WSDL file at location '{0}'
-CouldNotDownloadWSDLFile=Could not download WSDL file.
-CreateBindingFile=Create binding file to control stub generation process
-CreateHandler=Create a New Handler
-CreateImplClass=Create implementing class
-CreateImplClassTitle=Create Implementing Class
-CreateNewHandlerByClicking=Create a new Handler by clicking
-CreateNewPackage=Create new package
-CreateNewSourceFolder=Create new source folder
-CreateNewType=Create new type
-CreateNewWsConsumerByClicking=Create a new Webservice Consumer by clicking
-CreateNewWsProviderByClicking=Create a new Webservice Provider by clicking
-CreateNewX=Create new {0}
-CreateNewXByClicking=Create a new {0} by clicking
-CreateSourceFolder=Create new source folder
-CreateWebserviceStub=Create Webservice stub
-CreateWsConsumer=Create a New Webservice Consumer
-CreateWsProvider=Create a New Webservice Provider
-CreateWsdlFile=Create a New WSDL file
-CreateWsdlFromScratch=Create WSDL file from scratch
-CreationOfTemporyFileFailed=Could not create temporary file for WSDL
-CredentialValidation1=Credential Validation
-CredentialValidation=Credential validation
-CredentialValidationStrategies=Credential Validation Strategies
-CredentialValidationStrategy=Credential validation strategy
-CredentialsRequired=Credentials for authentication required.
-DeleteWebServiceProvider=Delete Webservice Provider
-DeleteWebserviceConsumer=Delete Webservice Consumer
-DeriveOtherNamesFormPortTypeChosen=Derive other names from port type chosen
-DeriveOtherNamesFormWsdlFileName=Derive other names from WSDL file name
-Description=Description
-DescriptionAuthenticationHandlerConsumer=Authentication handlers include user credentials into the outbound message in the form of the handler's authentication mechanism.
-DescriptionAuthenticationHandlerProvider=Authentication handlers intercept inbound messages to only allow authenticated requests to pass.\nIf no user credentials is provided, they challenge the client based on their authentication mechanism for some credentials.
-DescriptionAuthenticationMechanism=Which authentication mechanism should be installed?
-DescriptionBuildDirectives=Control the stub generation process by configuring some build directives
-DescriptionChangeJaxWsServletAlias=Please note that by changing the servlet's alias the URL pattern of all webservices published by the chosen servlet are updated accordingly.\r\nE.g. if having webservices in another bundle using this JAX-WS servlet registration, their URL patterns are changed as well.
-DescriptionCredentialValidatinStrategy=Credential validation strategies encapsulates logic to validate user's credentials against a strategy such as database, config.ini, LDAP or others.\r\nThey are used in conjunction with an authentication mechanism represented by an authentication handler.
-DescriptionCredentialValidationValidation=How should user's credentials be validated?
-DescriptionHandlerChainFilter=Configure a filter to optionally apply the handler chain to specific protocols, services and ports
-DescriptionHandlerSession=Specify the session to be used for the transaction
-DescriptionHandlers=Handlers are message interceptors that are plugged in to the JAX-WS runtime to do additional processing of the inbound and outbound messages.
-DescriptionJaxWsBundleConfiguration=Choose the bundle to register JAX-WS servlet and specify the servlet's alias
-DescriptionScoutWebServiceAnnotation=By using {0} annotation, webservice calls can easily be authenticated and to be configured to run within a server session.
-DescriptionScoutWebServiceClientAnnotation=By using {0} annotation, the authentication mechanism can be specified.
-DescriptionServerSerssionFactory=Server session factories are used to create a server session for webservice providers and transational handlers to run in session scope.
-DescriptionSessionFactory=Specify a factory to define the strategy of which session to be used for authenticated requests.
-DescriptionTaskMoveFiles=Use this task to move the WSDL file and related resources into the folder '{0}'.
-Directive=Directive
-DirectiveXMustBeUnique=There is already configured a directive with the given name '{0}'
-DiscouragedPortConfigurationNoPortFoundInWSDLFileX=Discouraged port configuration\: No port found in WSDL file '{0}'.
-DiscouragedServiceConfigurationMissingOrIinvalidQNameInAttributeX=Discouraged service configuration\: Missing or invalid QName in attribute '{0}'.
-DoYouWantToChangePerspective=Do you want to change perspective to view folder content?
-DocumentLiteral=Document/literal
-DocumentLiteralWrapped=Document/literal wrapped
-Edit=Edit
-EditBuildProperties=Edit build properties
-EditFilter=Edit filter
-EditFilterXActive=Edit filter ({0} active)
-EndpointPublishConfiguration=Endpoint publish configuration
-EnterJaxWsAlias=Please enter a valid webservice servlet alias
-EnterNameForSourceFolderToBeCreated=Enter a name for the source folder to be created.
-EnterSourceFolder=Please enter the source folder to be created
-Error=Error
-FailedToDeleteFile=Failed to delete file
-FailedToDeleteFileX=Failed to delete file '{0}'. Please ensure the file not be locked.
-FailedToDeriveStubPackageNameFromTargetNamespace=Failed to derive stub package name from targetNamespace '{0}' specified in WSDL file. Please ensure the WSDL file to be valid.
-FailedToDeriveStubPackageNameFromTargetNamespaceWSDLNotValid=Failed to derive stub package name from targetNamespace as WSDL file is not valid.
-Failure=Failure
-File=File
-FileChosenFromFilesystemDoesNotExist=File chosen from filesytem does not exist
-FileDoesNotExistOrIsCorrupt=File does not exist or is corrupt
-Filter=Filter
-FilterXInstalledForHandlerChain=There is a '{0}' configured for this handler chain.\nTo change the filter, click on '{1}'.
-Folder=Folder
-FullyQualifiedName=Fully qualified name
-General=General
-GenerateWsStubByClicking=Rebuild the webservice stub by clicking
-Handler=Handler
-HandlerChain=Handler Chain
-HandlerChainFilter=Handler chain filter
-HandlerChainNewAction=Add handler chain
-HandlerChainRemoveAction=Remove handler chain
-HandlerChainX=Handler Chain '{0}'
-HandlerChains=Handler chains
-HandlerRegistration=Handler Registration
-Handlers=Handlers
-HintForOptionalFilter=An optional filter can be configured to only apply the handlers of this chain to certain protocol, servcies or ports
-Implementation=Implementation
-ImplementationTypeName=Implementation type name
-ImplementationTypePackage=Implementation type package
-ImportedIncludedXsdSchemas=Imported / included XSD schemas
-ImportedXsdSchemas=Imported XSD schemas
-IncludedXsdSchemas=Included XSD schemas
-Information=Information
-Interface=Interface
-InvalidImplementationType=Invalid implementation type
-InvalidJAXWSPortTypeConfiguredInSuperMustBeAnnotatedWithY=Invalid JAX-WS port type configured in super type generic parameter [must be annotated with '{0}'].\r\nPlease make sure, that the build directive 'Xnocompile' is not set to have the *.class files being generated.\r\nMaybe, the webservice stub is out of date. Try to rebuild the webservice stub.
-InvalidJavaType=Specified Java type {0} is not valid.
-InvalidPortTypeInSuperGenericParameter=Invalid JAX-WS port type configured in super type generic parameter [must be annotated with '{0}']\t
-InvalidPortTypeInWsdl=Invalid JAX-WS port type configured in super type generic parameter [must be annotated with '{0}']. Please make sure, that the build directive 'Xnocompile' is not set to have the *.class files being generated.\r\nMaybe, the webservice stub is out of date. Try to rebuild the webservice stub.
-InvalidServiceConfigurationMissingOrInvalidQNameInAttributeX=Invalid service configuration\: Missing or invalid QName in attribute '{0}'.
-InvalidServiceInSuperTypeGenericParameter=Invalid JAX-WS service configured in super type generic parameter [must be of type '{0}' and be annotated with '{1}']
-InvalidServiceInWsdl=Invalid JAX-WS service configured in super type generic parameter [must be of type '{0}' and be annotated with '{1}'].\r\nPlease make sure, that the build directive 'Xnocompile' is not set to have the *.class files being generated.\r\nMaybe, the webservice stub is out of date. Try to rebuild the webservice stub.
-InvalidServletAliasX=Invalid servlet alias '{0}'
-InvalidSourceFolder=Invalid source folder name
-InvalidUrlX=Invalid URL '{0}'
-InvalidValue=Invalid value
-JarFileXOfWsYMustBeOnClasspath=Stub JAR file '{0}' of webservice '{1}' must be on project classpath
-JaxWsAlias=Webservice servlet alias
-JaxWsCannotDerivePackageNameFromTargetNamespace=JAX-WS cannot derive Java package name from target namespace. Please define a custom package name.
-JaxWsDeploymentDescriptor=JAX-WS deployment descriptor
-JaxWsPortTypeInterface=JAX-WS Port type interface
-JaxWsPreferences=JAX-WS Preferences
-JaxWsProperties=JAX-WS properties
-JaxWsServletRegistration=JAX-WS Servlet registration
-JaxWsServletRegistrationInBundleX=JAX-WS servlet registration in bundle '{0}'.
-KeepLaunchConfiguration=Keep launch configuration of stub generation
-LowerCaseTypeName=\ Type name is discouraged. By convention, Java type names usually start with an uppercase letter
-MissingBuildEntryInFileX=Missing build entry in file '{0}'.
-MissingNameForImplementingClass=No name for implementing class specified.
-MissingOrEmptyAttributeX=Missing or empty attribute '{0}'.
-MissingPropertyXOnAnnotationYToLinkThePortTypeWithTheRespectivePortTypeInterface=Missing property '{0}' on annotation '{1}' to link the port type with the respective PortType interface.
-MoveReferencedXToY=Move referenced {0} to '{1}'
-MoveWsdlFileAndArtefacts=Move WSDL file and its artefacts to another folder
-MoveXToY=Move {0} to '{1} '
-MovingFiles=Moving files
-MultipleGlobalBindingDefinitionsFoundOnlyOneAllowed=Multiple global binding definitions found, but only 1 is allowed per webservice compilation.
-Name=Name
-Namespace=Namespace
-NamespacePrefix=Namespace prefix
-NoClassSpecified=No {0} class specified.
-NoFilter=No filter
-NoPhantomJarFilesFound=No phantom stub JAR files found
-NoPortTypesFound=No port types found. Please ensure the webservice stub to be built.
-NoServiceFoundInWSDLFileX=No service found in WSDL file '{0}'
-NoServicesFound=No services found. Please ensure the webservice stub to be built.
-NoWSDLFileConfigured=No WSDL file configured.
-NonExistingBindingFileConfigured=Non existing binding file configured.
-NullValuesDiscouraged=It is discouraged not to set a value for '{0}'
-Open=Open
-Package=Package
-PackageDoesNotExistClickOnLinkToCreate=Package does not exist. Click on label link to create it.
-PackageDoesNotExistWSOutOfDateRebuild=Package does not exist. Maybe, the webservice stub is out of date. Try to rebuild the webservice stub.
-PackageNameMustNotBeEmpty=Package name is not allowed to be empty. Change package name by specifying the build option \\"-b\\" accordingly.
-PackageNameNotValidJavaPackageName=Package name is not a valid Java package name. Change package name by specifying the build option \\"-b\\" accordingly. [{0}]
-Password=Password
-Path=Path
-PleaseChooseFileFromFilesystem=Please choose file from filesystem
-PleaseChoosePortType=Please choose a port type.
-PleaseChoosePortTypeInterface1=Please choose a port type interface.
-PleaseChoosePortTypeInterface=Please choose the port type interface from the list
-PleaseChooseServiceType=Please choose a service type.
-PleaseEnterValidUrl=Please enter valid URL
-Port=Port
-PortFilter=Port filter
-PortType=Port type
-PortTypeInterface=Port type interface
-PortTypeXNotFoundInStubJarY=The generated stub class for the port type '{0}' could not be found in JAR file '{1}'.\r\nPlease make sure, that the build directive 'Xnocompile' is not set to have the *.class files being generated.\r\nMaybe, the webservice stub is out of date. Try to rebuild the webservice stub.
-PortTypeXNotFoundInWsdl=Port type '{0}' configured in super type generic parameter could not be found in WSDL file.
-Properties=Properties
-ProtocolBindings=Protocol bindings
-ProtocolFilter=Protocol filter
-Provider=Provider
-QuestionClearPackageFolderX=Should package folder '{0}' be cleared prior to stub generation?
-QuestionDeletion=By clicking Finish all the selected resources will be deleted.\r\nDo you want to continue?
-QuestionMove=By clicking Finish the selected resources are moved or changed.\r\nDo you want to continue?
-QuestionMoveFiles=Should the following files be moved to '{0}'?
-QuestionReferencedFilesFound=Your WSDL file depends on other files such as XSD schemas or related WSDL files.\r\nPlease choose from the files to be copied.
-QuestionRemoveHandlerChain=Should the handler chain be removed?
-QuestionShouldFileXAlsoBeDeletedFromDisk=Should file '{0}' be deleted from disk?
-RebuildWebserviceStub=Rebuild webservice stub
-ReferencedFilesFound=Referenced files found
-ReferencedWsdlDefintions=Referenced WSDL definitions
-ReferencedXsdSchemas=Referenced XSD schemas
-References=References
-Refresh=Refresh
-RefreshByClicking=Refresh by clicking
-RegisterImplClassInSunJaxWs=Register implementing class in sun-jaxws.xml to be installed as webservice
-ReloadResourcesFromDisk=Reload associated resources and definitions from disk
-Remove=Remove
-RemoveChain=Remove chain
-RemoveHandlerChain=Remove handler chain
-Repair=Repair
-RepairRequired=Manual repair required
-RepairTools=Repair tools
-Resource=Resource
-RestrictionPattern=Restriction pattern
-RunHandlerInScoutTransaction=Run handler in Scout transaction
-SectionDescriptionScoutWebServiceAnnotation=Specify strategies to authenticate webservice requests and to control session allocation
-SectionRepairDescription=There were encountered some problems.
-SelectAll=Select all
-SelectSourceFolder=Please select a source folder.
-ServerSessionFactories=Server session factories
-ServerSessionFactory=Server session factory
-Service=Service
-ServiceCouldNotBeFoundInWSDLmodel=Service could not be found in WSDL model.
-ServiceFilter=Service filter
-ServiceName=Service name
-ServiceNamespaceMustEndWithASlash=Service namespace must end with a slash.
-ServiceOperation=Service operation name
-ServiceTypeXNotFoundInStubJarY=The generated stub class for the service '{0}' could not be found in JAR file '{1}'.\r\nPlease make sure, that the build directive 'Xnocompile' is not set to have the *.class files being generated.\r\nMaybe, the webservice stub is out of date. Try to rebuild the webservice stub.
-ServiceXNotFoundInWsdl=Service '{0}' configured in super type generic parameter could not be found in WSDL file.
-Services=Services
-ServletAlias=Servlet alias
-ServletRegistrationBundle=Servlet registration bundle
-Session=Session
-SessionFactories1=Session Factories
-SessionFactories=Session factories
-SessionFactory=Session factory
-SourceFolder=Source Folder
-SourceFolderAlreadyExsists=Source folder does already exists.
-SourceFolderMustNotBeEmpty=Source folder must not be empty
-SourceFolderXDoesNotExist=Source folder '{0}' does not exist.
-SpecifyUrlOfWsdl=Specify the URL to which the web service's WSDL is published
-SpecifyWsdlLocation=Specify WSDL Location
-StubFolder=Stub folder
-StubFolderMustNotBeEmpty=Stub folder must not be empty
-StubFolderXDoesNotExist=Stub folder '{0}' does not exist.
-StubGenerationFailed=Webservice stub generation failed
-StubJar=Stub JAR
-StubPackage=Stub package
-StubProperties=Stub properties
-TargetNamespace=Target namespace
-TargetNamespaceMustBeValudUrl=TargetNamespace must be a valid URL.
-TheEndpointInterfaceConfiguredWithinAnnotationXDoesNotExistOrIsNotImplementedByThisEndpoint=The endpoint interface configured within annotation '{0}' does not exist or is not implemented by this endpoint.
-TheFollowingProblemsWereEncountered=The following problems were encountered.
-ToConfigureAuthenticationAndSessionHandlingForTheWebserviceAnnotateThePortTypeWithX=To configure authentication and session handling for the webservice, annotate the port type with '{0}'.
-TooltipBindingFileNew=Click to create a new binding file
-TooltipCleanupUnreferencedJarFiles=Removes phantom JAR files, that are not used by either webservice providers or consumers
-TooltipEditBuildProperties=Click to configure properties to control the stub generation process
-TooltipEditFilter=Click to configure a filter to optionally apply the handler chain to specific protocols, services and ports
-TooltipHanderChainNew=Click to create a new JAX-WS handler chain
-TooltipHandlerChainRemove=Click to remove this handler chain and all its associated handler registrations
-TooltipHandlerNew=Click to create a new JAX-WS handler
-TooltipNamespace=Specify the namespace associated with the prefix
-TooltipNamespacePrefix=Specify the namespace prefix to be referenced in the pattern definition
-TooltipProtocolBindings=Protocol names starts with '\#\#'. Multiple protocols can be specified by putting a space in between of the protocols, e.g. \#\#SOAP11_HTTP \#\#SOAP12_HTTP
-TooltipRemoveBindingFile=Remove entry in build-jaxws.xml and delete file from disk
-TooltipRemoveHandlerRegistration=Remove handler registration
-TooltipRestriction=Restrict the handler chain to only apply to matching {0}. Thereby, the wildcard character '*' can be used in the pattern definition.
-Transactional=Transactional
-Type=Type
-TypeAlreadyExsits=Type {0} already exists.
-TypeDoesNotExistClickOnXToCreate=Type does not exist. Click on '{0}' to create it.
-TypeMustBeAnnotatedWithXAnnotationInOrderToBeInstalledAsWebservice=Type must be annotated with '{0}' annotation in order to be installed as webservice
-TypeNameMustMatchRegex=Type name must match the regex {0}
-URLCouldNotBeAccessed=URL could not be accessed.
-UnknownPortConfiguredInAttributeX=Unknown port configured in attribute '{0}'.
-UpperCaseHint=By convention, names usually start with an uppercase letter
-Url=Url
-UrlPattern=URL Pattern
-UrlPatternJaxWsAliasMismatch=The URL pattern must start with '{0}' as this is the alias for JAX-WS servlet.\nThis can be changed by specifying another alias in JAX-WS servlet registration in plugin.xml.
-UrlXshouldNotContainWhitespaces=The URL '{0}' should not contain whitespaces
-UsageOfDefaultPackageDiscouraged=Usage of default package is discouraged
-UsageOfDefaultPackageNotAllowed=Usage of default package is not allowed
-UseExistingWsdlFile=Use existing WSDL file
-User=User
-Username=Username
-Value=Value
-ValueOptional=Value (optional)
-WSDLFileAlreadyExists=WSDL file {0} already exists in {1}.\nBy continuing, it is overwritten.
-WSDLFileXCouldNotBeFound=WSDL file '{0}' could not be found.
-WarningClearingPackage=The specified package does already exist. The package will be cleared prior to stub generation.
-WarningWsdlFolder=Discouraged folder. It should be '{0}' or a resultant sub-folder.\r\nOtherwise, webservice consumer specific WSDL files might interfere with provider specific WSDL files, e.g. if specifying same services or ports.
-WebserviceConsumer=Webservice Consumer
-WebserviceProperties=Webservice properties
-WebserviceProvider=Webservice Provider
-Webservices=Webservices (JAX-WS RI 2.1.6)
-WizardDescriptionDeletePhanomStubJarFiles=The following phanom stub JAR-files were detected.\r\nPlease choose the phantom JAR's to be deleted.
-WsBuildDirective=WS Build Directive
-WsBuildDirectives=WS Build Directives
-WsImplXMustImplementPortTypeInterface=The webservice implementation '{0}' must implement the webservice port type interface
-WsStubGenerationFailed=Failed to generate webservice stub.\r\nPlease refer to console output for more information.
-WsStubSuccessfullyGenerated=Webservice stub successfully generated.
-WsdlCorrupt=WSDL {0} is corrupt.\r\nIf the WSDL file references other files such as XSD schema definitions, ensure those files to exist.
-WsdlCouldNotBeParsed=The WSDL could not be parsed as it might be corrupt
-WsdlFile=WSDL file
-WsdlFolder=WSDL folder
-WsdlLocation=WSDL location
-WsdlName=WSDL Name
-WsdlNewWizardPageDescription=Please choose whether to create the webservice based on a new or an existing WSDL file.
-WsdlStyle=WSDL style
-XMustBeOfTheTypeY={0} must be of the type {1}.
-XMustBeSubtypeOfY=Type '{0}' must be a subtype of '{1}'
-XMustNotBeEmpty={0} must not be empty
-XWithYDoesAlreadyExist=The '{0}' with value '{1}' does already exist.
-XdoesNotExistDueToInexistenceOrCorruptResource={0} could not be loaded as it might not exist or is not a valid XML resource
-XisInheritedFromY={0} is inherited from {1}
-XshouldStartWithY='{0}' should start with '{1}'
-class=class
-here=here
-inherited=inherited
-jaxWsAlias=Servlet Alias
-jaxWsAliasMustNotEndWithSlash=Alias must not end with '/'
-jaxWsAliasMustStartWithSlash=Alias must start with '/'
-package=package
-port=port
-ports=ports
-presenterRepair=Analyse and repair problems by using the
-protocol=protocol
-readOnlyBecauseBinaryFile=readonly because binary file
-recommended=recommended
-repairTools=repair tools
-service=service
-services=services
+Add=Add
+AddAdditionalResources1=WSDL port and binding definitions as well as schema types might be located in separate files.\n Add those related resources.
+AddAdditionalResources=Add additional resources
+AddBindingFile=Add binding file
+AddHandler=Add handler
+AddRelatedFiles=Add related files
+AdditionalResources=Additional resources
+Alias=Alias
+AliasXAlreadyExists=There already exists an alias with the name {0}.
+AnnotateImplClass=Annotate implementing class with {0} Annotation
+AnnotationXWithPropertyYRequired=Type must be annotated with '{0}' annotation with the property '{1}' set.
+Artefact=Artefact
+ArtefactPackage=Artefact package
+Authentication=Authentication
+AuthenticationAndSesDescriptionCredentialValidatinStrategysionHandling=Authentication and session handling
+AuthenticationAndSessionContext=Authentication and session context
+AuthenticationHandler=Authentication Handler
+AuthenticationHandlers=Authentication Handlers
+AuthenticationMechanism=Authentication mechanism
+Binding=Binding
+BindingFile=Binding file
+BindingFileXCouldNotBeFound=Binding file '{0}' could not be found.
+BindingFileXIsNotAValidXMLFile=Binding file '{0}' is not a valid XML file.
+Browse=Browse
+BrowseForType=Browse for a type
+BrowseForWsdlFile=Browse for a WSDL file
+BuildProperties=Build properties
+BuildStubInDebugMode=Build stub in DEBUG-mode
+ByClickingFinishHandlerIsCreated=By clicking finish, the handler is created.
+ByClickingFinishSourceFolderIsCreated=By clicking finish, the source folder is created.
+ByClickingFinishXIsCreated=By clicking finish, the {0} is created.
+ByConventionXShouldByY=By convention, the '{0}' should be '{1}'
+ByConventionXShouldStartWithY=By convention, the '{0}' should start with '{1}'
+Change=Change
+ChangeJaxWsAlias=Change webservice servlet alias
+ChangeJaxWsAliasByClicking=Change the webservice servlet alias by clicking
+ChangeJaxWsServletRegistration=Change JAX-WS servlet registration
+ChangeUrlOfWsdl=Change the URL to which the web service's WSDL is published
+ChangeUrlPatternOrJaxWsServletRegistration=Change URL pattern or JAX-WS Servlet registration
+ChooseFolder=Choose folder
+ChooseFolderForWsdlFileAndArtefacts=Choose the folder for the WSDL file and its artefacts to be copied
+ChoosePackageForHandler=Choose package for handler class
+ChoosePackageForImplementingClass=Choose package for implementing class
+ChoosePackageForWsConsumer=Choose package for webservice consumer
+ChoosePackageForX=Choose package for {0} class
+ChooseType=Choose type
+ChooseWsdlFile=Choose the WSDL file to be used
+ChooseWsdlFileFromFilesystem=Choose WSDL file from filesystem
+ChooseWsdlFromUrl=Choose WSDL from URL
+ChooseXY=Choose {0}
+CleanupPhantomStubFiles=Cleanup phantom stub JAR files
+CleanupUnreferencedJarFiles=Cleanup phantom stub JAR files
+CleanupUnreferencedJarFilesByClicking=Cleanup phantom stub JAR files by clicking
+ClearPackage=Clear package and subpackages prior to stub generation
+ClickFinishToCreateDirective=Click finish to create build directive
+ClickNextToContinue=Click next to continue
+ClickToAddAdditionalResources=Click to add related resources like XSD schemas or related WSDL files located in separate files
+ClickToBrowseForAnotherPackage=Click to browse for another package
+ClickToCreateNewSourceFolder=Click to create a new source folder
+ClickToCreatePackageXY=Click to create package '{0}'
+ClickToFixTheProblems=Click to fix the problems.
+ClickToGenerateWsStub=Click to rebuild the webservice stub
+ClickToIncreasePrecendence=Click to give the handler a higher precedence
+ClickToLowerPrecendence=Click to give the handler a lower precedence
+ConfigureFilterForHandlerChain=Configure a filter for handler chain
+ConfigureImplementingClass=Configure Webservice Implementing Class
+ConfigureJaxWsAlias=Configure the alias the webservices should be accessable at.
+ConfigureJaxWsServletRegistration=Configure JAX-WS servlet registration
+ConfigureWebServiceStub=Configure Webservice Stub
+ConfigureWebserviceProperties=Configure Webservice Properties
+ConsiderLinks=Consider the following links
+Consumer=Consumer
+ConventionPackageNameEqualsToTargetNamespaceX=By specifying a custom package name, JAX-WS is instrumented to not apply the default package name algorithm and to ignore any WSDL and schema binding customization for package name.
+CorruptWSDLFileAtLocationX=Corrupt WSDL file at location '{0}'
+CouldNotDownloadWSDLFile=Could not download WSDL file.
+CreateBindingFile=Create binding file to control stub generation process
+CreateHandler=Create a New Handler
+CreateImplClass=Create implementing class
+CreateImplClassTitle=Create Implementing Class
+CreateNewHandlerByClicking=Create a new Handler by clicking
+CreateNewPackage=Create new package
+CreateNewSourceFolder=Create new source folder
+CreateNewType=Create new type
+CreateNewWsConsumerByClicking=Create a new Webservice Consumer by clicking
+CreateNewWsProviderByClicking=Create a new Webservice Provider by clicking
+CreateNewX=Create new {0}
+CreateNewXByClicking=Create a new {0} by clicking
+CreateSourceFolder=Create new source folder
+CreateWebserviceStub=Create Webservice stub
+CreateWsConsumer=Create a New Webservice Consumer
+CreateWsProvider=Create a New Webservice Provider
+CreateWsdlFile=Create a New WSDL file
+CreateWsdlFromScratch=Create WSDL file from scratch
+CreationOfTemporyFileFailed=Could not create temporary file for WSDL
+CredentialValidation1=Credential Validation
+CredentialValidation=Credential validation
+CredentialValidationStrategies=Credential Validation Strategies
+CredentialValidationStrategy=Credential validation strategy
+CredentialsRequired=Credentials for authentication required.
+DeleteWebServiceProvider=Delete Webservice Provider
+DeleteWebserviceConsumer=Delete Webservice Consumer
+DeriveOtherNamesFormPortTypeChosen=Derive other names from port type chosen
+DeriveOtherNamesFormWsdlFileName=Derive other names from WSDL file name
+Description=Description
+DescriptionAuthenticationHandlerConsumer=Authentication handlers include user credentials into the outbound message in the form of the handler's authentication mechanism.
+DescriptionAuthenticationHandlerProvider=Authentication handlers intercept inbound messages to only allow authenticated requests to pass.\nIf no user credentials is provided, they challenge the client based on their authentication mechanism for some credentials.
+DescriptionAuthenticationMechanism=Which authentication mechanism should be installed?
+DescriptionBuildDirectives=Control the stub generation process by configuring some build directives
+DescriptionChangeJaxWsServletAlias=Please note that by changing the servlet's alias the URL pattern of all webservices published by the chosen servlet are updated accordingly.\r\nE.g. if having webservices in another bundle using this JAX-WS servlet registration, their URL patterns are changed as well.
+DescriptionCredentialValidatinStrategy=Credential validation strategies encapsulates logic to validate user's credentials against a strategy such as database, config.ini, LDAP or others.\r\nThey are used in conjunction with an authentication mechanism represented by an authentication handler.
+DescriptionCredentialValidationValidation=How should user's credentials be validated?
+DescriptionHandlerChainFilter=Configure a filter to optionally apply the handler chain to specific protocols, services and ports
+DescriptionHandlerSession=Specify the session to be used for the transaction
+DescriptionHandlers=Handlers are message interceptors that are plugged in to the JAX-WS runtime to do additional processing of the inbound and outbound messages.
+DescriptionJaxWsBundleConfiguration=Choose the bundle to register JAX-WS servlet and specify the servlet's alias
+DescriptionScoutWebServiceAnnotation=By using {0} annotation, webservice calls can easily be authenticated and to be configured to run within a server session.
+DescriptionScoutWebServiceClientAnnotation=By using {0} annotation, the authentication mechanism can be specified.
+DescriptionServerSerssionFactory=Server session factories are used to create a server session for webservice providers and transational handlers to run in session scope.
+DescriptionSessionFactory=Specify a factory to define the strategy of which session to be used for authenticated requests.
+DescriptionTaskMoveFiles=Use this task to move the WSDL file and related resources into the folder '{0}'.
+Directive=Directive
+DirectiveXMustBeUnique=There is already configured a directive with the given name '{0}'
+DiscouragedPortConfigurationNoPortFoundInWSDLFileX=Discouraged port configuration\: No port found in WSDL file '{0}'.
+DiscouragedServiceConfigurationMissingOrIinvalidQNameInAttributeX=Discouraged service configuration\: Missing or invalid QName in attribute '{0}'.
+DoYouWantToChangePerspective=Do you want to change perspective to view folder content?
+DocumentLiteral=Document/literal
+DocumentLiteralWrapped=Document/literal wrapped
+Edit=Edit
+EditBuildProperties=Edit build properties
+EditFilter=Edit filter
+EditFilterXActive=Edit filter ({0} active)
+EndpointPublishConfiguration=Endpoint publish configuration
+EnterJaxWsAlias=Please enter a valid webservice servlet alias
+EnterNameForSourceFolderToBeCreated=Enter a name for the source folder to be created.
+EnterSourceFolder=Please enter the source folder to be created
+Error=Error
+FailedToDeleteFile=Failed to delete file
+FailedToDeleteFileX=Failed to delete file '{0}'. Please ensure the file not be locked.
+FailedToDeriveStubPackageNameFromTargetNamespace=Failed to derive stub package name from targetNamespace '{0}' specified in WSDL file. Please ensure the WSDL file to be valid.
+FailedToDeriveStubPackageNameFromTargetNamespaceWSDLNotValid=Failed to derive stub package name from targetNamespace as WSDL file is not valid.
+Failure=Failure
+File=File
+FileChosenFromFilesystemDoesNotExist=File chosen from filesytem does not exist
+FileDoesNotExistOrIsCorrupt=File does not exist or is corrupt
+Filter=Filter
+FilterXInstalledForHandlerChain=There is a '{0}' configured for this handler chain.\nTo change the filter, click on '{1}'.
+Folder=Folder
+FullyQualifiedName=Fully qualified name
+General=General
+GenerateWsStubByClicking=Rebuild the webservice stub by clicking
+Handler=Handler
+HandlerChain=Handler Chain
+HandlerChainFilter=Handler chain filter
+HandlerChainNewAction=Add handler chain
+HandlerChainRemoveAction=Remove handler chain
+HandlerChainX=Handler Chain '{0}'
+HandlerChains=Handler chains
+HandlerRegistration=Handler Registration
+Handlers=Handlers
+HintForOptionalFilter=An optional filter can be configured to only apply the handlers of this chain to certain protocol, servcies or ports
+Implementation=Implementation
+ImplementationTypeName=Implementation type name
+ImplementationTypePackage=Implementation type package
+ImportedIncludedXsdSchemas=Imported / included XSD schemas
+ImportedXsdSchemas=Imported XSD schemas
+IncludedXsdSchemas=Included XSD schemas
+Information=Information
+Interface=Interface
+InvalidImplementationType=Invalid implementation type
+InvalidJAXWSPortTypeConfiguredInSuperMustBeAnnotatedWithY=Invalid JAX-WS port type configured in super type generic parameter [must be annotated with '{0}'].\r\nPlease make sure, that the build directive 'Xnocompile' is not set to have the *.class files being generated.\r\nMaybe, the webservice stub is out of date. Try to rebuild the webservice stub.
+InvalidJavaType=Specified Java type {0} is not valid.
+InvalidPortTypeInSuperGenericParameter=Invalid JAX-WS port type configured in super type generic parameter [must be annotated with '{0}']\t
+InvalidPortTypeInWsdl=Invalid JAX-WS port type configured in super type generic parameter [must be annotated with '{0}']. Please make sure, that the build directive 'Xnocompile' is not set to have the *.class files being generated.\r\nMaybe, the webservice stub is out of date. Try to rebuild the webservice stub.
+InvalidServiceConfigurationMissingOrInvalidQNameInAttributeX=Invalid service configuration\: Missing or invalid QName in attribute '{0}'.
+InvalidServiceInSuperTypeGenericParameter=Invalid JAX-WS service configured in super type generic parameter [must be of type '{0}' and be annotated with '{1}']
+InvalidServiceInWsdl=Invalid JAX-WS service configured in super type generic parameter [must be of type '{0}' and be annotated with '{1}'].\r\nPlease make sure, that the build directive 'Xnocompile' is not set to have the *.class files being generated.\r\nMaybe, the webservice stub is out of date. Try to rebuild the webservice stub.
+InvalidServletAliasX=Invalid servlet alias '{0}'
+InvalidSourceFolder=Invalid source folder name
+InvalidUrlX=Invalid URL '{0}'
+InvalidValue=Invalid value
+JarFileXOfWsYMustBeOnClasspath=Stub JAR file '{0}' of webservice '{1}' must be on project classpath
+JaxWsAlias=Webservice servlet alias
+JaxWsCannotDerivePackageNameFromTargetNamespace=JAX-WS cannot derive Java package name from target namespace. Please define a custom package name.
+JaxWsDeploymentDescriptor=JAX-WS deployment descriptor
+JaxWsPortTypeInterface=JAX-WS Port type interface
+JaxWsPreferences=JAX-WS Preferences
+JaxWsProperties=JAX-WS properties
+JaxWsServletRegistration=JAX-WS Servlet registration
+JaxWsServletRegistrationInBundleX=JAX-WS servlet registration in bundle '{0}'.
+KeepLaunchConfiguration=Keep launch configuration of stub generation
+LowerCaseTypeName=\ Type name is discouraged. By convention, Java type names usually start with an uppercase letter
+MissingBuildEntryInFileX=Missing build entry in file '{0}'.
+MissingNameForImplementingClass=No name for implementing class specified.
+MissingOrEmptyAttributeX=Missing or empty attribute '{0}'.
+MissingPropertyXOnAnnotationYToLinkThePortTypeWithTheRespectivePortTypeInterface=Missing property '{0}' on annotation '{1}' to link the port type with the respective PortType interface.
+MoveReferencedXToY=Move referenced {0} to '{1}'
+MoveWsdlFileAndArtefacts=Move WSDL file and its artefacts to another folder
+MoveXToY=Move {0} to '{1} '
+MovingFiles=Moving files
+MultipleGlobalBindingDefinitionsFoundOnlyOneAllowed=Multiple global binding definitions found, but only 1 is allowed per webservice compilation.
+Name=Name
+Namespace=Namespace
+NamespacePrefix=Namespace prefix
+NoClassSpecified=No {0} class specified.
+NoFilter=No filter
+NoPhantomJarFilesFound=No phantom stub JAR files found
+NoPortTypesFound=No port types found. Please ensure the webservice stub to be built.
+NoServiceFoundInWSDLFileX=No service found in WSDL file '{0}'
+NoServicesFound=No services found. Please ensure the webservice stub to be built.
+NoWSDLFileConfigured=No WSDL file configured.
+NonExistingBindingFileConfigured=Non existing binding file configured.
+NullValuesDiscouraged=It is discouraged not to set a value for '{0}'
+Open=Open
+Package=Package
+PackageDoesNotExistClickOnLinkToCreate=Package does not exist. Click on label link to create it.
+PackageDoesNotExistWSOutOfDateRebuild=Package does not exist. Maybe, the webservice stub is out of date. Try to rebuild the webservice stub.
+PackageNameMustNotBeEmpty=Package name is not allowed to be empty. Change package name by specifying the build option \\"-b\\" accordingly.
+PackageNameNotValidJavaPackageName=Package name is not a valid Java package name. Change package name by specifying the build option \\"-b\\" accordingly. [{0}]
+Password=Password
+Path=Path
+PleaseChooseFileFromFilesystem=Please choose file from filesystem
+PleaseChoosePortType=Please choose a port type.
+PleaseChoosePortTypeInterface1=Please choose a port type interface.
+PleaseChoosePortTypeInterface=Please choose the port type interface from the list
+PleaseChooseServiceType=Please choose a service type.
+PleaseEnterValidUrl=Please enter valid URL
+Port=Port
+PortFilter=Port filter
+PortType=Port type
+PortTypeInterface=Port type interface
+PortTypeXNotFoundInStubJarY=The generated stub class for the port type '{0}' could not be found in JAR file '{1}'.\r\nPlease make sure, that the build directive 'Xnocompile' is not set to have the *.class files being generated.\r\nMaybe, the webservice stub is out of date. Try to rebuild the webservice stub.
+PortTypeXNotFoundInWsdl=Port type '{0}' configured in super type generic parameter could not be found in WSDL file.
+Properties=Properties
+ProtocolBindings=Protocol bindings
+ProtocolFilter=Protocol filter
+Provider=Provider
+QuestionClearPackageFolderX=Should package folder '{0}' be cleared prior to stub generation?
+QuestionDeletion=By clicking Finish all the selected resources will be deleted.\r\nDo you want to continue?
+QuestionMove=By clicking Finish the selected resources are moved or changed.\r\nDo you want to continue?
+QuestionMoveFiles=Should the following files be moved to '{0}'?
+QuestionReferencedFilesFound=Your WSDL file depends on other files such as XSD schemas or related WSDL files.\r\nPlease choose from the files to be copied.
+QuestionRemoveHandlerChain=Should the handler chain be removed?
+QuestionShouldFileXAlsoBeDeletedFromDisk=Should file '{0}' be deleted from disk?
+RebuildWebserviceStub=Rebuild webservice stub
+ReferencedFilesFound=Referenced files found
+ReferencedWsdlDefintions=Referenced WSDL definitions
+ReferencedXsdSchemas=Referenced XSD schemas
+References=References
+Refresh=Refresh
+RefreshByClicking=Refresh by clicking
+RegisterImplClassInSunJaxWs=Register implementing class in sun-jaxws.xml to be installed as webservice
+ReloadResourcesFromDisk=Reload associated resources and definitions from disk
+Remove=Remove
+RemoveChain=Remove chain
+RemoveHandlerChain=Remove handler chain
+Repair=Repair
+RepairRequired=Manual repair required
+RepairTools=Repair tools
+Resource=Resource
+RestrictionPattern=Restriction pattern
+RunHandlerInScoutTransaction=Run handler in Scout transaction
+SectionDescriptionScoutWebServiceAnnotation=Specify strategies to authenticate webservice requests and to control session allocation
+SectionRepairDescription=There were encountered some problems.
+SelectAll=Select all
+SelectSourceFolder=Please select a source folder.
+ServerSessionFactories=Server session factories
+ServerSessionFactory=Server session factory
+Service=Service
+ServiceCouldNotBeFoundInWSDLmodel=Service could not be found in WSDL model.
+ServiceFilter=Service filter
+ServiceName=Service name
+ServiceNamespaceMustEndWithASlash=Service namespace must end with a slash.
+ServiceOperation=Service operation name
+ServiceTypeXNotFoundInStubJarY=The generated stub class for the service '{0}' could not be found in JAR file '{1}'.\r\nPlease make sure, that the build directive 'Xnocompile' is not set to have the *.class files being generated.\r\nMaybe, the webservice stub is out of date. Try to rebuild the webservice stub.
+ServiceXNotFoundInWsdl=Service '{0}' configured in super type generic parameter could not be found in WSDL file.
+Services=Services
+ServletAlias=Servlet alias
+ServletRegistrationBundle=Servlet registration bundle
+Session=Session
+SessionFactories1=Session Factories
+SessionFactories=Session factories
+SessionFactory=Session factory
+SourceFolder=Source Folder
+SourceFolderAlreadyExsists=Source folder does already exists.
+SourceFolderMustNotBeEmpty=Source folder must not be empty
+SourceFolderXDoesNotExist=Source folder '{0}' does not exist.
+SpecifyUrlOfWsdl=Specify the URL to which the web service's WSDL is published
+SpecifyWsdlLocation=Specify WSDL Location
+StubFolder=Stub folder
+StubFolderMustNotBeEmpty=Stub folder must not be empty
+StubFolderXDoesNotExist=Stub folder '{0}' does not exist.
+StubGenerationFailed=Webservice stub generation failed
+StubJar=Stub JAR
+StubPackage=Stub package
+StubProperties=Stub properties
+TargetNamespace=Target namespace
+TargetNamespaceMustBeValudUrl=TargetNamespace must be a valid URL.
+TheEndpointInterfaceConfiguredWithinAnnotationXDoesNotExistOrIsNotImplementedByThisEndpoint=The endpoint interface configured within annotation '{0}' does not exist or is not implemented by this endpoint.
+TheFollowingProblemsWereEncountered=The following problems were encountered.
+ToConfigureAuthenticationAndSessionHandlingForTheWebserviceAnnotateThePortTypeWithX=To configure authentication and session handling for the webservice, annotate the port type with '{0}'.
+TooltipBindingFileNew=Click to create a new binding file
+TooltipCleanupUnreferencedJarFiles=Removes phantom JAR files, that are not used by either webservice providers or consumers
+TooltipEditBuildProperties=Click to configure properties to control the stub generation process
+TooltipEditFilter=Click to configure a filter to optionally apply the handler chain to specific protocols, services and ports
+TooltipHanderChainNew=Click to create a new JAX-WS handler chain
+TooltipHandlerChainRemove=Click to remove this handler chain and all its associated handler registrations
+TooltipHandlerNew=Click to create a new JAX-WS handler
+TooltipNamespace=Specify the namespace associated with the prefix
+TooltipNamespacePrefix=Specify the namespace prefix to be referenced in the pattern definition
+TooltipProtocolBindings=Protocol names starts with '\#\#'. Multiple protocols can be specified by putting a space in between of the protocols, e.g. \#\#SOAP11_HTTP \#\#SOAP12_HTTP
+TooltipRemoveBindingFile=Remove entry in build-jaxws.xml and delete file from disk
+TooltipRemoveHandlerRegistration=Remove handler registration
+TooltipRestriction=Restrict the handler chain to only apply to matching {0}. Thereby, the wildcard character '*' can be used in the pattern definition.
+Transactional=Transactional
+Type=Type
+TypeAlreadyExsits=Type {0} already exists.
+TypeDoesNotExistClickOnXToCreate=Type does not exist. Click on '{0}' to create it.
+TypeMustBeAnnotatedWithXAnnotationInOrderToBeInstalledAsWebservice=Type must be annotated with '{0}' annotation in order to be installed as webservice
+TypeNameMustMatchRegex=Type name must match the regex {0}
+URLCouldNotBeAccessed=URL could not be accessed.
+UnknownPortConfiguredInAttributeX=Unknown port configured in attribute '{0}'.
+UpperCaseHint=By convention, names usually start with an uppercase letter
+Url=Url
+UrlPattern=URL Pattern
+UrlPatternJaxWsAliasMismatch=The URL pattern must start with '{0}' as this is the alias for JAX-WS servlet.\nThis can be changed by specifying another alias in JAX-WS servlet registration in plugin.xml.
+UrlXshouldNotContainWhitespaces=The URL '{0}' should not contain whitespaces
+UsageOfDefaultPackageDiscouraged=Usage of default package is discouraged
+UsageOfDefaultPackageNotAllowed=Usage of default package is not allowed
+UseExistingWsdlFile=Use existing WSDL file
+User=User
+Username=Username
+Value=Value
+ValueOptional=Value (optional)
+WSDLFileAlreadyExists=WSDL file {0} already exists in {1}.\nBy continuing, it is overwritten.
+WSDLFileXCouldNotBeFound=WSDL file '{0}' could not be found.
+WarningClearingPackage=The specified package does already exist. The package will be cleared prior to stub generation.
+WarningWsdlFolder=Discouraged folder. It should be '{0}' or a resultant sub-folder.\r\nOtherwise, webservice consumer specific WSDL files might interfere with provider specific WSDL files, e.g. if specifying same services or ports.
+WebserviceConsumer=Webservice Consumer
+WebserviceProperties=Webservice properties
+WebserviceProvider=Webservice Provider
+Webservices=Webservices (JAX-WS RI 2.1.6)
+WizardDescriptionDeletePhanomStubJarFiles=The following phanom stub JAR-files were detected.\r\nPlease choose the phantom JAR's to be deleted.
+WsBuildDirective=WS Build Directive
+WsBuildDirectives=WS Build Directives
+WsImplXMustImplementPortTypeInterface=The webservice implementation '{0}' must implement the webservice port type interface
+WsStubGenerationFailed=Failed to generate webservice stub.\r\nPlease refer to console output for more information.
+WsStubSuccessfullyGenerated=Webservice stub successfully generated.
+WsdlCorrupt=WSDL {0} is corrupt.\r\nIf the WSDL file references other files such as XSD schema definitions, ensure those files to exist.
+WsdlCouldNotBeParsed=The WSDL could not be parsed as it might be corrupt
+WsdlFile=WSDL file
+WsdlFolder=WSDL folder
+WsdlLocation=WSDL location
+WsdlName=WSDL Name
+WsdlNewWizardPageDescription=Please choose whether to create the webservice based on a new or an existing WSDL file.
+WsdlStyle=WSDL style
+XMustBeOfTheTypeY={0} must be of the type {1}.
+XMustBeSubtypeOfY=Type '{0}' must be a subtype of '{1}'
+XMustNotBeEmpty={0} must not be empty
+XWithYDoesAlreadyExist=The '{0}' with value '{1}' does already exist.
+XdoesNotExistDueToInexistenceOrCorruptResource={0} could not be loaded as it might not exist or is not a valid XML resource
+XisInheritedFromY={0} is inherited from {1}
+XshouldStartWithY='{0}' should start with '{1}'
+class=class
+here=here
+inherited=inherited
+jaxWsAlias=Servlet Alias
+jaxWsAliasMustNotEndWithSlash=Alias must not end with '/'
+jaxWsAliasMustStartWithSlash=Alias must start with '/'
+package=package
+port=port
+ports=ports
+presenterRepair=Analyse and repair problems by using the
+protocol=protocol
+readOnlyBecauseBinaryFile=readonly because binary file
+recommended=recommended
+repairTools=repair tools
+service=service
+services=services
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsConstants.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsConstants.java
index af1d13cc4..7bf09d530 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsConstants.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsConstants.java
@@ -1,68 +1,68 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws;
-
-public final class JaxWsConstants {
-
- public static final String PATH_WEB_INF = "/WEB-INF";
- public static final String PATH_WSDL_PROVIDER = "/WEB-INF/wsdl/provider";
- public static final String PATH_WSDL_CONSUMER = "/WEB-INF/wsdl/consumer";
- public static final String PATH_BUILD = "/WEB-INF/build";
- public static final String PATH_SUN_JAXWS = "/WEB-INF/sun-jaxws.xml";
- public static final String PATH_BUILD_JAXWS = "/WEB-INF/build/build-jaxws.xml";
- public static final String JAX_WS_ALIAS = "/jaxws";
- public static final String SERVER_EXTENSION_POINT_SERVLETS = "org.eclipse.equinox.http.registry.servlets";
-
- public static final String SUFFIX_WS_PROVIDER = "WebService";
- public static final String SUFFIX_WS_CONSUMER = "WebServiceClient";
- public static final String SUFFIX_HANDLER = "Handler";
-
- public static final String OPTION_BINDING_FILE = "b";
- public static final String OPTION_PACKAGE = "p";
- public static final String OPTION_JAR = "jar";
-
- public static final String STUB_FOLDER = "ws-stub";
-
- public static final int GENERICS_WEBSERVICE_CLIENT_SERVICE_INDEX = 0;
- public static final int GENERICS_WEBSERVICE_CLIENT_PORT_TYPE_INDEX = 1;
-
- private JaxWsConstants() {
- }
-
- public enum MarkerType {
- JaxWs(JaxWsSdk.PLUGIN_ID + ".jaxws"),
- UrlPattern(JaxWsSdk.PLUGIN_ID + ".urlPattern"),
- Service(JaxWsSdk.PLUGIN_ID + ".service"),
- TargetNamespace(JaxWsSdk.PLUGIN_ID + ".targetNamespace"),
- ServiceType(JaxWsSdk.PLUGIN_ID + ".serviceType"),
- Port(JaxWsSdk.PLUGIN_ID + ".port"),
- PortType(JaxWsSdk.PLUGIN_ID + ".porttype"),
- StubFolder(JaxWsSdk.PLUGIN_ID + ".stubFolder"),
- StubJar(JaxWsSdk.PLUGIN_ID + ".stubJar"),
- Implementation(JaxWsSdk.PLUGIN_ID + ".implementation"),
- Package(JaxWsSdk.PLUGIN_ID + ".package"),
- Wsdl(JaxWsSdk.PLUGIN_ID + ".wsdl"),
- WsdlFolder(JaxWsSdk.PLUGIN_ID + ".wsdlFolder"),
- BindingFile(JaxWsSdk.PLUGIN_ID + ".bindingFile"),
- MissingBuildJaxWsEntry(JaxWsSdk.PLUGIN_ID + ".missingBuildJaxWsEntry"),
- HandlerClass(JaxWsSdk.PLUGIN_ID + ".handlerClazz");
-
- private String m_id;
-
- private MarkerType(String id) {
- m_id = id;
- }
-
- public String getId() {
- return m_id;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws;
+
+public final class JaxWsConstants {
+
+ public static final String PATH_WEB_INF = "/WEB-INF";
+ public static final String PATH_WSDL_PROVIDER = "/WEB-INF/wsdl/provider";
+ public static final String PATH_WSDL_CONSUMER = "/WEB-INF/wsdl/consumer";
+ public static final String PATH_BUILD = "/WEB-INF/build";
+ public static final String PATH_SUN_JAXWS = "/WEB-INF/sun-jaxws.xml";
+ public static final String PATH_BUILD_JAXWS = "/WEB-INF/build/build-jaxws.xml";
+ public static final String JAX_WS_ALIAS = "/jaxws";
+ public static final String SERVER_EXTENSION_POINT_SERVLETS = "org.eclipse.equinox.http.registry.servlets";
+
+ public static final String SUFFIX_WS_PROVIDER = "WebService";
+ public static final String SUFFIX_WS_CONSUMER = "WebServiceClient";
+ public static final String SUFFIX_HANDLER = "Handler";
+
+ public static final String OPTION_BINDING_FILE = "b";
+ public static final String OPTION_PACKAGE = "p";
+ public static final String OPTION_JAR = "jar";
+
+ public static final String STUB_FOLDER = "ws-stub";
+
+ public static final int GENERICS_WEBSERVICE_CLIENT_SERVICE_INDEX = 0;
+ public static final int GENERICS_WEBSERVICE_CLIENT_PORT_TYPE_INDEX = 1;
+
+ private JaxWsConstants() {
+ }
+
+ public enum MarkerType {
+ JaxWs(JaxWsSdk.PLUGIN_ID + ".jaxws"),
+ UrlPattern(JaxWsSdk.PLUGIN_ID + ".urlPattern"),
+ Service(JaxWsSdk.PLUGIN_ID + ".service"),
+ TargetNamespace(JaxWsSdk.PLUGIN_ID + ".targetNamespace"),
+ ServiceType(JaxWsSdk.PLUGIN_ID + ".serviceType"),
+ Port(JaxWsSdk.PLUGIN_ID + ".port"),
+ PortType(JaxWsSdk.PLUGIN_ID + ".porttype"),
+ StubFolder(JaxWsSdk.PLUGIN_ID + ".stubFolder"),
+ StubJar(JaxWsSdk.PLUGIN_ID + ".stubJar"),
+ Implementation(JaxWsSdk.PLUGIN_ID + ".implementation"),
+ Package(JaxWsSdk.PLUGIN_ID + ".package"),
+ Wsdl(JaxWsSdk.PLUGIN_ID + ".wsdl"),
+ WsdlFolder(JaxWsSdk.PLUGIN_ID + ".wsdlFolder"),
+ BindingFile(JaxWsSdk.PLUGIN_ID + ".bindingFile"),
+ MissingBuildJaxWsEntry(JaxWsSdk.PLUGIN_ID + ".missingBuildJaxWsEntry"),
+ HandlerClass(JaxWsSdk.PLUGIN_ID + ".handlerClazz");
+
+ private String m_id;
+
+ private MarkerType(String id) {
+ m_id = id;
+ }
+
+ public String getId() {
+ return m_id;
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsIcons.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsIcons.java
index f0016730d..845769982 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsIcons.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsIcons.java
@@ -1,65 +1,65 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws;
-
-public interface JaxWsIcons {
- public static final String BindingFile = "XSDTypeDefinition.gif";
- public static final String BuildJaxWsXmlFile = "build-jaxws.png";
- public static final String BuildProperties = "XSDTypeDefinition.gif";
- public static final String BuildDirective = "property_obj.gif";
- public static final String RebuildWsStub = "rebuild_ws_stub.png";
- public static final String Port = "port_obj.gif";
- public static final String PortType = "port_obj.gif";
- public static final String Refresh = "refresh.png";
- public static final String RepairInfo = "quick_assist_obj.gif";
- public static final String RepairWarning = "quick_fix_warning_obj.gif";
- public static final String RepairError = "quick_fix_error_obj.gif";
- public static final String Service = "service_obj.gif";
- public static final String SourceFolder = "packagefolder_obj.png";
- public static final String SunJaxWsXmlFile = "sunJaxWs.png";
- public static final String WsdlFile = "wsdl_file_obj.gif";
- public static final String XmlFile = "xmlFile.gif";
- public static final String XsdSchema = "xsdFile.gif";
- public static final String JaxWsAlias = "browser.gif";
- public static final String Jar = "jar_obj.gif";
- public static final String LibraryConflict = "ov_javadev48.gif";
- public static final String Up = "arrow_up.gif";
- public static final String Down = "arrow_down.gif";
- public static final String Filter = "filter.gif";
- public static final String Transactional = "repository-synchronize.gif";
- public static final String UrlPattern = "url_pattern.png";
-
- public static final String CredentialValidationStrategyFolder = "credential_validation_strategy_folder.png";
- public static final String CredentialValidationStrategyBinary = "credential_validation_strategy_binary.png";
- public static final String CredentialValidationStrategy = "credential_validation_strategy.png";
-
- public static final String HandlerFolder = "handler_folder.png";
- public static final String Handler = "handler.png";
- public static final String HandlerBinary = "handler_binary.png";
- public static final String Handlers = "handlers.png";
-
- public static final String SessionFactoryFolder = "session_folder.png";
- public static final String SessionFactory = "session.png";
- public static final String SessionFactoryBinary = "session_binary.png";
-
- public static final String AuthenticationHandlerFolder = "authentication_handler_folder.png";
- public static final String AuthenticationHandler = "authentication_handler.png";
- public static final String AuthenticationHandlerBinary = "authentication_handler_binary.png";
-
- public static final String WebservicesFolder = "webservices_folder.png";
- public static final String WebserviceProviderFolder = "webservice_folder.png";
- public static final String WebserviceProvider = "service_obj.gif";
- public static final String WebServiceProviderCodeFirst = "webservice_code_first.png";
-
- public static final String WebserviceConsumerFolder = "webservice_folder.png";
- public static final String WebserviceConsumer = "service_obj.gif";
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws;
+
+public interface JaxWsIcons {
+ public static final String BindingFile = "XSDTypeDefinition.gif";
+ public static final String BuildJaxWsXmlFile = "build-jaxws.png";
+ public static final String BuildProperties = "XSDTypeDefinition.gif";
+ public static final String BuildDirective = "property_obj.gif";
+ public static final String RebuildWsStub = "rebuild_ws_stub.png";
+ public static final String Port = "port_obj.gif";
+ public static final String PortType = "port_obj.gif";
+ public static final String Refresh = "refresh.png";
+ public static final String RepairInfo = "quick_assist_obj.gif";
+ public static final String RepairWarning = "quick_fix_warning_obj.gif";
+ public static final String RepairError = "quick_fix_error_obj.gif";
+ public static final String Service = "service_obj.gif";
+ public static final String SourceFolder = "packagefolder_obj.png";
+ public static final String SunJaxWsXmlFile = "sunJaxWs.png";
+ public static final String WsdlFile = "wsdl_file_obj.gif";
+ public static final String XmlFile = "xmlFile.gif";
+ public static final String XsdSchema = "xsdFile.gif";
+ public static final String JaxWsAlias = "browser.gif";
+ public static final String Jar = "jar_obj.gif";
+ public static final String LibraryConflict = "ov_javadev48.gif";
+ public static final String Up = "arrow_up.gif";
+ public static final String Down = "arrow_down.gif";
+ public static final String Filter = "filter.gif";
+ public static final String Transactional = "repository-synchronize.gif";
+ public static final String UrlPattern = "url_pattern.png";
+
+ public static final String CredentialValidationStrategyFolder = "credential_validation_strategy_folder.png";
+ public static final String CredentialValidationStrategyBinary = "credential_validation_strategy_binary.png";
+ public static final String CredentialValidationStrategy = "credential_validation_strategy.png";
+
+ public static final String HandlerFolder = "handler_folder.png";
+ public static final String Handler = "handler.png";
+ public static final String HandlerBinary = "handler_binary.png";
+ public static final String Handlers = "handlers.png";
+
+ public static final String SessionFactoryFolder = "session_folder.png";
+ public static final String SessionFactory = "session.png";
+ public static final String SessionFactoryBinary = "session_binary.png";
+
+ public static final String AuthenticationHandlerFolder = "authentication_handler_folder.png";
+ public static final String AuthenticationHandler = "authentication_handler.png";
+ public static final String AuthenticationHandlerBinary = "authentication_handler_binary.png";
+
+ public static final String WebservicesFolder = "webservices_folder.png";
+ public static final String WebserviceProviderFolder = "webservice_folder.png";
+ public static final String WebserviceProvider = "service_obj.gif";
+ public static final String WebServiceProviderCodeFirst = "webservice_code_first.png";
+
+ public static final String WebserviceConsumerFolder = "webservice_folder.png";
+ public static final String WebserviceConsumer = "service_obj.gif";
+
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsRuntimeClasses.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsRuntimeClasses.java
index 4e03331c4..f444409e8 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsRuntimeClasses.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsRuntimeClasses.java
@@ -1,56 +1,56 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws;
-
-
-public final class JaxWsRuntimeClasses {
-
- private JaxWsRuntimeClasses() {
- }
-
- public static final String JaxWsPlugin = "org.eclipse.scout.jaxws";
- public static final String JaxWsServlet = "org.eclipse.scout.jaxws.JaxWsServlet";
-
- public static final String JaxWsActivator = "org.eclipse.scout.jaxws.Activator";
- public static final String ScoutWebService = "org.eclipse.scout.jaxws.annotation.ScoutWebService";
- public static final String ScoutWebServiceClient = "org.eclipse.scout.jaxws.annotation.ScoutWebServiceClient";
- public static final String ScoutTransaction = "org.eclipse.scout.jaxws.annotation.ScoutTransaction";
-
- public static final String WsImportType = "com.sun.tools.internal.ws.WsImport";
-
- public static final String IServerSessionFactory = "org.eclipse.scout.jaxws.session.IServerSessionFactory";
- public static final String IAuthenticationHandlerProvider = "org.eclipse.scout.jaxws.security.provider.IAuthenticationHandler";
- public static final String ICredentialValidationStrategy = "org.eclipse.scout.jaxws.security.provider.ICredentialValidationStrategy";
- public static final String IAuthenticationHandlerConsumer = "org.eclipse.scout.jaxws.security.consumer.IAuthenticationHandler";
-
- public static final String DefaultServerSessionFactory = "org.eclipse.scout.jaxws.session.DefaultServerSessionFactory";
- public static final String BasicAuthenticationHandlerProvider = "org.eclipse.scout.jaxws.security.provider.BasicAuthenticationHandler";
- public static final String BasicAuthenticationHandlerConsumer = "org.eclipse.scout.jaxws.security.consumer.BasicAuthenticationHandler";
- public static final String NullAuthenticationHandlerConsumer = "org.eclipse.scout.jaxws.security.consumer.IAuthenticationHandler$NONE";
- public static final String NullAuthenticationHandlerProvider = "org.eclipse.scout.jaxws.security.provider.IAuthenticationHandler$NONE";
- public static final String ConfigIniCredentialValidationStrategy = "org.eclipse.scout.jaxws.security.provider.ConfigIniCredentialValidationStrategy";
-
- public static final String JaxWsStubGenerator = "org.eclipse.scout.jaxws.tool.JaxWsStubGenerator";
-
- public static final String IWebServiceClient = "org.eclipse.scout.jaxws.service.IWebServiceClient";
- public static final String AbstractWebServiceClient = "org.eclipse.scout.jaxws.service.AbstractWebServiceClient";
-
- public static final String PROP_SWS_SESSION_FACTORY = "sessionFactory";
- public static final String PROP_SWS_AUTH_HANDLER = "authenticationHandler";
- public static final String PROP_SWS_CREDENTIAL_STRATEGY = "credentialValidationStrategy";
-
- public static final String DefaultTimezoneDateAdapter = "org.eclipse.scout.jaxws.adapters.DefaultTimezoneDateAdapter";
- public static final String CalendarAdapter = "org.eclipse.scout.jaxws.adapters.CalendarAdapter";
- public static final String UtcDateAdapter = "org.eclipse.scout.jaxws.adapters.UtcDateAdapter";
-
- public static final String ServiceTunnelServlet = "org.eclipse.scout.rt.server.ServiceTunnelServlet";
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws;
+
+
+public final class JaxWsRuntimeClasses {
+
+ private JaxWsRuntimeClasses() {
+ }
+
+ public static final String JaxWsPlugin = "org.eclipse.scout.jaxws";
+ public static final String JaxWsServlet = "org.eclipse.scout.jaxws.JaxWsServlet";
+
+ public static final String JaxWsActivator = "org.eclipse.scout.jaxws.Activator";
+ public static final String ScoutWebService = "org.eclipse.scout.jaxws.annotation.ScoutWebService";
+ public static final String ScoutWebServiceClient = "org.eclipse.scout.jaxws.annotation.ScoutWebServiceClient";
+ public static final String ScoutTransaction = "org.eclipse.scout.jaxws.annotation.ScoutTransaction";
+
+ public static final String WsImportType = "com.sun.tools.internal.ws.WsImport";
+
+ public static final String IServerSessionFactory = "org.eclipse.scout.jaxws.session.IServerSessionFactory";
+ public static final String IAuthenticationHandlerProvider = "org.eclipse.scout.jaxws.security.provider.IAuthenticationHandler";
+ public static final String ICredentialValidationStrategy = "org.eclipse.scout.jaxws.security.provider.ICredentialValidationStrategy";
+ public static final String IAuthenticationHandlerConsumer = "org.eclipse.scout.jaxws.security.consumer.IAuthenticationHandler";
+
+ public static final String DefaultServerSessionFactory = "org.eclipse.scout.jaxws.session.DefaultServerSessionFactory";
+ public static final String BasicAuthenticationHandlerProvider = "org.eclipse.scout.jaxws.security.provider.BasicAuthenticationHandler";
+ public static final String BasicAuthenticationHandlerConsumer = "org.eclipse.scout.jaxws.security.consumer.BasicAuthenticationHandler";
+ public static final String NullAuthenticationHandlerConsumer = "org.eclipse.scout.jaxws.security.consumer.IAuthenticationHandler$NONE";
+ public static final String NullAuthenticationHandlerProvider = "org.eclipse.scout.jaxws.security.provider.IAuthenticationHandler$NONE";
+ public static final String ConfigIniCredentialValidationStrategy = "org.eclipse.scout.jaxws.security.provider.ConfigIniCredentialValidationStrategy";
+
+ public static final String JaxWsStubGenerator = "org.eclipse.scout.jaxws.tool.JaxWsStubGenerator";
+
+ public static final String IWebServiceClient = "org.eclipse.scout.jaxws.service.IWebServiceClient";
+ public static final String AbstractWebServiceClient = "org.eclipse.scout.jaxws.service.AbstractWebServiceClient";
+
+ public static final String PROP_SWS_SESSION_FACTORY = "sessionFactory";
+ public static final String PROP_SWS_AUTH_HANDLER = "authenticationHandler";
+ public static final String PROP_SWS_CREDENTIAL_STRATEGY = "credentialValidationStrategy";
+
+ public static final String DefaultTimezoneDateAdapter = "org.eclipse.scout.jaxws.adapters.DefaultTimezoneDateAdapter";
+ public static final String CalendarAdapter = "org.eclipse.scout.jaxws.adapters.CalendarAdapter";
+ public static final String UtcDateAdapter = "org.eclipse.scout.jaxws.adapters.UtcDateAdapter";
+
+ public static final String ServiceTunnelServlet = "org.eclipse.scout.rt.server.ServiceTunnelServlet";
+
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsSdk.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsSdk.java
index 348f7048f..61b94d919 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsSdk.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsSdk.java
@@ -1,322 +1,322 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-import java.util.concurrent.ConcurrentHashMap;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.resource.CompositeImageDescriptor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.ui.internal.ImageRegistry;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.log.SdkLogManager;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.IMarkerCommand;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageReloadNotification;
-import org.eclipse.scout.sdk.ws.jaxws.worker.MarkerQueueManager;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.SWTError;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.plugin.AbstractUIPlugin;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class JaxWsSdk extends AbstractUIPlugin implements JaxWsIcons {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.eclipse.scout.sdk.ws.jaxws";
- private static final String IMAGE_PATH = "resources/icons/";
-
- private static JaxWsSdk m_plugin;
- private static SdkLogManager logManager;
-
- private Map<String, IMarkerCommand> m_markerCommands;
- private MarkerQueueManager m_markerQueueManager;
- private Object m_pageRegistryLock;
- private Map<Class<? extends IPage>, Set<IPageReloadNotification>> m_pageRegistry;
-
- public JaxWsSdk() {
- m_markerCommands = new ConcurrentHashMap<String, IMarkerCommand>();
- m_pageRegistry = new HashMap<Class<? extends IPage>, Set<IPageReloadNotification>>();
- m_pageRegistryLock = new Object();
- }
-
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- m_plugin = this;
- logManager = new SdkLogManager(this);
- m_markerQueueManager = new MarkerQueueManager();
- }
-
- @Override
- public void stop(BundleContext context) throws Exception {
- if (m_markerQueueManager != null) {
- m_markerQueueManager.cancelWorker();
- m_markerQueueManager = null;
- }
- logManager = null;
- super.stop(context);
- }
-
- public static JaxWsSdk getDefault() {
- return m_plugin;
- }
-
- public static void logInfo(Throwable t) {
- logManager.logInfo(t);
- }
-
- public static void logInfo(String message) {
- logManager.logInfo(message);
- }
-
- public static void logInfo(String message, Throwable t) {
- logManager.logInfo(message, t);
- }
-
- public static void logWarning(String message) {
- logManager.logWarning(message);
- }
-
- public static void logWarning(Throwable t) {
- logManager.logWarning(t);
- }
-
- public static void logWarning(String message, Throwable t) {
- logManager.logWarning(message, t);
- }
-
- public static void logError(Throwable t) {
- logManager.logError(t);
- }
-
- public static void logError(String message) {
- logManager.logError(message);
- }
-
- public static void logError(String message, Throwable t) {
- logManager.logError(message, t);
- }
-
- public IMarkerCommand getMarkerCommand(String markerSourceId) {
- return m_markerCommands.get(markerSourceId);
- }
-
- public IMarkerCommand addMarkerCommand(String markerSourceId, IMarkerCommand markerCommand) {
- return m_markerCommands.put(markerSourceId, markerCommand);
- }
-
- public void removeMarkerCommand(String markerSourceId) {
- m_markerCommands.remove(markerSourceId);
- }
-
- public void removeMarkerCommands(String markerGroupUUID) {
- for (String markerSourceId : m_markerCommands.keySet()) {
- if (markerSourceId.startsWith(markerGroupUUID)) {
- m_markerCommands.remove(markerSourceId);
- }
- }
- }
-
- public boolean containsMarkerCommands(String markerGroupUUID) {
- Set<String> markerSourceIds = m_markerCommands.keySet();
- for (String markerSourceId : markerSourceIds) {
- if (markerSourceId.startsWith(markerGroupUUID)) {
- return true;
- }
- }
- return false;
- }
-
- public MarkerQueueManager getMarkerQueueManager() {
- return m_markerQueueManager;
- }
-
- /**
- * To load the model of a page
- *
- * @param pageClazz
- * @param markerGroupUUID
- * @param dataMask
- */
- public void notifyPageReload(Class<? extends IPage> pageClazz, final String markerGroupUUID, final int dataMask) {
- final IPageReloadNotification[] pages;
- synchronized (m_pageRegistryLock) {
- Set<IPageReloadNotification> pageSet = m_pageRegistry.get(pageClazz);
- if (pageSet == null || pageSet.size() == 0) {
- return;
- }
- pages = pageSet.toArray(new IPageReloadNotification[pageSet.size()]);
- }
-
- Job job = new Job("Reload page content") {
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- for (IPageReloadNotification page : pages) {
- try {
- if (CompareUtility.equals(markerGroupUUID, page.getMarkerGroupUUID())) {
- page.reloadPage(dataMask);
- }
- }
- catch (Exception e) {
- logError("failed to notify listener", e);
- }
- }
- return Status.OK_STATUS;
- }
- };
- job.schedule();
- }
-
- /**
- * Register page to receive reload requests
- *
- * @param pageClazz
- * @param page
- */
- public void registerPage(Class<? extends IPage> pageClazz, IPageReloadNotification page) {
- synchronized (m_pageRegistryLock) {
- Set<IPageReloadNotification> pages = m_pageRegistry.get(pageClazz);
- if (pages == null) {
- pages = new HashSet<IPageReloadNotification>();
- m_pageRegistry.put(pageClazz, pages);
- }
- pages.add(page);
- }
- }
-
- /**
- * Unregister page from receiving reload requests
- *
- * @param pageClazz
- * @param page
- */
- public void unregisterPage(Class<? extends IPage> pageClazz, IPageReloadNotification page) {
- synchronized (m_pageRegistryLock) {
- Set<IPageReloadNotification> pages = m_pageRegistry.get(pageClazz);
- if (pages == null) {
- return;
- }
- pages.remove(page);
- }
- }
-
- @Override
- protected ImageRegistry createImageRegistry() {
- // If we are in the UI Thread use that
- if (Display.getCurrent() != null) {
- return new ImageRegistry(Display.getCurrent());
- }
- if (PlatformUI.isWorkbenchRunning()) {
- return new ImageRegistry(PlatformUI.getWorkbench().getDisplay());
- }
- // Invalid thread access if it is not the UI Thread
- // and the workbench is not created.
- throw new SWTError(SWT.ERROR_THREAD_INVALID_ACCESS);
- }
-
- @Override
- protected void initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry reg) {
- }
-
- @Override
- public ImageRegistry getImageRegistry() {
- return (ImageRegistry) super.getImageRegistry();
- }
-
- /**
- * Returns the image for the given composite descriptor.
- */
- public static Image getImage(CompositeImageDescriptor imageDescriptor) {
- return getDefault().getImageImpl(imageDescriptor);
- }
-
- private Image getImageImpl(CompositeImageDescriptor imageDescriptor) {
- return getImageRegistry().get(imageDescriptor);
- }
-
- /**
- * To get a cached image with one of the extensions [gif | png | jpg]
- *
- * @param name
- * the name without extension located under resources/icons e.g. "person"
- * @return the cached image
- */
- public static Image getImage(String name) {
- return getDefault().getImageImpl(name);
- }
-
- private Image getImageImpl(String name) {
- Image image = getImageRegistry().get(name);
- if (image == null) {
- loadImage(name);
- image = getImageRegistry().get(name);
- }
- return image;
- }
-
- /**
- * To get a cached image with one of the extensions [gif | png | jpg]
- *
- * @param name
- * the name without extension located under resources/icons e.g. "person"
- * @return the cached image
- */
- public static ImageDescriptor getImageDescriptor(String name) {
- return getDefault().getImageDescriptorImpl(name);
- }
-
- private ImageDescriptor getImageDescriptorImpl(String name) {
- ImageDescriptor imageDesc = getImageRegistry().getDescriptor(name);
- if (imageDesc == null) {
- loadImage(name);
- imageDesc = getImageRegistry().getDescriptor(name);
- }
- return imageDesc;
- }
-
- private void loadImage(String name) {
- ImageDescriptor desc = null;
- // try already extension
- desc = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IMAGE_PATH + name);
- // gif
- if (desc == null) {
- desc = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IMAGE_PATH + name + ".gif");
- }
- // png
- if (desc == null) {
- desc = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IMAGE_PATH + name + ".png");
- }
- // jpg
- if (desc == null) {
- desc = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IMAGE_PATH + name + ".jpg");
- }
- if (desc == null) {
- logWarning("could not find image for plugin: '" + PLUGIN_ID + "' under: '" + IMAGE_PATH + name + "'.");
- }
- else {
- getImageRegistry().put(name, desc);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.resource.CompositeImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.ui.internal.ImageRegistry;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.log.SdkLogManager;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.IMarkerCommand;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageReloadNotification;
+import org.eclipse.scout.sdk.ws.jaxws.worker.MarkerQueueManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTError;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class JaxWsSdk extends AbstractUIPlugin implements JaxWsIcons {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.scout.sdk.ws.jaxws";
+ private static final String IMAGE_PATH = "resources/icons/";
+
+ private static JaxWsSdk m_plugin;
+ private static SdkLogManager logManager;
+
+ private Map<String, IMarkerCommand> m_markerCommands;
+ private MarkerQueueManager m_markerQueueManager;
+ private Object m_pageRegistryLock;
+ private Map<Class<? extends IPage>, Set<IPageReloadNotification>> m_pageRegistry;
+
+ public JaxWsSdk() {
+ m_markerCommands = new ConcurrentHashMap<String, IMarkerCommand>();
+ m_pageRegistry = new HashMap<Class<? extends IPage>, Set<IPageReloadNotification>>();
+ m_pageRegistryLock = new Object();
+ }
+
+ @Override
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ m_plugin = this;
+ logManager = new SdkLogManager(this);
+ m_markerQueueManager = new MarkerQueueManager();
+ }
+
+ @Override
+ public void stop(BundleContext context) throws Exception {
+ if (m_markerQueueManager != null) {
+ m_markerQueueManager.cancelWorker();
+ m_markerQueueManager = null;
+ }
+ logManager = null;
+ super.stop(context);
+ }
+
+ public static JaxWsSdk getDefault() {
+ return m_plugin;
+ }
+
+ public static void logInfo(Throwable t) {
+ logManager.logInfo(t);
+ }
+
+ public static void logInfo(String message) {
+ logManager.logInfo(message);
+ }
+
+ public static void logInfo(String message, Throwable t) {
+ logManager.logInfo(message, t);
+ }
+
+ public static void logWarning(String message) {
+ logManager.logWarning(message);
+ }
+
+ public static void logWarning(Throwable t) {
+ logManager.logWarning(t);
+ }
+
+ public static void logWarning(String message, Throwable t) {
+ logManager.logWarning(message, t);
+ }
+
+ public static void logError(Throwable t) {
+ logManager.logError(t);
+ }
+
+ public static void logError(String message) {
+ logManager.logError(message);
+ }
+
+ public static void logError(String message, Throwable t) {
+ logManager.logError(message, t);
+ }
+
+ public IMarkerCommand getMarkerCommand(String markerSourceId) {
+ return m_markerCommands.get(markerSourceId);
+ }
+
+ public IMarkerCommand addMarkerCommand(String markerSourceId, IMarkerCommand markerCommand) {
+ return m_markerCommands.put(markerSourceId, markerCommand);
+ }
+
+ public void removeMarkerCommand(String markerSourceId) {
+ m_markerCommands.remove(markerSourceId);
+ }
+
+ public void removeMarkerCommands(String markerGroupUUID) {
+ for (String markerSourceId : m_markerCommands.keySet()) {
+ if (markerSourceId.startsWith(markerGroupUUID)) {
+ m_markerCommands.remove(markerSourceId);
+ }
+ }
+ }
+
+ public boolean containsMarkerCommands(String markerGroupUUID) {
+ Set<String> markerSourceIds = m_markerCommands.keySet();
+ for (String markerSourceId : markerSourceIds) {
+ if (markerSourceId.startsWith(markerGroupUUID)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public MarkerQueueManager getMarkerQueueManager() {
+ return m_markerQueueManager;
+ }
+
+ /**
+ * To load the model of a page
+ *
+ * @param pageClazz
+ * @param markerGroupUUID
+ * @param dataMask
+ */
+ public void notifyPageReload(Class<? extends IPage> pageClazz, final String markerGroupUUID, final int dataMask) {
+ final IPageReloadNotification[] pages;
+ synchronized (m_pageRegistryLock) {
+ Set<IPageReloadNotification> pageSet = m_pageRegistry.get(pageClazz);
+ if (pageSet == null || pageSet.size() == 0) {
+ return;
+ }
+ pages = pageSet.toArray(new IPageReloadNotification[pageSet.size()]);
+ }
+
+ Job job = new Job("Reload page content") {
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ for (IPageReloadNotification page : pages) {
+ try {
+ if (CompareUtility.equals(markerGroupUUID, page.getMarkerGroupUUID())) {
+ page.reloadPage(dataMask);
+ }
+ }
+ catch (Exception e) {
+ logError("failed to notify listener", e);
+ }
+ }
+ return Status.OK_STATUS;
+ }
+ };
+ job.schedule();
+ }
+
+ /**
+ * Register page to receive reload requests
+ *
+ * @param pageClazz
+ * @param page
+ */
+ public void registerPage(Class<? extends IPage> pageClazz, IPageReloadNotification page) {
+ synchronized (m_pageRegistryLock) {
+ Set<IPageReloadNotification> pages = m_pageRegistry.get(pageClazz);
+ if (pages == null) {
+ pages = new HashSet<IPageReloadNotification>();
+ m_pageRegistry.put(pageClazz, pages);
+ }
+ pages.add(page);
+ }
+ }
+
+ /**
+ * Unregister page from receiving reload requests
+ *
+ * @param pageClazz
+ * @param page
+ */
+ public void unregisterPage(Class<? extends IPage> pageClazz, IPageReloadNotification page) {
+ synchronized (m_pageRegistryLock) {
+ Set<IPageReloadNotification> pages = m_pageRegistry.get(pageClazz);
+ if (pages == null) {
+ return;
+ }
+ pages.remove(page);
+ }
+ }
+
+ @Override
+ protected ImageRegistry createImageRegistry() {
+ // If we are in the UI Thread use that
+ if (Display.getCurrent() != null) {
+ return new ImageRegistry(Display.getCurrent());
+ }
+ if (PlatformUI.isWorkbenchRunning()) {
+ return new ImageRegistry(PlatformUI.getWorkbench().getDisplay());
+ }
+ // Invalid thread access if it is not the UI Thread
+ // and the workbench is not created.
+ throw new SWTError(SWT.ERROR_THREAD_INVALID_ACCESS);
+ }
+
+ @Override
+ protected void initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry reg) {
+ }
+
+ @Override
+ public ImageRegistry getImageRegistry() {
+ return (ImageRegistry) super.getImageRegistry();
+ }
+
+ /**
+ * Returns the image for the given composite descriptor.
+ */
+ public static Image getImage(CompositeImageDescriptor imageDescriptor) {
+ return getDefault().getImageImpl(imageDescriptor);
+ }
+
+ private Image getImageImpl(CompositeImageDescriptor imageDescriptor) {
+ return getImageRegistry().get(imageDescriptor);
+ }
+
+ /**
+ * To get a cached image with one of the extensions [gif | png | jpg]
+ *
+ * @param name
+ * the name without extension located under resources/icons e.g. "person"
+ * @return the cached image
+ */
+ public static Image getImage(String name) {
+ return getDefault().getImageImpl(name);
+ }
+
+ private Image getImageImpl(String name) {
+ Image image = getImageRegistry().get(name);
+ if (image == null) {
+ loadImage(name);
+ image = getImageRegistry().get(name);
+ }
+ return image;
+ }
+
+ /**
+ * To get a cached image with one of the extensions [gif | png | jpg]
+ *
+ * @param name
+ * the name without extension located under resources/icons e.g. "person"
+ * @return the cached image
+ */
+ public static ImageDescriptor getImageDescriptor(String name) {
+ return getDefault().getImageDescriptorImpl(name);
+ }
+
+ private ImageDescriptor getImageDescriptorImpl(String name) {
+ ImageDescriptor imageDesc = getImageRegistry().getDescriptor(name);
+ if (imageDesc == null) {
+ loadImage(name);
+ imageDesc = getImageRegistry().getDescriptor(name);
+ }
+ return imageDesc;
+ }
+
+ private void loadImage(String name) {
+ ImageDescriptor desc = null;
+ // try already extension
+ desc = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IMAGE_PATH + name);
+ // gif
+ if (desc == null) {
+ desc = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IMAGE_PATH + name + ".gif");
+ }
+ // png
+ if (desc == null) {
+ desc = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IMAGE_PATH + name + ".png");
+ }
+ // jpg
+ if (desc == null) {
+ desc = AbstractUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, IMAGE_PATH + name + ".jpg");
+ }
+ if (desc == null) {
+ logWarning("could not find image for plugin: '" + PLUGIN_ID + "' under: '" + IMAGE_PATH + name + "'.");
+ }
+ else {
+ getImageRegistry().put(name, desc);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsSdkStatus.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsSdkStatus.java
index 6122b817f..fc5c4bfd1 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsSdkStatus.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/JaxWsSdkStatus.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.scout.commons.StringUtility;
-
-public class JaxWsSdkStatus implements IStatus {
- private IStatus status;
-
- public JaxWsSdkStatus(IStatus status) {
- this.status = status;
- }
-
- @Override
- public IStatus[] getChildren() {
- return status.getChildren();
- }
-
- @Override
- public int getCode() {
- return status.getCode();
- }
-
- @Override
- public Throwable getException() {
- return status.getException();
- }
-
- @Override
- public String getMessage() {
- return StringUtility.join(" > JaxWS Scout SDK", status.getMessage());
- }
-
- @Override
- public String getPlugin() {
- return status.getPlugin();
- }
-
- @Override
- public int getSeverity() {
- return status.getSeverity();
- }
-
- @Override
- public boolean isMultiStatus() {
- return status.isMultiStatus();
- }
-
- @Override
- public boolean isOK() {
- return status.isOK();
- }
-
- @Override
- public boolean matches(int severityMask) {
- return status.matches(severityMask);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.scout.commons.StringUtility;
+
+public class JaxWsSdkStatus implements IStatus {
+ private IStatus status;
+
+ public JaxWsSdkStatus(IStatus status) {
+ this.status = status;
+ }
+
+ @Override
+ public IStatus[] getChildren() {
+ return status.getChildren();
+ }
+
+ @Override
+ public int getCode() {
+ return status.getCode();
+ }
+
+ @Override
+ public Throwable getException() {
+ return status.getException();
+ }
+
+ @Override
+ public String getMessage() {
+ return StringUtility.join(" > JaxWS Scout SDK", status.getMessage());
+ }
+
+ @Override
+ public String getPlugin() {
+ return status.getPlugin();
+ }
+
+ @Override
+ public int getSeverity() {
+ return status.getSeverity();
+ }
+
+ @Override
+ public boolean isMultiStatus() {
+ return status.isMultiStatus();
+ }
+
+ @Override
+ public boolean isOK() {
+ return status.isOK();
+ }
+
+ @Override
+ public boolean matches(int severityMask) {
+ return status.matches(severityMask);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/Texts.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/Texts.java
index 16c134bc6..f213d9f25 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/Texts.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/Texts.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws;
-
-/**
- * This class provides the nls support.
- * Do not change any member nor field of this class anytime otherwise the
- * nls support is not anymore garanteed.
- * This calss is auto generated and is maintained by the plugins
- * translations.nls file in the root directory of the plugin.
- *
- * @see translations.nls
- */
-public class Texts extends org.eclipse.scout.sdk.Texts {
- public static final String RESOURCE_BUNDLE_NAME = "resources.texts.Texts";//$NON-NLS-1$
- private static Texts instance = new Texts();
-
- public static Texts getInstance() {
- return instance;
- }
-
- public static String get(String key, String... messageArguments) {
- return instance.getText(key, messageArguments);
- }
-
- public static String get(String key) {
- return instance.getText(key, new String[0]);
- }
-
- protected Texts() {
- registerResourceBundle(RESOURCE_BUNDLE_NAME, Texts.class);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws;
+
+/**
+ * This class provides the nls support.
+ * Do not change any member nor field of this class anytime otherwise the
+ * nls support is not anymore garanteed.
+ * This calss is auto generated and is maintained by the plugins
+ * translations.nls file in the root directory of the plugin.
+ *
+ * @see translations.nls
+ */
+public class Texts extends org.eclipse.scout.sdk.Texts {
+ public static final String RESOURCE_BUNDLE_NAME = "resources.texts.Texts";//$NON-NLS-1$
+ private static Texts instance = new Texts();
+
+ public static Texts getInstance() {
+ return instance;
+ }
+
+ public static String get(String key, String... messageArguments) {
+ return instance.getText(key, messageArguments);
+ }
+
+ public static String get(String key) {
+ return instance.getText(key, new String[0]);
+ }
+
+ protected Texts() {
+ registerResourceBundle(RESOURCE_BUNDLE_NAME, Texts.class);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/ext/WebServicePageFactory.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/ext/WebServicePageFactory.java
index 188f5c57a..e88ae7b02 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/ext/WebServicePageFactory.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/ext/WebServicePageFactory.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.ext;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.ui.extensions.IPageFactory;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServicesTablePage;
-
-public class WebServicePageFactory implements IPageFactory {
-
- public WebServicePageFactory() {
- }
-
- @Override
- public void createChildren(IPage parentPage) {
- IScoutBundle bundle = (IScoutBundle) parentPage.getScoutResource();
- if (bundle.getType() != IScoutBundle.BUNDLE_SERVER) {
- return;
- }
-
- if (!isJaxWsDependencyInstalled(bundle)) {
- return;
- }
-
- // contribute WebServicesTablePage
- new WebServicesTablePage(parentPage);
- }
-
- private boolean isJaxWsDependencyInstalled(IScoutBundle bundle) {
- IType activator = TypeUtility.getType(JaxWsRuntimeClasses.JaxWsActivator);
- return TypeUtility.exists(activator) && TypeUtility.isOnClasspath(activator, bundle.getJavaProject());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.ext;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.ui.extensions.IPageFactory;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServicesTablePage;
+
+public class WebServicePageFactory implements IPageFactory {
+
+ public WebServicePageFactory() {
+ }
+
+ @Override
+ public void createChildren(IPage parentPage) {
+ IScoutBundle bundle = (IScoutBundle) parentPage.getScoutResource();
+ if (bundle.getType() != IScoutBundle.BUNDLE_SERVER) {
+ return;
+ }
+
+ if (!isJaxWsDependencyInstalled(bundle)) {
+ return;
+ }
+
+ // contribute WebServicesTablePage
+ new WebServicesTablePage(parentPage);
+ }
+
+ private boolean isJaxWsDependencyInstalled(IScoutBundle bundle) {
+ IType activator = TypeUtility.getType(JaxWsRuntimeClasses.JaxWsActivator);
+ return TypeUtility.exists(activator) && TypeUtility.isOnClasspath(activator, bundle.getJavaProject());
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/IMarkerCommandListener.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/IMarkerCommandListener.java
index 45a441996..33dd173ea 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/IMarkerCommandListener.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/IMarkerCommandListener.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.marker;
-
-public interface IMarkerCommandListener {
- public void markerCommandAdded(String markerSourceId);
-
- public void markerCommandRemoved(String markerSourceId);
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.marker;
+
+public interface IMarkerCommandListener {
+ public void markerCommandAdded(String markerSourceId);
+
+ public void markerCommandRemoved(String markerSourceId);
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/IMarkerRebuildListener.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/IMarkerRebuildListener.java
index 0c8d7a876..50274eec6 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/IMarkerRebuildListener.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/IMarkerRebuildListener.java
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.marker;
-
-public interface IMarkerRebuildListener {
- public void rebuildMarkers();
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.marker;
+
+public interface IMarkerRebuildListener {
+ public void rebuildMarkers();
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/MarkerRebuildUtility.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/MarkerRebuildUtility.java
index 669a45db8..75a6dc181 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/MarkerRebuildUtility.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/MarkerRebuildUtility.java
@@ -1,657 +1,657 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker;
-
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import javax.jws.WebService;
-import javax.wsdl.Definition;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.xml.namespace.QName;
-import javax.xml.ws.WebServiceClient;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IMemberValuePair;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.util.pde.PluginModelHelper;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.CorruptBindingFileCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.CorruptWsdlCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.DiscouragedWsdlFolderCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.InvalidPortTypeCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.InvalidServiceCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.JaxWsServletRegistrationCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingBuildJaxWsEntryCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingClasspathEntryForJarFileCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingEndpointCodeFirstCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingEndpointPropertyCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingPortTypeCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingPortTypeInheritanceCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingScoutWebServiceAnnotationCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingServiceCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingWsdlCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MultipleGlobalBindingsCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.StubRebuildCommand;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.UrlPatternAliasMismatchCommand;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean.IHandlerVisitor;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.part.AnnotationProperty;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility;
-
-@SuppressWarnings("restriction")
-public final class MarkerRebuildUtility {
- public static final String PROPERTY_ENDPOINT_INTERFACE = "endpointInterface";
-
- private MarkerRebuildUtility() {
- }
-
- public static boolean rebuildPortTypeImplMarkers(IFile sunJaxWsFile, SunJaxWsBean sunJaxWsBean, BuildJaxWsBean buildJaxWsBean, IType portType, Definition wsdlDefinition, String markerGroupUUID, IScoutBundle bundle) {
- // determine resource to store markers
- IResource markerResource = sunJaxWsFile;
- if (!JaxWsSdkUtility.exists(sunJaxWsFile)) {
- markerResource = bundle.getJavaProject().getResource();
- }
-
- try {
- IType portTypeInterfaceType = null;
- PortType wsdlPortType = JaxWsSdkUtility.getPortType(wsdlDefinition, sunJaxWsBean.getServiceQNameSafe(), sunJaxWsBean.getPort());
- if (wsdlPortType != null && wsdlPortType.getQName() != null) {
- IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(bundle, buildJaxWsBean, sunJaxWsBean.getWsdl());
- portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(wsdlPortType.getQName(), stubJarFile);
- }
-
- // validate port type
- if (!TypeUtility.exists(portType)) {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.Implementation, markerGroupUUID, Texts.get("InvalidImplementationType"));
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingPortTypeCommand(bundle, markerGroupUUID, sunJaxWsBean, portTypeInterfaceType));
- return false;
- }
- // validate port type package
- String recommendedPackageName = JaxWsSdkUtility.getRecommendedProviderImplPackageName(bundle);
- if (!portType.getPackageFragment().getElementName().startsWith(recommendedPackageName)) {
- MarkerUtility.createMarker(portType.getResource(), MarkerType.Package, markerGroupUUID, IMarker.SEVERITY_WARNING, Texts.get("ByConventionXShouldStartWithY", Texts.get("Package"), recommendedPackageName));
- return false;
- }
-
- // validate port type interface types
- Set<IType> interfacePortTypes = new HashSet<IType>();
-
- ITypeHierarchy hierarchy = portType.newSupertypeHierarchy(new NullProgressMonitor());
-
- for (IType superInterface : hierarchy.getAllSuperInterfaces(portType)) {
- IAnnotation annotation = JaxWsSdkUtility.getAnnotation(superInterface, WebService.class.getName(), false);
- if (annotation == null || !annotation.exists()) {
- continue;
- }
- interfacePortTypes.add(superInterface);
- }
-
- if (interfacePortTypes.size() == 0) {
- String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, Texts.get("WsImplXMustImplementPortTypeInterface", portType.getElementName()));
- if (portTypeInterfaceType != null) {
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingPortTypeInheritanceCommand(bundle, markerGroupUUID, portType, portTypeInterfaceType, sunJaxWsBean));
- }
- return false;
- }
-
- // validate WebService annotation of port type
- IAnnotation webServiceAnnotation = JaxWsSdkUtility.getAnnotation(portType, WebService.class.getSimpleName(), false);
- if (!TypeUtility.exists(webServiceAnnotation)) {
- String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, Texts.get("TypeMustBeAnnotatedWithXAnnotationInOrderToBeInstalledAsWebservice", WebService.class.getSimpleName()));
- registerMissingEndpointCommand(markerSourceId, bundle, sunJaxWsBean, buildJaxWsBean, portType, wsdlDefinition);
- return false;
- }
- IMemberValuePair[] memberValuePairs = webServiceAnnotation.getMemberValuePairs();
- String interfacePortTypeQualifiedNameFromAnnotation = null;
- for (IMemberValuePair mvPair : memberValuePairs) {
- if (PROPERTY_ENDPOINT_INTERFACE.equals(mvPair.getMemberName())) {
- interfacePortTypeQualifiedNameFromAnnotation = (String) mvPair.getValue();
- break;
- }
- }
- if (interfacePortTypeQualifiedNameFromAnnotation == null) {
- String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, Texts.get("MissingPropertyXOnAnnotationYToLinkThePortTypeWithTheRespectivePortTypeInterface", PROPERTY_ENDPOINT_INTERFACE, WebService.class.getSimpleName()));
- registerMissingEndpointCommand(markerSourceId, bundle, sunJaxWsBean, buildJaxWsBean, portType, wsdlDefinition);
- return false;
- }
-
- // validate mismatch among endpoint property in annotation and implemented interfaces
- boolean match = false;
- for (IType interfacePortTypeCandidate : interfacePortTypes) {
- if (interfacePortTypeCandidate.getFullyQualifiedName().equals(interfacePortTypeQualifiedNameFromAnnotation)) {
- match = true;
- break;
- }
- }
- if (!match) {
- String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, Texts.get("TheEndpointInterfaceConfiguredWithinAnnotationXDoesNotExistOrIsNotImplementedByThisEndpoint", WebService.class.getSimpleName()));
- registerMissingEndpointCommand(markerSourceId, bundle, sunJaxWsBean, buildJaxWsBean, portType, wsdlDefinition);
- return false;
- }
-
- // validate ScoutWebService annotation
- IAnnotation scoutWebServiceAnnotation = JaxWsSdkUtility.getAnnotation(portType, TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName(), false);
- if (!TypeUtility.exists(scoutWebServiceAnnotation)) {
- String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, IMarker.SEVERITY_WARNING,
- Texts.get("ToConfigureAuthenticationAndSessionHandlingForTheWebserviceAnnotateThePortTypeWithX", TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName()));
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingScoutWebServiceAnnotationCommand(portType));
- return false;
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("failed to rebuild markers for endpoint", e);
- }
- return true;
- }
-
- public static boolean rebuildBuildJaxWsMarkers(IFile buildJaxWsFile, BuildJaxWsBean buildJaxWsBean, String alias, WsdlResource wsdlResource, String markerGroupUUID, IScoutBundle bundle, WebserviceEnum webserviceEnum) {
- // determine resource to store markers
- IResource markerResource = buildJaxWsFile;
- if (!JaxWsSdkUtility.exists(buildJaxWsFile)) {
- markerResource = bundle.getJavaProject().getResource();
- }
-
- if (buildJaxWsBean == null) {
- String markerSourceId = MarkerUtility.createMarker(bundle.getJavaProject().getResource(), MarkerType.MissingBuildJaxWsEntry, markerGroupUUID, Texts.get("MissingBuildEntryInFileX", JaxWsConstants.PATH_BUILD_JAXWS));
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingBuildJaxWsEntryCommand(bundle, alias, webserviceEnum));
- return false;
- }
-
- // validate stub folder
- IFolder folder = JaxWsSdkUtility.getFolder(bundle, JaxWsConstants.STUB_FOLDER, false);
- if (folder == null || !folder.exists()) {
- MarkerUtility.createMarker(markerResource, MarkerType.StubFolder, markerGroupUUID, Texts.get("StubFolderXDoesNotExist", JaxWsConstants.STUB_FOLDER));
- return false;
- }
-
- // validate package
- String stubPackageName = JaxWsSdkUtility.getBuildProperty(buildJaxWsBean.getPropertiers(), JaxWsConstants.OPTION_PACKAGE);
- if (stubPackageName != null) {
- // warning as custom package
- MarkerUtility.createMarker(markerResource, MarkerType.Package, markerGroupUUID, IMarker.SEVERITY_WARNING, Texts.get("ConventionPackageNameEqualsToTargetNamespaceX"));
- if (!StringUtility.hasText(stubPackageName)) {
- MarkerUtility.createMarker(markerResource, MarkerType.Package, markerGroupUUID, Texts.get("PackageNameMustNotBeEmpty"));
- return false;
- }
- // only validate custom package
- IStatus status = JavaConventionsUtil.validatePackageName(stubPackageName, bundle.getJavaProject());
- if (status.getSeverity() == IStatus.ERROR) {
- MarkerUtility.createMarker(markerResource, MarkerType.Package, markerGroupUUID, Texts.get("PackageNameNotValidJavaPackageName", status.getMessage()));
- return false;
- }
- else if (status.getSeverity() == IStatus.WARNING) {
- MarkerUtility.createMarker(markerResource, MarkerType.Package, markerGroupUUID, IMarker.SEVERITY_WARNING, Texts.get("PackageNameNotValidJavaPackageName", status.getMessage()));
- }
- }
- return true;
- }
-
- public static boolean rebuildSunJaxWsMarkers(IFile sunJaxWsFile, SunJaxWsBean sunJaxWsBean, WsdlResource wsdlResource, String markerGroupUUID, IScoutBundle bundle) {
- // determine resource to store markers
- IResource markerResource = sunJaxWsFile;
- if (!JaxWsSdkUtility.exists(sunJaxWsFile)) {
- markerResource = bundle.getJavaProject().getResource();
- }
-
- // validate alias
- if (!StringUtility.hasText(sunJaxWsBean.getAlias())) {
- MarkerUtility.createMarker(markerResource, markerGroupUUID, Texts.get("MissingOrEmptyAttributeX", SunJaxWsBean.XML_ALIAS));
- return false;
- }
-
- // validate implementation
- if (!StringUtility.hasText(sunJaxWsBean.getImplementation())) {
- MarkerUtility.createMarker(markerResource, markerGroupUUID, Texts.get("MissingOrEmptyAttributeX", SunJaxWsBean.XML_IMPLEMENTATION));
- return false;
- }
-
- if (!validateJaxWsServletRegistartionAndUrlPattern(sunJaxWsBean, markerGroupUUID, bundle)) {
- return false;
- }
-
- Definition wsdlDefinition = wsdlResource.loadWsdlDefinition();
- if (wsdlDefinition == null) {
- return true;
- }
-
- // validate service
- Map services = wsdlDefinition.getServices();
- if (sunJaxWsBean.getServiceQNameSafe() == null) {
- MarkerUtility.createMarker(markerResource, MarkerType.Service, markerGroupUUID, IMarker.SEVERITY_WARNING, Texts.get("InvalidServiceConfigurationMissingOrInvalidQNameInAttributeX", SunJaxWsBean.XML_SERVICE));
- return false;
- }
- else if (!services.keySet().contains(sunJaxWsBean.getServiceQNameSafe())) {
- MarkerUtility.createMarker(markerResource, MarkerType.Service, markerGroupUUID, Texts.get("ServiceCouldNotBeFoundInWSDLmodel"));
-
- if (!sunJaxWsBean.getServiceQNameSafe().getNamespaceURI().endsWith("/")) {
- MarkerUtility.createMarker(markerResource, MarkerType.Service, markerGroupUUID, Texts.get("ServiceNamespaceMustEndWithASlash"));
- }
- return false;
- }
-
- // validate port
- Service service = (Service) services.get(sunJaxWsBean.getServiceQNameSafe());
- Map ports = service.getPorts();
- if (ports == null || ports.size() == 0) {
- MarkerUtility.createMarker(markerResource, MarkerType.Port, markerGroupUUID, IMarker.SEVERITY_WARNING, Texts.get("DiscouragedPortConfigurationNoPortFoundInWSDLFileX", wsdlResource.getFile().getProjectRelativePath().toPortableString()));
- return false;
- }
- else if (sunJaxWsBean.getPortQNameSafe() == null) {
- MarkerUtility.createMarker(markerResource, MarkerType.Port, markerGroupUUID, IMarker.SEVERITY_WARNING, Texts.get("DiscouragedServiceConfigurationMissingOrIinvalidQNameInAttributeX", SunJaxWsBean.XML_PORT));
- return false;
- }
- else if (!ports.keySet().contains(sunJaxWsBean.getPortQNameSafe().getLocalPart())) {
- MarkerUtility.createMarker(markerResource, MarkerType.Port, markerGroupUUID, Texts.get("UnknownPortConfiguredInAttributeX", SunJaxWsBean.XML_PORT));
- return false;
- }
- return true;
- }
-
- private static boolean validateJaxWsServletRegistartionAndUrlPattern(SunJaxWsBean sunJaxWsBean, String markerGroupUUID, IScoutBundle bundle) {
- // validate JAX-WS servlet registration alais
- String servletAlias = ServletRegistrationUtility.getAlias(bundle);
- if (!StringUtility.hasText(servletAlias)) {
- String markerSourceId = MarkerUtility.createMarker(bundle.getJavaProject().getResource(), MarkerType.UrlPattern, markerGroupUUID, IMarker.SEVERITY_ERROR, "No or wrong servlet plugin specified in build-jaxws.xml to host JAX-WS servlet registration.\nAdd the element 'servlet-bundle' with the attribute 'name' to build-jaxws.xml and specify the symbolic name of the plugin that contains the JAX-WS servlet registration in its plugin.xml.");
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new JaxWsServletRegistrationCommand(bundle));
- return false;
- }
- else if (!servletAlias.matches("[\\w\\-/]*")) { // check for illegal characters
- String markerSourceId = MarkerUtility.createMarker(bundle.getJavaProject().getResource(), MarkerType.UrlPattern, markerGroupUUID, IMarker.SEVERITY_ERROR, "Invalid JAX-WS servlet alias '" + servletAlias + "' specified.");
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new JaxWsServletRegistrationCommand(bundle));
- return false;
- }
-
- IResource markerResource = ResourceFactory.getSunJaxWsResource(bundle).getFile();
- if (!JaxWsSdkUtility.exists(markerResource)) {
- markerResource = bundle.getJavaProject().getResource();
- }
-
- // condition: servlet alias is not null
- servletAlias = JaxWsSdkUtility.normalizePath(servletAlias, SeparatorType.BothType);
- String urlPattern = sunJaxWsBean.getUrlPattern();
- if (urlPattern == null) {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.UrlPattern, markerGroupUUID, Texts.get("MissingOrEmptyAttributeX", SunJaxWsBean.XML_URL_PATTERN));
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new UrlPatternAliasMismatchCommand(bundle, sunJaxWsBean, servletAlias));
- return false;
- }
- else if (JaxWsSdkUtility.normalizePath(urlPattern, SeparatorType.BothType).equals(servletAlias)) {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.UrlPattern, markerGroupUUID, Texts.get("XMustNotBeEmpty", SunJaxWsBean.XML_URL_PATTERN));
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new UrlPatternAliasMismatchCommand(bundle, sunJaxWsBean, servletAlias));
- return false;
- }
- else if (!urlPattern.startsWith(servletAlias)) {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.UrlPattern, markerGroupUUID, IMarker.SEVERITY_ERROR, Texts.get("UrlPatternJaxWsAliasMismatch", servletAlias));
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new UrlPatternAliasMismatchCommand(bundle, sunJaxWsBean, servletAlias));
- return false;
- }
- else if (!urlPattern.matches("[\\w\\-/]*")) { // check for illegal characters
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.UrlPattern, markerGroupUUID, IMarker.SEVERITY_ERROR, "Invalid URL pattern '" + urlPattern + "' specified.");
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new JaxWsServletRegistrationCommand(bundle, sunJaxWsBean));
- return false;
- }
- else if (urlPattern.endsWith("/")) {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.UrlPattern, markerGroupUUID, IMarker.SEVERITY_ERROR, "URL pattern must not end with a '/'.");
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new JaxWsServletRegistrationCommand(bundle, sunJaxWsBean));
- return false;
- }
- return true;
- }
-
- public static boolean rebuildBindingFileMarkers(IFile buildJaxWsFile, XmlResource[] bindingFileResources, WsdlResource wsdlResource, String markerGroupUUID, IScoutBundle bundle) {
- IResource defaultMarkerResource = buildJaxWsFile;
-
- // binding file
- for (int index = 0; index < bindingFileResources.length; index++) {
- XmlResource bindingFileResource = bindingFileResources[index];
-
- if (bindingFileResource.getFile() == null) {
- MarkerUtility.createMarker(defaultMarkerResource, MarkerType.BindingFile, JaxWsSdkUtility.toMarkerGroupUUID(markerGroupUUID, index), IMarker.SEVERITY_ERROR, Texts.get("NonExistingBindingFileConfigured"));
- return false;
- }
- else if (!bindingFileResource.getFile().exists()) {
- String markerSourceId = MarkerUtility.createMarker(defaultMarkerResource, MarkerType.BindingFile, JaxWsSdkUtility.toMarkerGroupUUID(markerGroupUUID, index), IMarker.SEVERITY_ERROR, Texts.get("BindingFileXCouldNotBeFound", bindingFileResource.getFile().getProjectRelativePath().toPortableString()));
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new CorruptBindingFileCommand(bundle, bindingFileResource.getFile(), wsdlResource));
- return false;
- }
- else if (bindingFileResource.loadXml() == null) {
- String markerSourceId = MarkerUtility.createMarker(bindingFileResource.getFile(), MarkerType.BindingFile, JaxWsSdkUtility.toMarkerGroupUUID(markerGroupUUID, index), IMarker.SEVERITY_ERROR, Texts.get("BindingFileXIsNotAValidXMLFile", bindingFileResource.getFile().getProjectRelativePath().toPortableString()));
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new CorruptBindingFileCommand(bundle, bindingFileResource.getFile(), wsdlResource));
- return false;
- }
- }
-
- if (JaxWsSdkUtility.containsGlobalBindingSection(bindingFileResources, true)) {
- String markerSourceId = MarkerUtility.createMarker(defaultMarkerResource, MarkerType.BindingFile, markerGroupUUID, IMarker.SEVERITY_ERROR, Texts.get("MultipleGlobalBindingDefinitionsFoundOnlyOneAllowed"));
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MultipleGlobalBindingsCommand());
- return false;
- }
- return true;
- }
-
- public static boolean rebuildWsdlMarkers(WsdlResource wsdlResource, BuildJaxWsBean buildJaxWsBean, SunJaxWsBean sunJaxWsBean, String markerGroupUUID, IScoutBundle bundle) {
- // determine resource to store markers
- IResource markerResource = wsdlResource.getFile();
- if (!JaxWsSdkUtility.exists(wsdlResource.getFile())) {
- markerResource = bundle.getJavaProject().getResource();
- }
-
- IFile wsdlFile = wsdlResource.getFile();
- if (wsdlFile == null) {
- MarkerUtility.createMarker(markerResource, MarkerType.Wsdl, markerGroupUUID, Texts.get("NoWSDLFileConfigured"));
- return false;
- }
- boolean provider = (sunJaxWsBean != null);
- if (!wsdlResource.existsFile()) {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.Wsdl, markerGroupUUID, Texts.get("WSDLFileXCouldNotBeFound", wsdlFile.getProjectRelativePath().toPortableString()));
- if (provider) {
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingWsdlCommand(bundle, wsdlResource, sunJaxWsBean));
- }
- else {
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingWsdlCommand(bundle, wsdlResource, buildJaxWsBean));
- }
- return false;
- }
-
- Definition wsdlDefinition = wsdlResource.loadWsdlDefinition();
- if (wsdlDefinition == null) {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.Wsdl, markerGroupUUID, Texts.get("CorruptWSDLFileAtLocationX", wsdlFile.getProjectRelativePath().toPortableString()));
- if (provider) {
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new CorruptWsdlCommand(bundle, wsdlResource, sunJaxWsBean));
- }
- else {
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new CorruptWsdlCommand(bundle, wsdlResource, buildJaxWsBean));
- }
- return false;
- }
-
- // validate services
- Map services = wsdlDefinition.getServices();
- if (services == null || services.size() == 0) {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.Service, markerGroupUUID, IMarker.SEVERITY_ERROR, Texts.get("NoServiceFoundInWSDLFileX", wsdlResource.getFile().getProjectRelativePath().toPortableString()));
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingServiceCommand(wsdlResource.getFile().getName()));
- return false;
- }
-
- // validate WSDL folder > only accept subfolders of root folder
- IFolder rootFolder;
- if (provider) {
- rootFolder = JaxWsSdkUtility.getFolder(bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false);
- }
- else {
- rootFolder = JaxWsSdkUtility.getFolder(bundle, JaxWsConstants.PATH_WSDL_CONSUMER, false);
- }
- IFolder folder = JaxWsSdkUtility.getParentFolder(bundle, wsdlFile);
- IPath wsdlRootPath = rootFolder.getProjectRelativePath();
- IPath candidatePath = folder.getProjectRelativePath();
- candidatePath = candidatePath.makeRelativeTo(wsdlRootPath);
- if (candidatePath.toPortableString().startsWith("..")) {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.WsdlFolder, markerGroupUUID, IMarker.SEVERITY_WARNING, Texts.get("WarningWsdlFolder", rootFolder.getProjectRelativePath().toPortableString()));
- if (provider) {
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new DiscouragedWsdlFolderCommand(bundle, markerGroupUUID, buildJaxWsBean, sunJaxWsBean));
- }
- else {
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new DiscouragedWsdlFolderCommand(bundle, markerGroupUUID, buildJaxWsBean));
- }
- }
- return true;
- }
-
- public static boolean rebuildWebserviceClientType(IType webserviceClientType, BuildJaxWsBean buildJaxWsBean, WsdlResource wsdlResource, String markerGroupUUID, IScoutBundle bundle) {
- if (buildJaxWsBean == null) {
- return false;
- }
-
- if (!TypeUtility.exists(webserviceClientType)) {
- return false;
- }
- // determine resource to store markers
- IResource markerResource = webserviceClientType.getResource();
- if (!JaxWsSdkUtility.exists(markerResource)) {
- markerResource = bundle.getJavaProject().getResource();
- }
-
- IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(bundle, buildJaxWsBean, buildJaxWsBean.getWsdl());
-
- // validate service
- QName serviceQName = JaxWsSdkUtility.extractServiceQNameFromWsClient(webserviceClientType);
- if (serviceQName == null) {
- if (stubJarFile != null && stubJarFile.exists()) {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.Service, markerGroupUUID, Texts.get("InvalidServiceInSuperTypeGenericParameter", javax.xml.ws.Service.class.getName(), WebServiceClient.class.getSimpleName()));
- InvalidServiceCommand cmd = new InvalidServiceCommand(webserviceClientType, stubJarFile);
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, cmd);
- }
- else {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.Service, markerGroupUUID, Texts.get("InvalidServiceInWsdl", javax.xml.ws.Service.class.getName(), WebServiceClient.class.getSimpleName()));
- registerStubRebuildCommand(markerSourceId, buildJaxWsBean, wsdlResource, bundle);
- }
- return false;
- }
-
- // validate port type interface type
- QName portTypeQName = JaxWsSdkUtility.extractPortTypeQNameFromWsClient(webserviceClientType);
- if (portTypeQName == null) {
- if (stubJarFile != null && stubJarFile.exists()) {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.PortType, markerGroupUUID, Texts.get("InvalidPortTypeInSuperGenericParameter", WebService.class.getSimpleName()));
- InvalidPortTypeCommand cmd = new InvalidPortTypeCommand(webserviceClientType, stubJarFile);
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, cmd);
- }
- else {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.PortType, markerGroupUUID, Texts.get("InvalidPortTypeInWsdl", WebService.class.getSimpleName()));
- registerStubRebuildCommand(markerSourceId, buildJaxWsBean, wsdlResource, bundle);
- }
- return false;
- }
-
- Definition wsdlDefinition = wsdlResource.loadWsdlDefinition();
- // check that service exists in WSDL
- if (wsdlDefinition == null) {
- return true;
- }
-
- if (wsdlDefinition.getService(serviceQName) == null) {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.Service, markerGroupUUID, Texts.get("ServiceXNotFoundInWsdl", serviceQName.toString()));
- if (stubJarFile != null && stubJarFile.exists()) {
- InvalidServiceCommand cmd = new InvalidServiceCommand(webserviceClientType, stubJarFile);
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, cmd);
- }
- return false;
- }
-
- if (wsdlDefinition.getPortType(portTypeQName) == null) {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.PortType, markerGroupUUID, Texts.get("PortTypeXNotFoundInWsdl", portTypeQName.toString()));
- if (stubJarFile != null && stubJarFile.exists()) {
- InvalidPortTypeCommand cmd = new InvalidPortTypeCommand(webserviceClientType, stubJarFile);
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, cmd);
- }
- return false;
- }
- return true;
- }
-
- public static boolean rebuildStubJarFileMarkers(BuildJaxWsBean buildJaxWsBean, WsdlResource wsdlResource, QName portTypeQName, QName serviceQName, IScoutBundle bundle, String markerGroupUUID) {
- if (buildJaxWsBean == null || wsdlResource == null || wsdlResource.getFile() == null) {
- return false;
- }
-
- IResource markerResource = bundle.getJavaProject().getResource();
-
- // validate existence of Jar file
- IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(bundle, buildJaxWsBean, wsdlResource.getFile().getName());
- if (!stubJarFile.exists()) {
- String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.StubJar, markerGroupUUID, "Could not find JAR file '" + stubJarFile.getName() + "' with generated stub classes for webservice '" + buildJaxWsBean.getAlias() + "'");
- registerStubRebuildCommand(markerSourceId, buildJaxWsBean, wsdlResource, bundle);
- return false;
- }
- else {
- // ensure JAR file to be on project classpath
- try {
- PluginModelHelper h = new PluginModelHelper(bundle.getProject());
- if (!h.Manifest.existsClasspathEntry(stubJarFile.getProjectRelativePath().toPortableString())) {
- String markerSourceId = MarkerUtility.createMarker(wsdlResource.getFile(), MarkerType.StubJar, markerGroupUUID, Texts.get("JarFileXOfWsYMustBeOnClasspath", stubJarFile.getName(), buildJaxWsBean.getAlias()));
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingClasspathEntryForJarFileCommand(bundle, buildJaxWsBean.getAlias(), stubJarFile));
- }
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- }
- }
-
- // validate existence of PortType interface type
- if (portTypeQName != null) {
- IType portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(portTypeQName, stubJarFile);
- if (portTypeInterfaceType == null) {
- String markerSourceId = MarkerUtility.createMarker(wsdlResource.getFile(), MarkerType.StubJar, markerGroupUUID, Texts.get("PortTypeXNotFoundInStubJarY", portTypeQName == null ? "<?>" : portTypeQName.toString(), stubJarFile.getName()));
- registerStubRebuildCommand(markerSourceId, buildJaxWsBean, wsdlResource, bundle);
- }
- }
-
- // validate existence of service
- if (serviceQName != null) {
- IType serviceType = JaxWsSdkUtility.resolveServiceType(serviceQName, stubJarFile);
- if (serviceType == null) {
- String markerSourceId = MarkerUtility.createMarker(wsdlResource.getFile(), MarkerType.StubJar, markerGroupUUID, Texts.get("ServiceTypeXNotFoundInStubJarY", serviceQName == null ? "<?>" : serviceQName.toString(), stubJarFile.getName()));
- registerStubRebuildCommand(markerSourceId, buildJaxWsBean, wsdlResource, bundle);
- return false;
- }
- }
- return true;
- }
-
- public static void rebuildHandlerMarkers(SunJaxWsBean sunJaxWsBean, final IScoutBundle bundle, final String markerGroupUUID) {
-
- sunJaxWsBean.visitHandlers(new IHandlerVisitor() {
-
- @Override
- public boolean visit(ScoutXmlElement xmlHandlerElement, String fullyQualifiedName, int handlerIndex, int handlerCount) {
- if (fullyQualifiedName == null) {
- MarkerUtility.createMarker(ResourceFactory.getSunJaxWsResource(bundle).getFile(), MarkerType.HandlerClass, markerGroupUUID, "Missing handler class");
- return false;
- }
- else if (!TypeUtility.existsType(fullyQualifiedName)) {
- MarkerUtility.createMarker(ResourceFactory.getSunJaxWsResource(bundle).getFile(), MarkerType.HandlerClass, markerGroupUUID, "Configured handler class '" + fullyQualifiedName + "' could not be found.");
- return false;
- }
- return true;
- }
- });
- }
-
- public static void rebuildCodeFirstPortTypeMarkers(IScoutBundle bundle, IType portType, SunJaxWsBean sunJaxWsBean, String markerGroupUUID) {
- try {
- // validate port type
- if (!TypeUtility.exists(portType)) {
- String markerSourceId = MarkerUtility.createMarker(ResourceFactory.getSunJaxWsResource(bundle).getFile(), MarkerType.Implementation, markerGroupUUID, Texts.get("InvalidImplementationType"));
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingPortTypeCommand(bundle, markerGroupUUID, sunJaxWsBean, null));
- return;
- }
-
- if (!TypeUtility.exists(portType)) {
- return;
- }
-
- // validate port type interface
- IAnnotation webServiceAnnotation = JaxWsSdkUtility.getAnnotation(portType, WebService.class.getName(), false);
- if (webServiceAnnotation == null) {
- String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, Texts.get("AnnotationXWithPropertyYRequired", WebService.class.getSimpleName(), "endpointInterface"));
- registerMissingEndpointCodeFirstCommand(portType, markerGroupUUID, markerSourceId);
- return;
- }
- AnnotationProperty property = JaxWsSdkUtility.parseAnnotationTypeValue(portType, webServiceAnnotation, "endpointInterface");
- IType portTypeInterfaceType = TypeUtility.getType(property.getFullyQualifiedName());
- if (portTypeInterfaceType == null) {
- String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, Texts.get("AnnotationXWithPropertyYRequired", WebService.class.getSimpleName(), "endpointInterface"));
- registerMissingEndpointCodeFirstCommand(portType, markerGroupUUID, markerSourceId);
- return;
- }
- if (!JaxWsSdkUtility.isJdtSubType(portTypeInterfaceType.getFullyQualifiedName(), portType)) {
- String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, Texts.get("WsImplXMustImplementPortTypeInterface", portType.getElementName()));
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingPortTypeInheritanceCommand(bundle, markerGroupUUID, portType, portTypeInterfaceType, sunJaxWsBean));
- return;
- }
-
- // validate ScoutWebService annotation
- IAnnotation scoutWebServiceAnnotation = JaxWsSdkUtility.getAnnotation(portType, TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName(), false);
- if (!TypeUtility.exists(scoutWebServiceAnnotation)) {
- String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, IMarker.SEVERITY_WARNING,
- Texts.get("ToConfigureAuthenticationAndSessionHandlingForTheWebserviceAnnotateThePortTypeWithX", TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName()));
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingScoutWebServiceAnnotationCommand(portType));
- return;
- }
-
- if (!validateJaxWsServletRegistartionAndUrlPattern(sunJaxWsBean, markerGroupUUID, bundle)) {
- return;
- }
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- }
- }
-
- private static void registerStubRebuildCommand(String markerSourceId, BuildJaxWsBean buildJaxWsBean, WsdlResource wsdlResource, IScoutBundle bundle) {
- if (wsdlResource.getFile() != null) {
- StubRebuildCommand cmd = new StubRebuildCommand(bundle);
- cmd.setAlias(buildJaxWsBean.getAlias());
- cmd.setProperties(buildJaxWsBean.getPropertiers());
- cmd.setWsdlResource(wsdlResource);
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, cmd);
- }
- }
-
- private static void registerMissingEndpointCommand(String markerSourceId, IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, BuildJaxWsBean buildJaxWsBean, IType implType, Definition wsdlDefinition) {
- if (sunJaxWsBean == null || wsdlDefinition == null) {
- return;
- }
- IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(bundle, buildJaxWsBean, sunJaxWsBean.getWsdl());
- if (stubJarFile == null) {
- return;
- }
- MissingEndpointPropertyCommand cmd = new MissingEndpointPropertyCommand(implType);
- PortType wsdlPortType = JaxWsSdkUtility.getPortType(wsdlDefinition, sunJaxWsBean.getServiceQNameSafe(), sunJaxWsBean.getPort());
- if (wsdlPortType != null) {
- cmd.setPortTypeQName(wsdlPortType.getQName());
- }
- cmd.setStubJarFile(stubJarFile);
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, cmd);
- }
-
- private static void registerMissingEndpointCodeFirstCommand(IType portType, String markerGroupUUID, String markerSourceId) {
- MissingEndpointCodeFirstCommand cmd = new MissingEndpointCodeFirstCommand(portType);
- JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, cmd);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker;
+
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.jws.WebService;
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceClient;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IMemberValuePair;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.util.pde.PluginModelHelper;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.CorruptBindingFileCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.CorruptWsdlCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.DiscouragedWsdlFolderCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.InvalidPortTypeCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.InvalidServiceCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.JaxWsServletRegistrationCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingBuildJaxWsEntryCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingClasspathEntryForJarFileCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingEndpointCodeFirstCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingEndpointPropertyCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingPortTypeCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingPortTypeInheritanceCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingScoutWebServiceAnnotationCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingServiceCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MissingWsdlCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.MultipleGlobalBindingsCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.StubRebuildCommand;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.UrlPatternAliasMismatchCommand;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean.IHandlerVisitor;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.part.AnnotationProperty;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility;
+
+@SuppressWarnings("restriction")
+public final class MarkerRebuildUtility {
+ public static final String PROPERTY_ENDPOINT_INTERFACE = "endpointInterface";
+
+ private MarkerRebuildUtility() {
+ }
+
+ public static boolean rebuildPortTypeImplMarkers(IFile sunJaxWsFile, SunJaxWsBean sunJaxWsBean, BuildJaxWsBean buildJaxWsBean, IType portType, Definition wsdlDefinition, String markerGroupUUID, IScoutBundle bundle) {
+ // determine resource to store markers
+ IResource markerResource = sunJaxWsFile;
+ if (!JaxWsSdkUtility.exists(sunJaxWsFile)) {
+ markerResource = bundle.getJavaProject().getResource();
+ }
+
+ try {
+ IType portTypeInterfaceType = null;
+ PortType wsdlPortType = JaxWsSdkUtility.getPortType(wsdlDefinition, sunJaxWsBean.getServiceQNameSafe(), sunJaxWsBean.getPort());
+ if (wsdlPortType != null && wsdlPortType.getQName() != null) {
+ IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(bundle, buildJaxWsBean, sunJaxWsBean.getWsdl());
+ portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(wsdlPortType.getQName(), stubJarFile);
+ }
+
+ // validate port type
+ if (!TypeUtility.exists(portType)) {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.Implementation, markerGroupUUID, Texts.get("InvalidImplementationType"));
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingPortTypeCommand(bundle, markerGroupUUID, sunJaxWsBean, portTypeInterfaceType));
+ return false;
+ }
+ // validate port type package
+ String recommendedPackageName = JaxWsSdkUtility.getRecommendedProviderImplPackageName(bundle);
+ if (!portType.getPackageFragment().getElementName().startsWith(recommendedPackageName)) {
+ MarkerUtility.createMarker(portType.getResource(), MarkerType.Package, markerGroupUUID, IMarker.SEVERITY_WARNING, Texts.get("ByConventionXShouldStartWithY", Texts.get("Package"), recommendedPackageName));
+ return false;
+ }
+
+ // validate port type interface types
+ Set<IType> interfacePortTypes = new HashSet<IType>();
+
+ ITypeHierarchy hierarchy = portType.newSupertypeHierarchy(new NullProgressMonitor());
+
+ for (IType superInterface : hierarchy.getAllSuperInterfaces(portType)) {
+ IAnnotation annotation = JaxWsSdkUtility.getAnnotation(superInterface, WebService.class.getName(), false);
+ if (annotation == null || !annotation.exists()) {
+ continue;
+ }
+ interfacePortTypes.add(superInterface);
+ }
+
+ if (interfacePortTypes.size() == 0) {
+ String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, Texts.get("WsImplXMustImplementPortTypeInterface", portType.getElementName()));
+ if (portTypeInterfaceType != null) {
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingPortTypeInheritanceCommand(bundle, markerGroupUUID, portType, portTypeInterfaceType, sunJaxWsBean));
+ }
+ return false;
+ }
+
+ // validate WebService annotation of port type
+ IAnnotation webServiceAnnotation = JaxWsSdkUtility.getAnnotation(portType, WebService.class.getSimpleName(), false);
+ if (!TypeUtility.exists(webServiceAnnotation)) {
+ String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, Texts.get("TypeMustBeAnnotatedWithXAnnotationInOrderToBeInstalledAsWebservice", WebService.class.getSimpleName()));
+ registerMissingEndpointCommand(markerSourceId, bundle, sunJaxWsBean, buildJaxWsBean, portType, wsdlDefinition);
+ return false;
+ }
+ IMemberValuePair[] memberValuePairs = webServiceAnnotation.getMemberValuePairs();
+ String interfacePortTypeQualifiedNameFromAnnotation = null;
+ for (IMemberValuePair mvPair : memberValuePairs) {
+ if (PROPERTY_ENDPOINT_INTERFACE.equals(mvPair.getMemberName())) {
+ interfacePortTypeQualifiedNameFromAnnotation = (String) mvPair.getValue();
+ break;
+ }
+ }
+ if (interfacePortTypeQualifiedNameFromAnnotation == null) {
+ String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, Texts.get("MissingPropertyXOnAnnotationYToLinkThePortTypeWithTheRespectivePortTypeInterface", PROPERTY_ENDPOINT_INTERFACE, WebService.class.getSimpleName()));
+ registerMissingEndpointCommand(markerSourceId, bundle, sunJaxWsBean, buildJaxWsBean, portType, wsdlDefinition);
+ return false;
+ }
+
+ // validate mismatch among endpoint property in annotation and implemented interfaces
+ boolean match = false;
+ for (IType interfacePortTypeCandidate : interfacePortTypes) {
+ if (interfacePortTypeCandidate.getFullyQualifiedName().equals(interfacePortTypeQualifiedNameFromAnnotation)) {
+ match = true;
+ break;
+ }
+ }
+ if (!match) {
+ String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, Texts.get("TheEndpointInterfaceConfiguredWithinAnnotationXDoesNotExistOrIsNotImplementedByThisEndpoint", WebService.class.getSimpleName()));
+ registerMissingEndpointCommand(markerSourceId, bundle, sunJaxWsBean, buildJaxWsBean, portType, wsdlDefinition);
+ return false;
+ }
+
+ // validate ScoutWebService annotation
+ IAnnotation scoutWebServiceAnnotation = JaxWsSdkUtility.getAnnotation(portType, TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName(), false);
+ if (!TypeUtility.exists(scoutWebServiceAnnotation)) {
+ String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, IMarker.SEVERITY_WARNING,
+ Texts.get("ToConfigureAuthenticationAndSessionHandlingForTheWebserviceAnnotateThePortTypeWithX", TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName()));
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingScoutWebServiceAnnotationCommand(portType));
+ return false;
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("failed to rebuild markers for endpoint", e);
+ }
+ return true;
+ }
+
+ public static boolean rebuildBuildJaxWsMarkers(IFile buildJaxWsFile, BuildJaxWsBean buildJaxWsBean, String alias, WsdlResource wsdlResource, String markerGroupUUID, IScoutBundle bundle, WebserviceEnum webserviceEnum) {
+ // determine resource to store markers
+ IResource markerResource = buildJaxWsFile;
+ if (!JaxWsSdkUtility.exists(buildJaxWsFile)) {
+ markerResource = bundle.getJavaProject().getResource();
+ }
+
+ if (buildJaxWsBean == null) {
+ String markerSourceId = MarkerUtility.createMarker(bundle.getJavaProject().getResource(), MarkerType.MissingBuildJaxWsEntry, markerGroupUUID, Texts.get("MissingBuildEntryInFileX", JaxWsConstants.PATH_BUILD_JAXWS));
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingBuildJaxWsEntryCommand(bundle, alias, webserviceEnum));
+ return false;
+ }
+
+ // validate stub folder
+ IFolder folder = JaxWsSdkUtility.getFolder(bundle, JaxWsConstants.STUB_FOLDER, false);
+ if (folder == null || !folder.exists()) {
+ MarkerUtility.createMarker(markerResource, MarkerType.StubFolder, markerGroupUUID, Texts.get("StubFolderXDoesNotExist", JaxWsConstants.STUB_FOLDER));
+ return false;
+ }
+
+ // validate package
+ String stubPackageName = JaxWsSdkUtility.getBuildProperty(buildJaxWsBean.getPropertiers(), JaxWsConstants.OPTION_PACKAGE);
+ if (stubPackageName != null) {
+ // warning as custom package
+ MarkerUtility.createMarker(markerResource, MarkerType.Package, markerGroupUUID, IMarker.SEVERITY_WARNING, Texts.get("ConventionPackageNameEqualsToTargetNamespaceX"));
+ if (!StringUtility.hasText(stubPackageName)) {
+ MarkerUtility.createMarker(markerResource, MarkerType.Package, markerGroupUUID, Texts.get("PackageNameMustNotBeEmpty"));
+ return false;
+ }
+ // only validate custom package
+ IStatus status = JavaConventionsUtil.validatePackageName(stubPackageName, bundle.getJavaProject());
+ if (status.getSeverity() == IStatus.ERROR) {
+ MarkerUtility.createMarker(markerResource, MarkerType.Package, markerGroupUUID, Texts.get("PackageNameNotValidJavaPackageName", status.getMessage()));
+ return false;
+ }
+ else if (status.getSeverity() == IStatus.WARNING) {
+ MarkerUtility.createMarker(markerResource, MarkerType.Package, markerGroupUUID, IMarker.SEVERITY_WARNING, Texts.get("PackageNameNotValidJavaPackageName", status.getMessage()));
+ }
+ }
+ return true;
+ }
+
+ public static boolean rebuildSunJaxWsMarkers(IFile sunJaxWsFile, SunJaxWsBean sunJaxWsBean, WsdlResource wsdlResource, String markerGroupUUID, IScoutBundle bundle) {
+ // determine resource to store markers
+ IResource markerResource = sunJaxWsFile;
+ if (!JaxWsSdkUtility.exists(sunJaxWsFile)) {
+ markerResource = bundle.getJavaProject().getResource();
+ }
+
+ // validate alias
+ if (!StringUtility.hasText(sunJaxWsBean.getAlias())) {
+ MarkerUtility.createMarker(markerResource, markerGroupUUID, Texts.get("MissingOrEmptyAttributeX", SunJaxWsBean.XML_ALIAS));
+ return false;
+ }
+
+ // validate implementation
+ if (!StringUtility.hasText(sunJaxWsBean.getImplementation())) {
+ MarkerUtility.createMarker(markerResource, markerGroupUUID, Texts.get("MissingOrEmptyAttributeX", SunJaxWsBean.XML_IMPLEMENTATION));
+ return false;
+ }
+
+ if (!validateJaxWsServletRegistartionAndUrlPattern(sunJaxWsBean, markerGroupUUID, bundle)) {
+ return false;
+ }
+
+ Definition wsdlDefinition = wsdlResource.loadWsdlDefinition();
+ if (wsdlDefinition == null) {
+ return true;
+ }
+
+ // validate service
+ Map services = wsdlDefinition.getServices();
+ if (sunJaxWsBean.getServiceQNameSafe() == null) {
+ MarkerUtility.createMarker(markerResource, MarkerType.Service, markerGroupUUID, IMarker.SEVERITY_WARNING, Texts.get("InvalidServiceConfigurationMissingOrInvalidQNameInAttributeX", SunJaxWsBean.XML_SERVICE));
+ return false;
+ }
+ else if (!services.keySet().contains(sunJaxWsBean.getServiceQNameSafe())) {
+ MarkerUtility.createMarker(markerResource, MarkerType.Service, markerGroupUUID, Texts.get("ServiceCouldNotBeFoundInWSDLmodel"));
+
+ if (!sunJaxWsBean.getServiceQNameSafe().getNamespaceURI().endsWith("/")) {
+ MarkerUtility.createMarker(markerResource, MarkerType.Service, markerGroupUUID, Texts.get("ServiceNamespaceMustEndWithASlash"));
+ }
+ return false;
+ }
+
+ // validate port
+ Service service = (Service) services.get(sunJaxWsBean.getServiceQNameSafe());
+ Map ports = service.getPorts();
+ if (ports == null || ports.size() == 0) {
+ MarkerUtility.createMarker(markerResource, MarkerType.Port, markerGroupUUID, IMarker.SEVERITY_WARNING, Texts.get("DiscouragedPortConfigurationNoPortFoundInWSDLFileX", wsdlResource.getFile().getProjectRelativePath().toPortableString()));
+ return false;
+ }
+ else if (sunJaxWsBean.getPortQNameSafe() == null) {
+ MarkerUtility.createMarker(markerResource, MarkerType.Port, markerGroupUUID, IMarker.SEVERITY_WARNING, Texts.get("DiscouragedServiceConfigurationMissingOrIinvalidQNameInAttributeX", SunJaxWsBean.XML_PORT));
+ return false;
+ }
+ else if (!ports.keySet().contains(sunJaxWsBean.getPortQNameSafe().getLocalPart())) {
+ MarkerUtility.createMarker(markerResource, MarkerType.Port, markerGroupUUID, Texts.get("UnknownPortConfiguredInAttributeX", SunJaxWsBean.XML_PORT));
+ return false;
+ }
+ return true;
+ }
+
+ private static boolean validateJaxWsServletRegistartionAndUrlPattern(SunJaxWsBean sunJaxWsBean, String markerGroupUUID, IScoutBundle bundle) {
+ // validate JAX-WS servlet registration alais
+ String servletAlias = ServletRegistrationUtility.getAlias(bundle);
+ if (!StringUtility.hasText(servletAlias)) {
+ String markerSourceId = MarkerUtility.createMarker(bundle.getJavaProject().getResource(), MarkerType.UrlPattern, markerGroupUUID, IMarker.SEVERITY_ERROR, "No or wrong servlet plugin specified in build-jaxws.xml to host JAX-WS servlet registration.\nAdd the element 'servlet-bundle' with the attribute 'name' to build-jaxws.xml and specify the symbolic name of the plugin that contains the JAX-WS servlet registration in its plugin.xml.");
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new JaxWsServletRegistrationCommand(bundle));
+ return false;
+ }
+ else if (!servletAlias.matches("[\\w\\-/]*")) { // check for illegal characters
+ String markerSourceId = MarkerUtility.createMarker(bundle.getJavaProject().getResource(), MarkerType.UrlPattern, markerGroupUUID, IMarker.SEVERITY_ERROR, "Invalid JAX-WS servlet alias '" + servletAlias + "' specified.");
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new JaxWsServletRegistrationCommand(bundle));
+ return false;
+ }
+
+ IResource markerResource = ResourceFactory.getSunJaxWsResource(bundle).getFile();
+ if (!JaxWsSdkUtility.exists(markerResource)) {
+ markerResource = bundle.getJavaProject().getResource();
+ }
+
+ // condition: servlet alias is not null
+ servletAlias = JaxWsSdkUtility.normalizePath(servletAlias, SeparatorType.BothType);
+ String urlPattern = sunJaxWsBean.getUrlPattern();
+ if (urlPattern == null) {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.UrlPattern, markerGroupUUID, Texts.get("MissingOrEmptyAttributeX", SunJaxWsBean.XML_URL_PATTERN));
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new UrlPatternAliasMismatchCommand(bundle, sunJaxWsBean, servletAlias));
+ return false;
+ }
+ else if (JaxWsSdkUtility.normalizePath(urlPattern, SeparatorType.BothType).equals(servletAlias)) {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.UrlPattern, markerGroupUUID, Texts.get("XMustNotBeEmpty", SunJaxWsBean.XML_URL_PATTERN));
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new UrlPatternAliasMismatchCommand(bundle, sunJaxWsBean, servletAlias));
+ return false;
+ }
+ else if (!urlPattern.startsWith(servletAlias)) {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.UrlPattern, markerGroupUUID, IMarker.SEVERITY_ERROR, Texts.get("UrlPatternJaxWsAliasMismatch", servletAlias));
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new UrlPatternAliasMismatchCommand(bundle, sunJaxWsBean, servletAlias));
+ return false;
+ }
+ else if (!urlPattern.matches("[\\w\\-/]*")) { // check for illegal characters
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.UrlPattern, markerGroupUUID, IMarker.SEVERITY_ERROR, "Invalid URL pattern '" + urlPattern + "' specified.");
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new JaxWsServletRegistrationCommand(bundle, sunJaxWsBean));
+ return false;
+ }
+ else if (urlPattern.endsWith("/")) {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.UrlPattern, markerGroupUUID, IMarker.SEVERITY_ERROR, "URL pattern must not end with a '/'.");
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new JaxWsServletRegistrationCommand(bundle, sunJaxWsBean));
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean rebuildBindingFileMarkers(IFile buildJaxWsFile, XmlResource[] bindingFileResources, WsdlResource wsdlResource, String markerGroupUUID, IScoutBundle bundle) {
+ IResource defaultMarkerResource = buildJaxWsFile;
+
+ // binding file
+ for (int index = 0; index < bindingFileResources.length; index++) {
+ XmlResource bindingFileResource = bindingFileResources[index];
+
+ if (bindingFileResource.getFile() == null) {
+ MarkerUtility.createMarker(defaultMarkerResource, MarkerType.BindingFile, JaxWsSdkUtility.toMarkerGroupUUID(markerGroupUUID, index), IMarker.SEVERITY_ERROR, Texts.get("NonExistingBindingFileConfigured"));
+ return false;
+ }
+ else if (!bindingFileResource.getFile().exists()) {
+ String markerSourceId = MarkerUtility.createMarker(defaultMarkerResource, MarkerType.BindingFile, JaxWsSdkUtility.toMarkerGroupUUID(markerGroupUUID, index), IMarker.SEVERITY_ERROR, Texts.get("BindingFileXCouldNotBeFound", bindingFileResource.getFile().getProjectRelativePath().toPortableString()));
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new CorruptBindingFileCommand(bundle, bindingFileResource.getFile(), wsdlResource));
+ return false;
+ }
+ else if (bindingFileResource.loadXml() == null) {
+ String markerSourceId = MarkerUtility.createMarker(bindingFileResource.getFile(), MarkerType.BindingFile, JaxWsSdkUtility.toMarkerGroupUUID(markerGroupUUID, index), IMarker.SEVERITY_ERROR, Texts.get("BindingFileXIsNotAValidXMLFile", bindingFileResource.getFile().getProjectRelativePath().toPortableString()));
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new CorruptBindingFileCommand(bundle, bindingFileResource.getFile(), wsdlResource));
+ return false;
+ }
+ }
+
+ if (JaxWsSdkUtility.containsGlobalBindingSection(bindingFileResources, true)) {
+ String markerSourceId = MarkerUtility.createMarker(defaultMarkerResource, MarkerType.BindingFile, markerGroupUUID, IMarker.SEVERITY_ERROR, Texts.get("MultipleGlobalBindingDefinitionsFoundOnlyOneAllowed"));
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MultipleGlobalBindingsCommand());
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean rebuildWsdlMarkers(WsdlResource wsdlResource, BuildJaxWsBean buildJaxWsBean, SunJaxWsBean sunJaxWsBean, String markerGroupUUID, IScoutBundle bundle) {
+ // determine resource to store markers
+ IResource markerResource = wsdlResource.getFile();
+ if (!JaxWsSdkUtility.exists(wsdlResource.getFile())) {
+ markerResource = bundle.getJavaProject().getResource();
+ }
+
+ IFile wsdlFile = wsdlResource.getFile();
+ if (wsdlFile == null) {
+ MarkerUtility.createMarker(markerResource, MarkerType.Wsdl, markerGroupUUID, Texts.get("NoWSDLFileConfigured"));
+ return false;
+ }
+ boolean provider = (sunJaxWsBean != null);
+ if (!wsdlResource.existsFile()) {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.Wsdl, markerGroupUUID, Texts.get("WSDLFileXCouldNotBeFound", wsdlFile.getProjectRelativePath().toPortableString()));
+ if (provider) {
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingWsdlCommand(bundle, wsdlResource, sunJaxWsBean));
+ }
+ else {
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingWsdlCommand(bundle, wsdlResource, buildJaxWsBean));
+ }
+ return false;
+ }
+
+ Definition wsdlDefinition = wsdlResource.loadWsdlDefinition();
+ if (wsdlDefinition == null) {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.Wsdl, markerGroupUUID, Texts.get("CorruptWSDLFileAtLocationX", wsdlFile.getProjectRelativePath().toPortableString()));
+ if (provider) {
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new CorruptWsdlCommand(bundle, wsdlResource, sunJaxWsBean));
+ }
+ else {
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new CorruptWsdlCommand(bundle, wsdlResource, buildJaxWsBean));
+ }
+ return false;
+ }
+
+ // validate services
+ Map services = wsdlDefinition.getServices();
+ if (services == null || services.size() == 0) {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.Service, markerGroupUUID, IMarker.SEVERITY_ERROR, Texts.get("NoServiceFoundInWSDLFileX", wsdlResource.getFile().getProjectRelativePath().toPortableString()));
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingServiceCommand(wsdlResource.getFile().getName()));
+ return false;
+ }
+
+ // validate WSDL folder > only accept subfolders of root folder
+ IFolder rootFolder;
+ if (provider) {
+ rootFolder = JaxWsSdkUtility.getFolder(bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false);
+ }
+ else {
+ rootFolder = JaxWsSdkUtility.getFolder(bundle, JaxWsConstants.PATH_WSDL_CONSUMER, false);
+ }
+ IFolder folder = JaxWsSdkUtility.getParentFolder(bundle, wsdlFile);
+ IPath wsdlRootPath = rootFolder.getProjectRelativePath();
+ IPath candidatePath = folder.getProjectRelativePath();
+ candidatePath = candidatePath.makeRelativeTo(wsdlRootPath);
+ if (candidatePath.toPortableString().startsWith("..")) {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.WsdlFolder, markerGroupUUID, IMarker.SEVERITY_WARNING, Texts.get("WarningWsdlFolder", rootFolder.getProjectRelativePath().toPortableString()));
+ if (provider) {
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new DiscouragedWsdlFolderCommand(bundle, markerGroupUUID, buildJaxWsBean, sunJaxWsBean));
+ }
+ else {
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new DiscouragedWsdlFolderCommand(bundle, markerGroupUUID, buildJaxWsBean));
+ }
+ }
+ return true;
+ }
+
+ public static boolean rebuildWebserviceClientType(IType webserviceClientType, BuildJaxWsBean buildJaxWsBean, WsdlResource wsdlResource, String markerGroupUUID, IScoutBundle bundle) {
+ if (buildJaxWsBean == null) {
+ return false;
+ }
+
+ if (!TypeUtility.exists(webserviceClientType)) {
+ return false;
+ }
+ // determine resource to store markers
+ IResource markerResource = webserviceClientType.getResource();
+ if (!JaxWsSdkUtility.exists(markerResource)) {
+ markerResource = bundle.getJavaProject().getResource();
+ }
+
+ IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(bundle, buildJaxWsBean, buildJaxWsBean.getWsdl());
+
+ // validate service
+ QName serviceQName = JaxWsSdkUtility.extractServiceQNameFromWsClient(webserviceClientType);
+ if (serviceQName == null) {
+ if (stubJarFile != null && stubJarFile.exists()) {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.Service, markerGroupUUID, Texts.get("InvalidServiceInSuperTypeGenericParameter", javax.xml.ws.Service.class.getName(), WebServiceClient.class.getSimpleName()));
+ InvalidServiceCommand cmd = new InvalidServiceCommand(webserviceClientType, stubJarFile);
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, cmd);
+ }
+ else {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.Service, markerGroupUUID, Texts.get("InvalidServiceInWsdl", javax.xml.ws.Service.class.getName(), WebServiceClient.class.getSimpleName()));
+ registerStubRebuildCommand(markerSourceId, buildJaxWsBean, wsdlResource, bundle);
+ }
+ return false;
+ }
+
+ // validate port type interface type
+ QName portTypeQName = JaxWsSdkUtility.extractPortTypeQNameFromWsClient(webserviceClientType);
+ if (portTypeQName == null) {
+ if (stubJarFile != null && stubJarFile.exists()) {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.PortType, markerGroupUUID, Texts.get("InvalidPortTypeInSuperGenericParameter", WebService.class.getSimpleName()));
+ InvalidPortTypeCommand cmd = new InvalidPortTypeCommand(webserviceClientType, stubJarFile);
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, cmd);
+ }
+ else {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.PortType, markerGroupUUID, Texts.get("InvalidPortTypeInWsdl", WebService.class.getSimpleName()));
+ registerStubRebuildCommand(markerSourceId, buildJaxWsBean, wsdlResource, bundle);
+ }
+ return false;
+ }
+
+ Definition wsdlDefinition = wsdlResource.loadWsdlDefinition();
+ // check that service exists in WSDL
+ if (wsdlDefinition == null) {
+ return true;
+ }
+
+ if (wsdlDefinition.getService(serviceQName) == null) {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.Service, markerGroupUUID, Texts.get("ServiceXNotFoundInWsdl", serviceQName.toString()));
+ if (stubJarFile != null && stubJarFile.exists()) {
+ InvalidServiceCommand cmd = new InvalidServiceCommand(webserviceClientType, stubJarFile);
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, cmd);
+ }
+ return false;
+ }
+
+ if (wsdlDefinition.getPortType(portTypeQName) == null) {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.PortType, markerGroupUUID, Texts.get("PortTypeXNotFoundInWsdl", portTypeQName.toString()));
+ if (stubJarFile != null && stubJarFile.exists()) {
+ InvalidPortTypeCommand cmd = new InvalidPortTypeCommand(webserviceClientType, stubJarFile);
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, cmd);
+ }
+ return false;
+ }
+ return true;
+ }
+
+ public static boolean rebuildStubJarFileMarkers(BuildJaxWsBean buildJaxWsBean, WsdlResource wsdlResource, QName portTypeQName, QName serviceQName, IScoutBundle bundle, String markerGroupUUID) {
+ if (buildJaxWsBean == null || wsdlResource == null || wsdlResource.getFile() == null) {
+ return false;
+ }
+
+ IResource markerResource = bundle.getJavaProject().getResource();
+
+ // validate existence of Jar file
+ IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(bundle, buildJaxWsBean, wsdlResource.getFile().getName());
+ if (!stubJarFile.exists()) {
+ String markerSourceId = MarkerUtility.createMarker(markerResource, MarkerType.StubJar, markerGroupUUID, "Could not find JAR file '" + stubJarFile.getName() + "' with generated stub classes for webservice '" + buildJaxWsBean.getAlias() + "'");
+ registerStubRebuildCommand(markerSourceId, buildJaxWsBean, wsdlResource, bundle);
+ return false;
+ }
+ else {
+ // ensure JAR file to be on project classpath
+ try {
+ PluginModelHelper h = new PluginModelHelper(bundle.getProject());
+ if (!h.Manifest.existsClasspathEntry(stubJarFile.getProjectRelativePath().toPortableString())) {
+ String markerSourceId = MarkerUtility.createMarker(wsdlResource.getFile(), MarkerType.StubJar, markerGroupUUID, Texts.get("JarFileXOfWsYMustBeOnClasspath", stubJarFile.getName(), buildJaxWsBean.getAlias()));
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingClasspathEntryForJarFileCommand(bundle, buildJaxWsBean.getAlias(), stubJarFile));
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+
+ // validate existence of PortType interface type
+ if (portTypeQName != null) {
+ IType portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(portTypeQName, stubJarFile);
+ if (portTypeInterfaceType == null) {
+ String markerSourceId = MarkerUtility.createMarker(wsdlResource.getFile(), MarkerType.StubJar, markerGroupUUID, Texts.get("PortTypeXNotFoundInStubJarY", portTypeQName == null ? "<?>" : portTypeQName.toString(), stubJarFile.getName()));
+ registerStubRebuildCommand(markerSourceId, buildJaxWsBean, wsdlResource, bundle);
+ }
+ }
+
+ // validate existence of service
+ if (serviceQName != null) {
+ IType serviceType = JaxWsSdkUtility.resolveServiceType(serviceQName, stubJarFile);
+ if (serviceType == null) {
+ String markerSourceId = MarkerUtility.createMarker(wsdlResource.getFile(), MarkerType.StubJar, markerGroupUUID, Texts.get("ServiceTypeXNotFoundInStubJarY", serviceQName == null ? "<?>" : serviceQName.toString(), stubJarFile.getName()));
+ registerStubRebuildCommand(markerSourceId, buildJaxWsBean, wsdlResource, bundle);
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public static void rebuildHandlerMarkers(SunJaxWsBean sunJaxWsBean, final IScoutBundle bundle, final String markerGroupUUID) {
+
+ sunJaxWsBean.visitHandlers(new IHandlerVisitor() {
+
+ @Override
+ public boolean visit(ScoutXmlElement xmlHandlerElement, String fullyQualifiedName, int handlerIndex, int handlerCount) {
+ if (fullyQualifiedName == null) {
+ MarkerUtility.createMarker(ResourceFactory.getSunJaxWsResource(bundle).getFile(), MarkerType.HandlerClass, markerGroupUUID, "Missing handler class");
+ return false;
+ }
+ else if (!TypeUtility.existsType(fullyQualifiedName)) {
+ MarkerUtility.createMarker(ResourceFactory.getSunJaxWsResource(bundle).getFile(), MarkerType.HandlerClass, markerGroupUUID, "Configured handler class '" + fullyQualifiedName + "' could not be found.");
+ return false;
+ }
+ return true;
+ }
+ });
+ }
+
+ public static void rebuildCodeFirstPortTypeMarkers(IScoutBundle bundle, IType portType, SunJaxWsBean sunJaxWsBean, String markerGroupUUID) {
+ try {
+ // validate port type
+ if (!TypeUtility.exists(portType)) {
+ String markerSourceId = MarkerUtility.createMarker(ResourceFactory.getSunJaxWsResource(bundle).getFile(), MarkerType.Implementation, markerGroupUUID, Texts.get("InvalidImplementationType"));
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingPortTypeCommand(bundle, markerGroupUUID, sunJaxWsBean, null));
+ return;
+ }
+
+ if (!TypeUtility.exists(portType)) {
+ return;
+ }
+
+ // validate port type interface
+ IAnnotation webServiceAnnotation = JaxWsSdkUtility.getAnnotation(portType, WebService.class.getName(), false);
+ if (webServiceAnnotation == null) {
+ String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, Texts.get("AnnotationXWithPropertyYRequired", WebService.class.getSimpleName(), "endpointInterface"));
+ registerMissingEndpointCodeFirstCommand(portType, markerGroupUUID, markerSourceId);
+ return;
+ }
+ AnnotationProperty property = JaxWsSdkUtility.parseAnnotationTypeValue(portType, webServiceAnnotation, "endpointInterface");
+ IType portTypeInterfaceType = TypeUtility.getType(property.getFullyQualifiedName());
+ if (portTypeInterfaceType == null) {
+ String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, Texts.get("AnnotationXWithPropertyYRequired", WebService.class.getSimpleName(), "endpointInterface"));
+ registerMissingEndpointCodeFirstCommand(portType, markerGroupUUID, markerSourceId);
+ return;
+ }
+ if (!JaxWsSdkUtility.isJdtSubType(portTypeInterfaceType.getFullyQualifiedName(), portType)) {
+ String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, Texts.get("WsImplXMustImplementPortTypeInterface", portType.getElementName()));
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingPortTypeInheritanceCommand(bundle, markerGroupUUID, portType, portTypeInterfaceType, sunJaxWsBean));
+ return;
+ }
+
+ // validate ScoutWebService annotation
+ IAnnotation scoutWebServiceAnnotation = JaxWsSdkUtility.getAnnotation(portType, TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName(), false);
+ if (!TypeUtility.exists(scoutWebServiceAnnotation)) {
+ String markerSourceId = MarkerUtility.createMarker(portType.getResource(), MarkerType.Implementation, markerGroupUUID, IMarker.SEVERITY_WARNING,
+ Texts.get("ToConfigureAuthenticationAndSessionHandlingForTheWebserviceAnnotateThePortTypeWithX", TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName()));
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, new MissingScoutWebServiceAnnotationCommand(portType));
+ return;
+ }
+
+ if (!validateJaxWsServletRegistartionAndUrlPattern(sunJaxWsBean, markerGroupUUID, bundle)) {
+ return;
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+
+ private static void registerStubRebuildCommand(String markerSourceId, BuildJaxWsBean buildJaxWsBean, WsdlResource wsdlResource, IScoutBundle bundle) {
+ if (wsdlResource.getFile() != null) {
+ StubRebuildCommand cmd = new StubRebuildCommand(bundle);
+ cmd.setAlias(buildJaxWsBean.getAlias());
+ cmd.setProperties(buildJaxWsBean.getPropertiers());
+ cmd.setWsdlResource(wsdlResource);
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, cmd);
+ }
+ }
+
+ private static void registerMissingEndpointCommand(String markerSourceId, IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, BuildJaxWsBean buildJaxWsBean, IType implType, Definition wsdlDefinition) {
+ if (sunJaxWsBean == null || wsdlDefinition == null) {
+ return;
+ }
+ IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(bundle, buildJaxWsBean, sunJaxWsBean.getWsdl());
+ if (stubJarFile == null) {
+ return;
+ }
+ MissingEndpointPropertyCommand cmd = new MissingEndpointPropertyCommand(implType);
+ PortType wsdlPortType = JaxWsSdkUtility.getPortType(wsdlDefinition, sunJaxWsBean.getServiceQNameSafe(), sunJaxWsBean.getPort());
+ if (wsdlPortType != null) {
+ cmd.setPortTypeQName(wsdlPortType.getQName());
+ }
+ cmd.setStubJarFile(stubJarFile);
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, cmd);
+ }
+
+ private static void registerMissingEndpointCodeFirstCommand(IType portType, String markerGroupUUID, String markerSourceId) {
+ MissingEndpointCodeFirstCommand cmd = new MissingEndpointCodeFirstCommand(portType);
+ JaxWsSdk.getDefault().addMarkerCommand(markerSourceId, cmd);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/MarkerUtility.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/MarkerUtility.java
index ff574f73d..c98246083 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/MarkerUtility.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/MarkerUtility.java
@@ -1,156 +1,156 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker;
-
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.IMarkerCommand;
-
-public class MarkerUtility {
-
- public static int getQuality(IPage page, IScoutBundle bundle, String groupUUID) {
- int quality = IMarker.SEVERITY_INFO;
-
- for (IMarker marker : getMarkers(bundle, MarkerType.JaxWs, groupUUID)) {
- quality = Math.max(quality, marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO));
- if (quality == IMarker.SEVERITY_ERROR) {
- return quality;
- }
- }
-
- if (page.hasChildren()) {
- IPage[] a = page.getChildArray();
- for (int i = 0; i < a.length; i++) {
- quality = Math.max(quality, a[i].getQuality());
- if (quality == IMarker.SEVERITY_ERROR) {
- break;
- }
- }
- return quality;
- }
- else {
- return quality;
- }
- }
-
- public static void clearMarkers(IScoutBundle bundle, String groupUUID) {
- JaxWsSdk.getDefault().removeMarkerCommands(groupUUID);
- try {
- for (IMarker marker : getMarkers(bundle, MarkerType.JaxWs, groupUUID)) {
- marker.delete();
- }
- }
- catch (CoreException e) {
- JaxWsSdk.logError("Could not delete markers", e);
- }
- }
-
- public static void deleteMarkers(IScoutBundle bundle, MarkerType markerType, String groupUUID) {
- try {
- for (IMarker marker : getMarkers(bundle, markerType, groupUUID)) {
- marker.delete();
- String markerSourceId = marker.getAttribute(IMarker.SOURCE_ID, null);
- if (markerSourceId != null) {
- JaxWsSdk.getDefault().removeMarkerCommand(markerSourceId);
- }
- }
- }
- catch (CoreException e) {
- JaxWsSdk.logError("Could not delete markers", e);
- }
- }
-
- public static String createMarker(IResource resource, String groupUUID, String message) {
- return createMarker(resource, MarkerType.JaxWs, groupUUID, message);
- }
-
- public static String createMarker(IResource resource, MarkerType markerType, String groupUUID, String message) {
- return createMarker(resource, markerType, groupUUID, IMarker.SEVERITY_ERROR, message);
- }
-
- public static String createMarker(IResource resource, MarkerType markerType, String groupUUID, int severity, String message) {
- if (resource != null && resource.exists()) {
- try {
- IMarker marker = resource.createMarker(markerType.getId());
- marker.setAttribute(IMarker.MESSAGE, message);
- marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
- marker.setAttribute(IMarker.SEVERITY, severity);
- marker.setAttribute(IMarker.TRANSIENT, true);
- String sourceId = StringUtility.join(" ", groupUUID, UUID.randomUUID().toString());
- marker.setAttribute(IMarker.SOURCE_ID, sourceId);
- return sourceId;
- }
- catch (Exception e) {
- JaxWsSdk.logError("could not create marker", e);
- }
- }
- return null;
- }
-
- public static boolean containsMarker(IScoutBundle bundle, MarkerType markerType, String groupUUID, int minimumSeverity) {
- IMarker[] markers = getMarkers(bundle, markerType, groupUUID);
- for (IMarker marker : markers) {
- if (marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO) >= minimumSeverity) {
- return true;
- }
- }
- return false;
- }
-
- public static IMarker[] getMarkers(IScoutBundle bundle, MarkerType markerType, String groupUUID) {
- Set<IMarker> markers = new HashSet<IMarker>();
-
- try {
- IMarker[] candidates = bundle.getJavaProject().getResource().findMarkers(markerType.getId(), true, IResource.DEPTH_INFINITE);
- for (IMarker candidate : candidates) {
- if (groupUUID == null) {
- markers.add(candidate);
- }
- else if (candidate.getAttribute(IMarker.SOURCE_ID, "").startsWith(groupUUID)) {
- markers.add(candidate);
- }
- }
- }
- catch (Exception e) {
- JaxWsSdk.logError("Could not retrieve markers", e);
- }
- return markers.toArray(new IMarker[markers.size()]);
- }
-
- public static IMarkerCommand[] getMarkerCommands(String markerGroupUUID, IScoutBundle bundle) {
- List<IMarkerCommand> commands = new LinkedList<IMarkerCommand>();
- IMarker[] markers = MarkerUtility.getMarkers(bundle, MarkerType.JaxWs, markerGroupUUID);
- for (IMarker marker : markers) {
- String sourceId = marker.getAttribute(IMarker.SOURCE_ID, null);
- if (sourceId == null) {
- continue;
- }
- IMarkerCommand markerCommand = JaxWsSdk.getDefault().getMarkerCommand(sourceId);
- if (markerCommand != null) {
- markerCommand.setMarker(marker);
- commands.add(markerCommand);
- }
- }
- return commands.toArray(new IMarkerCommand[commands.size()]);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker;
+
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.IMarkerCommand;
+
+public class MarkerUtility {
+
+ public static int getQuality(IPage page, IScoutBundle bundle, String groupUUID) {
+ int quality = IMarker.SEVERITY_INFO;
+
+ for (IMarker marker : getMarkers(bundle, MarkerType.JaxWs, groupUUID)) {
+ quality = Math.max(quality, marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO));
+ if (quality == IMarker.SEVERITY_ERROR) {
+ return quality;
+ }
+ }
+
+ if (page.hasChildren()) {
+ IPage[] a = page.getChildArray();
+ for (int i = 0; i < a.length; i++) {
+ quality = Math.max(quality, a[i].getQuality());
+ if (quality == IMarker.SEVERITY_ERROR) {
+ break;
+ }
+ }
+ return quality;
+ }
+ else {
+ return quality;
+ }
+ }
+
+ public static void clearMarkers(IScoutBundle bundle, String groupUUID) {
+ JaxWsSdk.getDefault().removeMarkerCommands(groupUUID);
+ try {
+ for (IMarker marker : getMarkers(bundle, MarkerType.JaxWs, groupUUID)) {
+ marker.delete();
+ }
+ }
+ catch (CoreException e) {
+ JaxWsSdk.logError("Could not delete markers", e);
+ }
+ }
+
+ public static void deleteMarkers(IScoutBundle bundle, MarkerType markerType, String groupUUID) {
+ try {
+ for (IMarker marker : getMarkers(bundle, markerType, groupUUID)) {
+ marker.delete();
+ String markerSourceId = marker.getAttribute(IMarker.SOURCE_ID, null);
+ if (markerSourceId != null) {
+ JaxWsSdk.getDefault().removeMarkerCommand(markerSourceId);
+ }
+ }
+ }
+ catch (CoreException e) {
+ JaxWsSdk.logError("Could not delete markers", e);
+ }
+ }
+
+ public static String createMarker(IResource resource, String groupUUID, String message) {
+ return createMarker(resource, MarkerType.JaxWs, groupUUID, message);
+ }
+
+ public static String createMarker(IResource resource, MarkerType markerType, String groupUUID, String message) {
+ return createMarker(resource, markerType, groupUUID, IMarker.SEVERITY_ERROR, message);
+ }
+
+ public static String createMarker(IResource resource, MarkerType markerType, String groupUUID, int severity, String message) {
+ if (resource != null && resource.exists()) {
+ try {
+ IMarker marker = resource.createMarker(markerType.getId());
+ marker.setAttribute(IMarker.MESSAGE, message);
+ marker.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
+ marker.setAttribute(IMarker.SEVERITY, severity);
+ marker.setAttribute(IMarker.TRANSIENT, true);
+ String sourceId = StringUtility.join(" ", groupUUID, UUID.randomUUID().toString());
+ marker.setAttribute(IMarker.SOURCE_ID, sourceId);
+ return sourceId;
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("could not create marker", e);
+ }
+ }
+ return null;
+ }
+
+ public static boolean containsMarker(IScoutBundle bundle, MarkerType markerType, String groupUUID, int minimumSeverity) {
+ IMarker[] markers = getMarkers(bundle, markerType, groupUUID);
+ for (IMarker marker : markers) {
+ if (marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO) >= minimumSeverity) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static IMarker[] getMarkers(IScoutBundle bundle, MarkerType markerType, String groupUUID) {
+ Set<IMarker> markers = new HashSet<IMarker>();
+
+ try {
+ IMarker[] candidates = bundle.getJavaProject().getResource().findMarkers(markerType.getId(), true, IResource.DEPTH_INFINITE);
+ for (IMarker candidate : candidates) {
+ if (groupUUID == null) {
+ markers.add(candidate);
+ }
+ else if (candidate.getAttribute(IMarker.SOURCE_ID, "").startsWith(groupUUID)) {
+ markers.add(candidate);
+ }
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("Could not retrieve markers", e);
+ }
+ return markers.toArray(new IMarker[markers.size()]);
+ }
+
+ public static IMarkerCommand[] getMarkerCommands(String markerGroupUUID, IScoutBundle bundle) {
+ List<IMarkerCommand> commands = new LinkedList<IMarkerCommand>();
+ IMarker[] markers = MarkerUtility.getMarkers(bundle, MarkerType.JaxWs, markerGroupUUID);
+ for (IMarker marker : markers) {
+ String sourceId = marker.getAttribute(IMarker.SOURCE_ID, null);
+ if (sourceId == null) {
+ continue;
+ }
+ IMarkerCommand markerCommand = JaxWsSdk.getDefault().getMarkerCommand(sourceId);
+ if (markerCommand != null) {
+ markerCommand.setMarker(marker);
+ commands.add(markerCommand);
+ }
+ }
+ return commands.toArray(new IMarkerCommand[commands.size()]);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/AbstractExecutableMarkerCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/AbstractExecutableMarkerCommand.java
index 5c9045456..578a683b3 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/AbstractExecutableMarkerCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/AbstractExecutableMarkerCommand.java
@@ -1,78 +1,78 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-
-public abstract class AbstractExecutableMarkerCommand implements IMarkerCommand {
-
- private boolean m_doExecute;
- private String m_problemName;
- private IMarker m_marker;
- private String m_solutionDescription;
-
- public AbstractExecutableMarkerCommand(String problemName, String solutionDescription) {
- m_problemName = problemName;
- m_solutionDescription = solutionDescription;
- }
-
- public AbstractExecutableMarkerCommand(String problemName) {
- m_problemName = problemName;
- }
-
- @Override
- public String getProblemName() {
- return m_problemName;
- }
-
- @Override
- public String getSolutionDescription() {
- return m_solutionDescription;
- }
-
- public void setSolutionDescription(String solutionDescription) {
- m_solutionDescription = solutionDescription;
- }
-
- @Override
- public boolean isDoExecute() {
- return m_doExecute;
- }
-
- @Override
- public void setDoExecute(boolean doExecute) {
- this.m_doExecute = doExecute;
- }
-
- @Override
- public boolean isExecutable() {
- return true;
- }
-
- @Override
- public IMarker getMarker() {
- return m_marker;
- }
-
- @Override
- public void setMarker(IMarker marker) {
- m_marker = marker;
- }
-
- @Override
- public boolean prepareForUi() throws CoreException {
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+
+public abstract class AbstractExecutableMarkerCommand implements IMarkerCommand {
+
+ private boolean m_doExecute;
+ private String m_problemName;
+ private IMarker m_marker;
+ private String m_solutionDescription;
+
+ public AbstractExecutableMarkerCommand(String problemName, String solutionDescription) {
+ m_problemName = problemName;
+ m_solutionDescription = solutionDescription;
+ }
+
+ public AbstractExecutableMarkerCommand(String problemName) {
+ m_problemName = problemName;
+ }
+
+ @Override
+ public String getProblemName() {
+ return m_problemName;
+ }
+
+ @Override
+ public String getSolutionDescription() {
+ return m_solutionDescription;
+ }
+
+ public void setSolutionDescription(String solutionDescription) {
+ m_solutionDescription = solutionDescription;
+ }
+
+ @Override
+ public boolean isDoExecute() {
+ return m_doExecute;
+ }
+
+ @Override
+ public void setDoExecute(boolean doExecute) {
+ this.m_doExecute = doExecute;
+ }
+
+ @Override
+ public boolean isExecutable() {
+ return true;
+ }
+
+ @Override
+ public IMarker getMarker() {
+ return m_marker;
+ }
+
+ @Override
+ public void setMarker(IMarker marker) {
+ m_marker = marker;
+ }
+
+ @Override
+ public boolean prepareForUi() throws CoreException {
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/AbstractNonExecutableMarkerCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/AbstractNonExecutableMarkerCommand.java
index 3541c2ed4..de99715bb 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/AbstractNonExecutableMarkerCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/AbstractNonExecutableMarkerCommand.java
@@ -1,83 +1,83 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-
-public abstract class AbstractNonExecutableMarkerCommand implements IMarkerCommand {
-
- private String m_problemName;
- private IMarker m_marker;
- private String m_solutionDescription;
-
- public AbstractNonExecutableMarkerCommand(String problemName, String solutionDescription) {
- m_problemName = problemName;
- m_solutionDescription = solutionDescription;
- }
-
- public AbstractNonExecutableMarkerCommand(String problemName) {
- m_problemName = problemName;
- }
-
- @Override
- public final boolean isDoExecute() {
- return false;
- }
-
- @Override
- public final void setDoExecute(boolean doExecute) {
- }
-
- @Override
- public final boolean isExecutable() {
- return false;
- }
-
- @Override
- public final void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- // nop
- }
-
- @Override
- public String getProblemName() {
- return m_problemName;
- }
-
- @Override
- public String getSolutionDescription() {
- return m_solutionDescription;
- }
-
- public void setSolutionDescription(String solutionDescription) {
- m_solutionDescription = solutionDescription;
- }
-
- @Override
- public IMarker getMarker() {
- return m_marker;
- }
-
- @Override
- public void setMarker(IMarker marker) {
- m_marker = marker;
- }
-
- @Override
- public final boolean prepareForUi() throws CoreException {
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+
+public abstract class AbstractNonExecutableMarkerCommand implements IMarkerCommand {
+
+ private String m_problemName;
+ private IMarker m_marker;
+ private String m_solutionDescription;
+
+ public AbstractNonExecutableMarkerCommand(String problemName, String solutionDescription) {
+ m_problemName = problemName;
+ m_solutionDescription = solutionDescription;
+ }
+
+ public AbstractNonExecutableMarkerCommand(String problemName) {
+ m_problemName = problemName;
+ }
+
+ @Override
+ public final boolean isDoExecute() {
+ return false;
+ }
+
+ @Override
+ public final void setDoExecute(boolean doExecute) {
+ }
+
+ @Override
+ public final boolean isExecutable() {
+ return false;
+ }
+
+ @Override
+ public final void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ // nop
+ }
+
+ @Override
+ public String getProblemName() {
+ return m_problemName;
+ }
+
+ @Override
+ public String getSolutionDescription() {
+ return m_solutionDescription;
+ }
+
+ public void setSolutionDescription(String solutionDescription) {
+ m_solutionDescription = solutionDescription;
+ }
+
+ @Override
+ public IMarker getMarker() {
+ return m_marker;
+ }
+
+ @Override
+ public void setMarker(IMarker marker) {
+ m_marker = marker;
+ }
+
+ @Override
+ public final boolean prepareForUi() throws CoreException {
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptBindingFileCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptBindingFileCommand.java
index 0b5b5efb4..e358461df 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptBindingFileCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptBindingFileCommand.java
@@ -1,81 +1,81 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.operation.BindingFileCreateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper;
-import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper.SchemaCandidate;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
-
-public class CorruptBindingFileCommand extends AbstractExecutableMarkerCommand {
-
- private IScoutBundle m_bundle;
- private IFile m_bindingFile;
- private WsdlResource m_wsdlResource;
-
- private SchemaCandidate m_schemaCandidate;
-
- public CorruptBindingFileCommand(IScoutBundle bundle, IFile bindingFile, WsdlResource wsdlResource) {
- super("Corrupt or missing binding file");
- m_bundle = bundle;
- m_bindingFile = bindingFile;
- m_wsdlResource = wsdlResource;
- setSolutionDescription("By using this task, a new binding file '" + m_bindingFile.getProjectRelativePath() + "' is created.");
- }
-
- @Override
- public boolean prepareForUi() throws CoreException {
- try {
- m_schemaCandidate = GlobalBindingRegistrationHelper.popupForSchema(m_bundle, m_wsdlResource.getFile());
- }
- catch (CoreException e) {
- if (e.getStatus() != null && e.getStatus().getCode() == Status.CANCEL_STATUS.getCode()) {
- return false;
- }
- }
- return true;
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- IPath bindingFilePath = m_bindingFile.getProjectRelativePath();
- IFolder wsdlFolder = JaxWsSdkUtility.getParentFolder(m_bundle, m_wsdlResource.getFile());
-
- BindingFileCreateOperation op = new BindingFileCreateOperation();
- op.setBundle(m_bundle);
- op.setProjectRelativeFilePath(bindingFilePath);
- op.setWsdlDestinationFolder(wsdlFolder);
-
- if (m_schemaCandidate != null) {
- WsdlArtefact wsdlArtefact = m_schemaCandidate.getWsdlArtefact();
- if (wsdlArtefact.getInlineSchemas().length > 1) {
- op.setSchemaTargetNamespace(SchemaUtility.getSchemaTargetNamespace(m_schemaCandidate.getSchema()));
- }
- if (m_schemaCandidate.getWsdlArtefact().getTypeEnum() == TypeEnum.ReferencedWsdl) {
- IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, m_schemaCandidate.getWsdlArtefact().getFile());
- op.setWsdlLocation(referencedWsdlFile);
- }
- }
- op.run(monitor, workingCopyManager);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.operation.BindingFileCreateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper;
+import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper.SchemaCandidate;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
+
+public class CorruptBindingFileCommand extends AbstractExecutableMarkerCommand {
+
+ private IScoutBundle m_bundle;
+ private IFile m_bindingFile;
+ private WsdlResource m_wsdlResource;
+
+ private SchemaCandidate m_schemaCandidate;
+
+ public CorruptBindingFileCommand(IScoutBundle bundle, IFile bindingFile, WsdlResource wsdlResource) {
+ super("Corrupt or missing binding file");
+ m_bundle = bundle;
+ m_bindingFile = bindingFile;
+ m_wsdlResource = wsdlResource;
+ setSolutionDescription("By using this task, a new binding file '" + m_bindingFile.getProjectRelativePath() + "' is created.");
+ }
+
+ @Override
+ public boolean prepareForUi() throws CoreException {
+ try {
+ m_schemaCandidate = GlobalBindingRegistrationHelper.popupForSchema(m_bundle, m_wsdlResource.getFile());
+ }
+ catch (CoreException e) {
+ if (e.getStatus() != null && e.getStatus().getCode() == Status.CANCEL_STATUS.getCode()) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ IPath bindingFilePath = m_bindingFile.getProjectRelativePath();
+ IFolder wsdlFolder = JaxWsSdkUtility.getParentFolder(m_bundle, m_wsdlResource.getFile());
+
+ BindingFileCreateOperation op = new BindingFileCreateOperation();
+ op.setBundle(m_bundle);
+ op.setProjectRelativeFilePath(bindingFilePath);
+ op.setWsdlDestinationFolder(wsdlFolder);
+
+ if (m_schemaCandidate != null) {
+ WsdlArtefact wsdlArtefact = m_schemaCandidate.getWsdlArtefact();
+ if (wsdlArtefact.getInlineSchemas().length > 1) {
+ op.setSchemaTargetNamespace(SchemaUtility.getSchemaTargetNamespace(m_schemaCandidate.getSchema()));
+ }
+ if (m_schemaCandidate.getWsdlArtefact().getTypeEnum() == TypeEnum.ReferencedWsdl) {
+ IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, m_schemaCandidate.getWsdlArtefact().getFile());
+ op.setWsdlLocation(referencedWsdlFile);
+ }
+ }
+ op.run(monitor, workingCopyManager);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptBuildJaxWsXmlFileCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptBuildJaxWsXmlFileCommand.java
index 1fd0f479b..8ddda0e91 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptBuildJaxWsXmlFileCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptBuildJaxWsXmlFileCommand.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.operation.BuildJaxWsFileCreateOperation;
-
-public class CorruptBuildJaxWsXmlFileCommand extends AbstractExecutableMarkerCommand {
-
- private IScoutBundle m_bundle;
-
- public CorruptBuildJaxWsXmlFileCommand(IScoutBundle bundle) {
- super(new Path(JaxWsConstants.PATH_BUILD_JAXWS).lastSegment());
- m_bundle = bundle;
- setSolutionDescription("Create a new '" + JaxWsConstants.PATH_BUILD_JAXWS + "' file");
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- BuildJaxWsFileCreateOperation op = new BuildJaxWsFileCreateOperation(m_bundle);
- op.run(monitor, workingCopyManager);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.operation.BuildJaxWsFileCreateOperation;
+
+public class CorruptBuildJaxWsXmlFileCommand extends AbstractExecutableMarkerCommand {
+
+ private IScoutBundle m_bundle;
+
+ public CorruptBuildJaxWsXmlFileCommand(IScoutBundle bundle) {
+ super(new Path(JaxWsConstants.PATH_BUILD_JAXWS).lastSegment());
+ m_bundle = bundle;
+ setSolutionDescription("Create a new '" + JaxWsConstants.PATH_BUILD_JAXWS + "' file");
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ BuildJaxWsFileCreateOperation op = new BuildJaxWsFileCreateOperation(m_bundle);
+ op.run(monitor, workingCopyManager);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptSunJaxWsXmlFileCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptSunJaxWsXmlFileCommand.java
index f1a10531f..52653f28b 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptSunJaxWsXmlFileCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptSunJaxWsXmlFileCommand.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.operation.SunJaxWsFileCreateOperation;
-
-public class CorruptSunJaxWsXmlFileCommand extends AbstractExecutableMarkerCommand {
-
- private IScoutBundle m_bundle;
-
- public CorruptSunJaxWsXmlFileCommand(IScoutBundle bundle) {
- super(new Path(JaxWsConstants.PATH_SUN_JAXWS).lastSegment());
- m_bundle = bundle;
- setSolutionDescription("Create a new '" + JaxWsConstants.PATH_SUN_JAXWS + "' file");
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- SunJaxWsFileCreateOperation op = new SunJaxWsFileCreateOperation(m_bundle);
- op.run(monitor, workingCopyManager);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.operation.SunJaxWsFileCreateOperation;
+
+public class CorruptSunJaxWsXmlFileCommand extends AbstractExecutableMarkerCommand {
+
+ private IScoutBundle m_bundle;
+
+ public CorruptSunJaxWsXmlFileCommand(IScoutBundle bundle) {
+ super(new Path(JaxWsConstants.PATH_SUN_JAXWS).lastSegment());
+ m_bundle = bundle;
+ setSolutionDescription("Create a new '" + JaxWsConstants.PATH_SUN_JAXWS + "' file");
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ SunJaxWsFileCreateOperation op = new SunJaxWsFileCreateOperation(m_bundle);
+ op.run(monitor, workingCopyManager);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptWsdlCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptWsdlCommand.java
index af695bec3..beb2520de 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptWsdlCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/CorruptWsdlCommand.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsdlNewWizard;
-
-public class CorruptWsdlCommand extends AbstractExecutableMarkerCommand {
-
- private IScoutBundle m_bundle;
- /**
- * User for WS provider
- */
- private SunJaxWsBean m_sunJaxWsBean;
- /**
- * User for WS consumer
- */
- private BuildJaxWsBean m_buildJaxWsBean;
- private WsdlResource m_wsdlResource;
-
- private WsdlNewWizard m_wizard;
-
- public CorruptWsdlCommand(IScoutBundle bundle, WsdlResource wsdlResource, SunJaxWsBean sunJaxWsBean) {
- super("Corrupt WSDL file '" + wsdlResource.getFile().getName() + "'");
- setSolutionDescription("Failed to parse WSDL resource. Please ensure the WSDL file to be valid.\nBy using this task, the existing WSDL file is replaced by a new one.");
- m_bundle = bundle;
- m_sunJaxWsBean = sunJaxWsBean;
- m_wsdlResource = wsdlResource;
- }
-
- public CorruptWsdlCommand(IScoutBundle bundle, WsdlResource wsdlResource, BuildJaxWsBean buildJaxWsBean) {
- super("Corrupt WSDL file '" + wsdlResource.getFile().getName() + "'");
- setSolutionDescription("Failed to parse WSDL resource. Please ensure the WSDL file to be valid.\nBy using this task, the existing WSDL file is replaced by a new one.");
- m_bundle = bundle;
- m_buildJaxWsBean = buildJaxWsBean;
- m_wsdlResource = wsdlResource;
- }
-
- @Override
- public boolean prepareForUi() throws CoreException {
- if (m_sunJaxWsBean != null) {
- m_wizard = new WsdlNewWizard(m_bundle, m_sunJaxWsBean, m_wsdlResource);
- }
- else {
- m_wizard = new WsdlNewWizard(m_bundle, m_buildJaxWsBean, m_wsdlResource);
- }
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(m_wizard);
- // TODO DWI remove hardcoded sizes
- wizardDialog.setPageSize(650, 410);
- return wizardDialog.open() == Window.OK;
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- // operation executed within wizard
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsdlNewWizard;
+
+public class CorruptWsdlCommand extends AbstractExecutableMarkerCommand {
+
+ private IScoutBundle m_bundle;
+ /**
+ * User for WS provider
+ */
+ private SunJaxWsBean m_sunJaxWsBean;
+ /**
+ * User for WS consumer
+ */
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private WsdlResource m_wsdlResource;
+
+ private WsdlNewWizard m_wizard;
+
+ public CorruptWsdlCommand(IScoutBundle bundle, WsdlResource wsdlResource, SunJaxWsBean sunJaxWsBean) {
+ super("Corrupt WSDL file '" + wsdlResource.getFile().getName() + "'");
+ setSolutionDescription("Failed to parse WSDL resource. Please ensure the WSDL file to be valid.\nBy using this task, the existing WSDL file is replaced by a new one.");
+ m_bundle = bundle;
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_wsdlResource = wsdlResource;
+ }
+
+ public CorruptWsdlCommand(IScoutBundle bundle, WsdlResource wsdlResource, BuildJaxWsBean buildJaxWsBean) {
+ super("Corrupt WSDL file '" + wsdlResource.getFile().getName() + "'");
+ setSolutionDescription("Failed to parse WSDL resource. Please ensure the WSDL file to be valid.\nBy using this task, the existing WSDL file is replaced by a new one.");
+ m_bundle = bundle;
+ m_buildJaxWsBean = buildJaxWsBean;
+ m_wsdlResource = wsdlResource;
+ }
+
+ @Override
+ public boolean prepareForUi() throws CoreException {
+ if (m_sunJaxWsBean != null) {
+ m_wizard = new WsdlNewWizard(m_bundle, m_sunJaxWsBean, m_wsdlResource);
+ }
+ else {
+ m_wizard = new WsdlNewWizard(m_bundle, m_buildJaxWsBean, m_wsdlResource);
+ }
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(m_wizard);
+ // TODO DWI remove hardcoded sizes
+ wizardDialog.setPageSize(650, 410);
+ return wizardDialog.open() == Window.OK;
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ // operation executed within wizard
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/DiscouragedWsdlFolderCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/DiscouragedWsdlFolderCommand.java
index 91dbbbf41..864402b2a 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/DiscouragedWsdlFolderCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/DiscouragedWsdlFolderCommand.java
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsFileMoveWizard;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-
-public class DiscouragedWsdlFolderCommand extends AbstractExecutableMarkerCommand {
-
- private IScoutBundle m_bundle;
- private SunJaxWsBean m_sunJaxWsBean;
- private BuildJaxWsBean m_buildJaxWsBean;
- private IFolder m_newFolder;
- private String m_markerGroupUUID;
- private WebserviceEnum m_webserviceEnum;
-
- /**
- * Used for webservice providers
- *
- * @param bundle
- * @param markerGroupUUID
- * @param buildJaxWsBean
- * @param sunJaxWsBean
- */
- public DiscouragedWsdlFolderCommand(IScoutBundle bundle, String markerGroupUUID, BuildJaxWsBean buildJaxWsBean, SunJaxWsBean sunJaxWsBean) {
- super("Discouraged WSDL folder");
- m_bundle = bundle;
- m_newFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false);
- m_markerGroupUUID = markerGroupUUID;
- m_buildJaxWsBean = buildJaxWsBean;
- m_sunJaxWsBean = sunJaxWsBean;
- m_webserviceEnum = WebserviceEnum.Provider;
- setSolutionDescription(Texts.get("DescriptionTaskMoveFiles", m_newFolder.getProjectRelativePath().toPortableString()));
- }
-
- /**
- * Used for webservice consumers
- *
- * @param bundle
- * @param markerGroupUUID
- * @param buildJaxWsBean
- */
- public DiscouragedWsdlFolderCommand(IScoutBundle bundle, String markerGroupUUID, BuildJaxWsBean buildJaxWsBean) {
- super("Discouraged WSDL folder");
- m_bundle = bundle;
- m_newFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_CONSUMER, false);
- m_markerGroupUUID = markerGroupUUID;
- m_buildJaxWsBean = buildJaxWsBean;
- m_webserviceEnum = WebserviceEnum.Consumer;
- setSolutionDescription("By using this task, a new WSDL file is created.");
- }
-
- @Override
- public boolean prepareForUi() throws CoreException {
- WsFileMoveWizard wizard = new WsFileMoveWizard();
- wizard.setBundle(m_bundle);
- wizard.setWebserviceEnum(m_webserviceEnum);
- wizard.setBuildJaxWsBean(m_buildJaxWsBean);
- wizard.setSunJaxWsBean(m_sunJaxWsBean);
- wizard.setDestination(m_newFolder);
- wizard.setMarkerGroupUUID(m_markerGroupUUID);
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- return (wizardDialog.open() == SWT.OK);
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- // operation executed within wizard
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsFileMoveWizard;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+
+public class DiscouragedWsdlFolderCommand extends AbstractExecutableMarkerCommand {
+
+ private IScoutBundle m_bundle;
+ private SunJaxWsBean m_sunJaxWsBean;
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private IFolder m_newFolder;
+ private String m_markerGroupUUID;
+ private WebserviceEnum m_webserviceEnum;
+
+ /**
+ * Used for webservice providers
+ *
+ * @param bundle
+ * @param markerGroupUUID
+ * @param buildJaxWsBean
+ * @param sunJaxWsBean
+ */
+ public DiscouragedWsdlFolderCommand(IScoutBundle bundle, String markerGroupUUID, BuildJaxWsBean buildJaxWsBean, SunJaxWsBean sunJaxWsBean) {
+ super("Discouraged WSDL folder");
+ m_bundle = bundle;
+ m_newFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false);
+ m_markerGroupUUID = markerGroupUUID;
+ m_buildJaxWsBean = buildJaxWsBean;
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_webserviceEnum = WebserviceEnum.Provider;
+ setSolutionDescription(Texts.get("DescriptionTaskMoveFiles", m_newFolder.getProjectRelativePath().toPortableString()));
+ }
+
+ /**
+ * Used for webservice consumers
+ *
+ * @param bundle
+ * @param markerGroupUUID
+ * @param buildJaxWsBean
+ */
+ public DiscouragedWsdlFolderCommand(IScoutBundle bundle, String markerGroupUUID, BuildJaxWsBean buildJaxWsBean) {
+ super("Discouraged WSDL folder");
+ m_bundle = bundle;
+ m_newFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_CONSUMER, false);
+ m_markerGroupUUID = markerGroupUUID;
+ m_buildJaxWsBean = buildJaxWsBean;
+ m_webserviceEnum = WebserviceEnum.Consumer;
+ setSolutionDescription("By using this task, a new WSDL file is created.");
+ }
+
+ @Override
+ public boolean prepareForUi() throws CoreException {
+ WsFileMoveWizard wizard = new WsFileMoveWizard();
+ wizard.setBundle(m_bundle);
+ wizard.setWebserviceEnum(m_webserviceEnum);
+ wizard.setBuildJaxWsBean(m_buildJaxWsBean);
+ wizard.setSunJaxWsBean(m_sunJaxWsBean);
+ wizard.setDestination(m_newFolder);
+ wizard.setMarkerGroupUUID(m_markerGroupUUID);
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ return (wizardDialog.open() == SWT.OK);
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ // operation executed within wizard
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/ErrorProneWsdlLocatorCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/ErrorProneWsdlLocatorCommand.java
index 6615fe5e7..3bb26d5f3 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/ErrorProneWsdlLocatorCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/ErrorProneWsdlLocatorCommand.java
@@ -1,219 +1,219 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.StringReader;
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IInitializer;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.util.ScoutUtility;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-import org.eclipse.scout.sdk.util.type.ITypeFilter;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.TypeSelectionDialog;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceConsumerNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.text.edits.ReplaceEdit;
-import org.osgi.framework.BundleActivator;
-
-/**
- * Not used in this release
- */
-public class ErrorProneWsdlLocatorCommand extends AbstractExecutableMarkerCommand {
-
- private IScoutBundle m_bundle;
- private IInitializer m_initializer;
- private String m_projectRelativeWsdlPath;
- private String m_staticMemberName;
- private IType m_activator;
- private String m_markerGroupUUID;
- private WebserviceEnum m_webserviceEnum;
-
- public ErrorProneWsdlLocatorCommand(IScoutBundle bundle, IInitializer initializer, String projectRelativeWsdlPath, String staticMemberName, String markerGroupUUID, WebserviceEnum webserviceEnum) {
- super("Fix problem to load WSDL resource");
- m_bundle = bundle;
- m_initializer = initializer;
- m_projectRelativeWsdlPath = projectRelativeWsdlPath;
- m_staticMemberName = staticMemberName;
- m_markerGroupUUID = markerGroupUUID;
- m_webserviceEnum = webserviceEnum;
- setSolutionDescription("By using this task, the locator code is changed to use the bundle's class loader instead.");
- }
-
- @Override
- public boolean prepareForUi() throws CoreException {
- IType[] activators = findActivator();
-
- if (activators.length == 0) {
- MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_QUESTION | SWT.OK);
- messageBox.setText(Texts.get("Error"));
- messageBox.setMessage("Unable to find bundle's activator class");
- messageBox.open();
- return false;
- }
- else if (activators.length == 1) {
- m_activator = activators[0];
- return true;
- }
- else {
- TypeSelectionDialog dialog = new TypeSelectionDialog(ScoutSdkUi.getShell(), "Activator selection", "Which Activator should be used to search for resources with it's bundle's classloader?");
- dialog.setElements(Arrays.asList(activators));
- if (dialog.open() == Window.OK) {
- m_activator = dialog.getElement();
- return TypeUtility.exists(m_activator);
- }
- return false;
- }
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- ICompilationUnit icu = m_initializer.getDeclaringType().getCompilationUnit();
- IType declaringType = m_initializer.getDeclaringType();
- workingCopyManager.register(icu, monitor);
-
- String resolvedActivatorName = JaxWsSdkUtility.resolveTypeName(declaringType, m_activator);
-
- // prepare new content of static initializer
- StringBuffer buf = new StringBuffer();
-
- try {
- String oldCode = m_initializer.getSource();
- buf.append("/*\n")
- .append(" *").append(" This is a fix by Eclipse Scout SDK to use bundle's classloader to locate WSDL file.\n")
- .append(" * The uncommented static initializer code originates by JAX-WS stub generation process.\n")
- .append(" */\n");
- BufferedReader reader = null;
- try {
- reader = new BufferedReader(new StringReader(oldCode));
- String line = null;
- while ((line = reader.readLine()) != null) {
- buf.append("// ").append(line).append("\n");
- }
- }
- finally {
- if (reader != null) {
- try {
- reader.close();
- }
- catch (Exception e) {
- }
- }
- }
- }
- catch (IOException e) {
- JaxWsSdk.logError(e);
- }
-
- buf.append("static {\n");
- buf.append("URL url = " + resolvedActivatorName + ".getDefault().getBundle().getResource(\"" + m_projectRelativeWsdlPath + "\");\n");
- buf.append("if (url == null) {\n");
- buf.append(" logger.warning(\"Failed to create URL for the wsdl Location: '" + m_projectRelativeWsdlPath + "', retrying as a local file\");\n");
- buf.append("}\n");
- buf.append(m_staticMemberName + " = url;\n");
- buf.append("}");
-
- // replace static initializer with new content
- Document icuDoc = new Document(declaringType.getCompilationUnit().getBuffer().getContents());
- ReplaceEdit edit = new ReplaceEdit(m_initializer.getSourceRange().getOffset(), m_initializer.getSourceRange().getLength(), buf.toString());
- try {
- edit.apply(icuDoc);
- }
- catch (BadLocationException e) {
- throw new CoreException(new ScoutStatus("Failed to update static initializer. [type=" + declaringType.getElementName() + "]", e));
- }
-
- // format icu
- SourceFormatOperation sourceFormatOp = new SourceFormatOperation(declaringType.getJavaProject(), icuDoc, null);
- sourceFormatOp.run(monitor, workingCopyManager);
-
- // write document back
- icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
-
- // create import directive of Activator if required
- JaxWsSdkUtility.createImportDirective(declaringType, m_activator);
-
- // reconcilation
- workingCopyManager.reconcile(declaringType.getCompilationUnit(), monitor);
- workingCopyManager.unregister(icu, monitor);
-
- if (m_webserviceEnum == WebserviceEnum.Provider) {
- JaxWsSdk.getDefault().notifyPageReload(WebServiceProviderNodePage.class, m_markerGroupUUID, WebServiceProviderNodePage.DATA_STUB_FILES);
- }
- else {
- JaxWsSdk.getDefault().notifyPageReload(WebServiceConsumerNodePage.class, m_markerGroupUUID, WebServiceConsumerNodePage.DATA_STUB_FILES);
- }
- }
-
- public IType[] findActivator() {
- // try to find Activator to use it's bundle to load resources
- IType bundleActivator = TypeUtility.getType(BundleActivator.class.getName());
- IPrimaryTypeTypeHierarchy hierarchy = TypeUtility.getPrimaryTypeHierarchy(bundleActivator);
- IType[] types = hierarchy.getAllSubtypes(bundleActivator, new ITypeFilter() {
-
- @Override
- public boolean accept(IType type) {
- try {
- if (!TypeUtility.exists(type)) {
- return false;
- }
- // must be concrete type
- if (Flags.isAbstract(type.getFlags())) {
- return false;
- }
-
- // must be in same project
- if (!m_bundle.contains(type)) {
- return false;
- }
-
- return true;
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("could not determine bundle's activator properly", e);
- }
- return false;
- }
- });
-
- return types;
- }
-
- public IType getActivator() {
- return m_activator;
- }
-
- public void setActivator(IType activator) {
- m_activator = activator;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.StringReader;
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IInitializer;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.util.ScoutUtility;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+import org.eclipse.scout.sdk.util.type.ITypeFilter;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.TypeSelectionDialog;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceConsumerNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.text.edits.ReplaceEdit;
+import org.osgi.framework.BundleActivator;
+
+/**
+ * Not used in this release
+ */
+public class ErrorProneWsdlLocatorCommand extends AbstractExecutableMarkerCommand {
+
+ private IScoutBundle m_bundle;
+ private IInitializer m_initializer;
+ private String m_projectRelativeWsdlPath;
+ private String m_staticMemberName;
+ private IType m_activator;
+ private String m_markerGroupUUID;
+ private WebserviceEnum m_webserviceEnum;
+
+ public ErrorProneWsdlLocatorCommand(IScoutBundle bundle, IInitializer initializer, String projectRelativeWsdlPath, String staticMemberName, String markerGroupUUID, WebserviceEnum webserviceEnum) {
+ super("Fix problem to load WSDL resource");
+ m_bundle = bundle;
+ m_initializer = initializer;
+ m_projectRelativeWsdlPath = projectRelativeWsdlPath;
+ m_staticMemberName = staticMemberName;
+ m_markerGroupUUID = markerGroupUUID;
+ m_webserviceEnum = webserviceEnum;
+ setSolutionDescription("By using this task, the locator code is changed to use the bundle's class loader instead.");
+ }
+
+ @Override
+ public boolean prepareForUi() throws CoreException {
+ IType[] activators = findActivator();
+
+ if (activators.length == 0) {
+ MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_QUESTION | SWT.OK);
+ messageBox.setText(Texts.get("Error"));
+ messageBox.setMessage("Unable to find bundle's activator class");
+ messageBox.open();
+ return false;
+ }
+ else if (activators.length == 1) {
+ m_activator = activators[0];
+ return true;
+ }
+ else {
+ TypeSelectionDialog dialog = new TypeSelectionDialog(ScoutSdkUi.getShell(), "Activator selection", "Which Activator should be used to search for resources with it's bundle's classloader?");
+ dialog.setElements(Arrays.asList(activators));
+ if (dialog.open() == Window.OK) {
+ m_activator = dialog.getElement();
+ return TypeUtility.exists(m_activator);
+ }
+ return false;
+ }
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ ICompilationUnit icu = m_initializer.getDeclaringType().getCompilationUnit();
+ IType declaringType = m_initializer.getDeclaringType();
+ workingCopyManager.register(icu, monitor);
+
+ String resolvedActivatorName = JaxWsSdkUtility.resolveTypeName(declaringType, m_activator);
+
+ // prepare new content of static initializer
+ StringBuffer buf = new StringBuffer();
+
+ try {
+ String oldCode = m_initializer.getSource();
+ buf.append("/*\n")
+ .append(" *").append(" This is a fix by Eclipse Scout SDK to use bundle's classloader to locate WSDL file.\n")
+ .append(" * The uncommented static initializer code originates by JAX-WS stub generation process.\n")
+ .append(" */\n");
+ BufferedReader reader = null;
+ try {
+ reader = new BufferedReader(new StringReader(oldCode));
+ String line = null;
+ while ((line = reader.readLine()) != null) {
+ buf.append("// ").append(line).append("\n");
+ }
+ }
+ finally {
+ if (reader != null) {
+ try {
+ reader.close();
+ }
+ catch (Exception e) {
+ }
+ }
+ }
+ }
+ catch (IOException e) {
+ JaxWsSdk.logError(e);
+ }
+
+ buf.append("static {\n");
+ buf.append("URL url = " + resolvedActivatorName + ".getDefault().getBundle().getResource(\"" + m_projectRelativeWsdlPath + "\");\n");
+ buf.append("if (url == null) {\n");
+ buf.append(" logger.warning(\"Failed to create URL for the wsdl Location: '" + m_projectRelativeWsdlPath + "', retrying as a local file\");\n");
+ buf.append("}\n");
+ buf.append(m_staticMemberName + " = url;\n");
+ buf.append("}");
+
+ // replace static initializer with new content
+ Document icuDoc = new Document(declaringType.getCompilationUnit().getBuffer().getContents());
+ ReplaceEdit edit = new ReplaceEdit(m_initializer.getSourceRange().getOffset(), m_initializer.getSourceRange().getLength(), buf.toString());
+ try {
+ edit.apply(icuDoc);
+ }
+ catch (BadLocationException e) {
+ throw new CoreException(new ScoutStatus("Failed to update static initializer. [type=" + declaringType.getElementName() + "]", e));
+ }
+
+ // format icu
+ SourceFormatOperation sourceFormatOp = new SourceFormatOperation(declaringType.getJavaProject(), icuDoc, null);
+ sourceFormatOp.run(monitor, workingCopyManager);
+
+ // write document back
+ icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
+
+ // create import directive of Activator if required
+ JaxWsSdkUtility.createImportDirective(declaringType, m_activator);
+
+ // reconcilation
+ workingCopyManager.reconcile(declaringType.getCompilationUnit(), monitor);
+ workingCopyManager.unregister(icu, monitor);
+
+ if (m_webserviceEnum == WebserviceEnum.Provider) {
+ JaxWsSdk.getDefault().notifyPageReload(WebServiceProviderNodePage.class, m_markerGroupUUID, WebServiceProviderNodePage.DATA_STUB_FILES);
+ }
+ else {
+ JaxWsSdk.getDefault().notifyPageReload(WebServiceConsumerNodePage.class, m_markerGroupUUID, WebServiceConsumerNodePage.DATA_STUB_FILES);
+ }
+ }
+
+ public IType[] findActivator() {
+ // try to find Activator to use it's bundle to load resources
+ IType bundleActivator = TypeUtility.getType(BundleActivator.class.getName());
+ IPrimaryTypeTypeHierarchy hierarchy = TypeUtility.getPrimaryTypeHierarchy(bundleActivator);
+ IType[] types = hierarchy.getAllSubtypes(bundleActivator, new ITypeFilter() {
+
+ @Override
+ public boolean accept(IType type) {
+ try {
+ if (!TypeUtility.exists(type)) {
+ return false;
+ }
+ // must be concrete type
+ if (Flags.isAbstract(type.getFlags())) {
+ return false;
+ }
+
+ // must be in same project
+ if (!m_bundle.contains(type)) {
+ return false;
+ }
+
+ return true;
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("could not determine bundle's activator properly", e);
+ }
+ return false;
+ }
+ });
+
+ return types;
+ }
+
+ public IType getActivator() {
+ return m_activator;
+ }
+
+ public void setActivator(IType activator) {
+ m_activator = activator;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/IMarkerCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/IMarkerCommand.java
index 43ab4a6e3..4bf51110b 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/IMarkerCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/IMarkerCommand.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-
-public interface IMarkerCommand {
-
- boolean prepareForUi() throws CoreException;
-
- void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException;
-
- void setDoExecute(boolean doExecute);
-
- boolean isDoExecute();
-
- boolean isExecutable();
-
- String getProblemName();
-
- String getSolutionDescription();
-
- IMarker getMarker();
-
- void setMarker(IMarker marker);
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+
+public interface IMarkerCommand {
+
+ boolean prepareForUi() throws CoreException;
+
+ void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException;
+
+ void setDoExecute(boolean doExecute);
+
+ boolean isDoExecute();
+
+ boolean isExecutable();
+
+ String getProblemName();
+
+ String getSolutionDescription();
+
+ IMarker getMarker();
+
+ void setMarker(IMarker marker);
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/InvalidPortTypeCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/InvalidPortTypeCommand.java
index ddfa6dc16..f77ec3bec 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/InvalidPortTypeCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/InvalidPortTypeCommand.java
@@ -1,146 +1,146 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import java.util.Arrays;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.ISourceRange;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.util.ScoutUtility;
-import org.eclipse.scout.sdk.util.jdt.SourceRange;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.TypeSelectionDialog;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.text.edits.ReplaceEdit;
-
-public class InvalidPortTypeCommand extends AbstractExecutableMarkerCommand {
-
- private IType m_type;
- private IFile m_stubJarFile;
- private IType m_portType;
-
- public InvalidPortTypeCommand(IType type, IFile stubJarFile) {
- super("Invalid port type in super type generic parameter");
- m_type = type;
- m_stubJarFile = stubJarFile;
- setSolutionDescription("Use this task to fix port type registration");
- }
-
- @Override
- public boolean prepareForUi() throws CoreException {
- IType[] candidates = JaxWsSdkUtility.resolvePortTypeInterfaceTypes(null, m_stubJarFile);
- switch (candidates.length) {
- case 0: {
- MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_INFORMATION | SWT.OK);
- messageBox.setText(Texts.get("Information"));
- messageBox.setMessage(Texts.get("NoPortTypesFound"));
- messageBox.open();
- break;
- }
- case 1: {
- m_portType = candidates[0];
- break;
- }
- default: {
- TypeSelectionDialog dialog = new TypeSelectionDialog(ScoutSdkUi.getShell(), Texts.get("PortType"), Texts.get("PleaseChoosePortType"));
- dialog.setElements(Arrays.asList(candidates));
- if (dialog.open() == Dialog.OK) {
- m_portType = dialog.getElement();
- }
- break;
- }
- }
- return m_portType != null;
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- ISourceRange classNameRange = m_type.getNameRange();
- int positionAfterClassName = classNameRange.getOffset() + classNameRange.getLength();
-
- String source = m_type.getCompilationUnit().getBuffer().getContents();
- String sourceAfterClassName = source.substring(positionAfterClassName);
-
- int insertPosition = -1;
-
- ReplaceEdit edit = null;
- Pattern pattern = Pattern.compile(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient).getElementName() + "\\s*\\<\\s*([^\\,]*?)\\,([^\\>]*?)\\s*\\>");
- Matcher matcher = pattern.matcher(sourceAfterClassName);
- if (matcher.find()) {
- insertPosition = positionAfterClassName + matcher.start(2);
- ISourceRange insertionRange = new SourceRange(insertPosition, matcher.end(2) - matcher.start(2));
- edit = new ReplaceEdit(insertionRange.getOffset(), insertionRange.getLength(), m_portType.getElementName());
- }
- else {
- pattern = Pattern.compile(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient).getElementName() + "\\s*\\<\\s*([^\\>]*?)\\>");
- matcher = pattern.matcher(sourceAfterClassName);
- if (matcher.find()) {
- insertPosition = positionAfterClassName + matcher.start(1);
- ISourceRange insertionRange = new SourceRange(insertPosition, matcher.end(1) - matcher.start(1));
- edit = new ReplaceEdit(insertionRange.getOffset(), insertionRange.getLength(), "Object, " + m_portType.getElementName());
- }
- else {
- pattern = Pattern.compile("(" + TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient).getElementName() + ")");
- matcher = pattern.matcher(sourceAfterClassName);
- if (matcher.find()) {
- insertPosition = positionAfterClassName + matcher.end(1);
- ISourceRange insertionRange = new SourceRange(insertPosition, 0);
- edit = new ReplaceEdit(insertionRange.getOffset(), insertionRange.getLength(), "<Object, " + m_portType.getElementName() + ">");
- }
- }
- }
- if (edit == null) {
- throw new CoreException(new ScoutStatus("Could not determine insert position for port type in type '" + m_type.getElementName() + "'"));
- }
-
- Document icuDoc = new Document(source);
- try {
- edit.apply(icuDoc);
- }
- catch (BadLocationException e) {
- throw new CoreException(new ScoutStatus("Failed to update interface declaration in type '" + m_type.getElementName() + "'", e));
- }
-
- ICompilationUnit icu = m_type.getCompilationUnit();
- workingCopyManager.register(icu, monitor);
-
- // format icu
- SourceFormatOperation sourceFormatOp = new SourceFormatOperation(m_type.getJavaProject(), icuDoc, null);
- sourceFormatOp.run(monitor, workingCopyManager);
-
- // write document back
- icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
-
- // create import directive of Activator if required
- JaxWsSdkUtility.createImportDirective(m_type, m_portType);
-
- // reconcilation
- workingCopyManager.reconcile(m_type.getCompilationUnit(), monitor);
- workingCopyManager.unregister(icu, monitor);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import java.util.Arrays;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.util.ScoutUtility;
+import org.eclipse.scout.sdk.util.jdt.SourceRange;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.TypeSelectionDialog;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.text.edits.ReplaceEdit;
+
+public class InvalidPortTypeCommand extends AbstractExecutableMarkerCommand {
+
+ private IType m_type;
+ private IFile m_stubJarFile;
+ private IType m_portType;
+
+ public InvalidPortTypeCommand(IType type, IFile stubJarFile) {
+ super("Invalid port type in super type generic parameter");
+ m_type = type;
+ m_stubJarFile = stubJarFile;
+ setSolutionDescription("Use this task to fix port type registration");
+ }
+
+ @Override
+ public boolean prepareForUi() throws CoreException {
+ IType[] candidates = JaxWsSdkUtility.resolvePortTypeInterfaceTypes(null, m_stubJarFile);
+ switch (candidates.length) {
+ case 0: {
+ MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_INFORMATION | SWT.OK);
+ messageBox.setText(Texts.get("Information"));
+ messageBox.setMessage(Texts.get("NoPortTypesFound"));
+ messageBox.open();
+ break;
+ }
+ case 1: {
+ m_portType = candidates[0];
+ break;
+ }
+ default: {
+ TypeSelectionDialog dialog = new TypeSelectionDialog(ScoutSdkUi.getShell(), Texts.get("PortType"), Texts.get("PleaseChoosePortType"));
+ dialog.setElements(Arrays.asList(candidates));
+ if (dialog.open() == Dialog.OK) {
+ m_portType = dialog.getElement();
+ }
+ break;
+ }
+ }
+ return m_portType != null;
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ ISourceRange classNameRange = m_type.getNameRange();
+ int positionAfterClassName = classNameRange.getOffset() + classNameRange.getLength();
+
+ String source = m_type.getCompilationUnit().getBuffer().getContents();
+ String sourceAfterClassName = source.substring(positionAfterClassName);
+
+ int insertPosition = -1;
+
+ ReplaceEdit edit = null;
+ Pattern pattern = Pattern.compile(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient).getElementName() + "\\s*\\<\\s*([^\\,]*?)\\,([^\\>]*?)\\s*\\>");
+ Matcher matcher = pattern.matcher(sourceAfterClassName);
+ if (matcher.find()) {
+ insertPosition = positionAfterClassName + matcher.start(2);
+ ISourceRange insertionRange = new SourceRange(insertPosition, matcher.end(2) - matcher.start(2));
+ edit = new ReplaceEdit(insertionRange.getOffset(), insertionRange.getLength(), m_portType.getElementName());
+ }
+ else {
+ pattern = Pattern.compile(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient).getElementName() + "\\s*\\<\\s*([^\\>]*?)\\>");
+ matcher = pattern.matcher(sourceAfterClassName);
+ if (matcher.find()) {
+ insertPosition = positionAfterClassName + matcher.start(1);
+ ISourceRange insertionRange = new SourceRange(insertPosition, matcher.end(1) - matcher.start(1));
+ edit = new ReplaceEdit(insertionRange.getOffset(), insertionRange.getLength(), "Object, " + m_portType.getElementName());
+ }
+ else {
+ pattern = Pattern.compile("(" + TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient).getElementName() + ")");
+ matcher = pattern.matcher(sourceAfterClassName);
+ if (matcher.find()) {
+ insertPosition = positionAfterClassName + matcher.end(1);
+ ISourceRange insertionRange = new SourceRange(insertPosition, 0);
+ edit = new ReplaceEdit(insertionRange.getOffset(), insertionRange.getLength(), "<Object, " + m_portType.getElementName() + ">");
+ }
+ }
+ }
+ if (edit == null) {
+ throw new CoreException(new ScoutStatus("Could not determine insert position for port type in type '" + m_type.getElementName() + "'"));
+ }
+
+ Document icuDoc = new Document(source);
+ try {
+ edit.apply(icuDoc);
+ }
+ catch (BadLocationException e) {
+ throw new CoreException(new ScoutStatus("Failed to update interface declaration in type '" + m_type.getElementName() + "'", e));
+ }
+
+ ICompilationUnit icu = m_type.getCompilationUnit();
+ workingCopyManager.register(icu, monitor);
+
+ // format icu
+ SourceFormatOperation sourceFormatOp = new SourceFormatOperation(m_type.getJavaProject(), icuDoc, null);
+ sourceFormatOp.run(monitor, workingCopyManager);
+
+ // write document back
+ icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
+
+ // create import directive of Activator if required
+ JaxWsSdkUtility.createImportDirective(m_type, m_portType);
+
+ // reconcilation
+ workingCopyManager.reconcile(m_type.getCompilationUnit(), monitor);
+ workingCopyManager.unregister(icu, monitor);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/InvalidServiceCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/InvalidServiceCommand.java
index c2902eff8..0d94e8711 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/InvalidServiceCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/InvalidServiceCommand.java
@@ -1,146 +1,146 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import java.util.Arrays;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.ISourceRange;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.util.ScoutUtility;
-import org.eclipse.scout.sdk.util.jdt.SourceRange;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.TypeSelectionDialog;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.text.edits.ReplaceEdit;
-
-public class InvalidServiceCommand extends AbstractExecutableMarkerCommand {
-
- private IType m_type;
- private IFile m_stubJarFile;
- private IType m_serviceType;
-
- public InvalidServiceCommand(IType type, IFile stubJarFile) {
- super("Invalid service in super type generic parameter");
- m_type = type;
- m_stubJarFile = stubJarFile;
- setSolutionDescription("Use this task to fix service registration");
- }
-
- @Override
- public boolean prepareForUi() throws CoreException {
- IType[] candidates = JaxWsSdkUtility.resolveServiceTypes(null, m_stubJarFile);
- switch (candidates.length) {
- case 0: {
- MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_INFORMATION | SWT.OK);
- messageBox.setText(Texts.get("Information"));
- messageBox.setMessage(Texts.get("NoServicesFound"));
- messageBox.open();
- break;
- }
- case 1: {
- m_serviceType = candidates[0];
- break;
- }
- default: {
- TypeSelectionDialog dialog = new TypeSelectionDialog(ScoutSdkUi.getShell(), Texts.get("Service"), Texts.get("PleaseChooseServiceType"));
- dialog.setElements(Arrays.asList(candidates));
- if (dialog.open() == Dialog.OK) {
- m_serviceType = dialog.getElement();
- }
- break;
- }
- }
- return m_serviceType != null;
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- ISourceRange classNameRange = m_type.getNameRange();
- int positionAfterClassName = classNameRange.getOffset() + classNameRange.getLength();
-
- String source = m_type.getCompilationUnit().getBuffer().getContents();
- String sourceAfterClassName = source.substring(positionAfterClassName);
-
- int insertPosition = -1;
-
- ReplaceEdit edit = null;
- Pattern pattern = Pattern.compile(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient).getElementName() + "\\s*\\<\\s*([^\\,]*?)\\,([^\\>]*?)\\s*\\>");
- Matcher matcher = pattern.matcher(sourceAfterClassName);
- if (matcher.find()) {
- insertPosition = positionAfterClassName + matcher.start(1);
- ISourceRange insertionRange = new SourceRange(insertPosition, matcher.end(1) - matcher.start(1));
- edit = new ReplaceEdit(insertionRange.getOffset(), insertionRange.getLength(), m_serviceType.getElementName());
- }
- else {
- pattern = Pattern.compile(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient).getElementName() + "\\s*\\<\\s*([^\\>]*?)\\>");
- matcher = pattern.matcher(sourceAfterClassName);
- if (matcher.find()) {
- insertPosition = positionAfterClassName + matcher.start(1);
- ISourceRange insertionRange = new SourceRange(insertPosition, matcher.end(1) - matcher.start(1));
- edit = new ReplaceEdit(insertionRange.getOffset(), insertionRange.getLength(), m_serviceType.getElementName() + ", Object");
- }
- else {
- pattern = Pattern.compile("(" + TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient).getElementName() + ")");
- matcher = pattern.matcher(sourceAfterClassName);
- if (matcher.find()) {
- insertPosition = positionAfterClassName + matcher.end(1);
- ISourceRange insertionRange = new SourceRange(insertPosition, 0);
- edit = new ReplaceEdit(insertionRange.getOffset(), insertionRange.getLength(), "<" + m_serviceType.getElementName() + ", Object>");
- }
- }
- }
- if (edit == null) {
- throw new CoreException(new ScoutStatus("Could not determine insert position for service type in type '" + m_type.getElementName() + "'"));
- }
-
- Document icuDoc = new Document(source);
- try {
- edit.apply(icuDoc);
- }
- catch (BadLocationException e) {
- throw new CoreException(new ScoutStatus("Failed to update interface declaration in type '" + m_type.getElementName() + "'", e));
- }
-
- ICompilationUnit icu = m_type.getCompilationUnit();
- workingCopyManager.register(icu, monitor);
-
- // format icu
- SourceFormatOperation sourceFormatOp = new SourceFormatOperation(m_type.getJavaProject(), icuDoc, null);
- sourceFormatOp.run(monitor, workingCopyManager);
-
- // write document back
- icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
-
- // create import directive of Activator if required
- JaxWsSdkUtility.createImportDirective(m_type, m_serviceType);
-
- // reconcilation
- workingCopyManager.reconcile(m_type.getCompilationUnit(), monitor);
- workingCopyManager.unregister(icu, monitor);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import java.util.Arrays;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.util.ScoutUtility;
+import org.eclipse.scout.sdk.util.jdt.SourceRange;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.TypeSelectionDialog;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.text.edits.ReplaceEdit;
+
+public class InvalidServiceCommand extends AbstractExecutableMarkerCommand {
+
+ private IType m_type;
+ private IFile m_stubJarFile;
+ private IType m_serviceType;
+
+ public InvalidServiceCommand(IType type, IFile stubJarFile) {
+ super("Invalid service in super type generic parameter");
+ m_type = type;
+ m_stubJarFile = stubJarFile;
+ setSolutionDescription("Use this task to fix service registration");
+ }
+
+ @Override
+ public boolean prepareForUi() throws CoreException {
+ IType[] candidates = JaxWsSdkUtility.resolveServiceTypes(null, m_stubJarFile);
+ switch (candidates.length) {
+ case 0: {
+ MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_INFORMATION | SWT.OK);
+ messageBox.setText(Texts.get("Information"));
+ messageBox.setMessage(Texts.get("NoServicesFound"));
+ messageBox.open();
+ break;
+ }
+ case 1: {
+ m_serviceType = candidates[0];
+ break;
+ }
+ default: {
+ TypeSelectionDialog dialog = new TypeSelectionDialog(ScoutSdkUi.getShell(), Texts.get("Service"), Texts.get("PleaseChooseServiceType"));
+ dialog.setElements(Arrays.asList(candidates));
+ if (dialog.open() == Dialog.OK) {
+ m_serviceType = dialog.getElement();
+ }
+ break;
+ }
+ }
+ return m_serviceType != null;
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ ISourceRange classNameRange = m_type.getNameRange();
+ int positionAfterClassName = classNameRange.getOffset() + classNameRange.getLength();
+
+ String source = m_type.getCompilationUnit().getBuffer().getContents();
+ String sourceAfterClassName = source.substring(positionAfterClassName);
+
+ int insertPosition = -1;
+
+ ReplaceEdit edit = null;
+ Pattern pattern = Pattern.compile(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient).getElementName() + "\\s*\\<\\s*([^\\,]*?)\\,([^\\>]*?)\\s*\\>");
+ Matcher matcher = pattern.matcher(sourceAfterClassName);
+ if (matcher.find()) {
+ insertPosition = positionAfterClassName + matcher.start(1);
+ ISourceRange insertionRange = new SourceRange(insertPosition, matcher.end(1) - matcher.start(1));
+ edit = new ReplaceEdit(insertionRange.getOffset(), insertionRange.getLength(), m_serviceType.getElementName());
+ }
+ else {
+ pattern = Pattern.compile(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient).getElementName() + "\\s*\\<\\s*([^\\>]*?)\\>");
+ matcher = pattern.matcher(sourceAfterClassName);
+ if (matcher.find()) {
+ insertPosition = positionAfterClassName + matcher.start(1);
+ ISourceRange insertionRange = new SourceRange(insertPosition, matcher.end(1) - matcher.start(1));
+ edit = new ReplaceEdit(insertionRange.getOffset(), insertionRange.getLength(), m_serviceType.getElementName() + ", Object");
+ }
+ else {
+ pattern = Pattern.compile("(" + TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient).getElementName() + ")");
+ matcher = pattern.matcher(sourceAfterClassName);
+ if (matcher.find()) {
+ insertPosition = positionAfterClassName + matcher.end(1);
+ ISourceRange insertionRange = new SourceRange(insertPosition, 0);
+ edit = new ReplaceEdit(insertionRange.getOffset(), insertionRange.getLength(), "<" + m_serviceType.getElementName() + ", Object>");
+ }
+ }
+ }
+ if (edit == null) {
+ throw new CoreException(new ScoutStatus("Could not determine insert position for service type in type '" + m_type.getElementName() + "'"));
+ }
+
+ Document icuDoc = new Document(source);
+ try {
+ edit.apply(icuDoc);
+ }
+ catch (BadLocationException e) {
+ throw new CoreException(new ScoutStatus("Failed to update interface declaration in type '" + m_type.getElementName() + "'", e));
+ }
+
+ ICompilationUnit icu = m_type.getCompilationUnit();
+ workingCopyManager.register(icu, monitor);
+
+ // format icu
+ SourceFormatOperation sourceFormatOp = new SourceFormatOperation(m_type.getJavaProject(), icuDoc, null);
+ sourceFormatOp.run(monitor, workingCopyManager);
+
+ // write document back
+ icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
+
+ // create import directive of Activator if required
+ JaxWsSdkUtility.createImportDirective(m_type, m_serviceType);
+
+ // reconcilation
+ workingCopyManager.reconcile(m_type.getCompilationUnit(), monitor);
+ workingCopyManager.unregister(icu, monitor);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/JaxWsServletRegistrationCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/JaxWsServletRegistrationCommand.java
index e93974c34..7d6e185c6 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/JaxWsServletRegistrationCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/JaxWsServletRegistrationCommand.java
@@ -1,69 +1,69 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.JaxWsServletRegistrationWizard;
-
-public class JaxWsServletRegistrationCommand extends AbstractExecutableMarkerCommand {
-
- private IScoutBundle m_bundle;
- private SunJaxWsBean m_sunJaxWsBean;
-
- /**
- * To fix JAX-WS servlet registration
- *
- * @param bundle
- */
- public JaxWsServletRegistrationCommand(IScoutBundle bundle) {
- super("Missing or invalid JAX-WS Servlet registration");
- m_bundle = bundle;
- setSolutionDescription("Use this task to fix the JAX-WS servlet registration");
- }
-
- /**
- * To fix JAX-WS servlet registration and URL pattern of given sunJaxWs entry
- *
- * @param bundle
- * @param sunJaxWsBean
- */
- public JaxWsServletRegistrationCommand(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean) {
- super("Missing or invalid URL pattern");
- m_bundle = bundle;
- m_sunJaxWsBean = sunJaxWsBean;
- setSolutionDescription("Use this task to fix the URL pattern and/or change the JAX-WS servlet registration");
- }
-
- @Override
- public boolean prepareForUi() throws CoreException {
- JaxWsServletRegistrationWizard wizard;
- if (m_sunJaxWsBean != null) {
- wizard = new JaxWsServletRegistrationWizard(m_bundle, m_sunJaxWsBean);
- }
- else {
- wizard = new JaxWsServletRegistrationWizard(m_bundle);
- }
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.setPageSize(650, 200);
- return wizardDialog.open() == Window.OK;
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- // operation executed within wizard
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.JaxWsServletRegistrationWizard;
+
+public class JaxWsServletRegistrationCommand extends AbstractExecutableMarkerCommand {
+
+ private IScoutBundle m_bundle;
+ private SunJaxWsBean m_sunJaxWsBean;
+
+ /**
+ * To fix JAX-WS servlet registration
+ *
+ * @param bundle
+ */
+ public JaxWsServletRegistrationCommand(IScoutBundle bundle) {
+ super("Missing or invalid JAX-WS Servlet registration");
+ m_bundle = bundle;
+ setSolutionDescription("Use this task to fix the JAX-WS servlet registration");
+ }
+
+ /**
+ * To fix JAX-WS servlet registration and URL pattern of given sunJaxWs entry
+ *
+ * @param bundle
+ * @param sunJaxWsBean
+ */
+ public JaxWsServletRegistrationCommand(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean) {
+ super("Missing or invalid URL pattern");
+ m_bundle = bundle;
+ m_sunJaxWsBean = sunJaxWsBean;
+ setSolutionDescription("Use this task to fix the URL pattern and/or change the JAX-WS servlet registration");
+ }
+
+ @Override
+ public boolean prepareForUi() throws CoreException {
+ JaxWsServletRegistrationWizard wizard;
+ if (m_sunJaxWsBean != null) {
+ wizard = new JaxWsServletRegistrationWizard(m_bundle, m_sunJaxWsBean);
+ }
+ else {
+ wizard = new JaxWsServletRegistrationWizard(m_bundle);
+ }
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.setPageSize(650, 200);
+ return wizardDialog.open() == Window.OK;
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ // operation executed within wizard
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingAnnotationTypePropertyCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingAnnotationTypePropertyCommand.java
index 50634ee04..67d468bc9 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingAnnotationTypePropertyCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingAnnotationTypePropertyCommand.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
-
-public class MissingAnnotationTypePropertyCommand extends AbstractExecutableMarkerCommand {
-
- private IType m_declaringType;
- private IType m_annotationType;
- private String m_property;
- private IType m_propertyValue;
-
- public MissingAnnotationTypePropertyCommand(IType declaringType, IType annotationType, String property, IType propertyValue) {
- super("Invalid annotation declaration");
- m_declaringType = declaringType;
- m_annotationType = annotationType;
- m_property = property;
- m_propertyValue = propertyValue;
- setSolutionDescription("By using this task, the annotation declaration is updated.");
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- AnnotationUpdateOperation op = new AnnotationUpdateOperation();
- op.setDeclaringType(m_declaringType);
- op.setAnnotationType(m_annotationType);
- op.addTypeProperty(m_property, m_propertyValue);
- new OperationJob(op).schedule();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
+
+public class MissingAnnotationTypePropertyCommand extends AbstractExecutableMarkerCommand {
+
+ private IType m_declaringType;
+ private IType m_annotationType;
+ private String m_property;
+ private IType m_propertyValue;
+
+ public MissingAnnotationTypePropertyCommand(IType declaringType, IType annotationType, String property, IType propertyValue) {
+ super("Invalid annotation declaration");
+ m_declaringType = declaringType;
+ m_annotationType = annotationType;
+ m_property = property;
+ m_propertyValue = propertyValue;
+ setSolutionDescription("By using this task, the annotation declaration is updated.");
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ AnnotationUpdateOperation op = new AnnotationUpdateOperation();
+ op.setDeclaringType(m_declaringType);
+ op.setAnnotationType(m_annotationType);
+ op.addTypeProperty(m_property, m_propertyValue);
+ new OperationJob(op).schedule();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingBuildJaxWsEntryCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingBuildJaxWsEntryCommand.java
index 840ab5f8f..edaed860e 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingBuildJaxWsEntryCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingBuildJaxWsEntryCommand.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-
-public class MissingBuildJaxWsEntryCommand extends AbstractExecutableMarkerCommand {
-
- private IScoutBundle m_bundle;
- private String m_alias;
- private WebserviceEnum m_webserviceEnum;
-
- public MissingBuildJaxWsEntryCommand(IScoutBundle bundle, String alias, WebserviceEnum webserviceEnum) {
- super("Missing entry in " + JaxWsConstants.PATH_BUILD_JAXWS);
- m_bundle = bundle;
- m_alias = alias;
- m_webserviceEnum = webserviceEnum;
- setSolutionDescription("By using this task, the missing entry is created for the webservice '" + alias + "'.");
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- ScoutXmlDocument xmlDocument = ResourceFactory.getBuildJaxWsResource(m_bundle).loadXml();
-
- ScoutXmlElement xml;
- if (m_webserviceEnum == WebserviceEnum.Provider) {
- xml = xmlDocument.getRoot().addChild(BuildJaxWsBean.XML_PROVIDER);
- }
- else {
- xml = xmlDocument.getRoot().addChild(BuildJaxWsBean.XML_CONSUMER);
- }
- BuildJaxWsBean bean = new BuildJaxWsBean(xml, m_webserviceEnum);
- bean.setAlias(m_alias);
-
- ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(bean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_ENTRY_ADDED, monitor, m_alias);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+
+public class MissingBuildJaxWsEntryCommand extends AbstractExecutableMarkerCommand {
+
+ private IScoutBundle m_bundle;
+ private String m_alias;
+ private WebserviceEnum m_webserviceEnum;
+
+ public MissingBuildJaxWsEntryCommand(IScoutBundle bundle, String alias, WebserviceEnum webserviceEnum) {
+ super("Missing entry in " + JaxWsConstants.PATH_BUILD_JAXWS);
+ m_bundle = bundle;
+ m_alias = alias;
+ m_webserviceEnum = webserviceEnum;
+ setSolutionDescription("By using this task, the missing entry is created for the webservice '" + alias + "'.");
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ ScoutXmlDocument xmlDocument = ResourceFactory.getBuildJaxWsResource(m_bundle).loadXml();
+
+ ScoutXmlElement xml;
+ if (m_webserviceEnum == WebserviceEnum.Provider) {
+ xml = xmlDocument.getRoot().addChild(BuildJaxWsBean.XML_PROVIDER);
+ }
+ else {
+ xml = xmlDocument.getRoot().addChild(BuildJaxWsBean.XML_CONSUMER);
+ }
+ BuildJaxWsBean bean = new BuildJaxWsBean(xml, m_webserviceEnum);
+ bean.setAlias(m_alias);
+
+ ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(bean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_ENTRY_ADDED, monitor, m_alias);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingClasspathEntryForJarFileCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingClasspathEntryForJarFileCommand.java
index 14e28c049..381ef4a90 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingClasspathEntryForJarFileCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingClasspathEntryForJarFileCommand.java
@@ -1,41 +1,41 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.util.pde.PluginModelHelper;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-
-public class MissingClasspathEntryForJarFileCommand extends AbstractExecutableMarkerCommand {
-
- private IScoutBundle m_bundle;
- private IFile m_stubJarFile;
-
- public MissingClasspathEntryForJarFileCommand(IScoutBundle bundle, String alias, IFile stubJarFile) {
- super("Stub JAR file '" + stubJarFile.getName() + "' is not on project classpath");
- m_bundle = bundle;
- m_stubJarFile = stubJarFile;
- setSolutionDescription("By using this task, the JAR file of the WS '" + alias + "' is registered on the project classpath.");
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- String jarFilePath = JaxWsSdkUtility.normalizePath(m_stubJarFile.getProjectRelativePath().toPortableString(), SeparatorType.None);
- PluginModelHelper h = new PluginModelHelper(m_bundle.getProject());
- h.Manifest.addClasspathEntry(jarFilePath);
- h.save();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.util.pde.PluginModelHelper;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+
+public class MissingClasspathEntryForJarFileCommand extends AbstractExecutableMarkerCommand {
+
+ private IScoutBundle m_bundle;
+ private IFile m_stubJarFile;
+
+ public MissingClasspathEntryForJarFileCommand(IScoutBundle bundle, String alias, IFile stubJarFile) {
+ super("Stub JAR file '" + stubJarFile.getName() + "' is not on project classpath");
+ m_bundle = bundle;
+ m_stubJarFile = stubJarFile;
+ setSolutionDescription("By using this task, the JAR file of the WS '" + alias + "' is registered on the project classpath.");
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ String jarFilePath = JaxWsSdkUtility.normalizePath(m_stubJarFile.getProjectRelativePath().toPortableString(), SeparatorType.None);
+ PluginModelHelper h = new PluginModelHelper(m_bundle.getProject());
+ h.Manifest.addClasspathEntry(jarFilePath);
+ h.save();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingEndpointCodeFirstCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingEndpointCodeFirstCommand.java
index 808cd5d4d..d0d3a90ac 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingEndpointCodeFirstCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingEndpointCodeFirstCommand.java
@@ -1,66 +1,66 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import javax.jws.WebService;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.TypeBrowseDialog;
-
-public class MissingEndpointCodeFirstCommand extends AbstractExecutableMarkerCommand {
-
- private IType m_implType;
- private IType m_annotationType;
- private String m_property;
- private IType m_portTypeInterfaceType;
-
- public MissingEndpointCodeFirstCommand(IType implType) {
- super("Missing or invalid " + WebService.class.getSimpleName() + " annotation declaration");
- m_implType = implType;
- m_annotationType = TypeUtility.getType(WebService.class.getName());
- m_property = "endpointInterface";
- setSolutionDescription("By using this task, the annotation declaration is updated.");
- }
-
- @Override
- public boolean prepareForUi() throws CoreException {
- TypeBrowseDialog dialog = new TypeBrowseDialog(ScoutSdkUi.getShell(), Texts.get("PortTypeInterface"), Texts.get("PleaseChoosePortTypeInterface1"));
- dialog.setTypeStyle(IJavaElementSearchConstants.CONSIDER_INTERFACES);
- if (dialog.open() == Dialog.OK) {
- m_portTypeInterfaceType = dialog.getType();
- return true;
- }
- return false;
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- AnnotationUpdateOperation op = new AnnotationUpdateOperation();
- op.setDeclaringType(m_implType);
- op.setAnnotationType(m_annotationType);
- op.addStringProperty(m_property, m_portTypeInterfaceType.getFullyQualifiedName());
- new OperationJob(op).schedule();
- }
-
- public IType getPortTypeInterfaceType() {
- return m_portTypeInterfaceType;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import javax.jws.WebService;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.ui.IJavaElementSearchConstants;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.TypeBrowseDialog;
+
+public class MissingEndpointCodeFirstCommand extends AbstractExecutableMarkerCommand {
+
+ private IType m_implType;
+ private IType m_annotationType;
+ private String m_property;
+ private IType m_portTypeInterfaceType;
+
+ public MissingEndpointCodeFirstCommand(IType implType) {
+ super("Missing or invalid " + WebService.class.getSimpleName() + " annotation declaration");
+ m_implType = implType;
+ m_annotationType = TypeUtility.getType(WebService.class.getName());
+ m_property = "endpointInterface";
+ setSolutionDescription("By using this task, the annotation declaration is updated.");
+ }
+
+ @Override
+ public boolean prepareForUi() throws CoreException {
+ TypeBrowseDialog dialog = new TypeBrowseDialog(ScoutSdkUi.getShell(), Texts.get("PortTypeInterface"), Texts.get("PleaseChoosePortTypeInterface1"));
+ dialog.setTypeStyle(IJavaElementSearchConstants.CONSIDER_INTERFACES);
+ if (dialog.open() == Dialog.OK) {
+ m_portTypeInterfaceType = dialog.getType();
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ AnnotationUpdateOperation op = new AnnotationUpdateOperation();
+ op.setDeclaringType(m_implType);
+ op.setAnnotationType(m_annotationType);
+ op.addStringProperty(m_property, m_portTypeInterfaceType.getFullyQualifiedName());
+ new OperationJob(op).schedule();
+ }
+
+ public IType getPortTypeInterfaceType() {
+ return m_portTypeInterfaceType;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingEndpointPropertyCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingEndpointPropertyCommand.java
index 39d640030..56d9aff27 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingEndpointPropertyCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingEndpointPropertyCommand.java
@@ -1,96 +1,96 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import java.util.Arrays;
-
-import javax.jws.WebService;
-import javax.xml.namespace.QName;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.TypeSelectionDialog;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class MissingEndpointPropertyCommand extends AbstractExecutableMarkerCommand {
-
- private IType m_implType;
- private IType m_annotationType;
- private String m_property;
- private IType m_portTypeInterfaceType;
- private IFile m_stubJarFile;
- private QName m_portTypeQName;
-
- public MissingEndpointPropertyCommand(IType implType) {
- super("Missing or invalid " + WebService.class.getSimpleName() + " annotation declaration");
- m_implType = implType;
- m_annotationType = TypeUtility.getType(WebService.class.getName());
- m_property = "endpointInterface";
- setSolutionDescription("By using this task, the annotation declaration is updated.");
- }
-
- @Override
- public boolean prepareForUi() throws CoreException {
- if (m_portTypeQName != null) {
- m_portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(m_portTypeQName, m_stubJarFile);
- }
- if (m_portTypeInterfaceType != null) {
- return true;
- }
-
- IType[] candidates = JaxWsSdkUtility.resolvePortTypeInterfaceTypes(null, m_stubJarFile);
- TypeSelectionDialog dialog = new TypeSelectionDialog(ScoutSdkUi.getShell(), Texts.get("PortTypeInterface"), Texts.get("PleaseChoosePortTypeInterface"));
- dialog.setElements(Arrays.asList(candidates));
- if (dialog.open() == Dialog.OK) {
- m_portTypeInterfaceType = dialog.getElement();
- return true;
- }
- return false;
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- AnnotationUpdateOperation op = new AnnotationUpdateOperation();
- op.setDeclaringType(m_implType);
- op.setAnnotationType(m_annotationType);
- op.addStringProperty(m_property, m_portTypeInterfaceType.getFullyQualifiedName());
- new OperationJob(op).schedule();
- }
-
- public IFile getStubJarFile() {
- return m_stubJarFile;
- }
-
- public void setStubJarFile(IFile stubJarFile) {
- m_stubJarFile = stubJarFile;
- }
-
- public QName getPortTypeQName() {
- return m_portTypeQName;
- }
-
- public void setPortTypeQName(QName portTypeQName) {
- m_portTypeQName = portTypeQName;
- }
-
- public IType getPortTypeInterfaceType() {
- return m_portTypeInterfaceType;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import java.util.Arrays;
+
+import javax.jws.WebService;
+import javax.xml.namespace.QName;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.TypeSelectionDialog;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class MissingEndpointPropertyCommand extends AbstractExecutableMarkerCommand {
+
+ private IType m_implType;
+ private IType m_annotationType;
+ private String m_property;
+ private IType m_portTypeInterfaceType;
+ private IFile m_stubJarFile;
+ private QName m_portTypeQName;
+
+ public MissingEndpointPropertyCommand(IType implType) {
+ super("Missing or invalid " + WebService.class.getSimpleName() + " annotation declaration");
+ m_implType = implType;
+ m_annotationType = TypeUtility.getType(WebService.class.getName());
+ m_property = "endpointInterface";
+ setSolutionDescription("By using this task, the annotation declaration is updated.");
+ }
+
+ @Override
+ public boolean prepareForUi() throws CoreException {
+ if (m_portTypeQName != null) {
+ m_portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(m_portTypeQName, m_stubJarFile);
+ }
+ if (m_portTypeInterfaceType != null) {
+ return true;
+ }
+
+ IType[] candidates = JaxWsSdkUtility.resolvePortTypeInterfaceTypes(null, m_stubJarFile);
+ TypeSelectionDialog dialog = new TypeSelectionDialog(ScoutSdkUi.getShell(), Texts.get("PortTypeInterface"), Texts.get("PleaseChoosePortTypeInterface"));
+ dialog.setElements(Arrays.asList(candidates));
+ if (dialog.open() == Dialog.OK) {
+ m_portTypeInterfaceType = dialog.getElement();
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ AnnotationUpdateOperation op = new AnnotationUpdateOperation();
+ op.setDeclaringType(m_implType);
+ op.setAnnotationType(m_annotationType);
+ op.addStringProperty(m_property, m_portTypeInterfaceType.getFullyQualifiedName());
+ new OperationJob(op).schedule();
+ }
+
+ public IFile getStubJarFile() {
+ return m_stubJarFile;
+ }
+
+ public void setStubJarFile(IFile stubJarFile) {
+ m_stubJarFile = stubJarFile;
+ }
+
+ public QName getPortTypeQName() {
+ return m_portTypeQName;
+ }
+
+ public void setPortTypeQName(QName portTypeQName) {
+ m_portTypeQName = portTypeQName;
+ }
+
+ public IType getPortTypeInterfaceType() {
+ return m_portTypeInterfaceType;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingPortTypeCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingPortTypeCommand.java
index a2eeefa81..27afeaf08 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingPortTypeCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingPortTypeCommand.java
@@ -1,84 +1,84 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsProviderImplNewOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderCodeFirstNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class MissingPortTypeCommand extends AbstractExecutableMarkerCommand {
-
- private IScoutBundle m_bundle;
- private SunJaxWsBean m_sunJaxWsBean;
- private IType m_portTypeInterfaceType;
- private String m_markerGroupUUID;
- private String m_fqnPortType;
-
- public MissingPortTypeCommand(IScoutBundle bundle, String markerGroupUUID, SunJaxWsBean sunJaxWsBean, IType portTypeInterfaceType) {
- super("Missing or invalid port type");
- m_bundle = bundle;
- m_portTypeInterfaceType = portTypeInterfaceType;
- m_sunJaxWsBean = sunJaxWsBean;
- m_markerGroupUUID = markerGroupUUID;
-
- String portType = m_sunJaxWsBean.getImplementation();
- if (portType == null) {
- String name = m_sunJaxWsBean.getAlias();
- if (!name.toLowerCase().endsWith("service") ||
- !name.toLowerCase().endsWith("webservice")) {
- name += "WebService";
- }
- m_fqnPortType = StringUtility.join(".", JaxWsSdkUtility.getRecommendedProviderImplPackageName(m_bundle), name);
- }
- else {
- m_fqnPortType = portType;
- }
-
- setSolutionDescription("By using this task, the port type '" + m_fqnPortType + "' is created'.");
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- WsProviderImplNewOperation op = new WsProviderImplNewOperation();
- op.setBundle(m_bundle);
- op.setPackageName(Signature.getQualifier(m_fqnPortType));
- op.setTypeName(Signature.getSimpleName(m_fqnPortType));
- op.setCreateScoutWebServiceAnnotation(true);
- op.setSessionFactoryQName(TypeUtility.getType(JaxWsRuntimeClasses.DefaultServerSessionFactory).getFullyQualifiedName());
- op.setAuthenticationHandlerQName(TypeUtility.getType(JaxWsRuntimeClasses.BasicAuthenticationHandlerProvider).getFullyQualifiedName());
- op.setCredentialValidationStrategyQName(TypeUtility.getType(JaxWsRuntimeClasses.ConfigIniCredentialValidationStrategy).getFullyQualifiedName());
- op.setPortTypeInterfaceType(m_portTypeInterfaceType);
- op.validate();
- op.run(monitor, workingCopyManager);
-
- m_sunJaxWsBean.setImplementation(m_fqnPortType);
- XmlResource sunJaxWsResource = ResourceFactory.getSunJaxWsResource(m_bundle);
- sunJaxWsResource.storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_URL_PATTERN_CHANGED, m_sunJaxWsBean.getAlias());
-
- JaxWsSdk.getDefault().notifyPageReload(WebServiceProviderNodePage.class, m_markerGroupUUID, WebServiceProviderNodePage.DATA_JDT_TYPE);
- JaxWsSdk.getDefault().notifyPageReload(WebServiceProviderCodeFirstNodePage.class, m_markerGroupUUID, WebServiceProviderCodeFirstNodePage.DATA_JDT_TYPE);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsProviderImplNewOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderCodeFirstNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class MissingPortTypeCommand extends AbstractExecutableMarkerCommand {
+
+ private IScoutBundle m_bundle;
+ private SunJaxWsBean m_sunJaxWsBean;
+ private IType m_portTypeInterfaceType;
+ private String m_markerGroupUUID;
+ private String m_fqnPortType;
+
+ public MissingPortTypeCommand(IScoutBundle bundle, String markerGroupUUID, SunJaxWsBean sunJaxWsBean, IType portTypeInterfaceType) {
+ super("Missing or invalid port type");
+ m_bundle = bundle;
+ m_portTypeInterfaceType = portTypeInterfaceType;
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_markerGroupUUID = markerGroupUUID;
+
+ String portType = m_sunJaxWsBean.getImplementation();
+ if (portType == null) {
+ String name = m_sunJaxWsBean.getAlias();
+ if (!name.toLowerCase().endsWith("service") ||
+ !name.toLowerCase().endsWith("webservice")) {
+ name += "WebService";
+ }
+ m_fqnPortType = StringUtility.join(".", JaxWsSdkUtility.getRecommendedProviderImplPackageName(m_bundle), name);
+ }
+ else {
+ m_fqnPortType = portType;
+ }
+
+ setSolutionDescription("By using this task, the port type '" + m_fqnPortType + "' is created'.");
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ WsProviderImplNewOperation op = new WsProviderImplNewOperation();
+ op.setBundle(m_bundle);
+ op.setPackageName(Signature.getQualifier(m_fqnPortType));
+ op.setTypeName(Signature.getSimpleName(m_fqnPortType));
+ op.setCreateScoutWebServiceAnnotation(true);
+ op.setSessionFactoryQName(TypeUtility.getType(JaxWsRuntimeClasses.DefaultServerSessionFactory).getFullyQualifiedName());
+ op.setAuthenticationHandlerQName(TypeUtility.getType(JaxWsRuntimeClasses.BasicAuthenticationHandlerProvider).getFullyQualifiedName());
+ op.setCredentialValidationStrategyQName(TypeUtility.getType(JaxWsRuntimeClasses.ConfigIniCredentialValidationStrategy).getFullyQualifiedName());
+ op.setPortTypeInterfaceType(m_portTypeInterfaceType);
+ op.validate();
+ op.run(monitor, workingCopyManager);
+
+ m_sunJaxWsBean.setImplementation(m_fqnPortType);
+ XmlResource sunJaxWsResource = ResourceFactory.getSunJaxWsResource(m_bundle);
+ sunJaxWsResource.storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_URL_PATTERN_CHANGED, m_sunJaxWsBean.getAlias());
+
+ JaxWsSdk.getDefault().notifyPageReload(WebServiceProviderNodePage.class, m_markerGroupUUID, WebServiceProviderNodePage.DATA_JDT_TYPE);
+ JaxWsSdk.getDefault().notifyPageReload(WebServiceProviderCodeFirstNodePage.class, m_markerGroupUUID, WebServiceProviderCodeFirstNodePage.DATA_JDT_TYPE);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingPortTypeInheritanceCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingPortTypeInheritanceCommand.java
index b015080ec..42db14dc4 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingPortTypeInheritanceCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingPortTypeInheritanceCommand.java
@@ -1,128 +1,128 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.ISourceRange;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
-import org.eclipse.scout.sdk.util.ScoutUtility;
-import org.eclipse.scout.sdk.util.jdt.SourceRange;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.text.edits.ReplaceEdit;
-
-public class MissingPortTypeInheritanceCommand extends AbstractExecutableMarkerCommand {
-
- private IScoutBundle m_bundle;
- private IType m_type;
- private IType m_portTypeInterfaceType;
- private SunJaxWsBean m_sunJaxWsBean;
- private String m_markerGroupUUID;
-
- public MissingPortTypeInheritanceCommand(IScoutBundle bundle, String markerGroupUUID, IType type, IType portTypeInterfaceType, SunJaxWsBean sunJaxWsBean) {
- super("Port type must implement service interface");
- m_bundle = bundle;
- m_type = type;
- m_portTypeInterfaceType = portTypeInterfaceType;
- m_sunJaxWsBean = sunJaxWsBean;
- m_markerGroupUUID = markerGroupUUID;
- setSolutionDescription("By using this task, the port type '" + m_type.getElementName() + "' is changed to inherit from the service interface '" + m_portTypeInterfaceType.getElementName() + "'.");
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- boolean superInterfaceAvailable = false;
-
- ISourceRange classNameRange = m_type.getNameRange();
- int positionAfterClassName = classNameRange.getOffset() + classNameRange.getLength();
-
- String source = m_type.getCompilationUnit().getBuffer().getContents();
- String sourceAfterClassName = source.substring(positionAfterClassName);
-
- int insertPosition = -1;
- // try to find 'implements' keyword
- Pattern pattern = Pattern.compile("(implements)\\s+(.*?)\\s+\\{");
- Matcher matcher = pattern.matcher(sourceAfterClassName);
- if (matcher.find()) {
- insertPosition = matcher.end(1);
- superInterfaceAvailable = true;
- }
- else {
- // try to find end of class declaration
- pattern = Pattern.compile("\\s+\\{");
- matcher = pattern.matcher(sourceAfterClassName);
- if (matcher.find()) {
- insertPosition = matcher.end() - 1;
- }
- }
-
- if (insertPosition == -1) {
- throw new CoreException(new ScoutStatus("Could not determine insert position for interface declaration in type '" + m_type.getElementName() + "'"));
- }
- insertPosition = positionAfterClassName + insertPosition;
-
- ISourceRange interfaceInsertionRange = new SourceRange(insertPosition, 0);
-
- Document icuDoc = new Document(source);
- String implementsKeyword = null;
- if (!superInterfaceAvailable) {
- implementsKeyword = "implements";
- }
- String replacement = StringUtility.join(" ", implementsKeyword, m_portTypeInterfaceType.getElementName());
- if (superInterfaceAvailable) {
- replacement += ", ";
- }
- replacement = " " + replacement + " ";
-
- ReplaceEdit edit = new ReplaceEdit(interfaceInsertionRange.getOffset(), interfaceInsertionRange.getLength(), replacement);
- try {
- edit.apply(icuDoc);
- }
- catch (BadLocationException e) {
- throw new CoreException(new ScoutStatus("Failed to update interface declaration in type '" + m_type.getElementName() + "'", e));
- }
-
- ICompilationUnit icu = m_type.getCompilationUnit();
- workingCopyManager.register(icu, monitor);
-
- // format icu
- SourceFormatOperation sourceFormatOp = new SourceFormatOperation(m_type.getJavaProject(), icuDoc, null);
- sourceFormatOp.run(monitor, workingCopyManager);
-
- // write document back
- icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
-
- // create import directive of Activator if required
- JaxWsSdkUtility.createImportDirective(m_type, m_portTypeInterfaceType);
-
- // reconcilation
- workingCopyManager.reconcile(m_type.getCompilationUnit(), monitor);
- workingCopyManager.unregister(icu, monitor);
-
- JaxWsSdkUtility.overrideUnimplementedMethodsAsync(m_type);
-
- JaxWsSdk.getDefault().notifyPageReload(WebServiceProviderNodePage.class, m_markerGroupUUID, WebServiceProviderNodePage.DATA_JDT_TYPE);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
+import org.eclipse.scout.sdk.util.ScoutUtility;
+import org.eclipse.scout.sdk.util.jdt.SourceRange;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.text.edits.ReplaceEdit;
+
+public class MissingPortTypeInheritanceCommand extends AbstractExecutableMarkerCommand {
+
+ private IScoutBundle m_bundle;
+ private IType m_type;
+ private IType m_portTypeInterfaceType;
+ private SunJaxWsBean m_sunJaxWsBean;
+ private String m_markerGroupUUID;
+
+ public MissingPortTypeInheritanceCommand(IScoutBundle bundle, String markerGroupUUID, IType type, IType portTypeInterfaceType, SunJaxWsBean sunJaxWsBean) {
+ super("Port type must implement service interface");
+ m_bundle = bundle;
+ m_type = type;
+ m_portTypeInterfaceType = portTypeInterfaceType;
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_markerGroupUUID = markerGroupUUID;
+ setSolutionDescription("By using this task, the port type '" + m_type.getElementName() + "' is changed to inherit from the service interface '" + m_portTypeInterfaceType.getElementName() + "'.");
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ boolean superInterfaceAvailable = false;
+
+ ISourceRange classNameRange = m_type.getNameRange();
+ int positionAfterClassName = classNameRange.getOffset() + classNameRange.getLength();
+
+ String source = m_type.getCompilationUnit().getBuffer().getContents();
+ String sourceAfterClassName = source.substring(positionAfterClassName);
+
+ int insertPosition = -1;
+ // try to find 'implements' keyword
+ Pattern pattern = Pattern.compile("(implements)\\s+(.*?)\\s+\\{");
+ Matcher matcher = pattern.matcher(sourceAfterClassName);
+ if (matcher.find()) {
+ insertPosition = matcher.end(1);
+ superInterfaceAvailable = true;
+ }
+ else {
+ // try to find end of class declaration
+ pattern = Pattern.compile("\\s+\\{");
+ matcher = pattern.matcher(sourceAfterClassName);
+ if (matcher.find()) {
+ insertPosition = matcher.end() - 1;
+ }
+ }
+
+ if (insertPosition == -1) {
+ throw new CoreException(new ScoutStatus("Could not determine insert position for interface declaration in type '" + m_type.getElementName() + "'"));
+ }
+ insertPosition = positionAfterClassName + insertPosition;
+
+ ISourceRange interfaceInsertionRange = new SourceRange(insertPosition, 0);
+
+ Document icuDoc = new Document(source);
+ String implementsKeyword = null;
+ if (!superInterfaceAvailable) {
+ implementsKeyword = "implements";
+ }
+ String replacement = StringUtility.join(" ", implementsKeyword, m_portTypeInterfaceType.getElementName());
+ if (superInterfaceAvailable) {
+ replacement += ", ";
+ }
+ replacement = " " + replacement + " ";
+
+ ReplaceEdit edit = new ReplaceEdit(interfaceInsertionRange.getOffset(), interfaceInsertionRange.getLength(), replacement);
+ try {
+ edit.apply(icuDoc);
+ }
+ catch (BadLocationException e) {
+ throw new CoreException(new ScoutStatus("Failed to update interface declaration in type '" + m_type.getElementName() + "'", e));
+ }
+
+ ICompilationUnit icu = m_type.getCompilationUnit();
+ workingCopyManager.register(icu, monitor);
+
+ // format icu
+ SourceFormatOperation sourceFormatOp = new SourceFormatOperation(m_type.getJavaProject(), icuDoc, null);
+ sourceFormatOp.run(monitor, workingCopyManager);
+
+ // write document back
+ icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
+
+ // create import directive of Activator if required
+ JaxWsSdkUtility.createImportDirective(m_type, m_portTypeInterfaceType);
+
+ // reconcilation
+ workingCopyManager.reconcile(m_type.getCompilationUnit(), monitor);
+ workingCopyManager.unregister(icu, monitor);
+
+ JaxWsSdkUtility.overrideUnimplementedMethodsAsync(m_type);
+
+ JaxWsSdk.getDefault().notifyPageReload(WebServiceProviderNodePage.class, m_markerGroupUUID, WebServiceProviderNodePage.DATA_JDT_TYPE);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingScoutWebServiceAnnotationCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingScoutWebServiceAnnotationCommand.java
index baa959a3d..a1b54ae71 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingScoutWebServiceAnnotationCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingScoutWebServiceAnnotationCommand.java
@@ -1,40 +1,40 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
-
-public class MissingScoutWebServiceAnnotationCommand extends AbstractExecutableMarkerCommand {
-
- private IType m_declaringType;
- private IType m_interfacePortType;
-
- public MissingScoutWebServiceAnnotationCommand(IType declaringType) {
- super("Missing annotation '" + TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName() + "'");
- m_declaringType = declaringType;
- setSolutionDescription("By using this task, the port type '" + m_declaringType.getElementName() + "' is annotated with '" + TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName() + "'.");
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- AnnotationUpdateOperation op = new AnnotationUpdateOperation();
- op.setDeclaringType(m_declaringType);
- op.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
- new OperationJob(op).schedule();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
+
+public class MissingScoutWebServiceAnnotationCommand extends AbstractExecutableMarkerCommand {
+
+ private IType m_declaringType;
+ private IType m_interfacePortType;
+
+ public MissingScoutWebServiceAnnotationCommand(IType declaringType) {
+ super("Missing annotation '" + TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName() + "'");
+ m_declaringType = declaringType;
+ setSolutionDescription("By using this task, the port type '" + m_declaringType.getElementName() + "' is annotated with '" + TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName() + "'.");
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ AnnotationUpdateOperation op = new AnnotationUpdateOperation();
+ op.setDeclaringType(m_declaringType);
+ op.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
+ new OperationJob(op).schedule();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingServiceCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingServiceCommand.java
index 025c884e0..c0d6dcd80 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingServiceCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingServiceCommand.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-public class MissingServiceCommand extends AbstractNonExecutableMarkerCommand {
-
- public MissingServiceCommand(String wsdlFilename) {
- super("No service found in WSDL file '" + wsdlFilename + "'");
- setSolutionDescription("At least, one service must be configured");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+public class MissingServiceCommand extends AbstractNonExecutableMarkerCommand {
+
+ public MissingServiceCommand(String wsdlFilename) {
+ super("No service found in WSDL file '" + wsdlFilename + "'");
+ setSolutionDescription("At least, one service must be configured");
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingWsdlCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingWsdlCommand.java
index f256634d4..4d01123bf 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingWsdlCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MissingWsdlCommand.java
@@ -1,72 +1,72 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsdlNewWizard;
-
-public class MissingWsdlCommand extends AbstractExecutableMarkerCommand {
-
- private IScoutBundle m_bundle;
- /**
- * Used for WS provider
- */
- private SunJaxWsBean m_sunJaxWsBean;
- /**
- * User for WS consumer
- */
- private BuildJaxWsBean m_buildJaxWsBean;
- private WsdlResource m_wsdlResource;
-
- private WsdlNewWizard m_wizard;
-
- public MissingWsdlCommand(IScoutBundle bundle, WsdlResource wsdlResource, SunJaxWsBean sunJaxWsBean) {
- super("Missing WSDL file '" + wsdlResource.getFile().getName() + "'");
- setSolutionDescription("By using this task, a new WSDL file is created.");
- m_bundle = bundle;
- m_sunJaxWsBean = sunJaxWsBean;
- m_wsdlResource = wsdlResource;
- }
-
- public MissingWsdlCommand(IScoutBundle bundle, WsdlResource wsdlResource, BuildJaxWsBean buildJaxWsBean) {
- super("Missing WSDL file '" + wsdlResource.getFile().getName() + "'");
- setSolutionDescription("By using this task, a new WSDL file is created.");
- m_bundle = bundle;
- m_buildJaxWsBean = buildJaxWsBean;
- m_wsdlResource = wsdlResource;
- }
-
- @Override
- public boolean prepareForUi() throws CoreException {
- if (m_sunJaxWsBean != null) {
- m_wizard = new WsdlNewWizard(m_bundle, m_sunJaxWsBean, m_wsdlResource);
- }
- else {
- m_wizard = new WsdlNewWizard(m_bundle, m_buildJaxWsBean, m_wsdlResource);
- }
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(m_wizard);
- wizardDialog.setPageSize(650, 410);
- return wizardDialog.open() == Window.OK;
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- // operation executed within wizard
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsdlNewWizard;
+
+public class MissingWsdlCommand extends AbstractExecutableMarkerCommand {
+
+ private IScoutBundle m_bundle;
+ /**
+ * Used for WS provider
+ */
+ private SunJaxWsBean m_sunJaxWsBean;
+ /**
+ * User for WS consumer
+ */
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private WsdlResource m_wsdlResource;
+
+ private WsdlNewWizard m_wizard;
+
+ public MissingWsdlCommand(IScoutBundle bundle, WsdlResource wsdlResource, SunJaxWsBean sunJaxWsBean) {
+ super("Missing WSDL file '" + wsdlResource.getFile().getName() + "'");
+ setSolutionDescription("By using this task, a new WSDL file is created.");
+ m_bundle = bundle;
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_wsdlResource = wsdlResource;
+ }
+
+ public MissingWsdlCommand(IScoutBundle bundle, WsdlResource wsdlResource, BuildJaxWsBean buildJaxWsBean) {
+ super("Missing WSDL file '" + wsdlResource.getFile().getName() + "'");
+ setSolutionDescription("By using this task, a new WSDL file is created.");
+ m_bundle = bundle;
+ m_buildJaxWsBean = buildJaxWsBean;
+ m_wsdlResource = wsdlResource;
+ }
+
+ @Override
+ public boolean prepareForUi() throws CoreException {
+ if (m_sunJaxWsBean != null) {
+ m_wizard = new WsdlNewWizard(m_bundle, m_sunJaxWsBean, m_wsdlResource);
+ }
+ else {
+ m_wizard = new WsdlNewWizard(m_bundle, m_buildJaxWsBean, m_wsdlResource);
+ }
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(m_wizard);
+ wizardDialog.setPageSize(650, 410);
+ return wizardDialog.open() == Window.OK;
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ // operation executed within wizard
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MultipleGlobalBindingsCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MultipleGlobalBindingsCommand.java
index b58b89c54..0b6a82133 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MultipleGlobalBindingsCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/MultipleGlobalBindingsCommand.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-public class MultipleGlobalBindingsCommand extends AbstractNonExecutableMarkerCommand {
-
- public MultipleGlobalBindingsCommand() {
- super("Multiple global binding definitions found");
- setSolutionDescription("Please note, that even though the binding is a global binding, it must be defined within schema scope in order to work. Thereby, the schema chosen is ignored and does not matter.");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+public class MultipleGlobalBindingsCommand extends AbstractNonExecutableMarkerCommand {
+
+ public MultipleGlobalBindingsCommand() {
+ super("Multiple global binding definitions found");
+ setSolutionDescription("Please note, that even though the binding is a global binding, it must be defined within schema scope in order to work. Thereby, the schema chosen is ignored and does not matter.");
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/StubRebuildCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/StubRebuildCommand.java
index 279ba63f9..a926772b1 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/StubRebuildCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/StubRebuildCommand.java
@@ -1,124 +1,124 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsStubGenerationOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ErrorDialog;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IOperationFinishedListener;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.MessageBox;
-
-public class StubRebuildCommand extends AbstractExecutableMarkerCommand {
-
- private IScoutBundle m_bundle;
-
- private String m_alias;
- private Map<String, List<String>> m_properties;
- private WsdlResource m_wsdlResource;
-
- public StubRebuildCommand(IScoutBundle bundle) {
- super("Webservice stub might be out of date");
- m_bundle = bundle;
- setSolutionDescription("By using this task, the webservice stub is rebuilt.");
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- WsStubGenerationOperation op = new WsStubGenerationOperation();
- op.setBundle(m_bundle);
- op.setAlias(m_alias);
- op.setProperties(m_properties);
- op.addOperationFinishedListener(new P_OperationFinishedListener());
- op.setWsdlFileName(m_wsdlResource.getFile().getName());
- IPath wsdlFolderPath = m_wsdlResource.getFile().getProjectRelativePath().removeLastSegments(1); // get folder of WSDL file
- op.setWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, wsdlFolderPath.toPortableString(), false));
- op.run(monitor, workingCopyManager);
- }
-
- private class P_OperationFinishedListener implements IOperationFinishedListener {
-
- @Override
- public void operationFinished(final boolean success, final Throwable e) {
- m_wsdlResource.notifyStubRebuilt(m_alias);
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (success) {
- MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_INFORMATION | SWT.OK);
- messageBox.setMessage(Texts.get("WsStubSuccessfullyGenerated"));
- messageBox.open();
- }
- else {
- ErrorDialog dialog = new ErrorDialog(Texts.get("StubGenerationFailed"));
- dialog.setError(Texts.get("WsStubGenerationFailed"), e);
- dialog.open();
- }
- }
- });
- }
- }
-
- private String getStacktrace(Throwable t) {
- if (t == null) {
- return null;
- }
- StringWriter writer = new StringWriter();
- t.printStackTrace(new PrintWriter(writer));
- return writer.toString();
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public String getAlias() {
- return m_alias;
- }
-
- public void setAlias(String alias) {
- m_alias = alias;
- }
-
- public Map<String, List<String>> getProperties() {
- return m_properties;
- }
-
- public void setProperties(Map<String, List<String>> properties) {
- m_properties = properties;
- }
-
- public WsdlResource getWsdlResource() {
- return m_wsdlResource;
- }
-
- public void setWsdlResource(WsdlResource wsdlResource) {
- m_wsdlResource = wsdlResource;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsStubGenerationOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ErrorDialog;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IOperationFinishedListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+
+public class StubRebuildCommand extends AbstractExecutableMarkerCommand {
+
+ private IScoutBundle m_bundle;
+
+ private String m_alias;
+ private Map<String, List<String>> m_properties;
+ private WsdlResource m_wsdlResource;
+
+ public StubRebuildCommand(IScoutBundle bundle) {
+ super("Webservice stub might be out of date");
+ m_bundle = bundle;
+ setSolutionDescription("By using this task, the webservice stub is rebuilt.");
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ WsStubGenerationOperation op = new WsStubGenerationOperation();
+ op.setBundle(m_bundle);
+ op.setAlias(m_alias);
+ op.setProperties(m_properties);
+ op.addOperationFinishedListener(new P_OperationFinishedListener());
+ op.setWsdlFileName(m_wsdlResource.getFile().getName());
+ IPath wsdlFolderPath = m_wsdlResource.getFile().getProjectRelativePath().removeLastSegments(1); // get folder of WSDL file
+ op.setWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, wsdlFolderPath.toPortableString(), false));
+ op.run(monitor, workingCopyManager);
+ }
+
+ private class P_OperationFinishedListener implements IOperationFinishedListener {
+
+ @Override
+ public void operationFinished(final boolean success, final Throwable e) {
+ m_wsdlResource.notifyStubRebuilt(m_alias);
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (success) {
+ MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_INFORMATION | SWT.OK);
+ messageBox.setMessage(Texts.get("WsStubSuccessfullyGenerated"));
+ messageBox.open();
+ }
+ else {
+ ErrorDialog dialog = new ErrorDialog(Texts.get("StubGenerationFailed"));
+ dialog.setError(Texts.get("WsStubGenerationFailed"), e);
+ dialog.open();
+ }
+ }
+ });
+ }
+ }
+
+ private String getStacktrace(Throwable t) {
+ if (t == null) {
+ return null;
+ }
+ StringWriter writer = new StringWriter();
+ t.printStackTrace(new PrintWriter(writer));
+ return writer.toString();
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public String getAlias() {
+ return m_alias;
+ }
+
+ public void setAlias(String alias) {
+ m_alias = alias;
+ }
+
+ public Map<String, List<String>> getProperties() {
+ return m_properties;
+ }
+
+ public void setProperties(Map<String, List<String>> properties) {
+ m_properties = properties;
+ }
+
+ public WsdlResource getWsdlResource() {
+ return m_wsdlResource;
+ }
+
+ public void setWsdlResource(WsdlResource wsdlResource) {
+ m_wsdlResource = wsdlResource;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/UrlPatternAliasMismatchCommand.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/UrlPatternAliasMismatchCommand.java
index 99e1310e2..57b178a73 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/UrlPatternAliasMismatchCommand.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/marker/commands/UrlPatternAliasMismatchCommand.java
@@ -1,44 +1,44 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-
-public class UrlPatternAliasMismatchCommand extends AbstractExecutableMarkerCommand {
-
- private IScoutBundle m_bundle;
- private SunJaxWsBean m_sunJaxWsBean;
- private String m_urlPattern;
-
- public UrlPatternAliasMismatchCommand(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, String servletAlias) {
- super("URL Pattern must start with JAX-WS servlet alias");
- m_bundle = bundle;
- m_sunJaxWsBean = sunJaxWsBean;
- m_urlPattern = JaxWsSdkUtility.normalizePath(servletAlias, SeparatorType.BothType) + m_sunJaxWsBean.getAlias();
- setSolutionDescription("By using this task, the URL Pattern is changed to '" + m_urlPattern + "'");
- }
-
- @Override
- public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- m_sunJaxWsBean.setUrlPattern(m_urlPattern);
- XmlResource sunJaxWsResource = ResourceFactory.getSunJaxWsResource(m_bundle);
- sunJaxWsResource.storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_URL_PATTERN_CHANGED, m_sunJaxWsBean.getAlias());
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.marker.commands;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+
+public class UrlPatternAliasMismatchCommand extends AbstractExecutableMarkerCommand {
+
+ private IScoutBundle m_bundle;
+ private SunJaxWsBean m_sunJaxWsBean;
+ private String m_urlPattern;
+
+ public UrlPatternAliasMismatchCommand(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, String servletAlias) {
+ super("URL Pattern must start with JAX-WS servlet alias");
+ m_bundle = bundle;
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_urlPattern = JaxWsSdkUtility.normalizePath(servletAlias, SeparatorType.BothType) + m_sunJaxWsBean.getAlias();
+ setSolutionDescription("By using this task, the URL Pattern is changed to '" + m_urlPattern + "'");
+ }
+
+ @Override
+ public void execute(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ m_sunJaxWsBean.setUrlPattern(m_urlPattern);
+ XmlResource sunJaxWsResource = ResourceFactory.getSunJaxWsResource(m_bundle);
+ sunJaxWsResource.storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_URL_PATTERN_CHANGED, m_sunJaxWsBean.getAlias());
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/AnnotationUpdateOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/AnnotationUpdateOperation.java
index b35b470b4..e654a7a23 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/AnnotationUpdateOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/AnnotationUpdateOperation.java
@@ -1,157 +1,157 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IMemberValuePair;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.operation.annotation.AnnotationCreateOperation;
-import org.eclipse.scout.sdk.operation.util.JavaElementFormatOperation;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class AnnotationUpdateOperation implements IOperation {
-
- private IType m_declaringType;
- private IType m_annotationType;
-
- private Map<String, IType> m_typePropertyMap;
- private Map<String, String> m_stringPropertyMap;
- private Set<String> m_propertyRemoveMap;
-
- public AnnotationUpdateOperation() {
- m_typePropertyMap = new HashMap<String, IType>();
- m_stringPropertyMap = new HashMap<String, String>();
- m_propertyRemoveMap = new HashSet<String>();
- }
-
- public void addTypeProperty(String propertyName, IType type) {
- m_typePropertyMap.put(propertyName, type);
- }
-
- public void addStringProperty(String propertyName, String value) {
- m_stringPropertyMap.put(propertyName, value);
- }
-
- public void removeProperty(String propertyName) {
- m_propertyRemoveMap.add(propertyName);
- }
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_declaringType == null) {
- throw new IllegalArgumentException("No declaring type set.");
- }
- if (m_annotationType == null) {
- throw new IllegalArgumentException("no Annotation Type set.");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- AnnotationCreateOperation op = new AnnotationCreateOperation(m_declaringType, Signature.createTypeSignature(m_annotationType.getFullyQualifiedName(), true));
- IAnnotation annotation = JaxWsSdkUtility.getAnnotation(m_declaringType, m_annotationType.getFullyQualifiedName(), false);
-
- Map<String, String> resolvedTypePropertyMap = new HashMap<String, String>();
-
- // if annotation is already installed, get properties already set
- if (TypeUtility.exists(annotation)) {
- for (IMemberValuePair pair : annotation.getMemberValuePairs()) {
- String propertyName = pair.getMemberName();
- Object propertyValue = pair.getValue();
-
- if (pair.getValueKind() == IMemberValuePair.K_CLASS) {
- resolvedTypePropertyMap.put(propertyName, (String) propertyValue);
- }
- else if (pair.getValueKind() == IMemberValuePair.K_STRING) {
- if (!m_stringPropertyMap.containsKey(propertyName)) {
- m_stringPropertyMap.put(propertyName, (String) propertyValue);
- }
- }
- }
- }
-
- // resolve qualified name of 'type properties' regarding to the imports directives installed
- for (String propertyName : m_typePropertyMap.keySet()) {
- IType type = m_typePropertyMap.get(propertyName);
- String resolvedTypeName = JaxWsSdkUtility.resolveTypeName(m_declaringType, type);
- resolvedTypePropertyMap.put(propertyName, resolvedTypeName);
- }
-
- // prepare creation of properties
- // type properties
- for (String propertyName : resolvedTypePropertyMap.keySet()) {
- if (!m_propertyRemoveMap.contains(propertyName)) {
- String resolvedTypeName = resolvedTypePropertyMap.get(propertyName);
- op.addParameter(propertyName + " = " + resolvedTypeName + ".class");
- }
- }
- // string properties
- for (String propertyName : m_stringPropertyMap.keySet()) {
- if (!m_propertyRemoveMap.contains(propertyName)) {
- op.addParameter(propertyName + " = \"" + m_stringPropertyMap.get(propertyName) + "\"");
- }
- }
-
- op.validate();
- op.run(monitor, workingCopyManager);
-
- // create import directives
- JaxWsSdkUtility.createImportDirective(m_declaringType, m_annotationType);
- for (IType type : m_typePropertyMap.values()) {
- JaxWsSdkUtility.createImportDirective(m_declaringType, type);
- }
- JaxWsSdkUtility.organizeImports(m_declaringType);
-
- JavaElementFormatOperation wellFormOp = new JavaElementFormatOperation(m_declaringType, true);
- wellFormOp.validate();
- try {
- wellFormOp.run(monitor, workingCopyManager);
- }
- catch (Exception e) {
- //nop
- }
- }
-
- @Override
- public String getOperationName() {
- return AnnotationUpdateOperation.class.getName();
- }
-
- public IType getDeclaringType() {
- return m_declaringType;
- }
-
- public void setDeclaringType(IType declaringType) {
- m_declaringType = declaringType;
- }
-
- public IType getAnnotationType() {
- return m_annotationType;
- }
-
- public void setAnnotationType(IType annotationType) {
- m_annotationType = annotationType;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IMemberValuePair;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.operation.annotation.AnnotationCreateOperation;
+import org.eclipse.scout.sdk.operation.util.JavaElementFormatOperation;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class AnnotationUpdateOperation implements IOperation {
+
+ private IType m_declaringType;
+ private IType m_annotationType;
+
+ private Map<String, IType> m_typePropertyMap;
+ private Map<String, String> m_stringPropertyMap;
+ private Set<String> m_propertyRemoveMap;
+
+ public AnnotationUpdateOperation() {
+ m_typePropertyMap = new HashMap<String, IType>();
+ m_stringPropertyMap = new HashMap<String, String>();
+ m_propertyRemoveMap = new HashSet<String>();
+ }
+
+ public void addTypeProperty(String propertyName, IType type) {
+ m_typePropertyMap.put(propertyName, type);
+ }
+
+ public void addStringProperty(String propertyName, String value) {
+ m_stringPropertyMap.put(propertyName, value);
+ }
+
+ public void removeProperty(String propertyName) {
+ m_propertyRemoveMap.add(propertyName);
+ }
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_declaringType == null) {
+ throw new IllegalArgumentException("No declaring type set.");
+ }
+ if (m_annotationType == null) {
+ throw new IllegalArgumentException("no Annotation Type set.");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ AnnotationCreateOperation op = new AnnotationCreateOperation(m_declaringType, Signature.createTypeSignature(m_annotationType.getFullyQualifiedName(), true));
+ IAnnotation annotation = JaxWsSdkUtility.getAnnotation(m_declaringType, m_annotationType.getFullyQualifiedName(), false);
+
+ Map<String, String> resolvedTypePropertyMap = new HashMap<String, String>();
+
+ // if annotation is already installed, get properties already set
+ if (TypeUtility.exists(annotation)) {
+ for (IMemberValuePair pair : annotation.getMemberValuePairs()) {
+ String propertyName = pair.getMemberName();
+ Object propertyValue = pair.getValue();
+
+ if (pair.getValueKind() == IMemberValuePair.K_CLASS) {
+ resolvedTypePropertyMap.put(propertyName, (String) propertyValue);
+ }
+ else if (pair.getValueKind() == IMemberValuePair.K_STRING) {
+ if (!m_stringPropertyMap.containsKey(propertyName)) {
+ m_stringPropertyMap.put(propertyName, (String) propertyValue);
+ }
+ }
+ }
+ }
+
+ // resolve qualified name of 'type properties' regarding to the imports directives installed
+ for (String propertyName : m_typePropertyMap.keySet()) {
+ IType type = m_typePropertyMap.get(propertyName);
+ String resolvedTypeName = JaxWsSdkUtility.resolveTypeName(m_declaringType, type);
+ resolvedTypePropertyMap.put(propertyName, resolvedTypeName);
+ }
+
+ // prepare creation of properties
+ // type properties
+ for (String propertyName : resolvedTypePropertyMap.keySet()) {
+ if (!m_propertyRemoveMap.contains(propertyName)) {
+ String resolvedTypeName = resolvedTypePropertyMap.get(propertyName);
+ op.addParameter(propertyName + " = " + resolvedTypeName + ".class");
+ }
+ }
+ // string properties
+ for (String propertyName : m_stringPropertyMap.keySet()) {
+ if (!m_propertyRemoveMap.contains(propertyName)) {
+ op.addParameter(propertyName + " = \"" + m_stringPropertyMap.get(propertyName) + "\"");
+ }
+ }
+
+ op.validate();
+ op.run(monitor, workingCopyManager);
+
+ // create import directives
+ JaxWsSdkUtility.createImportDirective(m_declaringType, m_annotationType);
+ for (IType type : m_typePropertyMap.values()) {
+ JaxWsSdkUtility.createImportDirective(m_declaringType, type);
+ }
+ JaxWsSdkUtility.organizeImports(m_declaringType);
+
+ JavaElementFormatOperation wellFormOp = new JavaElementFormatOperation(m_declaringType, true);
+ wellFormOp.validate();
+ try {
+ wellFormOp.run(monitor, workingCopyManager);
+ }
+ catch (Exception e) {
+ //nop
+ }
+ }
+
+ @Override
+ public String getOperationName() {
+ return AnnotationUpdateOperation.class.getName();
+ }
+
+ public IType getDeclaringType() {
+ return m_declaringType;
+ }
+
+ public void setDeclaringType(IType declaringType) {
+ m_declaringType = declaringType;
+ }
+
+ public IType getAnnotationType() {
+ return m_annotationType;
+ }
+
+ public void setAnnotationType(IType annotationType) {
+ m_annotationType = annotationType;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BindingFileCreateOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BindingFileCreateOperation.java
index 16a70f846..ac0868a3e 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BindingFileCreateOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BindingFileCreateOperation.java
@@ -1,229 +1,229 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import java.io.BufferedWriter;
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Date;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-
-public class BindingFileCreateOperation implements IOperation {
-
- private IScoutBundle m_bundle;
- private IPath m_projectRelativeFilePath;
- private IFile m_wsdlLocation;
- private String m_schemaTargetNamespace;
- private boolean m_createGlobalBindingSection;
- private IFolder m_wsdlDestinationFolder;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_bundle == null) {
- throw new IllegalArgumentException("no bundle set");
- }
-
- if (m_projectRelativeFilePath == null) {
- throw new IllegalArgumentException("no projectRelativePath set");
- }
-
- if (m_wsdlDestinationFolder == null) {
- throw new IllegalArgumentException("WSDL destination path must not be null");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- IFile bindingFile = JaxWsSdkUtility.getFile(m_bundle, m_projectRelativeFilePath.toPortableString(), true);
-
- ScoutXmlDocument xmlDocument = new ScoutXmlDocument();
-
- xmlDocument.setXmlVersion("1.0");
- xmlDocument.setXmlEncoding("UTF-8");
- xmlDocument.setPrettyPrint(true);
-
- ScoutXmlElement rootXml = createBindingsRootNode(xmlDocument);
- xmlDocument.setRoot(rootXml);
-
- rootXml.setNamespace("jaxws", "http://java.sun.com/xml/ns/jaxws");
- rootXml.setNamespace("jaxb", "http://java.sun.com/xml/ns/jaxb");
- rootXml.setNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/");
- rootXml.setNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
- rootXml.setNamespace("xjc", "http://java.sun.com/xml/ns/jaxb/xjc");
- rootXml.setName("jaxws:bindings");
- rootXml.setAttribute("version", "2.0");
- if (m_wsdlLocation != null) {
- IPath relativeWsdlFolderPath = m_wsdlDestinationFolder.getProjectRelativePath().makeRelativeTo(JaxWsSdkUtility.getParentFolder(m_bundle, bindingFile).getProjectRelativePath());
- rootXml.setAttribute("wsdlLocation", JaxWsSdkUtility.normalizePath(relativeWsdlFolderPath.toPortableString(), SeparatorType.TrailingType) + m_wsdlLocation.getName());
- }
- if (StringUtility.hasText(m_schemaTargetNamespace)) {
- rootXml.setAttribute("node", "wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='" + m_schemaTargetNamespace + "']");
- }
- else {
- rootXml.setAttribute("node", "wsdl:definitions/wsdl:types/xsd:schema");
- }
-
- if (isCreateGlobalBindingSection()) {
- ScoutXmlElement globalBindingsXml = rootXml.addChild();
- globalBindingsXml.setName("jaxb:globalBindings");
- IType utcDateAdapterType = TypeUtility.getType(JaxWsRuntimeClasses.UtcDateAdapter);
-
- ScoutXmlElement bindingJavaTypeXml = globalBindingsXml.addChild();
- bindingJavaTypeXml.setName("xjc:javaType");
- bindingJavaTypeXml.setAttribute("name", Date.class.getName());
- bindingJavaTypeXml.setAttribute("xmlType", "xsd:date");
- bindingJavaTypeXml.setAttribute("adapter", utcDateAdapterType.getFullyQualifiedName());
-
- bindingJavaTypeXml = globalBindingsXml.addChild();
- bindingJavaTypeXml.setName("xjc:javaType");
- bindingJavaTypeXml.setAttribute("name", Date.class.getName());
- bindingJavaTypeXml.setAttribute("xmlType", "xsd:time");
- bindingJavaTypeXml.setAttribute("adapter", utcDateAdapterType.getFullyQualifiedName());
-
- bindingJavaTypeXml = globalBindingsXml.addChild();
- bindingJavaTypeXml.setName("xjc:javaType");
- bindingJavaTypeXml.setAttribute("name", Date.class.getName());
- bindingJavaTypeXml.setAttribute("xmlType", "xsd:dateTime");
- bindingJavaTypeXml.setAttribute("adapter", utcDateAdapterType.getFullyQualifiedName());
- }
- /*
- * legacy: the following code dynamically creates adapters when stub is generated.
- * They simply act as delegates to the actual adapters.
- * If no specific package is configured (recommended approach), these adapters are
- * placed in package org.w3._2001.xmlschema. Thereby, various adapters are named in
- * sequence (Adapter1.java, Adapter2.java, ...).
- * This causes problems as different stub overwrite the respective adapters.
- */
-// ScoutXmlElement bindingJavaTypeXml = globalBindingsXml.addChild();
-// bindingJavaTypeXml.setName("jaxb:javaType");
-// bindingJavaTypeXml.setAttribute("name", Date.class.getName());
-// bindingJavaTypeXml.setAttribute("xmlType", "xsd:dateTime");
-// bindingJavaTypeXml.setAttribute("parseMethod", "org.eclipse.scout.jaxws.adapters.DateAdapterISO8601UTC.parseDate");
-// bindingJavaTypeXml.setAttribute("printMethod", "org.eclipse.scout.jaxws.adapters.DateAdapterISO8601UTC.printDate");
-
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- try {
- xmlDocument.write(os);
- InputStream is = new ByteArrayInputStream(os.toByteArray());
- bindingFile.setContents(is, true, false, monitor);
- }
- catch (IOException e) {
- throw new CoreException(new ScoutStatus(IStatus.ERROR, "could not create binding file.", e));
- }
- }
-
- @Override
- public String getOperationName() {
- return BindingFileCreateOperation.class.getName();
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public IPath getProjectRelativeFilePath() {
- return m_projectRelativeFilePath;
- }
-
- public void setProjectRelativeFilePath(IPath projectRelativeFilePath) {
- m_projectRelativeFilePath = projectRelativeFilePath;
- }
-
- public IFile getWsdlLocation() {
- return m_wsdlLocation;
- }
-
- public void setWsdlLocation(IFile wsdlLocation) {
- m_wsdlLocation = wsdlLocation;
- }
-
- public String getSchemaTargetNamespace() {
- return m_schemaTargetNamespace;
- }
-
- public void setSchemaTargetNamespace(String schemaTargetNamespace) {
- m_schemaTargetNamespace = schemaTargetNamespace;
- }
-
- public boolean isCreateGlobalBindingSection() {
- return m_createGlobalBindingSection;
- }
-
- public void setCreateGlobalBindingSection(boolean createGlobalBindingSection) {
- m_createGlobalBindingSection = createGlobalBindingSection;
- }
-
- public IFolder getWsdlDestinationFolder() {
- return m_wsdlDestinationFolder;
- }
-
- public void setWsdlDestinationFolder(IFolder wsdlDestinationFolder) {
- m_wsdlDestinationFolder = wsdlDestinationFolder;
- }
-
- private ScoutXmlElement createBindingsRootNode(ScoutXmlDocument xmlDocument) {
- // do not escape the quotation character because it used to specify XPath node constraint containing the targetNamespace definition
- return xmlDocument.new ScoutXmlElement("bindings") {
-
- private static final long serialVersionUID = 1L;
-
- @Override
- protected void writeEncoded(BufferedWriter bufferedWriter, String string) throws IOException {
- if (string == null) {
- return;
- }
- for (int i = 0; i < string.length(); i++) {
- char ch = string.charAt(i);
-
- if (ch == '\'') { // do not escape this character
- bufferedWriter.write(ch);
- }
- else {
- String escaped = ScoutXmlDocument.XML_ENTITIES.get(ch);
- if (escaped != null) {
- bufferedWriter.write(escaped);
- }
- else {
- bufferedWriter.write(ch);
- }
- }
- }
- }
- };
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import java.io.BufferedWriter;
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Date;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+
+public class BindingFileCreateOperation implements IOperation {
+
+ private IScoutBundle m_bundle;
+ private IPath m_projectRelativeFilePath;
+ private IFile m_wsdlLocation;
+ private String m_schemaTargetNamespace;
+ private boolean m_createGlobalBindingSection;
+ private IFolder m_wsdlDestinationFolder;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_bundle == null) {
+ throw new IllegalArgumentException("no bundle set");
+ }
+
+ if (m_projectRelativeFilePath == null) {
+ throw new IllegalArgumentException("no projectRelativePath set");
+ }
+
+ if (m_wsdlDestinationFolder == null) {
+ throw new IllegalArgumentException("WSDL destination path must not be null");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ IFile bindingFile = JaxWsSdkUtility.getFile(m_bundle, m_projectRelativeFilePath.toPortableString(), true);
+
+ ScoutXmlDocument xmlDocument = new ScoutXmlDocument();
+
+ xmlDocument.setXmlVersion("1.0");
+ xmlDocument.setXmlEncoding("UTF-8");
+ xmlDocument.setPrettyPrint(true);
+
+ ScoutXmlElement rootXml = createBindingsRootNode(xmlDocument);
+ xmlDocument.setRoot(rootXml);
+
+ rootXml.setNamespace("jaxws", "http://java.sun.com/xml/ns/jaxws");
+ rootXml.setNamespace("jaxb", "http://java.sun.com/xml/ns/jaxb");
+ rootXml.setNamespace("wsdl", "http://schemas.xmlsoap.org/wsdl/");
+ rootXml.setNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
+ rootXml.setNamespace("xjc", "http://java.sun.com/xml/ns/jaxb/xjc");
+ rootXml.setName("jaxws:bindings");
+ rootXml.setAttribute("version", "2.0");
+ if (m_wsdlLocation != null) {
+ IPath relativeWsdlFolderPath = m_wsdlDestinationFolder.getProjectRelativePath().makeRelativeTo(JaxWsSdkUtility.getParentFolder(m_bundle, bindingFile).getProjectRelativePath());
+ rootXml.setAttribute("wsdlLocation", JaxWsSdkUtility.normalizePath(relativeWsdlFolderPath.toPortableString(), SeparatorType.TrailingType) + m_wsdlLocation.getName());
+ }
+ if (StringUtility.hasText(m_schemaTargetNamespace)) {
+ rootXml.setAttribute("node", "wsdl:definitions/wsdl:types/xsd:schema[@targetNamespace='" + m_schemaTargetNamespace + "']");
+ }
+ else {
+ rootXml.setAttribute("node", "wsdl:definitions/wsdl:types/xsd:schema");
+ }
+
+ if (isCreateGlobalBindingSection()) {
+ ScoutXmlElement globalBindingsXml = rootXml.addChild();
+ globalBindingsXml.setName("jaxb:globalBindings");
+ IType utcDateAdapterType = TypeUtility.getType(JaxWsRuntimeClasses.UtcDateAdapter);
+
+ ScoutXmlElement bindingJavaTypeXml = globalBindingsXml.addChild();
+ bindingJavaTypeXml.setName("xjc:javaType");
+ bindingJavaTypeXml.setAttribute("name", Date.class.getName());
+ bindingJavaTypeXml.setAttribute("xmlType", "xsd:date");
+ bindingJavaTypeXml.setAttribute("adapter", utcDateAdapterType.getFullyQualifiedName());
+
+ bindingJavaTypeXml = globalBindingsXml.addChild();
+ bindingJavaTypeXml.setName("xjc:javaType");
+ bindingJavaTypeXml.setAttribute("name", Date.class.getName());
+ bindingJavaTypeXml.setAttribute("xmlType", "xsd:time");
+ bindingJavaTypeXml.setAttribute("adapter", utcDateAdapterType.getFullyQualifiedName());
+
+ bindingJavaTypeXml = globalBindingsXml.addChild();
+ bindingJavaTypeXml.setName("xjc:javaType");
+ bindingJavaTypeXml.setAttribute("name", Date.class.getName());
+ bindingJavaTypeXml.setAttribute("xmlType", "xsd:dateTime");
+ bindingJavaTypeXml.setAttribute("adapter", utcDateAdapterType.getFullyQualifiedName());
+ }
+ /*
+ * legacy: the following code dynamically creates adapters when stub is generated.
+ * They simply act as delegates to the actual adapters.
+ * If no specific package is configured (recommended approach), these adapters are
+ * placed in package org.w3._2001.xmlschema. Thereby, various adapters are named in
+ * sequence (Adapter1.java, Adapter2.java, ...).
+ * This causes problems as different stub overwrite the respective adapters.
+ */
+// ScoutXmlElement bindingJavaTypeXml = globalBindingsXml.addChild();
+// bindingJavaTypeXml.setName("jaxb:javaType");
+// bindingJavaTypeXml.setAttribute("name", Date.class.getName());
+// bindingJavaTypeXml.setAttribute("xmlType", "xsd:dateTime");
+// bindingJavaTypeXml.setAttribute("parseMethod", "org.eclipse.scout.jaxws.adapters.DateAdapterISO8601UTC.parseDate");
+// bindingJavaTypeXml.setAttribute("printMethod", "org.eclipse.scout.jaxws.adapters.DateAdapterISO8601UTC.printDate");
+
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ try {
+ xmlDocument.write(os);
+ InputStream is = new ByteArrayInputStream(os.toByteArray());
+ bindingFile.setContents(is, true, false, monitor);
+ }
+ catch (IOException e) {
+ throw new CoreException(new ScoutStatus(IStatus.ERROR, "could not create binding file.", e));
+ }
+ }
+
+ @Override
+ public String getOperationName() {
+ return BindingFileCreateOperation.class.getName();
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public IPath getProjectRelativeFilePath() {
+ return m_projectRelativeFilePath;
+ }
+
+ public void setProjectRelativeFilePath(IPath projectRelativeFilePath) {
+ m_projectRelativeFilePath = projectRelativeFilePath;
+ }
+
+ public IFile getWsdlLocation() {
+ return m_wsdlLocation;
+ }
+
+ public void setWsdlLocation(IFile wsdlLocation) {
+ m_wsdlLocation = wsdlLocation;
+ }
+
+ public String getSchemaTargetNamespace() {
+ return m_schemaTargetNamespace;
+ }
+
+ public void setSchemaTargetNamespace(String schemaTargetNamespace) {
+ m_schemaTargetNamespace = schemaTargetNamespace;
+ }
+
+ public boolean isCreateGlobalBindingSection() {
+ return m_createGlobalBindingSection;
+ }
+
+ public void setCreateGlobalBindingSection(boolean createGlobalBindingSection) {
+ m_createGlobalBindingSection = createGlobalBindingSection;
+ }
+
+ public IFolder getWsdlDestinationFolder() {
+ return m_wsdlDestinationFolder;
+ }
+
+ public void setWsdlDestinationFolder(IFolder wsdlDestinationFolder) {
+ m_wsdlDestinationFolder = wsdlDestinationFolder;
+ }
+
+ private ScoutXmlElement createBindingsRootNode(ScoutXmlDocument xmlDocument) {
+ // do not escape the quotation character because it used to specify XPath node constraint containing the targetNamespace definition
+ return xmlDocument.new ScoutXmlElement("bindings") {
+
+ private static final long serialVersionUID = 1L;
+
+ @Override
+ protected void writeEncoded(BufferedWriter bufferedWriter, String string) throws IOException {
+ if (string == null) {
+ return;
+ }
+ for (int i = 0; i < string.length(); i++) {
+ char ch = string.charAt(i);
+
+ if (ch == '\'') { // do not escape this character
+ bufferedWriter.write(ch);
+ }
+ else {
+ String escaped = ScoutXmlDocument.XML_ENTITIES.get(ch);
+ if (escaped != null) {
+ bufferedWriter.write(escaped);
+ }
+ else {
+ bufferedWriter.write(ch);
+ }
+ }
+ }
+ }
+ };
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BuildJaxWsEntryCreateOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BuildJaxWsEntryCreateOperation.java
index 61eb01686..c25c3eeb5 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BuildJaxWsEntryCreateOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BuildJaxWsEntryCreateOperation.java
@@ -1,140 +1,140 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-
-public class BuildJaxWsEntryCreateOperation implements IOperation {
-
- private IScoutBundle m_bundle;
-
- private String m_alias;
- private String m_wsdlFile;
- private Map<String, List<String>> m_buildProperties;
-
- private WebserviceEnum m_webserviceEnum;
- private BuildJaxWsBean m_createdBuildJaxWsBean;
-
- public BuildJaxWsEntryCreateOperation(WebserviceEnum webserviceEnum) {
- m_webserviceEnum = webserviceEnum;
- }
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_bundle == null) {
- throw new IllegalArgumentException("bundle not set");
- }
-
- if (!StringUtility.hasText(m_alias)) {
- throw new IllegalArgumentException("alias must not be empty");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- XmlResource buildJaxWsResource = ResourceFactory.getBuildJaxWsResource(m_bundle);
- if (buildJaxWsResource.getFile() == null || !buildJaxWsResource.getFile().exists()) {
- // create build-jaxws.xml file
- BuildJaxWsFileCreateOperation op = new BuildJaxWsFileCreateOperation(m_bundle);
- op.run(monitor, workingCopyManager);
- }
- ScoutXmlDocument xmlDocument = buildJaxWsResource.loadXml();
-
- ScoutXmlElement xml;
- if (m_webserviceEnum == WebserviceEnum.Provider) {
- xml = xmlDocument.getRoot().addChild(BuildJaxWsBean.XML_PROVIDER);
- }
- else {
- xml = xmlDocument.getRoot().addChild(BuildJaxWsBean.XML_CONSUMER);
- }
-
- BuildJaxWsBean bean = new BuildJaxWsBean(xml, m_webserviceEnum);
- bean.setAlias(m_alias);
- if (m_webserviceEnum == WebserviceEnum.Consumer) {
- bean.setWsdl(m_wsdlFile); // if provider, this is stored in sun-jaxws.xml
- }
- bean.setProperties(m_buildProperties);
- m_createdBuildJaxWsBean = bean;
-
- ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(m_createdBuildJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_ENTRY_ADDED, monitor, m_alias);
- }
-
- @Override
- public String getOperationName() {
- return BuildJaxWsEntryCreateOperation.class.getName();
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public String getAlias() {
- return m_alias;
- }
-
- public void setAlias(String alias) {
- m_alias = alias;
- }
-
- public Map<String, List<String>> getBuildProperties() {
- return m_buildProperties;
- }
-
- public void setBuildProperties(Map<String, List<String>> buildProperties) {
- m_buildProperties = buildProperties;
- }
-
- /**
- * only used for webservice consumer
- *
- * @return
- */
- public String getWsdlFile() {
- return m_wsdlFile;
- }
-
- /**
- * only used for webservice consumer
- *
- * @param wsdlFile
- */
- public void setWsdlFile(String wsdlFile) {
- m_wsdlFile = wsdlFile;
- }
-
- /**
- * After execution, to get the created {@link BuildJaxWsBean}.
- *
- * @return
- */
- public BuildJaxWsBean getCreatedBuildJaxWsBean() {
- return m_createdBuildJaxWsBean;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+
+public class BuildJaxWsEntryCreateOperation implements IOperation {
+
+ private IScoutBundle m_bundle;
+
+ private String m_alias;
+ private String m_wsdlFile;
+ private Map<String, List<String>> m_buildProperties;
+
+ private WebserviceEnum m_webserviceEnum;
+ private BuildJaxWsBean m_createdBuildJaxWsBean;
+
+ public BuildJaxWsEntryCreateOperation(WebserviceEnum webserviceEnum) {
+ m_webserviceEnum = webserviceEnum;
+ }
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_bundle == null) {
+ throw new IllegalArgumentException("bundle not set");
+ }
+
+ if (!StringUtility.hasText(m_alias)) {
+ throw new IllegalArgumentException("alias must not be empty");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ XmlResource buildJaxWsResource = ResourceFactory.getBuildJaxWsResource(m_bundle);
+ if (buildJaxWsResource.getFile() == null || !buildJaxWsResource.getFile().exists()) {
+ // create build-jaxws.xml file
+ BuildJaxWsFileCreateOperation op = new BuildJaxWsFileCreateOperation(m_bundle);
+ op.run(monitor, workingCopyManager);
+ }
+ ScoutXmlDocument xmlDocument = buildJaxWsResource.loadXml();
+
+ ScoutXmlElement xml;
+ if (m_webserviceEnum == WebserviceEnum.Provider) {
+ xml = xmlDocument.getRoot().addChild(BuildJaxWsBean.XML_PROVIDER);
+ }
+ else {
+ xml = xmlDocument.getRoot().addChild(BuildJaxWsBean.XML_CONSUMER);
+ }
+
+ BuildJaxWsBean bean = new BuildJaxWsBean(xml, m_webserviceEnum);
+ bean.setAlias(m_alias);
+ if (m_webserviceEnum == WebserviceEnum.Consumer) {
+ bean.setWsdl(m_wsdlFile); // if provider, this is stored in sun-jaxws.xml
+ }
+ bean.setProperties(m_buildProperties);
+ m_createdBuildJaxWsBean = bean;
+
+ ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(m_createdBuildJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_ENTRY_ADDED, monitor, m_alias);
+ }
+
+ @Override
+ public String getOperationName() {
+ return BuildJaxWsEntryCreateOperation.class.getName();
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public String getAlias() {
+ return m_alias;
+ }
+
+ public void setAlias(String alias) {
+ m_alias = alias;
+ }
+
+ public Map<String, List<String>> getBuildProperties() {
+ return m_buildProperties;
+ }
+
+ public void setBuildProperties(Map<String, List<String>> buildProperties) {
+ m_buildProperties = buildProperties;
+ }
+
+ /**
+ * only used for webservice consumer
+ *
+ * @return
+ */
+ public String getWsdlFile() {
+ return m_wsdlFile;
+ }
+
+ /**
+ * only used for webservice consumer
+ *
+ * @param wsdlFile
+ */
+ public void setWsdlFile(String wsdlFile) {
+ m_wsdlFile = wsdlFile;
+ }
+
+ /**
+ * After execution, to get the created {@link BuildJaxWsBean}.
+ *
+ * @return
+ */
+ public BuildJaxWsBean getCreatedBuildJaxWsBean() {
+ return m_createdBuildJaxWsBean;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BuildJaxWsFileCreateOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BuildJaxWsFileCreateOperation.java
index b7c22112a..36c1afc10 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BuildJaxWsFileCreateOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/BuildJaxWsFileCreateOperation.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-
-public class BuildJaxWsFileCreateOperation implements IOperation {
-
- private IScoutBundle m_bundle;
-
- public BuildJaxWsFileCreateOperation(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- @Override
- public void validate() throws IllegalArgumentException {
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- ScoutXmlDocument xmlDocument = new ScoutXmlDocument();
- xmlDocument.setRoot("webservices");
- ResourceFactory.getBuildJaxWsResource(m_bundle, true).storeXml(xmlDocument, IResourceListener.EVENT_BUILDJAXWS_REPLACED, monitor, IResourceListener.ELEMENT_FILE);
- }
-
- @Override
- public String getOperationName() {
- return BuildJaxWsFileCreateOperation.class.getName();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+
+public class BuildJaxWsFileCreateOperation implements IOperation {
+
+ private IScoutBundle m_bundle;
+
+ public BuildJaxWsFileCreateOperation(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ ScoutXmlDocument xmlDocument = new ScoutXmlDocument();
+ xmlDocument.setRoot("webservices");
+ ResourceFactory.getBuildJaxWsResource(m_bundle, true).storeXml(xmlDocument, IResourceListener.EVENT_BUILDJAXWS_REPLACED, monitor, IResourceListener.ELEMENT_FILE);
+ }
+
+ @Override
+ public String getOperationName() {
+ return BuildJaxWsFileCreateOperation.class.getName();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/CommandExecutionOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/CommandExecutionOperation.java
index d608ee8f7..c42121652 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/CommandExecutionOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/CommandExecutionOperation.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.IMarkerCommand;
-
-public class CommandExecutionOperation implements IOperation {
-
- private IMarkerCommand[] m_commands;
-
- public CommandExecutionOperation(IMarkerCommand... command) {
- m_commands = command;
- }
-
- @Override
- public void validate() throws IllegalArgumentException {
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- JaxWsSdk.getDefault().getMarkerQueueManager().suspend();
- try {
- for (IMarkerCommand command : m_commands) {
- if (command.isDoExecute()) {
- command.execute(monitor, workingCopyManager);
- }
- }
- }
- finally {
- JaxWsSdk.getDefault().getMarkerQueueManager().resume();
- }
- }
-
- @Override
- public String getOperationName() {
- return CommandExecutionOperation.class.getName();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.IMarkerCommand;
+
+public class CommandExecutionOperation implements IOperation {
+
+ private IMarkerCommand[] m_commands;
+
+ public CommandExecutionOperation(IMarkerCommand... command) {
+ m_commands = command;
+ }
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ JaxWsSdk.getDefault().getMarkerQueueManager().suspend();
+ try {
+ for (IMarkerCommand command : m_commands) {
+ if (command.isDoExecute()) {
+ command.execute(monitor, workingCopyManager);
+ }
+ }
+ }
+ finally {
+ JaxWsSdk.getDefault().getMarkerQueueManager().resume();
+ }
+ }
+
+ @Override
+ public String getOperationName() {
+ return CommandExecutionOperation.class.getName();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/ExternalFileCopyOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/ExternalFileCopyOperation.java
index dad611cfb..b66cadfbd 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/ExternalFileCopyOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/ExternalFileCopyOperation.java
@@ -1,148 +1,148 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-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.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class ExternalFileCopyOperation implements IOperation {
-
- private IScoutBundle m_bundle;
- private boolean m_overwrite;
- private File m_externalFile;
- private IPath m_workspacePath;
- private IFile m_fileCopied;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_bundle == null) {
- throw new IllegalArgumentException("No bundle provided.");
- }
- if (m_externalFile == null) {
- throw new IllegalArgumentException("No file to copy provided.");
- }
- if (m_workspacePath == null) {
- throw new IllegalArgumentException("No workspace path provided.");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- IProject tempProject = null;
- try {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- tempProject = workspace.getRoot().getProject("temp.project");
- if (!tempProject.exists()) {
- tempProject.create(new NullProgressMonitor());
- }
- if (!tempProject.isOpen()) {
- tempProject.open(new NullProgressMonitor());
- }
-
- Path path = new Path(m_externalFile.getAbsolutePath());
- IFile link = tempProject.getFile(path.lastSegment());
- link.createLink(path, IResource.NONE, new NullProgressMonitor());
-
- if (link.exists() && link.isAccessible()) {
- IProject project = m_bundle.getProject();
- IPath projectPath = project.getFullPath();
-
- IPath relativePath = m_workspacePath.append(new Path(link.getName()));
- IFile targetFile = project.getFile(relativePath);
- if (targetFile.exists()) {
- if (m_overwrite) {
- targetFile.delete(true, true, new NullProgressMonitor());
- }
- else {
- throw new CoreException(new ScoutStatus("File '" + targetFile.getFullPath().toPortableString() + "' already exists."));
- }
- }
-
- // create folder if not exist yet
- JaxWsSdkUtility.getFolder(m_bundle, m_workspacePath.toPortableString(), true);
- IPath destination = projectPath.append(relativePath);
- link.copy(destination, true, new NullProgressMonitor());
- m_fileCopied = m_bundle.getProject().getFile(destination.makeRelativeTo(projectPath));
- }
- else {
- throw new CoreException(new ScoutStatus("Temporary link '" + link.getFullPath().toPortableString() + "' is not accessible."));
- }
- }
- finally {
- if (tempProject != null && tempProject.exists()) {
- try {
- tempProject.delete(true, new NullProgressMonitor());
- }
- catch (CoreException e) {
- JaxWsSdk.logError("Could not cleanup temporary project for copying file.", e);
- }
- }
- }
- }
-
- @Override
- public String getOperationName() {
- return ExternalFileCopyOperation.class.getName();
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public File getExternalFile() {
- return m_externalFile;
- }
-
- public void setExternalFile(File externalFile) {
- m_externalFile = externalFile;
- }
-
- public IPath getWorkspacePath() {
- return m_workspacePath;
- }
-
- public void setWorkspacePath(IPath workspacePath) {
- m_workspacePath = workspacePath;
- }
-
- public IFile getFileCopied() {
- return m_fileCopied;
- }
-
- public boolean isOverwrite() {
- return m_overwrite;
- }
-
- public void setOverwrite(boolean overwrite) {
- m_overwrite = overwrite;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+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.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class ExternalFileCopyOperation implements IOperation {
+
+ private IScoutBundle m_bundle;
+ private boolean m_overwrite;
+ private File m_externalFile;
+ private IPath m_workspacePath;
+ private IFile m_fileCopied;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_bundle == null) {
+ throw new IllegalArgumentException("No bundle provided.");
+ }
+ if (m_externalFile == null) {
+ throw new IllegalArgumentException("No file to copy provided.");
+ }
+ if (m_workspacePath == null) {
+ throw new IllegalArgumentException("No workspace path provided.");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ IProject tempProject = null;
+ try {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ tempProject = workspace.getRoot().getProject("temp.project");
+ if (!tempProject.exists()) {
+ tempProject.create(new NullProgressMonitor());
+ }
+ if (!tempProject.isOpen()) {
+ tempProject.open(new NullProgressMonitor());
+ }
+
+ Path path = new Path(m_externalFile.getAbsolutePath());
+ IFile link = tempProject.getFile(path.lastSegment());
+ link.createLink(path, IResource.NONE, new NullProgressMonitor());
+
+ if (link.exists() && link.isAccessible()) {
+ IProject project = m_bundle.getProject();
+ IPath projectPath = project.getFullPath();
+
+ IPath relativePath = m_workspacePath.append(new Path(link.getName()));
+ IFile targetFile = project.getFile(relativePath);
+ if (targetFile.exists()) {
+ if (m_overwrite) {
+ targetFile.delete(true, true, new NullProgressMonitor());
+ }
+ else {
+ throw new CoreException(new ScoutStatus("File '" + targetFile.getFullPath().toPortableString() + "' already exists."));
+ }
+ }
+
+ // create folder if not exist yet
+ JaxWsSdkUtility.getFolder(m_bundle, m_workspacePath.toPortableString(), true);
+ IPath destination = projectPath.append(relativePath);
+ link.copy(destination, true, new NullProgressMonitor());
+ m_fileCopied = m_bundle.getProject().getFile(destination.makeRelativeTo(projectPath));
+ }
+ else {
+ throw new CoreException(new ScoutStatus("Temporary link '" + link.getFullPath().toPortableString() + "' is not accessible."));
+ }
+ }
+ finally {
+ if (tempProject != null && tempProject.exists()) {
+ try {
+ tempProject.delete(true, new NullProgressMonitor());
+ }
+ catch (CoreException e) {
+ JaxWsSdk.logError("Could not cleanup temporary project for copying file.", e);
+ }
+ }
+ }
+ }
+
+ @Override
+ public String getOperationName() {
+ return ExternalFileCopyOperation.class.getName();
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public File getExternalFile() {
+ return m_externalFile;
+ }
+
+ public void setExternalFile(File externalFile) {
+ m_externalFile = externalFile;
+ }
+
+ public IPath getWorkspacePath() {
+ return m_workspacePath;
+ }
+
+ public void setWorkspacePath(IPath workspacePath) {
+ m_workspacePath = workspacePath;
+ }
+
+ public IFile getFileCopied() {
+ return m_fileCopied;
+ }
+
+ public boolean isOverwrite() {
+ return m_overwrite;
+ }
+
+ public void setOverwrite(boolean overwrite) {
+ m_overwrite = overwrite;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/FileDeleteOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/FileDeleteOperation.java
index 274e7dc33..2f6d31ff4 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/FileDeleteOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/FileDeleteOperation.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-
-public class FileDeleteOperation implements IOperation {
-
- private IFile m_file;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_file == null) {
- throw new IllegalArgumentException("no file set");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- m_file.delete(true, true, monitor);
- }
-
- @Override
- public String getOperationName() {
- return FileDeleteOperation.class.getName();
- }
-
- public IFile getFile() {
- return m_file;
- }
-
- public void setFile(IFile file) {
- m_file = file;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+
+public class FileDeleteOperation implements IOperation {
+
+ private IFile m_file;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_file == null) {
+ throw new IllegalArgumentException("no file set");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ m_file.delete(true, true, monitor);
+ }
+
+ @Override
+ public String getOperationName() {
+ return FileDeleteOperation.class.getName();
+ }
+
+ public IFile getFile() {
+ return m_file;
+ }
+
+ public void setFile(IFile file) {
+ m_file = file;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/HandlerNewOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/HandlerNewOperation.java
index 8f69da522..48d558271 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/HandlerNewOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/HandlerNewOperation.java
@@ -1,180 +1,180 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import javax.xml.ws.handler.LogicalHandler;
-import javax.xml.ws.handler.LogicalMessageContext;
-import javax.xml.ws.handler.soap.SOAPHandler;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jface.text.Document;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.operation.util.ScoutTypeNewOperation;
-import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
-import org.eclipse.scout.sdk.util.ScoutUtility;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class HandlerNewOperation implements IOperation {
-
- private IScoutBundle m_bundle;
- private String m_typeName;
- private String m_packageName;
- private boolean m_transactional;
- private IType m_sessionFactoryType;
- private IType m_superType;
- private IType m_createdType;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_bundle == null) {
- throw new IllegalArgumentException("bundle not set");
- }
- if (m_superType == null) {
- throw new IllegalArgumentException("superType not set");
- }
- if (m_typeName == null) {
- throw new IllegalArgumentException("typeName not set");
- }
- if (m_packageName == null) {
- throw new IllegalArgumentException("packageName not set");
- }
- if (m_transactional && m_sessionFactoryType == null) {
- throw new IllegalArgumentException("session factory must be set");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- ScoutTypeNewOperation opType = new ScoutTypeNewOperation(m_typeName, m_packageName, m_bundle);
-
- String superTypeSignature;
- if (m_superType.getFullyQualifiedName().equals(LogicalHandler.class.getName())) {
- superTypeSignature = Signature.createTypeSignature(LogicalHandler.class.getName() + "<" + LogicalMessageContext.class.getName() + ">", false);
- }
- else if (m_superType.getFullyQualifiedName().equals(SOAPHandler.class.getName())) {
- superTypeSignature = Signature.createTypeSignature(SOAPHandler.class.getName() + "<" + SOAPMessageContext.class.getName() + ">", false);
- }
- else {
- superTypeSignature = Signature.createTypeSignature(m_superType.getFullyQualifiedName(), true);
- }
- if (m_superType.isInterface()) {
- opType.addInterfaceSignature(superTypeSignature);
- }
- else {
- opType.setSuperTypeSignature(superTypeSignature);
- }
- opType.run(monitor, workingCopyManager);
- m_createdType = opType.getCreatedType();
- workingCopyManager.register(m_createdType.getCompilationUnit(), monitor);
-
- if (m_transactional) {
- AnnotationUpdateOperation opAnnotation = new AnnotationUpdateOperation();
- opAnnotation.setDeclaringType(m_createdType);
- opAnnotation.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction));
-
- String defaultSessionFactory = (String) TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getMethod(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, new String[0]).getDefaultValue().getValue();
-
- if (!isSameType(m_sessionFactoryType.getFullyQualifiedName(), defaultSessionFactory)) {
- opAnnotation.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, m_sessionFactoryType);
- }
-
- opAnnotation.validate();
- opAnnotation.run(monitor, workingCopyManager);
- }
-
- JaxWsSdkUtility.overrideUnimplementedMethodsAsync(m_createdType);
-
- // format icu
- ICompilationUnit icu = m_createdType.getCompilationUnit();
- Document icuDoc = new Document(icu.getBuffer().getContents());
-
- SourceFormatOperation sourceFormatOp = new SourceFormatOperation(m_createdType.getJavaProject(), icuDoc, null);
- sourceFormatOp.run(monitor, workingCopyManager);
-
- // write document back
- icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
-
- // reconcilation
- workingCopyManager.reconcile(icu, monitor);
- }
-
- private IType createType(String qualifiedTypeName, IType interfaceType, IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- IType type;
- if (TypeUtility.existsType(qualifiedTypeName)) {
- type = TypeUtility.getType(qualifiedTypeName);
- }
- else {
- String typeName = Signature.getSimpleName(qualifiedTypeName);
- String packageName = Signature.getQualifier(qualifiedTypeName);
-
- ScoutTypeNewOperation newTypeOp = new ScoutTypeNewOperation(typeName, packageName, m_bundle);
- newTypeOp.addInterfaceSignature(Signature.createTypeSignature(interfaceType.getFullyQualifiedName(), true));
- newTypeOp.run(monitor, workingCopyManager);
- type = newTypeOp.getCreatedType();
- workingCopyManager.register(type.getCompilationUnit(), monitor);
- }
- return type;
- }
-
- @Override
- public String getOperationName() {
- return HandlerNewOperation.class.getName();
- }
-
- private boolean isSameType(String fullyQualifiedName1, String fullyQualifiedName2) {
- if (fullyQualifiedName1 != null) {
- fullyQualifiedName1 = fullyQualifiedName1.replaceAll("\\$", "."); // because of inner classes
- }
- if (fullyQualifiedName2 != null) {
- fullyQualifiedName2 = fullyQualifiedName2.replaceAll("\\$", "."); // because of inner classes
- }
-
- return CompareUtility.equals(fullyQualifiedName1, fullyQualifiedName2);
- }
-
- public IType getCreatedType() {
- return m_createdType;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public void setTypeName(String typeName) {
- m_typeName = typeName;
- }
-
- public void setPackageName(String packageName) {
- m_packageName = packageName;
- }
-
- public void setTransactional(boolean transactional) {
- m_transactional = transactional;
- }
-
- public void setSessionFactoryType(IType sessionFactoryType) {
- m_sessionFactoryType = sessionFactoryType;
- }
-
- public void setSuperType(IType superType) {
- m_superType = superType;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.LogicalMessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jface.text.Document;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.operation.util.ScoutTypeNewOperation;
+import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
+import org.eclipse.scout.sdk.util.ScoutUtility;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class HandlerNewOperation implements IOperation {
+
+ private IScoutBundle m_bundle;
+ private String m_typeName;
+ private String m_packageName;
+ private boolean m_transactional;
+ private IType m_sessionFactoryType;
+ private IType m_superType;
+ private IType m_createdType;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_bundle == null) {
+ throw new IllegalArgumentException("bundle not set");
+ }
+ if (m_superType == null) {
+ throw new IllegalArgumentException("superType not set");
+ }
+ if (m_typeName == null) {
+ throw new IllegalArgumentException("typeName not set");
+ }
+ if (m_packageName == null) {
+ throw new IllegalArgumentException("packageName not set");
+ }
+ if (m_transactional && m_sessionFactoryType == null) {
+ throw new IllegalArgumentException("session factory must be set");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ ScoutTypeNewOperation opType = new ScoutTypeNewOperation(m_typeName, m_packageName, m_bundle);
+
+ String superTypeSignature;
+ if (m_superType.getFullyQualifiedName().equals(LogicalHandler.class.getName())) {
+ superTypeSignature = Signature.createTypeSignature(LogicalHandler.class.getName() + "<" + LogicalMessageContext.class.getName() + ">", false);
+ }
+ else if (m_superType.getFullyQualifiedName().equals(SOAPHandler.class.getName())) {
+ superTypeSignature = Signature.createTypeSignature(SOAPHandler.class.getName() + "<" + SOAPMessageContext.class.getName() + ">", false);
+ }
+ else {
+ superTypeSignature = Signature.createTypeSignature(m_superType.getFullyQualifiedName(), true);
+ }
+ if (m_superType.isInterface()) {
+ opType.addInterfaceSignature(superTypeSignature);
+ }
+ else {
+ opType.setSuperTypeSignature(superTypeSignature);
+ }
+ opType.run(monitor, workingCopyManager);
+ m_createdType = opType.getCreatedType();
+ workingCopyManager.register(m_createdType.getCompilationUnit(), monitor);
+
+ if (m_transactional) {
+ AnnotationUpdateOperation opAnnotation = new AnnotationUpdateOperation();
+ opAnnotation.setDeclaringType(m_createdType);
+ opAnnotation.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction));
+
+ String defaultSessionFactory = (String) TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getMethod(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, new String[0]).getDefaultValue().getValue();
+
+ if (!isSameType(m_sessionFactoryType.getFullyQualifiedName(), defaultSessionFactory)) {
+ opAnnotation.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, m_sessionFactoryType);
+ }
+
+ opAnnotation.validate();
+ opAnnotation.run(monitor, workingCopyManager);
+ }
+
+ JaxWsSdkUtility.overrideUnimplementedMethodsAsync(m_createdType);
+
+ // format icu
+ ICompilationUnit icu = m_createdType.getCompilationUnit();
+ Document icuDoc = new Document(icu.getBuffer().getContents());
+
+ SourceFormatOperation sourceFormatOp = new SourceFormatOperation(m_createdType.getJavaProject(), icuDoc, null);
+ sourceFormatOp.run(monitor, workingCopyManager);
+
+ // write document back
+ icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
+
+ // reconcilation
+ workingCopyManager.reconcile(icu, monitor);
+ }
+
+ private IType createType(String qualifiedTypeName, IType interfaceType, IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ IType type;
+ if (TypeUtility.existsType(qualifiedTypeName)) {
+ type = TypeUtility.getType(qualifiedTypeName);
+ }
+ else {
+ String typeName = Signature.getSimpleName(qualifiedTypeName);
+ String packageName = Signature.getQualifier(qualifiedTypeName);
+
+ ScoutTypeNewOperation newTypeOp = new ScoutTypeNewOperation(typeName, packageName, m_bundle);
+ newTypeOp.addInterfaceSignature(Signature.createTypeSignature(interfaceType.getFullyQualifiedName(), true));
+ newTypeOp.run(monitor, workingCopyManager);
+ type = newTypeOp.getCreatedType();
+ workingCopyManager.register(type.getCompilationUnit(), monitor);
+ }
+ return type;
+ }
+
+ @Override
+ public String getOperationName() {
+ return HandlerNewOperation.class.getName();
+ }
+
+ private boolean isSameType(String fullyQualifiedName1, String fullyQualifiedName2) {
+ if (fullyQualifiedName1 != null) {
+ fullyQualifiedName1 = fullyQualifiedName1.replaceAll("\\$", "."); // because of inner classes
+ }
+ if (fullyQualifiedName2 != null) {
+ fullyQualifiedName2 = fullyQualifiedName2.replaceAll("\\$", "."); // because of inner classes
+ }
+
+ return CompareUtility.equals(fullyQualifiedName1, fullyQualifiedName2);
+ }
+
+ public IType getCreatedType() {
+ return m_createdType;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public void setTypeName(String typeName) {
+ m_typeName = typeName;
+ }
+
+ public void setPackageName(String packageName) {
+ m_packageName = packageName;
+ }
+
+ public void setTransactional(boolean transactional) {
+ m_transactional = transactional;
+ }
+
+ public void setSessionFactoryType(IType sessionFactoryType) {
+ m_sessionFactoryType = sessionFactoryType;
+ }
+
+ public void setSuperType(IType superType) {
+ m_superType = superType;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/JaxWsServletRegistrationOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/JaxWsServletRegistrationOperation.java
index 5109d1028..964e3e269 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/JaxWsServletRegistrationOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/JaxWsServletRegistrationOperation.java
@@ -1,242 +1,242 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.pde.core.plugin.IPluginAttribute;
-import org.eclipse.pde.core.plugin.IPluginElement;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.pde.PluginModelHelper;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.IScoutBundleFilter;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility;
-
-public class JaxWsServletRegistrationOperation implements IOperation {
-
- private IScoutBundle m_bundle;
- private IScoutBundle m_registrationBundle;
- private String m_jaxWsAlias;
- // used for URL pattern
- private SunJaxWsBean m_sunJaxWsBean;
- private String m_urlPattern;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_bundle == null) {
- throw new IllegalArgumentException("bundle must not be null");
- }
- if (m_bundle.getType() != IScoutBundle.BUNDLE_SERVER) {
- throw new IllegalArgumentException("bundle must be SERVER bundle");
- }
- if (m_registrationBundle == null) {
- throw new IllegalArgumentException("servlet registration bundle must not be null");
- }
- if (m_registrationBundle.getType() != IScoutBundle.BUNDLE_SERVER) {
- throw new IllegalArgumentException("servlet registration bundle must be SERVER bundle");
- }
- if (!StringUtility.hasText(m_jaxWsAlias)) {
- throw new IllegalArgumentException("JAX-WS alias must not be null");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- String oldServletRegBundleName = null;
-
- // build-jaxws.xml
- XmlResource buildJaxWsResource = ResourceFactory.getBuildJaxWsResource(m_bundle);
- if (!JaxWsSdkUtility.exists(buildJaxWsResource.getFile())) {
- // create build-jaxws.xml file
- BuildJaxWsFileCreateOperation op = new BuildJaxWsFileCreateOperation(m_bundle);
- op.run(monitor, workingCopyManager);
- }
- // ensure servlet registration in build-jaxws.xml
- ScoutXmlDocument document = buildJaxWsResource.loadXml();
- ScoutXmlElement xml = document.getRoot().getChild(ServletRegistrationUtility.XML_SERVLET_BUNDLE);
- if (xml == null) {
- xml = document.getRoot().addChild(ServletRegistrationUtility.XML_SERVLET_BUNDLE);
- }
-
- if (xml.hasAttribute(ServletRegistrationUtility.XML_NAME)) {
- oldServletRegBundleName = xml.getAttribute(ServletRegistrationUtility.XML_NAME);
- xml.removeAttribute(ServletRegistrationUtility.XML_NAME);
- }
- xml.setAttribute(ServletRegistrationUtility.XML_NAME, m_registrationBundle.getBundleName());
- ResourceFactory.getBuildJaxWsResource(m_bundle, true).storeXml(xml.getDocument(), IResourceListener.EVENT_BUILDJAXWS_REPLACED, monitor, IResourceListener.ELEMENT_FILE);
-
- String jaxWsServletClass = TypeUtility.getType(JaxWsRuntimeClasses.JaxWsServlet).getFullyQualifiedName();
- String alias = StringUtility.trim(JaxWsSdkUtility.normalizePath(m_jaxWsAlias, SeparatorType.LeadingType));
-
- // get original alias of servlet registration bundle and remove the servlet registration to be registered anew
- PluginModelHelper h = new PluginModelHelper(m_registrationBundle.getProject());
- HashMap<String, String> attributes = new HashMap<String, String>();
- attributes.put("class", jaxWsServletClass);
- IPluginElement ext = h.PluginXml.getSimpleExtension(JaxWsConstants.SERVER_EXTENSION_POINT_SERVLETS, "servlet", attributes);
- String originalAlias = null;
- if (ext != null) {
- IPluginAttribute attribute = ext.getAttribute("alias");
- if (attribute != null) {
- originalAlias = attribute.getValue();
- }
- }
-
- // remove old servlet registration if servlet defining bundle is this bundle itself
- if (CompareUtility.equals(oldServletRegBundleName, m_bundle.getBundleName())) {
- PluginModelHelper oldPluginHelper = new PluginModelHelper(m_bundle.getProject());
- attributes = new HashMap<String, String>();
- attributes.put("class", jaxWsServletClass);
- oldPluginHelper.PluginXml.removeSimpleExtension(JaxWsConstants.SERVER_EXTENSION_POINT_SERVLETS, "servlet", attributes);
- oldPluginHelper.save();
- }
-
- // remove existing registration
- attributes = new HashMap<String, String>();
- attributes.put("class", jaxWsServletClass);
- h = new PluginModelHelper(m_registrationBundle.getProject());
- h.PluginXml.removeSimpleExtension(JaxWsConstants.SERVER_EXTENSION_POINT_SERVLETS, "servlet", attributes);
- // add new registration
- attributes = new HashMap<String, String>();
- attributes.put("class", jaxWsServletClass);
- attributes.put("alias", alias);
- h.PluginXml.addSimpleExtension(JaxWsConstants.SERVER_EXTENSION_POINT_SERVLETS, "servlet", attributes);
- h.save();
-
- // update sun-jaxws entries
- try {
- // iterate through all dependent bundles to find JAX-WS dependent bundles
- IScoutBundle[] candidateBundles = m_registrationBundle.getDependentBundles(new IScoutBundleFilter() {
-
- @Override
- public boolean accept(IScoutBundle bundle) {
- return bundle.getType() == IScoutBundle.BUNDLE_SERVER && TypeUtility.isOnClasspath(TypeUtility.getType(JaxWsRuntimeClasses.JaxWsActivator), bundle.getJavaProject()); // ensure JAX-WS installed on bundle
- }
- }, true);
-
- for (IScoutBundle candidateBundle : candidateBundles) {
- XmlResource sunJaxWsResource = ResourceFactory.getSunJaxWsResource(candidateBundle);
- buildJaxWsResource = ResourceFactory.getBuildJaxWsResource(candidateBundle);
-
- if (JaxWsSdkUtility.exists(buildJaxWsResource.getFile()) &&
- JaxWsSdkUtility.exists(sunJaxWsResource.getFile())) {
- String bundleNameOfRegistration = ServletRegistrationUtility.getBuildJaxServletRegistrationBundleName(candidateBundle);
- if (bundleNameOfRegistration != null && bundleNameOfRegistration.equals(m_registrationBundle.getBundleName())) {
- ScoutXmlDocument sunJaxWsXmlDocument = sunJaxWsResource.loadXml();
- if (sunJaxWsXmlDocument == null) {
- continue;
- }
- List<String> changedEntries = new ArrayList<String>();
- for (ScoutXmlElement sunJaxWsXmlEntry : sunJaxWsXmlDocument.getRoot().getChildren(StringUtility.join(":", sunJaxWsXmlDocument.getRoot().getNamePrefix(), SunJaxWsBean.XML_ENDPOINT))) {
- SunJaxWsBean sunJaxWsEntryBean = new SunJaxWsBean(sunJaxWsXmlEntry);
- changedEntries.add(sunJaxWsEntryBean.getAlias());
-
- String endpointPattern = sunJaxWsEntryBean.getUrlPattern();
- if (originalAlias != null && endpointPattern.startsWith(originalAlias)) {
- endpointPattern = endpointPattern.substring(originalAlias.length());
- }
- String urlPattern = JaxWsSdkUtility.normalizePath(m_jaxWsAlias, SeparatorType.BothType) + JaxWsSdkUtility.normalizePath(endpointPattern, SeparatorType.None);
- sunJaxWsEntryBean.setUrlPattern(urlPattern);
- }
- if (changedEntries.size() > 0) {
- sunJaxWsResource.storeXmlAsync(sunJaxWsXmlDocument, IResourceListener.EVENT_SUNJAXWS_URL_PATTERN_CHANGED, changedEntries.toArray(new String[changedEntries.size()]));
- }
- }
- }
- }
- }
- catch (Exception e) {
- JaxWsSdk.logError("faild to update URL-pattern", e);
- }
-
- // change new URL pattenr
- if (m_sunJaxWsBean != null && m_urlPattern != null) {
- String urlPattern = m_urlPattern;
- if (!JaxWsSdkUtility.normalizePath(m_urlPattern, SeparatorType.LeadingType).startsWith(JaxWsSdkUtility.normalizePath(m_jaxWsAlias, SeparatorType.LeadingType))) {
- urlPattern = JaxWsSdkUtility.normalizePath(m_jaxWsAlias, SeparatorType.LeadingType) + JaxWsSdkUtility.normalizePath(m_urlPattern, SeparatorType.LeadingType);
- }
- m_sunJaxWsBean.setUrlPattern(urlPattern);
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_URL_PATTERN_CHANGED, m_sunJaxWsBean.getAlias());
- }
- }
-
- public static IScoutBundleFilter getServerFilter() {
- return new IScoutBundleFilter() {
- @Override
- public boolean accept(IScoutBundle bundle) {
- return bundle.getType() == IScoutBundle.BUNDLE_SERVER;
- }
- };
- }
-
- @Override
- public String getOperationName() {
- return JaxWsServletRegistrationOperation.class.getName();
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public IScoutBundle getRegistrationBundle() {
- return m_registrationBundle;
- }
-
- public void setRegistrationBundle(IScoutBundle registrationBundle) {
- m_registrationBundle = registrationBundle;
- }
-
- public String getJaxWsAlias() {
- return m_jaxWsAlias;
- }
-
- public void setJaxWsAlias(String jaxWsAlias) {
- m_jaxWsAlias = jaxWsAlias;
- }
-
- public String getUrlPattern() {
- return m_urlPattern;
- }
-
- public void setUrlPattern(String urlPattern) {
- m_urlPattern = urlPattern;
- }
-
- public SunJaxWsBean getSunJaxWsBean() {
- return m_sunJaxWsBean;
- }
-
- public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
- m_sunJaxWsBean = sunJaxWsBean;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.pde.core.plugin.IPluginAttribute;
+import org.eclipse.pde.core.plugin.IPluginElement;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.pde.PluginModelHelper;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.IScoutBundleFilter;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility;
+
+public class JaxWsServletRegistrationOperation implements IOperation {
+
+ private IScoutBundle m_bundle;
+ private IScoutBundle m_registrationBundle;
+ private String m_jaxWsAlias;
+ // used for URL pattern
+ private SunJaxWsBean m_sunJaxWsBean;
+ private String m_urlPattern;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_bundle == null) {
+ throw new IllegalArgumentException("bundle must not be null");
+ }
+ if (m_bundle.getType() != IScoutBundle.BUNDLE_SERVER) {
+ throw new IllegalArgumentException("bundle must be SERVER bundle");
+ }
+ if (m_registrationBundle == null) {
+ throw new IllegalArgumentException("servlet registration bundle must not be null");
+ }
+ if (m_registrationBundle.getType() != IScoutBundle.BUNDLE_SERVER) {
+ throw new IllegalArgumentException("servlet registration bundle must be SERVER bundle");
+ }
+ if (!StringUtility.hasText(m_jaxWsAlias)) {
+ throw new IllegalArgumentException("JAX-WS alias must not be null");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ String oldServletRegBundleName = null;
+
+ // build-jaxws.xml
+ XmlResource buildJaxWsResource = ResourceFactory.getBuildJaxWsResource(m_bundle);
+ if (!JaxWsSdkUtility.exists(buildJaxWsResource.getFile())) {
+ // create build-jaxws.xml file
+ BuildJaxWsFileCreateOperation op = new BuildJaxWsFileCreateOperation(m_bundle);
+ op.run(monitor, workingCopyManager);
+ }
+ // ensure servlet registration in build-jaxws.xml
+ ScoutXmlDocument document = buildJaxWsResource.loadXml();
+ ScoutXmlElement xml = document.getRoot().getChild(ServletRegistrationUtility.XML_SERVLET_BUNDLE);
+ if (xml == null) {
+ xml = document.getRoot().addChild(ServletRegistrationUtility.XML_SERVLET_BUNDLE);
+ }
+
+ if (xml.hasAttribute(ServletRegistrationUtility.XML_NAME)) {
+ oldServletRegBundleName = xml.getAttribute(ServletRegistrationUtility.XML_NAME);
+ xml.removeAttribute(ServletRegistrationUtility.XML_NAME);
+ }
+ xml.setAttribute(ServletRegistrationUtility.XML_NAME, m_registrationBundle.getBundleName());
+ ResourceFactory.getBuildJaxWsResource(m_bundle, true).storeXml(xml.getDocument(), IResourceListener.EVENT_BUILDJAXWS_REPLACED, monitor, IResourceListener.ELEMENT_FILE);
+
+ String jaxWsServletClass = TypeUtility.getType(JaxWsRuntimeClasses.JaxWsServlet).getFullyQualifiedName();
+ String alias = StringUtility.trim(JaxWsSdkUtility.normalizePath(m_jaxWsAlias, SeparatorType.LeadingType));
+
+ // get original alias of servlet registration bundle and remove the servlet registration to be registered anew
+ PluginModelHelper h = new PluginModelHelper(m_registrationBundle.getProject());
+ HashMap<String, String> attributes = new HashMap<String, String>();
+ attributes.put("class", jaxWsServletClass);
+ IPluginElement ext = h.PluginXml.getSimpleExtension(JaxWsConstants.SERVER_EXTENSION_POINT_SERVLETS, "servlet", attributes);
+ String originalAlias = null;
+ if (ext != null) {
+ IPluginAttribute attribute = ext.getAttribute("alias");
+ if (attribute != null) {
+ originalAlias = attribute.getValue();
+ }
+ }
+
+ // remove old servlet registration if servlet defining bundle is this bundle itself
+ if (CompareUtility.equals(oldServletRegBundleName, m_bundle.getBundleName())) {
+ PluginModelHelper oldPluginHelper = new PluginModelHelper(m_bundle.getProject());
+ attributes = new HashMap<String, String>();
+ attributes.put("class", jaxWsServletClass);
+ oldPluginHelper.PluginXml.removeSimpleExtension(JaxWsConstants.SERVER_EXTENSION_POINT_SERVLETS, "servlet", attributes);
+ oldPluginHelper.save();
+ }
+
+ // remove existing registration
+ attributes = new HashMap<String, String>();
+ attributes.put("class", jaxWsServletClass);
+ h = new PluginModelHelper(m_registrationBundle.getProject());
+ h.PluginXml.removeSimpleExtension(JaxWsConstants.SERVER_EXTENSION_POINT_SERVLETS, "servlet", attributes);
+ // add new registration
+ attributes = new HashMap<String, String>();
+ attributes.put("class", jaxWsServletClass);
+ attributes.put("alias", alias);
+ h.PluginXml.addSimpleExtension(JaxWsConstants.SERVER_EXTENSION_POINT_SERVLETS, "servlet", attributes);
+ h.save();
+
+ // update sun-jaxws entries
+ try {
+ // iterate through all dependent bundles to find JAX-WS dependent bundles
+ IScoutBundle[] candidateBundles = m_registrationBundle.getDependentBundles(new IScoutBundleFilter() {
+
+ @Override
+ public boolean accept(IScoutBundle bundle) {
+ return bundle.getType() == IScoutBundle.BUNDLE_SERVER && TypeUtility.isOnClasspath(TypeUtility.getType(JaxWsRuntimeClasses.JaxWsActivator), bundle.getJavaProject()); // ensure JAX-WS installed on bundle
+ }
+ }, true);
+
+ for (IScoutBundle candidateBundle : candidateBundles) {
+ XmlResource sunJaxWsResource = ResourceFactory.getSunJaxWsResource(candidateBundle);
+ buildJaxWsResource = ResourceFactory.getBuildJaxWsResource(candidateBundle);
+
+ if (JaxWsSdkUtility.exists(buildJaxWsResource.getFile()) &&
+ JaxWsSdkUtility.exists(sunJaxWsResource.getFile())) {
+ String bundleNameOfRegistration = ServletRegistrationUtility.getBuildJaxServletRegistrationBundleName(candidateBundle);
+ if (bundleNameOfRegistration != null && bundleNameOfRegistration.equals(m_registrationBundle.getBundleName())) {
+ ScoutXmlDocument sunJaxWsXmlDocument = sunJaxWsResource.loadXml();
+ if (sunJaxWsXmlDocument == null) {
+ continue;
+ }
+ List<String> changedEntries = new ArrayList<String>();
+ for (ScoutXmlElement sunJaxWsXmlEntry : sunJaxWsXmlDocument.getRoot().getChildren(StringUtility.join(":", sunJaxWsXmlDocument.getRoot().getNamePrefix(), SunJaxWsBean.XML_ENDPOINT))) {
+ SunJaxWsBean sunJaxWsEntryBean = new SunJaxWsBean(sunJaxWsXmlEntry);
+ changedEntries.add(sunJaxWsEntryBean.getAlias());
+
+ String endpointPattern = sunJaxWsEntryBean.getUrlPattern();
+ if (originalAlias != null && endpointPattern.startsWith(originalAlias)) {
+ endpointPattern = endpointPattern.substring(originalAlias.length());
+ }
+ String urlPattern = JaxWsSdkUtility.normalizePath(m_jaxWsAlias, SeparatorType.BothType) + JaxWsSdkUtility.normalizePath(endpointPattern, SeparatorType.None);
+ sunJaxWsEntryBean.setUrlPattern(urlPattern);
+ }
+ if (changedEntries.size() > 0) {
+ sunJaxWsResource.storeXmlAsync(sunJaxWsXmlDocument, IResourceListener.EVENT_SUNJAXWS_URL_PATTERN_CHANGED, changedEntries.toArray(new String[changedEntries.size()]));
+ }
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("faild to update URL-pattern", e);
+ }
+
+ // change new URL pattenr
+ if (m_sunJaxWsBean != null && m_urlPattern != null) {
+ String urlPattern = m_urlPattern;
+ if (!JaxWsSdkUtility.normalizePath(m_urlPattern, SeparatorType.LeadingType).startsWith(JaxWsSdkUtility.normalizePath(m_jaxWsAlias, SeparatorType.LeadingType))) {
+ urlPattern = JaxWsSdkUtility.normalizePath(m_jaxWsAlias, SeparatorType.LeadingType) + JaxWsSdkUtility.normalizePath(m_urlPattern, SeparatorType.LeadingType);
+ }
+ m_sunJaxWsBean.setUrlPattern(urlPattern);
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_URL_PATTERN_CHANGED, m_sunJaxWsBean.getAlias());
+ }
+ }
+
+ public static IScoutBundleFilter getServerFilter() {
+ return new IScoutBundleFilter() {
+ @Override
+ public boolean accept(IScoutBundle bundle) {
+ return bundle.getType() == IScoutBundle.BUNDLE_SERVER;
+ }
+ };
+ }
+
+ @Override
+ public String getOperationName() {
+ return JaxWsServletRegistrationOperation.class.getName();
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public IScoutBundle getRegistrationBundle() {
+ return m_registrationBundle;
+ }
+
+ public void setRegistrationBundle(IScoutBundle registrationBundle) {
+ m_registrationBundle = registrationBundle;
+ }
+
+ public String getJaxWsAlias() {
+ return m_jaxWsAlias;
+ }
+
+ public void setJaxWsAlias(String jaxWsAlias) {
+ m_jaxWsAlias = jaxWsAlias;
+ }
+
+ public String getUrlPattern() {
+ return m_urlPattern;
+ }
+
+ public void setUrlPattern(String urlPattern) {
+ m_urlPattern = urlPattern;
+ }
+
+ public SunJaxWsBean getSunJaxWsBean() {
+ return m_sunJaxWsBean;
+ }
+
+ public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
+ m_sunJaxWsBean = sunJaxWsBean;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/OverrideUnimplementedMethodsOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/OverrideUnimplementedMethodsOperation.java
index fd66fcce7..898c0d13c 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/OverrideUnimplementedMethodsOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/OverrideUnimplementedMethodsOperation.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.dom.AST;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.dom.ITypeBinding;
-import org.eclipse.jdt.internal.corext.codemanipulation.AddUnimplementedMethodsOperation;
-import org.eclipse.jdt.internal.corext.dom.ASTNodes;
-import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-
-@SuppressWarnings("restriction")
-public class OverrideUnimplementedMethodsOperation implements IOperation {
-
- private IType m_type;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (!TypeUtility.exists(m_type)) {
- throw new IllegalArgumentException("type must exsist");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- RefactoringASTParser parser = new RefactoringASTParser(AST.JLS3);
- CompilationUnit cu = parser.parse(m_type.getCompilationUnit(), true);
- ITypeBinding typeBinding = ASTNodes.getTypeBinding(cu, m_type);
- AddUnimplementedMethodsOperation op = new AddUnimplementedMethodsOperation(cu, typeBinding, null, -1, true, true, true);
- m_type.getJavaProject().getProject().getWorkspace().run(op, new NullProgressMonitor());
- }
-
- @Override
- public String getOperationName() {
- return OverrideUnimplementedMethodsOperation.class.getName();
- }
-
- public IType getType() {
- return m_type;
- }
-
- public void setType(IType type) {
- m_type = type;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.dom.AST;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.dom.ITypeBinding;
+import org.eclipse.jdt.internal.corext.codemanipulation.AddUnimplementedMethodsOperation;
+import org.eclipse.jdt.internal.corext.dom.ASTNodes;
+import org.eclipse.jdt.internal.corext.refactoring.util.RefactoringASTParser;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+
+@SuppressWarnings("restriction")
+public class OverrideUnimplementedMethodsOperation implements IOperation {
+
+ private IType m_type;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (!TypeUtility.exists(m_type)) {
+ throw new IllegalArgumentException("type must exsist");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ RefactoringASTParser parser = new RefactoringASTParser(AST.JLS3);
+ CompilationUnit cu = parser.parse(m_type.getCompilationUnit(), true);
+ ITypeBinding typeBinding = ASTNodes.getTypeBinding(cu, m_type);
+ AddUnimplementedMethodsOperation op = new AddUnimplementedMethodsOperation(cu, typeBinding, null, -1, true, true, true);
+ m_type.getJavaProject().getProject().getWorkspace().run(op, new NullProgressMonitor());
+ }
+
+ @Override
+ public String getOperationName() {
+ return OverrideUnimplementedMethodsOperation.class.getName();
+ }
+
+ public IType getType() {
+ return m_type;
+ }
+
+ public void setType(IType type) {
+ m_type = type;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SourceFolderCreateOrUpdateOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SourceFolderCreateOrUpdateOperation.java
index a8759473f..6b4230d4d 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SourceFolderCreateOrUpdateOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SourceFolderCreateOrUpdateOperation.java
@@ -1,70 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class SourceFolderCreateOrUpdateOperation implements IOperation {
-
- private IScoutBundle m_bundle;
- private IPath m_sourceFolder;
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public IPath getSourceFolder() {
- return m_sourceFolder;
- }
-
- public void setSourceFolder(IPath sourceFolder) {
- m_sourceFolder = sourceFolder;
- }
-
- @Override
- public void validate() throws IllegalArgumentException {
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- IFolder folder = JaxWsSdkUtility.getFolder(m_bundle, m_sourceFolder.makeRelativeTo(m_bundle.getProject().getFullPath()).toPortableString(), true);
- List<IClasspathEntry> classpathEntries = new LinkedList<IClasspathEntry>();
- for (IClasspathEntry entry : m_bundle.getJavaProject().getRawClasspath()) {
- if (entry.getPath().equals(folder.getFullPath())) {
- return; // source folder exists already
- }
- classpathEntries.add(entry);
- }
- classpathEntries.add(JavaCore.newSourceEntry(folder.getFullPath()));
- m_bundle.getJavaProject().setRawClasspath(classpathEntries.toArray(new IClasspathEntry[classpathEntries.size()]), m_bundle.getJavaProject().getOutputLocation(), monitor);
- }
-
- @Override
- public String getOperationName() {
- return SourceFolderCreateOrUpdateOperation.class.getName();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class SourceFolderCreateOrUpdateOperation implements IOperation {
+
+ private IScoutBundle m_bundle;
+ private IPath m_sourceFolder;
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public IPath getSourceFolder() {
+ return m_sourceFolder;
+ }
+
+ public void setSourceFolder(IPath sourceFolder) {
+ m_sourceFolder = sourceFolder;
+ }
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ IFolder folder = JaxWsSdkUtility.getFolder(m_bundle, m_sourceFolder.makeRelativeTo(m_bundle.getProject().getFullPath()).toPortableString(), true);
+ List<IClasspathEntry> classpathEntries = new LinkedList<IClasspathEntry>();
+ for (IClasspathEntry entry : m_bundle.getJavaProject().getRawClasspath()) {
+ if (entry.getPath().equals(folder.getFullPath())) {
+ return; // source folder exists already
+ }
+ classpathEntries.add(entry);
+ }
+ classpathEntries.add(JavaCore.newSourceEntry(folder.getFullPath()));
+ m_bundle.getJavaProject().setRawClasspath(classpathEntries.toArray(new IClasspathEntry[classpathEntries.size()]), m_bundle.getJavaProject().getOutputLocation(), monitor);
+ }
+
+ @Override
+ public String getOperationName() {
+ return SourceFolderCreateOrUpdateOperation.class.getName();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SourceRangeRemoveOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SourceRangeRemoveOperation.java
index 26121a33e..83cb9d67e 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SourceRangeRemoveOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SourceRangeRemoveOperation.java
@@ -1,93 +1,93 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.ISourceRange;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jface.text.BadLocationException;
-import org.eclipse.jface.text.Document;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
-import org.eclipse.scout.sdk.util.ScoutUtility;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.text.edits.ReplaceEdit;
-
-public class SourceRangeRemoveOperation implements IOperation {
-
- private IType m_declaringType;
- private IAnnotation m_annotation;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_declaringType == null) {
- throw new IllegalArgumentException("declaring must not be null");
- }
- if (m_annotation == null) {
- throw new IllegalArgumentException("annotation must not be null");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- ICompilationUnit icu = m_declaringType.getCompilationUnit();
- String source = m_declaringType.getCompilationUnit().getBuffer().getContents();
- ISourceRange sourceRange = m_annotation.getSourceRange();
-
- Document icuDoc = new Document(source);
- ReplaceEdit edit = new ReplaceEdit(sourceRange.getOffset(), sourceRange.getLength(), "");
- try {
- edit.apply(icuDoc);
- }
- catch (BadLocationException e) {
- throw new CoreException(new ScoutStatus("Failed to remve annotation", e));
- }
-
- workingCopyManager.register(icu, monitor);
-
- // format icu
- SourceFormatOperation sourceFormatOp = new SourceFormatOperation(m_declaringType.getJavaProject(), icuDoc, null);
- sourceFormatOp.run(monitor, workingCopyManager);
-
- // write document back
- icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
-
-// // reconcilation
-// do not call reconcile as loosing the selection in tree otherwise
-// workingCopyManager.reconcile(icu, monitor);
-// workingCopyManager.unregister(icu, monitor);
- }
-
- @Override
- public String getOperationName() {
- return SourceRangeRemoveOperation.class.getName();
- }
-
- public IType getDeclaringType() {
- return m_declaringType;
- }
-
- public void setDeclaringType(IType declaringType) {
- m_declaringType = declaringType;
- }
-
- public IAnnotation getAnnotation() {
- return m_annotation;
- }
-
- public void setAnnotation(IAnnotation annotation) {
- m_annotation = annotation;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jface.text.BadLocationException;
+import org.eclipse.jface.text.Document;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
+import org.eclipse.scout.sdk.util.ScoutUtility;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.text.edits.ReplaceEdit;
+
+public class SourceRangeRemoveOperation implements IOperation {
+
+ private IType m_declaringType;
+ private IAnnotation m_annotation;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_declaringType == null) {
+ throw new IllegalArgumentException("declaring must not be null");
+ }
+ if (m_annotation == null) {
+ throw new IllegalArgumentException("annotation must not be null");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ ICompilationUnit icu = m_declaringType.getCompilationUnit();
+ String source = m_declaringType.getCompilationUnit().getBuffer().getContents();
+ ISourceRange sourceRange = m_annotation.getSourceRange();
+
+ Document icuDoc = new Document(source);
+ ReplaceEdit edit = new ReplaceEdit(sourceRange.getOffset(), sourceRange.getLength(), "");
+ try {
+ edit.apply(icuDoc);
+ }
+ catch (BadLocationException e) {
+ throw new CoreException(new ScoutStatus("Failed to remve annotation", e));
+ }
+
+ workingCopyManager.register(icu, monitor);
+
+ // format icu
+ SourceFormatOperation sourceFormatOp = new SourceFormatOperation(m_declaringType.getJavaProject(), icuDoc, null);
+ sourceFormatOp.run(monitor, workingCopyManager);
+
+ // write document back
+ icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
+
+// // reconcilation
+// do not call reconcile as loosing the selection in tree otherwise
+// workingCopyManager.reconcile(icu, monitor);
+// workingCopyManager.unregister(icu, monitor);
+ }
+
+ @Override
+ public String getOperationName() {
+ return SourceRangeRemoveOperation.class.getName();
+ }
+
+ public IType getDeclaringType() {
+ return m_declaringType;
+ }
+
+ public void setDeclaringType(IType declaringType) {
+ m_declaringType = declaringType;
+ }
+
+ public IAnnotation getAnnotation() {
+ return m_annotation;
+ }
+
+ public void setAnnotation(IAnnotation annotation) {
+ m_annotation = annotation;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SunJaxWsEntryCreateOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SunJaxWsEntryCreateOperation.java
index fa6f0ee60..806d0d963 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SunJaxWsEntryCreateOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SunJaxWsEntryCreateOperation.java
@@ -1,149 +1,149 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import javax.xml.namespace.QName;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-
-public class SunJaxWsEntryCreateOperation implements IOperation {
-
- private IScoutBundle m_bundle;
-
- private String m_alias;
- private String m_implTypeQualifiedName;
- private QName m_serviceQName;
- private QName m_portQName;
- private String m_urlPattern;
- private String m_wsdlFile;
-
- private SunJaxWsBean m_createdSunJaxWsBean;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_bundle == null) {
- throw new IllegalArgumentException("bundle not set");
- }
-
- if (!StringUtility.hasText(m_alias)) {
- throw new IllegalArgumentException("alias must not be empty");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- XmlResource sunJaxWsResource = ResourceFactory.getSunJaxWsResource(m_bundle);
- if (sunJaxWsResource.getFile() == null || !sunJaxWsResource.getFile().exists()) {
- // create sun-jaxws.xml file
- SunJaxWsFileCreateOperation op = new SunJaxWsFileCreateOperation(m_bundle);
- op.run(monitor, workingCopyManager);
- }
- ScoutXmlDocument xmlDocument = ResourceFactory.getSunJaxWsResource(m_bundle).loadXml();
- String namespacePrefix = xmlDocument.getRoot().getNamePrefix();
-
- ScoutXmlElement endpointXml = xmlDocument.getRoot().addChild(StringUtility.join(":", namespacePrefix, SunJaxWsBean.XML_ENDPOINT));
- SunJaxWsBean bean = new SunJaxWsBean(endpointXml);
- bean.setAlias(m_alias);
- bean.setImplementation(m_implTypeQualifiedName);
- if (m_serviceQName != null) {
- bean.setService(m_serviceQName.toString());
- }
- if (m_portQName != null) {
- bean.setPort(m_portQName.toString());
- }
- bean.setUrlPattern(m_urlPattern);
- bean.setWsdl(m_wsdlFile);
- m_createdSunJaxWsBean = bean;
-
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXml(m_createdSunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_ENTRY_ADDED, monitor, m_alias);
- }
-
- @Override
- public String getOperationName() {
- return SunJaxWsEntryCreateOperation.class.getName();
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public String getAlias() {
- return m_alias;
- }
-
- public void setAlias(String alias) {
- m_alias = alias;
- }
-
- public String getImplQName() {
- return m_implTypeQualifiedName;
- }
-
- public void setImplTypeQualifiedName(String implTypeQualifiedName) {
- m_implTypeQualifiedName = implTypeQualifiedName;
- }
-
- public QName getServiceQName() {
- return m_serviceQName;
- }
-
- public void setServiceQName(QName serviceQName) {
- m_serviceQName = serviceQName;
- }
-
- public QName getPortQName() {
- return m_portQName;
- }
-
- public void setPortQName(QName portQName) {
- m_portQName = portQName;
- }
-
- public String getUrlPattern() {
- return m_urlPattern;
- }
-
- public void setUrlPattern(String urlPattern) {
- m_urlPattern = urlPattern;
- }
-
- public String getWsdlFileName() {
- return m_wsdlFile;
- }
-
- public void setWsdlFile(String wsdlFile) {
- m_wsdlFile = wsdlFile;
- }
-
- /**
- * After execution, to get the created {@link SunJaxWsBean}.
- *
- * @return
- */
- public SunJaxWsBean getCreatedSunJaxWsBean() {
- return m_createdSunJaxWsBean;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import javax.xml.namespace.QName;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+
+public class SunJaxWsEntryCreateOperation implements IOperation {
+
+ private IScoutBundle m_bundle;
+
+ private String m_alias;
+ private String m_implTypeQualifiedName;
+ private QName m_serviceQName;
+ private QName m_portQName;
+ private String m_urlPattern;
+ private String m_wsdlFile;
+
+ private SunJaxWsBean m_createdSunJaxWsBean;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_bundle == null) {
+ throw new IllegalArgumentException("bundle not set");
+ }
+
+ if (!StringUtility.hasText(m_alias)) {
+ throw new IllegalArgumentException("alias must not be empty");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ XmlResource sunJaxWsResource = ResourceFactory.getSunJaxWsResource(m_bundle);
+ if (sunJaxWsResource.getFile() == null || !sunJaxWsResource.getFile().exists()) {
+ // create sun-jaxws.xml file
+ SunJaxWsFileCreateOperation op = new SunJaxWsFileCreateOperation(m_bundle);
+ op.run(monitor, workingCopyManager);
+ }
+ ScoutXmlDocument xmlDocument = ResourceFactory.getSunJaxWsResource(m_bundle).loadXml();
+ String namespacePrefix = xmlDocument.getRoot().getNamePrefix();
+
+ ScoutXmlElement endpointXml = xmlDocument.getRoot().addChild(StringUtility.join(":", namespacePrefix, SunJaxWsBean.XML_ENDPOINT));
+ SunJaxWsBean bean = new SunJaxWsBean(endpointXml);
+ bean.setAlias(m_alias);
+ bean.setImplementation(m_implTypeQualifiedName);
+ if (m_serviceQName != null) {
+ bean.setService(m_serviceQName.toString());
+ }
+ if (m_portQName != null) {
+ bean.setPort(m_portQName.toString());
+ }
+ bean.setUrlPattern(m_urlPattern);
+ bean.setWsdl(m_wsdlFile);
+ m_createdSunJaxWsBean = bean;
+
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXml(m_createdSunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_ENTRY_ADDED, monitor, m_alias);
+ }
+
+ @Override
+ public String getOperationName() {
+ return SunJaxWsEntryCreateOperation.class.getName();
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public String getAlias() {
+ return m_alias;
+ }
+
+ public void setAlias(String alias) {
+ m_alias = alias;
+ }
+
+ public String getImplQName() {
+ return m_implTypeQualifiedName;
+ }
+
+ public void setImplTypeQualifiedName(String implTypeQualifiedName) {
+ m_implTypeQualifiedName = implTypeQualifiedName;
+ }
+
+ public QName getServiceQName() {
+ return m_serviceQName;
+ }
+
+ public void setServiceQName(QName serviceQName) {
+ m_serviceQName = serviceQName;
+ }
+
+ public QName getPortQName() {
+ return m_portQName;
+ }
+
+ public void setPortQName(QName portQName) {
+ m_portQName = portQName;
+ }
+
+ public String getUrlPattern() {
+ return m_urlPattern;
+ }
+
+ public void setUrlPattern(String urlPattern) {
+ m_urlPattern = urlPattern;
+ }
+
+ public String getWsdlFileName() {
+ return m_wsdlFile;
+ }
+
+ public void setWsdlFile(String wsdlFile) {
+ m_wsdlFile = wsdlFile;
+ }
+
+ /**
+ * After execution, to get the created {@link SunJaxWsBean}.
+ *
+ * @return
+ */
+ public SunJaxWsBean getCreatedSunJaxWsBean() {
+ return m_createdSunJaxWsBean;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SunJaxWsFileCreateOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SunJaxWsFileCreateOperation.java
index 0773fddc6..10224e2f8 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SunJaxWsFileCreateOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/SunJaxWsFileCreateOperation.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-
-public class SunJaxWsFileCreateOperation implements IOperation {
-
- private IScoutBundle m_bundle;
-
- public SunJaxWsFileCreateOperation(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- @Override
- public void validate() throws IllegalArgumentException {
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- ScoutXmlDocument xmlDocument = new ScoutXmlDocument();
- xmlDocument.setXmlVersion("1.0");
- xmlDocument.setXmlEncoding("UTF-8");
- xmlDocument.setPrettyPrint(true);
- ScoutXmlElement rootXml = xmlDocument.setRoot("endpoints");
- rootXml.setNamespace("jws", SunJaxWsBean.NS_ENDPOINT);
- rootXml.setName("jws:endpoints");
- rootXml.setAttribute("version", "2.0");
- ResourceFactory.getSunJaxWsResource(m_bundle, true).storeXml(xmlDocument, IResourceListener.EVENT_SUNJAXWS_REPLACED, monitor, IResourceListener.ELEMENT_FILE);
- }
-
- @Override
- public String getOperationName() {
- return SunJaxWsFileCreateOperation.class.getName();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+
+public class SunJaxWsFileCreateOperation implements IOperation {
+
+ private IScoutBundle m_bundle;
+
+ public SunJaxWsFileCreateOperation(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ ScoutXmlDocument xmlDocument = new ScoutXmlDocument();
+ xmlDocument.setXmlVersion("1.0");
+ xmlDocument.setXmlEncoding("UTF-8");
+ xmlDocument.setPrettyPrint(true);
+ ScoutXmlElement rootXml = xmlDocument.setRoot("endpoints");
+ rootXml.setNamespace("jws", SunJaxWsBean.NS_ENDPOINT);
+ rootXml.setName("jws:endpoints");
+ rootXml.setAttribute("version", "2.0");
+ ResourceFactory.getSunJaxWsResource(m_bundle, true).storeXml(xmlDocument, IResourceListener.EVENT_SUNJAXWS_REPLACED, monitor, IResourceListener.ELEMENT_FILE);
+ }
+
+ @Override
+ public String getOperationName() {
+ return SunJaxWsFileCreateOperation.class.getName();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/TypeNewOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/TypeNewOperation.java
index d3ea2778b..ec8cf790a 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/TypeNewOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/TypeNewOperation.java
@@ -1,107 +1,107 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jface.text.Document;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.operation.util.ScoutTypeNewOperation;
-import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
-import org.eclipse.scout.sdk.util.ScoutUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class TypeNewOperation implements IOperation {
-
- private IScoutBundle m_bundle;
- private String m_typeName;
- private String m_packageName;
- private IType m_superType;
- private IType m_interfaceType;
- private IType m_createdType;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_bundle == null) {
- throw new IllegalArgumentException("bundle not set");
- }
- if (m_typeName == null) {
- throw new IllegalArgumentException("typeName not set");
- }
- if (m_packageName == null) {
- throw new IllegalArgumentException("packageName not set");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- ScoutTypeNewOperation opType = new ScoutTypeNewOperation(m_typeName, m_packageName, m_bundle);
-
- if (m_superType != null) {
- opType.setSuperTypeSignature(Signature.createTypeSignature(m_superType.getFullyQualifiedName(), true));
- }
- if (m_interfaceType != null) {
- opType.addInterfaceSignature(Signature.createTypeSignature(m_interfaceType.getFullyQualifiedName(), true));
- }
- opType.run(monitor, workingCopyManager);
- m_createdType = opType.getCreatedType();
- workingCopyManager.register(m_createdType.getCompilationUnit(), monitor);
-
- JaxWsSdkUtility.overrideUnimplementedMethodsAsync(m_createdType);
-
- // format icu
- ICompilationUnit icu = m_createdType.getCompilationUnit();
- Document icuDoc = new Document(icu.getBuffer().getContents());
-
- SourceFormatOperation sourceFormatOp = new SourceFormatOperation(m_createdType.getJavaProject(), icuDoc, null);
- sourceFormatOp.run(monitor, workingCopyManager);
-
- // write document back
- icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
-
- // reconcilation
- workingCopyManager.reconcile(icu, monitor);
- }
-
- @Override
- public String getOperationName() {
- return TypeNewOperation.class.getName();
- }
-
- public IType getCreatedType() {
- return m_createdType;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public void setTypeName(String typeName) {
- m_typeName = typeName;
- }
-
- public void setPackageName(String packageName) {
- m_packageName = packageName;
- }
-
- public void setSuperType(IType superType) {
- m_superType = superType;
- }
-
- public void setInterfaceType(IType interfaceType) {
- m_interfaceType = interfaceType;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jface.text.Document;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.operation.util.ScoutTypeNewOperation;
+import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
+import org.eclipse.scout.sdk.util.ScoutUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class TypeNewOperation implements IOperation {
+
+ private IScoutBundle m_bundle;
+ private String m_typeName;
+ private String m_packageName;
+ private IType m_superType;
+ private IType m_interfaceType;
+ private IType m_createdType;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_bundle == null) {
+ throw new IllegalArgumentException("bundle not set");
+ }
+ if (m_typeName == null) {
+ throw new IllegalArgumentException("typeName not set");
+ }
+ if (m_packageName == null) {
+ throw new IllegalArgumentException("packageName not set");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ ScoutTypeNewOperation opType = new ScoutTypeNewOperation(m_typeName, m_packageName, m_bundle);
+
+ if (m_superType != null) {
+ opType.setSuperTypeSignature(Signature.createTypeSignature(m_superType.getFullyQualifiedName(), true));
+ }
+ if (m_interfaceType != null) {
+ opType.addInterfaceSignature(Signature.createTypeSignature(m_interfaceType.getFullyQualifiedName(), true));
+ }
+ opType.run(monitor, workingCopyManager);
+ m_createdType = opType.getCreatedType();
+ workingCopyManager.register(m_createdType.getCompilationUnit(), monitor);
+
+ JaxWsSdkUtility.overrideUnimplementedMethodsAsync(m_createdType);
+
+ // format icu
+ ICompilationUnit icu = m_createdType.getCompilationUnit();
+ Document icuDoc = new Document(icu.getBuffer().getContents());
+
+ SourceFormatOperation sourceFormatOp = new SourceFormatOperation(m_createdType.getJavaProject(), icuDoc, null);
+ sourceFormatOp.run(monitor, workingCopyManager);
+
+ // write document back
+ icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
+
+ // reconcilation
+ workingCopyManager.reconcile(icu, monitor);
+ }
+
+ @Override
+ public String getOperationName() {
+ return TypeNewOperation.class.getName();
+ }
+
+ public IType getCreatedType() {
+ return m_createdType;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public void setTypeName(String typeName) {
+ m_typeName = typeName;
+ }
+
+ public void setPackageName(String packageName) {
+ m_packageName = packageName;
+ }
+
+ public void setSuperType(IType superType) {
+ m_superType = superType;
+ }
+
+ public void setInterfaceType(IType interfaceType) {
+ m_interfaceType = interfaceType;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsConsumerDeleteOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsConsumerDeleteOperation.java
index 3a6d4ca5d..8ab93a2b2 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsConsumerDeleteOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsConsumerDeleteOperation.java
@@ -1,158 +1,158 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.sdk.ScoutSdkCore;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.ScoutUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.ScoutBundleFilters;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class WsConsumerDeleteOperation implements IOperation {
-
- public static final int ID_REGISTRATION = 1 << 0;
- public static final int ID_SERVICE_REGISTRATION = 1 << 1;
- public static final int ID_STUB = 1 << 2;
- public static final int ID_TYPE = 1 << 3;
- public static final int ID_BINDING_FILE = 1 << 4;
- public static final int ID_WSDL_FILE = 1 << 5;
- public static final int ID_REF_WSDL = 1 << 6;
- public static final int ID_REF_XSD = 1 << 7;
-
- private IScoutBundle m_bundle;
- private BuildJaxWsBean m_buildJaxWsBean;
- private List<ElementBean> m_elements;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_bundle == null) {
- throw new IllegalArgumentException("No bundle set");
- }
- if (m_elements == null) {
- throw new IllegalArgumentException("No elements set");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- for (ElementBean element : m_elements) {
- switch (element.getId()) {
- case ID_REGISTRATION:
- deleteBuildJaxWsXmlEntry(monitor);
- break;
- case ID_SERVICE_REGISTRATION:
- unregisterService(m_bundle, (IType) element.getJavaElement(), monitor);
- break;
- case ID_TYPE:
- deleteType((IType) element.getJavaElement(), monitor);
- break;
- case ID_STUB:
- deleteStubFile((IFile) element.getResource(), monitor);
- break;
- case ID_WSDL_FILE:
- case ID_BINDING_FILE:
- case ID_REF_WSDL:
- case ID_REF_XSD:
- deleteFile((IFile) element.getResource(), monitor);
- break;
- }
- }
- }
-
- private void deleteBuildJaxWsXmlEntry(IProgressMonitor monitor) throws CoreException {
- if (m_buildJaxWsBean == null) {
- return;
- }
- String alias = m_buildJaxWsBean.getAlias();
- ScoutXmlDocument xmlDocument = m_buildJaxWsBean.getXml().getDocument();
- xmlDocument.getRoot().removeChild(m_buildJaxWsBean.getXml());
- ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(xmlDocument, IResourceListener.EVENT_BUILDJAXWS_ENTRY_ADDED, monitor, alias);
- }
-
- private void deleteType(IType type, IProgressMonitor monitor) throws JavaModelException {
- try {
- type.getCompilationUnit().delete(true, monitor);
- }
- catch (Exception e) {
- JaxWsSdk.logError("could not delete type", e);
- }
- }
-
- private void deleteFile(IFile file, IProgressMonitor monitor) throws CoreException {
- if (file != null && file.exists()) {
- file.delete(true, true, monitor);
- }
- }
-
- private void deleteStubFile(IFile jarFile, IProgressMonitor monitor) throws CoreException {
- if (jarFile != null && jarFile.exists()) {
- try {
- jarFile.delete(true, true, monitor);
- JaxWsSdkUtility.registerJarLib(m_bundle, jarFile, true, monitor);
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- }
- }
- }
-
- private void unregisterService(IScoutBundle bundle, IType type, IProgressMonitor monitor) throws CoreException {
- // unregister server side
- IScoutBundle implementationBundle = ScoutSdkCore.getScoutWorkspace().getScoutBundle(bundle.getJavaProject().getProject());
- for (IScoutBundle serverBundle : implementationBundle.getRequiredBundles(ScoutBundleFilters.getServerFilter(), true)) {
- ScoutUtility.unregisterServiceClass(serverBundle.getProject(), IScoutBundle.EXTENSION_POINT_SERVICES, IScoutBundle.EXTENSION_ELEMENT_SERVICE, type.getFullyQualifiedName(), serverBundle.getRootPackageName() + ".ServerSession", monitor);
- }
- }
-
- @Override
- public String getOperationName() {
- return WsConsumerDeleteOperation.class.getName();
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public BuildJaxWsBean getBuildJaxWsBean() {
- return m_buildJaxWsBean;
- }
-
- public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
- m_buildJaxWsBean = buildJaxWsBean;
- }
-
- public List<ElementBean> getElements() {
- return m_elements;
- }
-
- public void setElements(List<ElementBean> elements) {
- m_elements = elements;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.sdk.ScoutSdkCore;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.ScoutUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.ScoutBundleFilters;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class WsConsumerDeleteOperation implements IOperation {
+
+ public static final int ID_REGISTRATION = 1 << 0;
+ public static final int ID_SERVICE_REGISTRATION = 1 << 1;
+ public static final int ID_STUB = 1 << 2;
+ public static final int ID_TYPE = 1 << 3;
+ public static final int ID_BINDING_FILE = 1 << 4;
+ public static final int ID_WSDL_FILE = 1 << 5;
+ public static final int ID_REF_WSDL = 1 << 6;
+ public static final int ID_REF_XSD = 1 << 7;
+
+ private IScoutBundle m_bundle;
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private List<ElementBean> m_elements;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_bundle == null) {
+ throw new IllegalArgumentException("No bundle set");
+ }
+ if (m_elements == null) {
+ throw new IllegalArgumentException("No elements set");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ for (ElementBean element : m_elements) {
+ switch (element.getId()) {
+ case ID_REGISTRATION:
+ deleteBuildJaxWsXmlEntry(monitor);
+ break;
+ case ID_SERVICE_REGISTRATION:
+ unregisterService(m_bundle, (IType) element.getJavaElement(), monitor);
+ break;
+ case ID_TYPE:
+ deleteType((IType) element.getJavaElement(), monitor);
+ break;
+ case ID_STUB:
+ deleteStubFile((IFile) element.getResource(), monitor);
+ break;
+ case ID_WSDL_FILE:
+ case ID_BINDING_FILE:
+ case ID_REF_WSDL:
+ case ID_REF_XSD:
+ deleteFile((IFile) element.getResource(), monitor);
+ break;
+ }
+ }
+ }
+
+ private void deleteBuildJaxWsXmlEntry(IProgressMonitor monitor) throws CoreException {
+ if (m_buildJaxWsBean == null) {
+ return;
+ }
+ String alias = m_buildJaxWsBean.getAlias();
+ ScoutXmlDocument xmlDocument = m_buildJaxWsBean.getXml().getDocument();
+ xmlDocument.getRoot().removeChild(m_buildJaxWsBean.getXml());
+ ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(xmlDocument, IResourceListener.EVENT_BUILDJAXWS_ENTRY_ADDED, monitor, alias);
+ }
+
+ private void deleteType(IType type, IProgressMonitor monitor) throws JavaModelException {
+ try {
+ type.getCompilationUnit().delete(true, monitor);
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("could not delete type", e);
+ }
+ }
+
+ private void deleteFile(IFile file, IProgressMonitor monitor) throws CoreException {
+ if (file != null && file.exists()) {
+ file.delete(true, true, monitor);
+ }
+ }
+
+ private void deleteStubFile(IFile jarFile, IProgressMonitor monitor) throws CoreException {
+ if (jarFile != null && jarFile.exists()) {
+ try {
+ jarFile.delete(true, true, monitor);
+ JaxWsSdkUtility.registerJarLib(m_bundle, jarFile, true, monitor);
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+ }
+
+ private void unregisterService(IScoutBundle bundle, IType type, IProgressMonitor monitor) throws CoreException {
+ // unregister server side
+ IScoutBundle implementationBundle = ScoutSdkCore.getScoutWorkspace().getScoutBundle(bundle.getJavaProject().getProject());
+ for (IScoutBundle serverBundle : implementationBundle.getRequiredBundles(ScoutBundleFilters.getServerFilter(), true)) {
+ ScoutUtility.unregisterServiceClass(serverBundle.getProject(), IScoutBundle.EXTENSION_POINT_SERVICES, IScoutBundle.EXTENSION_ELEMENT_SERVICE, type.getFullyQualifiedName(), serverBundle.getRootPackageName() + ".ServerSession", monitor);
+ }
+ }
+
+ @Override
+ public String getOperationName() {
+ return WsConsumerDeleteOperation.class.getName();
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public BuildJaxWsBean getBuildJaxWsBean() {
+ return m_buildJaxWsBean;
+ }
+
+ public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
+ m_buildJaxWsBean = buildJaxWsBean;
+ }
+
+ public List<ElementBean> getElements() {
+ return m_elements;
+ }
+
+ public void setElements(List<ElementBean> elements) {
+ m_elements = elements;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsConsumerImplNewOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsConsumerImplNewOperation.java
index 211fb4af6..ef1175c3c 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsConsumerImplNewOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsConsumerImplNewOperation.java
@@ -1,180 +1,180 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import javax.xml.ws.Service;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jface.text.Document;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.operation.service.ServiceNewOperation;
-import org.eclipse.scout.sdk.operation.util.ScoutTypeNewOperation;
-import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
-import org.eclipse.scout.sdk.util.ScoutUtility;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class WsConsumerImplNewOperation extends ServiceNewOperation {
- // used for generic super type
- private IType m_jaxWsServiceType;
- // used for generic super type
- private IType m_jaxWsPortType;
-
- private boolean m_createScoutWebServiceAnnotation;
- private String m_authenticationHandlerQName;
-
- @Override
- public void validate() throws IllegalArgumentException {
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- // assemble supertype signature
- IType jaxWsPortType = null;
- if (TypeUtility.exists(getJaxWsPortType())) {
- jaxWsPortType = getJaxWsPortType();
- }
- else {
- jaxWsPortType = TypeUtility.getType(Object.class.getName());
- JaxWsSdk.logError("Could not link webservice consumer to port type as port type could not be found");
- }
- IType jaxWsServiceType = null;
- if (TypeUtility.exists(getJaxWsServiceType())) {
- jaxWsServiceType = getJaxWsServiceType();
- }
- else {
- jaxWsServiceType = TypeUtility.getType(Service.class.getName());
- JaxWsSdk.logError("Could not link webservice consumer to service as service could not be found");
- }
-
- String superTypeSignature = "<";
- superTypeSignature += Signature.toString(Signature.createTypeSignature(jaxWsServiceType.getFullyQualifiedName(), true));
- superTypeSignature += ", ";
- superTypeSignature += Signature.toString(Signature.createTypeSignature(jaxWsPortType.getFullyQualifiedName(), true));
- superTypeSignature += ">";
- superTypeSignature = Signature.createTypeSignature(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient).getFullyQualifiedName() + superTypeSignature, true);
- setServiceSuperTypeSignature(superTypeSignature);
- super.run(monitor, workingCopyManager);
-
- IType createdType = getCreatedServiceImplementation();
-
- // create import directives for generic types
- JaxWsSdkUtility.createImportDirective(createdType, jaxWsPortType);
- JaxWsSdkUtility.createImportDirective(createdType, jaxWsServiceType);
-
- // create ScoutWebService annotation
- if (m_createScoutWebServiceAnnotation) {
- AnnotationUpdateOperation annotationOp = new AnnotationUpdateOperation();
- annotationOp.setDeclaringType(createdType);
- annotationOp.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebServiceClient));
-
- String defaultAuthFactory = (String) TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebServiceClient).getMethod(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER, new String[0]).getDefaultValue().getValue();
- // only add annotation property if different to default
-
- if (m_authenticationHandlerQName != null && !isSameType(m_authenticationHandlerQName, defaultAuthFactory)) {
- IType type = createType(m_authenticationHandlerQName, TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer), monitor, workingCopyManager);
- annotationOp.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER, type);
- }
- annotationOp.validate();
- annotationOp.run(monitor, workingCopyManager);
- }
-
- // format icu
- ICompilationUnit icu = createdType.getCompilationUnit();
- Document icuDoc = new Document(icu.getBuffer().getContents());
-
- SourceFormatOperation sourceFormatOp = new SourceFormatOperation(createdType.getJavaProject(), icuDoc, null);
- sourceFormatOp.run(monitor, workingCopyManager);
-
- // write document back
- icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
-
- // reconcilation
- workingCopyManager.reconcile(icu, monitor);
- }
-
- private IType createType(String qualifiedTypeName, IType interfaceType, IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- IType type;
- if (TypeUtility.existsType(qualifiedTypeName)) {
- type = TypeUtility.getType(qualifiedTypeName);
- }
- else {
- String typeName = Signature.getSimpleName(qualifiedTypeName);
- String packageName = Signature.getQualifier(qualifiedTypeName);
-
- ScoutTypeNewOperation newTypeOp = new ScoutTypeNewOperation(typeName, packageName, getImplementationBundle());
- newTypeOp.addInterfaceSignature(Signature.createTypeSignature(interfaceType.getFullyQualifiedName(), true));
- newTypeOp.run(monitor, workingCopyManager);
- type = newTypeOp.getCreatedType();
- workingCopyManager.register(type.getCompilationUnit(), monitor);
- }
- return type;
- }
-
- @Override
- public String getOperationName() {
- return WsConsumerImplNewOperation.class.getName();
- }
-
- public boolean isCreateScoutWebserviceAnnotation() {
- return m_createScoutWebServiceAnnotation;
- }
-
- public void setCreateScoutWebServiceAnnotation(boolean createScoutWebServiceAnnotation) {
- m_createScoutWebServiceAnnotation = createScoutWebServiceAnnotation;
- }
-
- public String getAuthenticationHandlerQName() {
- return m_authenticationHandlerQName;
- }
-
- public void setAuthenticationHandlerQName(String authenticationHandlerQName) {
- m_authenticationHandlerQName = authenticationHandlerQName;
- }
-
- public boolean isCreateScoutWebServiceAnnotation() {
- return m_createScoutWebServiceAnnotation;
- }
-
- public IType getJaxWsServiceType() {
- return m_jaxWsServiceType;
- }
-
- public void setJaxWsServiceType(IType jaxWsServiceType) {
- m_jaxWsServiceType = jaxWsServiceType;
- }
-
- public IType getJaxWsPortType() {
- return m_jaxWsPortType;
- }
-
- public void setJaxWsPortType(IType jaxWsPortType) {
- m_jaxWsPortType = jaxWsPortType;
- }
-
- private boolean isSameType(String fullyQualifiedName1, String fullyQualifiedName2) {
- if (fullyQualifiedName1 != null) {
- fullyQualifiedName1 = fullyQualifiedName1.replaceAll("\\$", "."); // because of inner classes
- }
- if (fullyQualifiedName2 != null) {
- fullyQualifiedName2 = fullyQualifiedName2.replaceAll("\\$", "."); // because of inner classes
- }
-
- return CompareUtility.equals(fullyQualifiedName1, fullyQualifiedName2);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import javax.xml.ws.Service;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jface.text.Document;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.operation.service.ServiceNewOperation;
+import org.eclipse.scout.sdk.operation.util.ScoutTypeNewOperation;
+import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
+import org.eclipse.scout.sdk.util.ScoutUtility;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class WsConsumerImplNewOperation extends ServiceNewOperation {
+ // used for generic super type
+ private IType m_jaxWsServiceType;
+ // used for generic super type
+ private IType m_jaxWsPortType;
+
+ private boolean m_createScoutWebServiceAnnotation;
+ private String m_authenticationHandlerQName;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ // assemble supertype signature
+ IType jaxWsPortType = null;
+ if (TypeUtility.exists(getJaxWsPortType())) {
+ jaxWsPortType = getJaxWsPortType();
+ }
+ else {
+ jaxWsPortType = TypeUtility.getType(Object.class.getName());
+ JaxWsSdk.logError("Could not link webservice consumer to port type as port type could not be found");
+ }
+ IType jaxWsServiceType = null;
+ if (TypeUtility.exists(getJaxWsServiceType())) {
+ jaxWsServiceType = getJaxWsServiceType();
+ }
+ else {
+ jaxWsServiceType = TypeUtility.getType(Service.class.getName());
+ JaxWsSdk.logError("Could not link webservice consumer to service as service could not be found");
+ }
+
+ String superTypeSignature = "<";
+ superTypeSignature += Signature.toString(Signature.createTypeSignature(jaxWsServiceType.getFullyQualifiedName(), true));
+ superTypeSignature += ", ";
+ superTypeSignature += Signature.toString(Signature.createTypeSignature(jaxWsPortType.getFullyQualifiedName(), true));
+ superTypeSignature += ">";
+ superTypeSignature = Signature.createTypeSignature(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient).getFullyQualifiedName() + superTypeSignature, true);
+ setServiceSuperTypeSignature(superTypeSignature);
+ super.run(monitor, workingCopyManager);
+
+ IType createdType = getCreatedServiceImplementation();
+
+ // create import directives for generic types
+ JaxWsSdkUtility.createImportDirective(createdType, jaxWsPortType);
+ JaxWsSdkUtility.createImportDirective(createdType, jaxWsServiceType);
+
+ // create ScoutWebService annotation
+ if (m_createScoutWebServiceAnnotation) {
+ AnnotationUpdateOperation annotationOp = new AnnotationUpdateOperation();
+ annotationOp.setDeclaringType(createdType);
+ annotationOp.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebServiceClient));
+
+ String defaultAuthFactory = (String) TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebServiceClient).getMethod(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER, new String[0]).getDefaultValue().getValue();
+ // only add annotation property if different to default
+
+ if (m_authenticationHandlerQName != null && !isSameType(m_authenticationHandlerQName, defaultAuthFactory)) {
+ IType type = createType(m_authenticationHandlerQName, TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer), monitor, workingCopyManager);
+ annotationOp.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER, type);
+ }
+ annotationOp.validate();
+ annotationOp.run(monitor, workingCopyManager);
+ }
+
+ // format icu
+ ICompilationUnit icu = createdType.getCompilationUnit();
+ Document icuDoc = new Document(icu.getBuffer().getContents());
+
+ SourceFormatOperation sourceFormatOp = new SourceFormatOperation(createdType.getJavaProject(), icuDoc, null);
+ sourceFormatOp.run(monitor, workingCopyManager);
+
+ // write document back
+ icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
+
+ // reconcilation
+ workingCopyManager.reconcile(icu, monitor);
+ }
+
+ private IType createType(String qualifiedTypeName, IType interfaceType, IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ IType type;
+ if (TypeUtility.existsType(qualifiedTypeName)) {
+ type = TypeUtility.getType(qualifiedTypeName);
+ }
+ else {
+ String typeName = Signature.getSimpleName(qualifiedTypeName);
+ String packageName = Signature.getQualifier(qualifiedTypeName);
+
+ ScoutTypeNewOperation newTypeOp = new ScoutTypeNewOperation(typeName, packageName, getImplementationBundle());
+ newTypeOp.addInterfaceSignature(Signature.createTypeSignature(interfaceType.getFullyQualifiedName(), true));
+ newTypeOp.run(monitor, workingCopyManager);
+ type = newTypeOp.getCreatedType();
+ workingCopyManager.register(type.getCompilationUnit(), monitor);
+ }
+ return type;
+ }
+
+ @Override
+ public String getOperationName() {
+ return WsConsumerImplNewOperation.class.getName();
+ }
+
+ public boolean isCreateScoutWebserviceAnnotation() {
+ return m_createScoutWebServiceAnnotation;
+ }
+
+ public void setCreateScoutWebServiceAnnotation(boolean createScoutWebServiceAnnotation) {
+ m_createScoutWebServiceAnnotation = createScoutWebServiceAnnotation;
+ }
+
+ public String getAuthenticationHandlerQName() {
+ return m_authenticationHandlerQName;
+ }
+
+ public void setAuthenticationHandlerQName(String authenticationHandlerQName) {
+ m_authenticationHandlerQName = authenticationHandlerQName;
+ }
+
+ public boolean isCreateScoutWebServiceAnnotation() {
+ return m_createScoutWebServiceAnnotation;
+ }
+
+ public IType getJaxWsServiceType() {
+ return m_jaxWsServiceType;
+ }
+
+ public void setJaxWsServiceType(IType jaxWsServiceType) {
+ m_jaxWsServiceType = jaxWsServiceType;
+ }
+
+ public IType getJaxWsPortType() {
+ return m_jaxWsPortType;
+ }
+
+ public void setJaxWsPortType(IType jaxWsPortType) {
+ m_jaxWsPortType = jaxWsPortType;
+ }
+
+ private boolean isSameType(String fullyQualifiedName1, String fullyQualifiedName2) {
+ if (fullyQualifiedName1 != null) {
+ fullyQualifiedName1 = fullyQualifiedName1.replaceAll("\\$", "."); // because of inner classes
+ }
+ if (fullyQualifiedName2 != null) {
+ fullyQualifiedName2 = fullyQualifiedName2.replaceAll("\\$", "."); // because of inner classes
+ }
+
+ return CompareUtility.equals(fullyQualifiedName1, fullyQualifiedName2);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsFilesMoveOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsFilesMoveOperation.java
index 8a81cc308..fb27a3f71 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsFilesMoveOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsFilesMoveOperation.java
@@ -1,187 +1,187 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-
-public class WsFilesMoveOperation implements IOperation {
-
- public static final int ID_WSDL_FILE = 1 << 1;
- public static final int ID_REF_WSDL = 1 << 2;
- public static final int ID_REF_XSD = 1 << 3;
- public static final int ID_WSDL_SUNJAXWS_REGISTRATION = 1 << 4;
- public static final int ID_WSDL_BUILDJAXWS_REGISTRATION = 1 << 5;
- public static final int ID_BINDING_FILE = 1 << 6;
-
- private IScoutBundle m_bundle;
- private SunJaxWsBean m_sunJaxWsBean;
- private BuildJaxWsBean m_buildJaxWsBean;
- private List<ElementBean> m_elements;
- private IFolder m_destination;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_bundle == null) {
- throw new IllegalArgumentException("No bundle set");
- }
- if (m_buildJaxWsBean == null) {
- throw new IllegalArgumentException("No buildJaxWsBean set");
- }
- if (m_elements == null) {
- throw new IllegalArgumentException("No elements set");
- }
- if (m_destination == null) {
- throw new IllegalArgumentException("No destination path set");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- JaxWsSdk.getDefault().getMarkerQueueManager().suspend();
- try {
- String wsdlFileName = null;
- for (ElementBean element : m_elements) {
- switch (element.getId()) {
- case ID_WSDL_FILE:
- case ID_REF_WSDL:
- case ID_REF_XSD: {
- moveFile((IFile) element.getResource(), m_destination, monitor);
- break;
- }
- case ID_WSDL_SUNJAXWS_REGISTRATION: {
- wsdlFileName = JaxWsSdkUtility.getFile(m_bundle, m_sunJaxWsBean.getWsdl(), false).getName();
- m_sunJaxWsBean.setWsdl(JaxWsSdkUtility.normalizePath(m_destination.getProjectRelativePath().append(wsdlFileName).toPortableString(), SeparatorType.None));
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXml(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_WSDL_CHANGED, monitor, m_sunJaxWsBean.getAlias());
- break;
- }
- case ID_WSDL_BUILDJAXWS_REGISTRATION: {
- wsdlFileName = JaxWsSdkUtility.getFile(m_bundle, m_buildJaxWsBean.getWsdl(), false).getName();
- m_buildJaxWsBean.setWsdl(JaxWsSdkUtility.normalizePath(m_destination.getProjectRelativePath().append(wsdlFileName).toPortableString(), SeparatorType.None));
- ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(m_buildJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_WSDL_CHANGED, monitor, m_buildJaxWsBean.getAlias());
- break;
- }
- case ID_BINDING_FILE: {
- IFile bindingFile = (IFile) element.getResource();
-
- XmlResource xmlResource = new XmlResource(m_bundle);
- xmlResource.setFile(bindingFile);
- ScoutXmlDocument xmlDocument = xmlResource.loadXml();
- String namespacePrefix = xmlDocument.getRoot().getNamePrefix();
- ScoutXmlElement xmlBindings = xmlDocument.getChild(StringUtility.join(":", namespacePrefix, "bindings"));
- if (xmlBindings.hasAttribute("wsdlLocation")) {
- xmlBindings.removeAttribute("wsdlLocation");
- xmlBindings.setAttribute("wsdlLocation", (String) element.getData());
- xmlResource.storeXml(xmlDocument, IResourceListener.EVENT_UNKNOWN, monitor);
- }
- break;
- }
- }
- }
-
- // rebuild webservice stub
- if (wsdlFileName != null) {
- WsStubGenerationOperation op = new WsStubGenerationOperation();
- op.setBundle(m_bundle);
- op.setAlias(m_buildJaxWsBean.getAlias());
- op.setProperties(m_buildJaxWsBean.getPropertiers());
- op.setWsdlFileName(wsdlFileName);
- op.setWsdlFolder(m_destination);
- op.run(monitor, workingCopyManager);
- }
- }
- finally {
- JaxWsSdk.getDefault().getMarkerQueueManager().resume();
- }
- }
-
- private void moveFile(IFile file, IFolder destinationFolderPath, IProgressMonitor monitor) throws CoreException {
- if (file == null || !file.exists()) {
- return;
- }
- try {
- // ensure folder to be created
- JaxWsSdkUtility.getFolder(m_bundle, destinationFolderPath.getProjectRelativePath().toPortableString(), true);
- // move file
- file.move(destinationFolderPath.getFullPath().append(file.getName()), true, true, monitor);
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- }
- }
-
- @Override
- public String getOperationName() {
- return WsFilesMoveOperation.class.getName();
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public SunJaxWsBean getSunJaxWsBean() {
- return m_sunJaxWsBean;
- }
-
- public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
- m_sunJaxWsBean = sunJaxWsBean;
- }
-
- public BuildJaxWsBean getBuildJaxWsBean() {
- return m_buildJaxWsBean;
- }
-
- public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
- m_buildJaxWsBean = buildJaxWsBean;
- }
-
- public IFolder getDestination() {
- return m_destination;
- }
-
- public void setDestination(IFolder destination) {
- m_destination = destination;
- }
-
- public List<ElementBean> getElements() {
- return m_elements;
- }
-
- public void setElements(List<ElementBean> elements) {
- m_elements = elements;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+
+public class WsFilesMoveOperation implements IOperation {
+
+ public static final int ID_WSDL_FILE = 1 << 1;
+ public static final int ID_REF_WSDL = 1 << 2;
+ public static final int ID_REF_XSD = 1 << 3;
+ public static final int ID_WSDL_SUNJAXWS_REGISTRATION = 1 << 4;
+ public static final int ID_WSDL_BUILDJAXWS_REGISTRATION = 1 << 5;
+ public static final int ID_BINDING_FILE = 1 << 6;
+
+ private IScoutBundle m_bundle;
+ private SunJaxWsBean m_sunJaxWsBean;
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private List<ElementBean> m_elements;
+ private IFolder m_destination;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_bundle == null) {
+ throw new IllegalArgumentException("No bundle set");
+ }
+ if (m_buildJaxWsBean == null) {
+ throw new IllegalArgumentException("No buildJaxWsBean set");
+ }
+ if (m_elements == null) {
+ throw new IllegalArgumentException("No elements set");
+ }
+ if (m_destination == null) {
+ throw new IllegalArgumentException("No destination path set");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ JaxWsSdk.getDefault().getMarkerQueueManager().suspend();
+ try {
+ String wsdlFileName = null;
+ for (ElementBean element : m_elements) {
+ switch (element.getId()) {
+ case ID_WSDL_FILE:
+ case ID_REF_WSDL:
+ case ID_REF_XSD: {
+ moveFile((IFile) element.getResource(), m_destination, monitor);
+ break;
+ }
+ case ID_WSDL_SUNJAXWS_REGISTRATION: {
+ wsdlFileName = JaxWsSdkUtility.getFile(m_bundle, m_sunJaxWsBean.getWsdl(), false).getName();
+ m_sunJaxWsBean.setWsdl(JaxWsSdkUtility.normalizePath(m_destination.getProjectRelativePath().append(wsdlFileName).toPortableString(), SeparatorType.None));
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXml(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_WSDL_CHANGED, monitor, m_sunJaxWsBean.getAlias());
+ break;
+ }
+ case ID_WSDL_BUILDJAXWS_REGISTRATION: {
+ wsdlFileName = JaxWsSdkUtility.getFile(m_bundle, m_buildJaxWsBean.getWsdl(), false).getName();
+ m_buildJaxWsBean.setWsdl(JaxWsSdkUtility.normalizePath(m_destination.getProjectRelativePath().append(wsdlFileName).toPortableString(), SeparatorType.None));
+ ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(m_buildJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_WSDL_CHANGED, monitor, m_buildJaxWsBean.getAlias());
+ break;
+ }
+ case ID_BINDING_FILE: {
+ IFile bindingFile = (IFile) element.getResource();
+
+ XmlResource xmlResource = new XmlResource(m_bundle);
+ xmlResource.setFile(bindingFile);
+ ScoutXmlDocument xmlDocument = xmlResource.loadXml();
+ String namespacePrefix = xmlDocument.getRoot().getNamePrefix();
+ ScoutXmlElement xmlBindings = xmlDocument.getChild(StringUtility.join(":", namespacePrefix, "bindings"));
+ if (xmlBindings.hasAttribute("wsdlLocation")) {
+ xmlBindings.removeAttribute("wsdlLocation");
+ xmlBindings.setAttribute("wsdlLocation", (String) element.getData());
+ xmlResource.storeXml(xmlDocument, IResourceListener.EVENT_UNKNOWN, monitor);
+ }
+ break;
+ }
+ }
+ }
+
+ // rebuild webservice stub
+ if (wsdlFileName != null) {
+ WsStubGenerationOperation op = new WsStubGenerationOperation();
+ op.setBundle(m_bundle);
+ op.setAlias(m_buildJaxWsBean.getAlias());
+ op.setProperties(m_buildJaxWsBean.getPropertiers());
+ op.setWsdlFileName(wsdlFileName);
+ op.setWsdlFolder(m_destination);
+ op.run(monitor, workingCopyManager);
+ }
+ }
+ finally {
+ JaxWsSdk.getDefault().getMarkerQueueManager().resume();
+ }
+ }
+
+ private void moveFile(IFile file, IFolder destinationFolderPath, IProgressMonitor monitor) throws CoreException {
+ if (file == null || !file.exists()) {
+ return;
+ }
+ try {
+ // ensure folder to be created
+ JaxWsSdkUtility.getFolder(m_bundle, destinationFolderPath.getProjectRelativePath().toPortableString(), true);
+ // move file
+ file.move(destinationFolderPath.getFullPath().append(file.getName()), true, true, monitor);
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+
+ @Override
+ public String getOperationName() {
+ return WsFilesMoveOperation.class.getName();
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public SunJaxWsBean getSunJaxWsBean() {
+ return m_sunJaxWsBean;
+ }
+
+ public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
+ m_sunJaxWsBean = sunJaxWsBean;
+ }
+
+ public BuildJaxWsBean getBuildJaxWsBean() {
+ return m_buildJaxWsBean;
+ }
+
+ public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
+ m_buildJaxWsBean = buildJaxWsBean;
+ }
+
+ public IFolder getDestination() {
+ return m_destination;
+ }
+
+ public void setDestination(IFolder destination) {
+ m_destination = destination;
+ }
+
+ public List<ElementBean> getElements() {
+ return m_elements;
+ }
+
+ public void setElements(List<ElementBean> elements) {
+ m_elements = elements;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderCodeFirstDeleteOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderCodeFirstDeleteOperation.java
index 1e5d1c3fc..a1b858bc6 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderCodeFirstDeleteOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderCodeFirstDeleteOperation.java
@@ -1,109 +1,109 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
-
-public class WsProviderCodeFirstDeleteOperation implements IOperation {
-
- public static final int ID_REGISTRATION = 1 << 0;
- public static final int ID_IMPL_TYPE = 1 << 1;
-
- private IScoutBundle m_bundle;
- private SunJaxWsBean m_sunJaxWsBean;
- private List<ElementBean> m_elements;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_bundle == null) {
- throw new IllegalArgumentException("No bundle set");
- }
- if (m_sunJaxWsBean == null) {
- throw new IllegalArgumentException("No sunJaxWsBean set");
- }
- if (m_elements == null) {
- throw new IllegalArgumentException("No elements set");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- for (ElementBean element : m_elements) {
- switch (element.getId()) {
- case ID_REGISTRATION:
- deleteSunJaxWsXmlEntry(monitor);
- break;
- case ID_IMPL_TYPE:
- deleteType((IType) element.getJavaElement(), monitor);
- break;
- }
- }
- }
-
- private void deleteSunJaxWsXmlEntry(IProgressMonitor monitor) throws CoreException {
- String alias = m_sunJaxWsBean.getAlias();
- ScoutXmlDocument xmlDocument = m_sunJaxWsBean.getXml().getDocument();
- xmlDocument.getRoot().removeChild(m_sunJaxWsBean.getXml());
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXml(xmlDocument, IResourceListener.EVENT_SUNJAXWS_ENTRY_REMOVED, monitor, alias);
- }
-
- private void deleteType(IType type, IProgressMonitor monitor) throws JavaModelException {
- try {
- type.getCompilationUnit().delete(true, monitor);
- }
- catch (Exception e) {
- JaxWsSdk.logError("could not delete type", e);
- }
- }
-
- @Override
- public String getOperationName() {
- return WsProviderCodeFirstDeleteOperation.class.getName();
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public SunJaxWsBean getSunJaxWsBean() {
- return m_sunJaxWsBean;
- }
-
- public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
- m_sunJaxWsBean = sunJaxWsBean;
- }
-
- public List<ElementBean> getElements() {
- return m_elements;
- }
-
- public void setElements(List<ElementBean> elements) {
- m_elements = elements;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
+
+public class WsProviderCodeFirstDeleteOperation implements IOperation {
+
+ public static final int ID_REGISTRATION = 1 << 0;
+ public static final int ID_IMPL_TYPE = 1 << 1;
+
+ private IScoutBundle m_bundle;
+ private SunJaxWsBean m_sunJaxWsBean;
+ private List<ElementBean> m_elements;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_bundle == null) {
+ throw new IllegalArgumentException("No bundle set");
+ }
+ if (m_sunJaxWsBean == null) {
+ throw new IllegalArgumentException("No sunJaxWsBean set");
+ }
+ if (m_elements == null) {
+ throw new IllegalArgumentException("No elements set");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ for (ElementBean element : m_elements) {
+ switch (element.getId()) {
+ case ID_REGISTRATION:
+ deleteSunJaxWsXmlEntry(monitor);
+ break;
+ case ID_IMPL_TYPE:
+ deleteType((IType) element.getJavaElement(), monitor);
+ break;
+ }
+ }
+ }
+
+ private void deleteSunJaxWsXmlEntry(IProgressMonitor monitor) throws CoreException {
+ String alias = m_sunJaxWsBean.getAlias();
+ ScoutXmlDocument xmlDocument = m_sunJaxWsBean.getXml().getDocument();
+ xmlDocument.getRoot().removeChild(m_sunJaxWsBean.getXml());
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXml(xmlDocument, IResourceListener.EVENT_SUNJAXWS_ENTRY_REMOVED, monitor, alias);
+ }
+
+ private void deleteType(IType type, IProgressMonitor monitor) throws JavaModelException {
+ try {
+ type.getCompilationUnit().delete(true, monitor);
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("could not delete type", e);
+ }
+ }
+
+ @Override
+ public String getOperationName() {
+ return WsProviderCodeFirstDeleteOperation.class.getName();
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public SunJaxWsBean getSunJaxWsBean() {
+ return m_sunJaxWsBean;
+ }
+
+ public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
+ m_sunJaxWsBean = sunJaxWsBean;
+ }
+
+ public List<ElementBean> getElements() {
+ return m_elements;
+ }
+
+ public void setElements(List<ElementBean> elements) {
+ m_elements = elements;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderDeleteOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderDeleteOperation.java
index 102a49965..3c32df58e 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderDeleteOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderDeleteOperation.java
@@ -1,164 +1,164 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class WsProviderDeleteOperation implements IOperation {
-
- public static final int ID_REGISTRATION = 1 << 0;
- public static final int ID_STUB = 1 << 1;
- public static final int ID_IMPL_TYPE = 1 << 2;
- public static final int ID_BINDING_FILE = 1 << 3;
- public static final int ID_WSDL_FILE = 1 << 4;
- public static final int ID_REF_WSDL = 1 << 5;
- public static final int ID_REF_XSD = 1 << 6;
-
- private IScoutBundle m_bundle;
- private SunJaxWsBean m_sunJaxWsBean;
- private BuildJaxWsBean m_buildJaxWsBean;
- private List<ElementBean> m_elements;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_bundle == null) {
- throw new IllegalArgumentException("No bundle set");
- }
- if (m_sunJaxWsBean == null) {
- throw new IllegalArgumentException("No sunJaxWsBean set");
- }
- if (m_elements == null) {
- throw new IllegalArgumentException("No elements set");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- for (ElementBean element : m_elements) {
- switch (element.getId()) {
- case ID_REGISTRATION:
- deleteSunJaxWsXmlEntry(monitor);
- deleteBuildJaxWsXmlEntry(monitor);
- break;
- case ID_IMPL_TYPE:
- deleteType((IType) element.getJavaElement(), monitor);
- break;
- case ID_STUB:
- deleteStubFile((IFile) element.getResource(), monitor);
- break;
- case ID_WSDL_FILE:
- case ID_BINDING_FILE:
- case ID_REF_WSDL:
- case ID_REF_XSD:
- deleteFile((IFile) element.getResource(), monitor);
- break;
- }
- }
- }
-
- private void deleteSunJaxWsXmlEntry(IProgressMonitor monitor) throws CoreException {
- String alias = m_sunJaxWsBean.getAlias();
- ScoutXmlDocument xmlDocument = m_sunJaxWsBean.getXml().getDocument();
- xmlDocument.getRoot().removeChild(m_sunJaxWsBean.getXml());
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXml(xmlDocument, IResourceListener.EVENT_SUNJAXWS_ENTRY_REMOVED, monitor, alias);
- }
-
- private void deleteBuildJaxWsXmlEntry(IProgressMonitor monitor) throws CoreException {
- if (m_buildJaxWsBean == null) {
- return;
- }
- String alias = m_buildJaxWsBean.getAlias();
- ScoutXmlDocument xmlDocument = m_buildJaxWsBean.getXml().getDocument();
- xmlDocument.getRoot().removeChild(m_buildJaxWsBean.getXml());
- ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(xmlDocument, IResourceListener.EVENT_BUILDJAXWS_ENTRY_ADDED, monitor, alias);
- }
-
- private void deleteType(IType type, IProgressMonitor monitor) throws JavaModelException {
- try {
- type.getCompilationUnit().delete(true, monitor);
- }
- catch (Exception e) {
- JaxWsSdk.logError("could not delete type", e);
- }
- }
-
- private void deleteFile(IFile file, IProgressMonitor monitor) throws CoreException {
- if (file != null && file.exists()) {
- file.delete(true, true, monitor);
- }
- }
-
- private void deleteStubFile(IFile jarFile, IProgressMonitor monitor) throws CoreException {
- if (jarFile != null && jarFile.exists()) {
- try {
- jarFile.delete(true, true, monitor);
- JaxWsSdkUtility.registerJarLib(m_bundle, jarFile, true, monitor);
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- }
- }
- }
-
- @Override
- public String getOperationName() {
- return WsProviderDeleteOperation.class.getName();
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public SunJaxWsBean getSunJaxWsBean() {
- return m_sunJaxWsBean;
- }
-
- public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
- m_sunJaxWsBean = sunJaxWsBean;
- }
-
- public BuildJaxWsBean getBuildJaxWsBean() {
- return m_buildJaxWsBean;
- }
-
- public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
- m_buildJaxWsBean = buildJaxWsBean;
- }
-
- public List<ElementBean> getElements() {
- return m_elements;
- }
-
- public void setElements(List<ElementBean> elements) {
- m_elements = elements;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class WsProviderDeleteOperation implements IOperation {
+
+ public static final int ID_REGISTRATION = 1 << 0;
+ public static final int ID_STUB = 1 << 1;
+ public static final int ID_IMPL_TYPE = 1 << 2;
+ public static final int ID_BINDING_FILE = 1 << 3;
+ public static final int ID_WSDL_FILE = 1 << 4;
+ public static final int ID_REF_WSDL = 1 << 5;
+ public static final int ID_REF_XSD = 1 << 6;
+
+ private IScoutBundle m_bundle;
+ private SunJaxWsBean m_sunJaxWsBean;
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private List<ElementBean> m_elements;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_bundle == null) {
+ throw new IllegalArgumentException("No bundle set");
+ }
+ if (m_sunJaxWsBean == null) {
+ throw new IllegalArgumentException("No sunJaxWsBean set");
+ }
+ if (m_elements == null) {
+ throw new IllegalArgumentException("No elements set");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ for (ElementBean element : m_elements) {
+ switch (element.getId()) {
+ case ID_REGISTRATION:
+ deleteSunJaxWsXmlEntry(monitor);
+ deleteBuildJaxWsXmlEntry(monitor);
+ break;
+ case ID_IMPL_TYPE:
+ deleteType((IType) element.getJavaElement(), monitor);
+ break;
+ case ID_STUB:
+ deleteStubFile((IFile) element.getResource(), monitor);
+ break;
+ case ID_WSDL_FILE:
+ case ID_BINDING_FILE:
+ case ID_REF_WSDL:
+ case ID_REF_XSD:
+ deleteFile((IFile) element.getResource(), monitor);
+ break;
+ }
+ }
+ }
+
+ private void deleteSunJaxWsXmlEntry(IProgressMonitor monitor) throws CoreException {
+ String alias = m_sunJaxWsBean.getAlias();
+ ScoutXmlDocument xmlDocument = m_sunJaxWsBean.getXml().getDocument();
+ xmlDocument.getRoot().removeChild(m_sunJaxWsBean.getXml());
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXml(xmlDocument, IResourceListener.EVENT_SUNJAXWS_ENTRY_REMOVED, monitor, alias);
+ }
+
+ private void deleteBuildJaxWsXmlEntry(IProgressMonitor monitor) throws CoreException {
+ if (m_buildJaxWsBean == null) {
+ return;
+ }
+ String alias = m_buildJaxWsBean.getAlias();
+ ScoutXmlDocument xmlDocument = m_buildJaxWsBean.getXml().getDocument();
+ xmlDocument.getRoot().removeChild(m_buildJaxWsBean.getXml());
+ ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(xmlDocument, IResourceListener.EVENT_BUILDJAXWS_ENTRY_ADDED, monitor, alias);
+ }
+
+ private void deleteType(IType type, IProgressMonitor monitor) throws JavaModelException {
+ try {
+ type.getCompilationUnit().delete(true, monitor);
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("could not delete type", e);
+ }
+ }
+
+ private void deleteFile(IFile file, IProgressMonitor monitor) throws CoreException {
+ if (file != null && file.exists()) {
+ file.delete(true, true, monitor);
+ }
+ }
+
+ private void deleteStubFile(IFile jarFile, IProgressMonitor monitor) throws CoreException {
+ if (jarFile != null && jarFile.exists()) {
+ try {
+ jarFile.delete(true, true, monitor);
+ JaxWsSdkUtility.registerJarLib(m_bundle, jarFile, true, monitor);
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+ }
+
+ @Override
+ public String getOperationName() {
+ return WsProviderDeleteOperation.class.getName();
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public SunJaxWsBean getSunJaxWsBean() {
+ return m_sunJaxWsBean;
+ }
+
+ public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
+ m_sunJaxWsBean = sunJaxWsBean;
+ }
+
+ public BuildJaxWsBean getBuildJaxWsBean() {
+ return m_buildJaxWsBean;
+ }
+
+ public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
+ m_buildJaxWsBean = buildJaxWsBean;
+ }
+
+ public List<ElementBean> getElements() {
+ return m_elements;
+ }
+
+ public void setElements(List<ElementBean> elements) {
+ m_elements = elements;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderImplNewOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderImplNewOperation.java
index fab45df26..0ffa85658 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderImplNewOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsProviderImplNewOperation.java
@@ -1,255 +1,255 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import javax.jws.WebService;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jface.text.Document;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.operation.annotation.AnnotationCreateOperation;
-import org.eclipse.scout.sdk.operation.method.MethodCreateOperation;
-import org.eclipse.scout.sdk.operation.util.JavaElementFormatOperation;
-import org.eclipse.scout.sdk.operation.util.ScoutTypeNewOperation;
-import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
-import org.eclipse.scout.sdk.util.ScoutUtility;
-import org.eclipse.scout.sdk.util.signature.SignatureUtility;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-
-public class WsProviderImplNewOperation implements IOperation {
-
- private IScoutBundle m_bundle;
- private String m_typeName;
- private String m_packageName;
- private IType m_portTypeInterfaceType;
- private boolean m_createScoutWebServiceAnnotation;
- private String m_sessionFactoryQName;
- private String m_authenticationHandlerQName;
- private String m_credentialValidationStrategyQName;
-
- private IType m_createdType;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_bundle == null) {
- throw new IllegalArgumentException("bundle not set");
- }
- if (m_typeName == null) {
- throw new IllegalArgumentException("typeName not set");
- }
- if (m_packageName == null) {
- throw new IllegalArgumentException("packageName not set");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- ScoutTypeNewOperation implNewTypeOp = new ScoutTypeNewOperation(m_typeName, m_packageName, m_bundle);
- if (TypeUtility.exists(m_portTypeInterfaceType)) {
- implNewTypeOp.addInterfaceSignature(Signature.createTypeSignature(m_portTypeInterfaceType.getFullyQualifiedName(), true));
- }
- else {
- JaxWsSdk.logError("Could not link webservice provider to port type as port type could not be found");
- }
- implNewTypeOp.run(monitor, workingCopyManager);
- m_createdType = implNewTypeOp.getCreatedType();
- workingCopyManager.register(m_createdType.getCompilationUnit(), monitor);
- if (TypeUtility.exists(m_portTypeInterfaceType)) {
- // override methods
- for (IMethod method : m_portTypeInterfaceType.getMethods()) {
- MethodCreateOperation op = new MethodCreateOperation(m_createdType, method.getElementName());
- op.setReturnTypeSignature(SignatureUtility.getReturnTypeSignatureResolved(method, m_portTypeInterfaceType));
- op.setMethodFlags(method.getFlags());
- op.setExceptionSignatures(method.getExceptionTypes());
- String[] paramNames = method.getParameterNames();
- op.setParameterNames(paramNames);
- op.setParameterSignatures(SignatureUtility.getMethodParameterSignatureResolved(method, m_portTypeInterfaceType));
- op.addAnnotation(new AnnotationCreateOperation(null, Signature.createTypeSignature(Override.class.getName(), true)));
- op.run(monitor, workingCopyManager);
-
- JavaElementFormatOperation wellFormOp = new JavaElementFormatOperation(op.getCreatedMethod(), true);
- wellFormOp.validate();
- wellFormOp.run(monitor, workingCopyManager);
- }
- }
-
- // create JAX-WS webservice annotation
- AnnotationUpdateOperation annotationOp = new AnnotationUpdateOperation();
- annotationOp.setDeclaringType(m_createdType);
- annotationOp.setAnnotationType(TypeUtility.getType(WebService.class.getName()));
-
- if (TypeUtility.exists(m_portTypeInterfaceType)) {
- annotationOp.addStringProperty("endpointInterface", m_portTypeInterfaceType.getFullyQualifiedName());
- }
- annotationOp.validate();
- annotationOp.run(monitor, workingCopyManager);
-
- // create ScoutWebService annotation
- if (m_createScoutWebServiceAnnotation) {
- annotationOp = new AnnotationUpdateOperation();
- annotationOp.setDeclaringType(m_createdType);
- annotationOp.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
-
- String defaultSessionFactory = (String) TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getMethod(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, new String[0]).getDefaultValue().getValue();
- String defaultAuthFactory = (String) TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getMethod(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER, new String[0]).getDefaultValue().getValue();
- String defaultCredentialFactory = (String) TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getMethod(JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY, new String[0]).getDefaultValue().getValue();
-
- if (m_sessionFactoryQName != null && !isSameType(m_sessionFactoryQName, defaultSessionFactory)) {
- IType type = createType(m_sessionFactoryQName, TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory), monitor, workingCopyManager);
- annotationOp.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, type);
- }
- if (m_authenticationHandlerQName != null && !isSameType(m_authenticationHandlerQName, defaultAuthFactory)) {
- IType type = createType(m_authenticationHandlerQName, TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider), monitor, workingCopyManager);
- annotationOp.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER, type);
- }
- if (m_credentialValidationStrategyQName != null && !isSameType(m_credentialValidationStrategyQName, defaultCredentialFactory)) {
- IType type = createType(m_credentialValidationStrategyQName, TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy), monitor, workingCopyManager);
- annotationOp.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY, type);
- }
-
- annotationOp.validate();
- annotationOp.run(monitor, workingCopyManager);
- }
-
- // format icu
- ICompilationUnit icu = m_createdType.getCompilationUnit();
- Document icuDoc = new Document(icu.getBuffer().getContents());
-
- SourceFormatOperation sourceFormatOp = new SourceFormatOperation(m_createdType.getJavaProject(), icuDoc, null);
- sourceFormatOp.run(monitor, workingCopyManager);
-
- // write document back
- icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
-
- // reconcilation
- workingCopyManager.reconcile(icu, monitor);
- }
-
- private IType createType(String qualifiedTypeName, IType interfaceType, IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- IType type;
- if (TypeUtility.existsType(qualifiedTypeName)) {
- type = TypeUtility.getType(qualifiedTypeName);
- }
- else {
- String typeName = Signature.getSimpleName(qualifiedTypeName);
- String packageName = Signature.getQualifier(qualifiedTypeName);
-
- ScoutTypeNewOperation newTypeOp = new ScoutTypeNewOperation(typeName, packageName, m_bundle);
- newTypeOp.addInterfaceSignature(Signature.createTypeSignature(interfaceType.getFullyQualifiedName(), true));
- newTypeOp.run(monitor, workingCopyManager);
- type = newTypeOp.getCreatedType();
- workingCopyManager.register(type.getCompilationUnit(), monitor);
- }
- return type;
- }
-
- @Override
- public String getOperationName() {
- return WsProviderImplNewOperation.class.getName();
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public String getTypeName() {
- return m_typeName;
- }
-
- public void setTypeName(String typeName) {
- m_typeName = typeName;
- }
-
- public String getPackageName() {
- return m_packageName;
- }
-
- public void setPackageName(String packageName) {
- m_packageName = packageName;
- }
-
- public boolean isCreateScoutWebserviceAnnotation() {
- return m_createScoutWebServiceAnnotation;
- }
-
- public void setCreateScoutWebServiceAnnotation(boolean createScoutWebServiceAnnotation) {
- m_createScoutWebServiceAnnotation = createScoutWebServiceAnnotation;
- }
-
- public String getSessionFactoryQName() {
- return m_sessionFactoryQName;
- }
-
- public void setSessionFactoryQName(String sessionFactoryQName) {
- m_sessionFactoryQName = sessionFactoryQName;
- }
-
- public String getAuthenticationHandlerQName() {
- return m_authenticationHandlerQName;
- }
-
- public void setAuthenticationHandlerQName(String authenticationHandlerQName) {
- m_authenticationHandlerQName = authenticationHandlerQName;
- }
-
- public String getCredentialValidationStrategyQName() {
- return m_credentialValidationStrategyQName;
- }
-
- public void setCredentialValidationStrategyQName(String credentialValidationStrategyQName) {
- m_credentialValidationStrategyQName = credentialValidationStrategyQName;
- }
-
- public boolean isCreateScoutWebServiceAnnotation() {
- return m_createScoutWebServiceAnnotation;
- }
-
- public void setCreatedType(IType createdType) {
- m_createdType = createdType;
- }
-
- public IType getCreatedType() {
- return m_createdType;
- }
-
- public IType getPortTypeInterfaceType() {
- return m_portTypeInterfaceType;
- }
-
- public void setPortTypeInterfaceType(IType portTypeInterfaceType) {
- m_portTypeInterfaceType = portTypeInterfaceType;
- }
-
- private boolean isSameType(String fullyQualifiedName1, String fullyQualifiedName2) {
- if (fullyQualifiedName1 != null) {
- fullyQualifiedName1 = fullyQualifiedName1.replaceAll("\\$", "."); // because of inner classes
- }
- if (fullyQualifiedName2 != null) {
- fullyQualifiedName2 = fullyQualifiedName2.replaceAll("\\$", "."); // because of inner classes
- }
-
- return CompareUtility.equals(fullyQualifiedName1, fullyQualifiedName2);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import javax.jws.WebService;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jface.text.Document;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.operation.annotation.AnnotationCreateOperation;
+import org.eclipse.scout.sdk.operation.method.MethodCreateOperation;
+import org.eclipse.scout.sdk.operation.util.JavaElementFormatOperation;
+import org.eclipse.scout.sdk.operation.util.ScoutTypeNewOperation;
+import org.eclipse.scout.sdk.operation.util.SourceFormatOperation;
+import org.eclipse.scout.sdk.util.ScoutUtility;
+import org.eclipse.scout.sdk.util.signature.SignatureUtility;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+
+public class WsProviderImplNewOperation implements IOperation {
+
+ private IScoutBundle m_bundle;
+ private String m_typeName;
+ private String m_packageName;
+ private IType m_portTypeInterfaceType;
+ private boolean m_createScoutWebServiceAnnotation;
+ private String m_sessionFactoryQName;
+ private String m_authenticationHandlerQName;
+ private String m_credentialValidationStrategyQName;
+
+ private IType m_createdType;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_bundle == null) {
+ throw new IllegalArgumentException("bundle not set");
+ }
+ if (m_typeName == null) {
+ throw new IllegalArgumentException("typeName not set");
+ }
+ if (m_packageName == null) {
+ throw new IllegalArgumentException("packageName not set");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ ScoutTypeNewOperation implNewTypeOp = new ScoutTypeNewOperation(m_typeName, m_packageName, m_bundle);
+ if (TypeUtility.exists(m_portTypeInterfaceType)) {
+ implNewTypeOp.addInterfaceSignature(Signature.createTypeSignature(m_portTypeInterfaceType.getFullyQualifiedName(), true));
+ }
+ else {
+ JaxWsSdk.logError("Could not link webservice provider to port type as port type could not be found");
+ }
+ implNewTypeOp.run(monitor, workingCopyManager);
+ m_createdType = implNewTypeOp.getCreatedType();
+ workingCopyManager.register(m_createdType.getCompilationUnit(), monitor);
+ if (TypeUtility.exists(m_portTypeInterfaceType)) {
+ // override methods
+ for (IMethod method : m_portTypeInterfaceType.getMethods()) {
+ MethodCreateOperation op = new MethodCreateOperation(m_createdType, method.getElementName());
+ op.setReturnTypeSignature(SignatureUtility.getReturnTypeSignatureResolved(method, m_portTypeInterfaceType));
+ op.setMethodFlags(method.getFlags());
+ op.setExceptionSignatures(method.getExceptionTypes());
+ String[] paramNames = method.getParameterNames();
+ op.setParameterNames(paramNames);
+ op.setParameterSignatures(SignatureUtility.getMethodParameterSignatureResolved(method, m_portTypeInterfaceType));
+ op.addAnnotation(new AnnotationCreateOperation(null, Signature.createTypeSignature(Override.class.getName(), true)));
+ op.run(monitor, workingCopyManager);
+
+ JavaElementFormatOperation wellFormOp = new JavaElementFormatOperation(op.getCreatedMethod(), true);
+ wellFormOp.validate();
+ wellFormOp.run(monitor, workingCopyManager);
+ }
+ }
+
+ // create JAX-WS webservice annotation
+ AnnotationUpdateOperation annotationOp = new AnnotationUpdateOperation();
+ annotationOp.setDeclaringType(m_createdType);
+ annotationOp.setAnnotationType(TypeUtility.getType(WebService.class.getName()));
+
+ if (TypeUtility.exists(m_portTypeInterfaceType)) {
+ annotationOp.addStringProperty("endpointInterface", m_portTypeInterfaceType.getFullyQualifiedName());
+ }
+ annotationOp.validate();
+ annotationOp.run(monitor, workingCopyManager);
+
+ // create ScoutWebService annotation
+ if (m_createScoutWebServiceAnnotation) {
+ annotationOp = new AnnotationUpdateOperation();
+ annotationOp.setDeclaringType(m_createdType);
+ annotationOp.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
+
+ String defaultSessionFactory = (String) TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getMethod(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, new String[0]).getDefaultValue().getValue();
+ String defaultAuthFactory = (String) TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getMethod(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER, new String[0]).getDefaultValue().getValue();
+ String defaultCredentialFactory = (String) TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getMethod(JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY, new String[0]).getDefaultValue().getValue();
+
+ if (m_sessionFactoryQName != null && !isSameType(m_sessionFactoryQName, defaultSessionFactory)) {
+ IType type = createType(m_sessionFactoryQName, TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory), monitor, workingCopyManager);
+ annotationOp.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, type);
+ }
+ if (m_authenticationHandlerQName != null && !isSameType(m_authenticationHandlerQName, defaultAuthFactory)) {
+ IType type = createType(m_authenticationHandlerQName, TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider), monitor, workingCopyManager);
+ annotationOp.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER, type);
+ }
+ if (m_credentialValidationStrategyQName != null && !isSameType(m_credentialValidationStrategyQName, defaultCredentialFactory)) {
+ IType type = createType(m_credentialValidationStrategyQName, TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy), monitor, workingCopyManager);
+ annotationOp.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY, type);
+ }
+
+ annotationOp.validate();
+ annotationOp.run(monitor, workingCopyManager);
+ }
+
+ // format icu
+ ICompilationUnit icu = m_createdType.getCompilationUnit();
+ Document icuDoc = new Document(icu.getBuffer().getContents());
+
+ SourceFormatOperation sourceFormatOp = new SourceFormatOperation(m_createdType.getJavaProject(), icuDoc, null);
+ sourceFormatOp.run(monitor, workingCopyManager);
+
+ // write document back
+ icu.getBuffer().setContents(ScoutUtility.cleanLineSeparator(icuDoc.get(), icuDoc));
+
+ // reconcilation
+ workingCopyManager.reconcile(icu, monitor);
+ }
+
+ private IType createType(String qualifiedTypeName, IType interfaceType, IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ IType type;
+ if (TypeUtility.existsType(qualifiedTypeName)) {
+ type = TypeUtility.getType(qualifiedTypeName);
+ }
+ else {
+ String typeName = Signature.getSimpleName(qualifiedTypeName);
+ String packageName = Signature.getQualifier(qualifiedTypeName);
+
+ ScoutTypeNewOperation newTypeOp = new ScoutTypeNewOperation(typeName, packageName, m_bundle);
+ newTypeOp.addInterfaceSignature(Signature.createTypeSignature(interfaceType.getFullyQualifiedName(), true));
+ newTypeOp.run(monitor, workingCopyManager);
+ type = newTypeOp.getCreatedType();
+ workingCopyManager.register(type.getCompilationUnit(), monitor);
+ }
+ return type;
+ }
+
+ @Override
+ public String getOperationName() {
+ return WsProviderImplNewOperation.class.getName();
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public String getTypeName() {
+ return m_typeName;
+ }
+
+ public void setTypeName(String typeName) {
+ m_typeName = typeName;
+ }
+
+ public String getPackageName() {
+ return m_packageName;
+ }
+
+ public void setPackageName(String packageName) {
+ m_packageName = packageName;
+ }
+
+ public boolean isCreateScoutWebserviceAnnotation() {
+ return m_createScoutWebServiceAnnotation;
+ }
+
+ public void setCreateScoutWebServiceAnnotation(boolean createScoutWebServiceAnnotation) {
+ m_createScoutWebServiceAnnotation = createScoutWebServiceAnnotation;
+ }
+
+ public String getSessionFactoryQName() {
+ return m_sessionFactoryQName;
+ }
+
+ public void setSessionFactoryQName(String sessionFactoryQName) {
+ m_sessionFactoryQName = sessionFactoryQName;
+ }
+
+ public String getAuthenticationHandlerQName() {
+ return m_authenticationHandlerQName;
+ }
+
+ public void setAuthenticationHandlerQName(String authenticationHandlerQName) {
+ m_authenticationHandlerQName = authenticationHandlerQName;
+ }
+
+ public String getCredentialValidationStrategyQName() {
+ return m_credentialValidationStrategyQName;
+ }
+
+ public void setCredentialValidationStrategyQName(String credentialValidationStrategyQName) {
+ m_credentialValidationStrategyQName = credentialValidationStrategyQName;
+ }
+
+ public boolean isCreateScoutWebServiceAnnotation() {
+ return m_createScoutWebServiceAnnotation;
+ }
+
+ public void setCreatedType(IType createdType) {
+ m_createdType = createdType;
+ }
+
+ public IType getCreatedType() {
+ return m_createdType;
+ }
+
+ public IType getPortTypeInterfaceType() {
+ return m_portTypeInterfaceType;
+ }
+
+ public void setPortTypeInterfaceType(IType portTypeInterfaceType) {
+ m_portTypeInterfaceType = portTypeInterfaceType;
+ }
+
+ private boolean isSameType(String fullyQualifiedName1, String fullyQualifiedName2) {
+ if (fullyQualifiedName1 != null) {
+ fullyQualifiedName1 = fullyQualifiedName1.replaceAll("\\$", "."); // because of inner classes
+ }
+ if (fullyQualifiedName2 != null) {
+ fullyQualifiedName2 = fullyQualifiedName2.replaceAll("\\$", "."); // because of inner classes
+ }
+
+ return CompareUtility.equals(fullyQualifiedName1, fullyQualifiedName2);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsStubGenerationOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsStubGenerationOperation.java
index 5ba3b6511..8b7c5c65b 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsStubGenerationOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsStubGenerationOperation.java
@@ -1,363 +1,363 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import java.io.File;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.debug.core.DebugException;
-import org.eclipse.debug.core.DebugPlugin;
-import org.eclipse.debug.core.ILaunch;
-import org.eclipse.debug.core.ILaunchConfiguration;
-import org.eclipse.debug.core.ILaunchConfigurationType;
-import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
-import org.eclipse.debug.core.ILaunchManager;
-import org.eclipse.debug.core.model.IProcess;
-import org.eclipse.debug.internal.ui.DebugUIPlugin;
-import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
-import org.eclipse.debug.ui.IDebugUIConstants;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
-import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
-import org.eclipse.jdt.launching.JavaRuntime;
-import org.eclipse.jface.dialogs.MessageDialogWithToggle;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.preferences.IPreferenceConstants;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IOperationFinishedListener;
-
-@SuppressWarnings("restriction")
-public class WsStubGenerationOperation implements IOperation {
-
- private IScoutBundle m_bundle;
- private String m_alias;
- private String m_wsdlFileName;
- private Map<String, List<String>> m_properties;
- private String m_packageName;
- private IFolder m_wsdlFolder;
-
- private Set<IOperationFinishedListener> m_operationFinishedListeners;
-
- public WsStubGenerationOperation() {
- m_operationFinishedListeners = new HashSet<IOperationFinishedListener>();
- }
-
- public void addOperationFinishedListener(IOperationFinishedListener listener) {
- m_operationFinishedListeners.add(listener);
- }
-
- public void removeOperationFinishedListener(IOperationFinishedListener listener) {
- m_operationFinishedListeners.remove(listener);
- }
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_bundle == null) {
- throw new IllegalArgumentException("bundle not set");
- }
- if (m_alias == null) {
- throw new IllegalArgumentException("alias not set");
- }
- if (m_wsdlFolder == null || !m_wsdlFolder.exists()) {
- throw new IllegalArgumentException("wsdl folder not set");
- }
- if (m_wsdlFileName == null) {
- throw new IllegalArgumentException("wsdlFileName not set");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- JaxWsSdk.getDefault().getMarkerQueueManager().suspend();
- try {
- // ensure stub folder created
- JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.STUB_FOLDER, true);
-
- // launch JAX-WS Stub generator
- String launcherName = m_alias + " (JAX-WS stub generation)";
-
- // ensure WSDL folder to be registered in build.xml
- JaxWsSdkUtility.prepareFolderAccess(getWsdlFolder(), true);
-
- IFile jarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, m_properties, m_wsdlFileName);
- // remove JAR file to ensure successful JAR generation
- if (jarFile.exists()) {
- try {
- jarFile.delete(true, monitor);
- JaxWsSdkUtility.registerJarLib(m_bundle, jarFile, true, monitor);
- }
- catch (Exception e) {
- JaxWsSdk.logError("failed to delete jar file", e);
- notifyListeners(false, new Exception("Failed to delete stub JAR-file '" + jarFile.getProjectRelativePath().toPortableString() + "'. The file might be locked because the server is running.", e));
- return;
- }
- }
-
- // assemble arguments to generate stub
- String args = null;
- String jarFilePath = JaxWsSdkUtility.normalizePath(jarFile.getProjectRelativePath().toPortableString(), SeparatorType.None);
- args = StringUtility.join("\n", args, jarFilePath);
- args = StringUtility.join("\n", args, getWsdlFolder().getProjectRelativePath().append(m_wsdlFileName).toPortableString());
- args = StringUtility.join("\n", args, "1"); // apply patches
-
- if (m_properties != null && m_properties.size() > 0) {
- for (Entry<String, List<String>> property : m_properties.entrySet()) {
- String propName = property.getKey();
- if (!StringUtility.hasText(propName)) {
- continue;
- }
- // skip not JAX-WS options
- if (propName.equals(JaxWsConstants.OPTION_JAR)) {
- continue;
- }
-
- List<String> propValues = property.getValue();
- if (propValues == null || propValues.size() == 0) {
- String directive = propName;
- args = StringUtility.join("\n", args, directive);
- }
- else {
- for (String value : propValues) {
- // escape paths containing whitespace characters
- if (propName.equals("b") && StringUtility.hasText(value) && value.matches(".*\\s.*") && !value.startsWith("\\")) {
- value = "\"" + value + "\"";
- }
- String directive = StringUtility.join("=", propName, value);
- args = StringUtility.join("\n", args, directive);
- }
- }
- }
- }
-
- // run stub generation
- Throwable exception = null;
- try {
- launchJavaApplicationSync(launcherName,
- m_bundle.getProject().getName(),
- TypeUtility.getType(JaxWsRuntimeClasses.JaxWsStubGenerator).getFullyQualifiedName(),
- args,
- monitor);
- }
- catch (Throwable e) {
- exception = e;
- }
- finally {
- // refresh folder to be reflected in SDK
- JaxWsSdkUtility.refreshLocal(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.STUB_FOLDER, false), IResource.DEPTH_INFINITE);
- }
-
- if (exception == null) {
- // check whether artefacts were created. This is necessary as not all failures are propagated
- jarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, m_properties, m_wsdlFileName);
- if (JaxWsSdkUtility.exists(jarFile)) {
- // register stub JAR
- if (!JaxWsSdkUtility.registerJarLib(m_bundle, jarFile, false, monitor)) {
- exception = new Exception("Stub generation was successfull but registration of JAR file '" + jarFilePath + "' failed in .classpath / MANIFEST.MF / build.properties");
- }
- }
- else {
- exception = new CoreException(new ScoutStatus("Failed to generate webservice artefacts. Probably a corrupt WSDL file, non-standardized WSDL file or a binding file problem."));
- }
- }
-
- if (exception == null) {
- notifyListeners(true, null);
- }
- else {
- notifyListeners(false, exception);
- }
- }
- finally {
- JaxWsSdk.getDefault().getMarkerQueueManager().resume();
- }
- }
-
- @Override
- public String getOperationName() {
- return WsStubGenerationOperation.class.getName();
- }
-
- private void launchJavaApplicationSync(String launchName, String projectName, String javaMainTypeName, String argumentList, IProgressMonitor monitor) throws Exception {
- ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
- ILaunchConfigurationType type = launchManager.getLaunchConfigurationType("org.eclipse.jdt.launching.localJavaApplication");
- ILaunchConfigurationWorkingCopy wc = type.newInstance(null, launchName);
- wc.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, javaMainTypeName);
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, argumentList);
- wc.setAttribute(org.eclipse.debug.internal.core.LaunchConfiguration.ATTR_MAPPED_RESOURCE_TYPES, Arrays.asList(new String[]{Integer.toString(IResource.PROJECT)}));
- wc.setAttribute(org.eclipse.debug.internal.core.LaunchConfiguration.ATTR_MAPPED_RESOURCE_PATHS, Arrays.asList(new String[]{"/" + projectName}));
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, getClasspathEntries());
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
- wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN, false);
- wc.setAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
- ILaunchConfiguration lc = wc.doSave();
-
- String mode;
- boolean debugMode = JaxWsSdk.getDefault().getPreferenceStore().getBoolean(IPreferenceConstants.PREF_STUB_GENERATION_DEBUG_MODE);
- if (debugMode) {
- mode = ILaunchManager.DEBUG_MODE;
- }
- else {
- mode = ILaunchManager.RUN_MODE;
- }
-
- String continueWithCompileErros = DebugUIPlugin.getDefault().getPreferenceStore().getString(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR);
- boolean changedDebugPref = false;
- try {
- if (!CompareUtility.equals(MessageDialogWithToggle.ALWAYS, continueWithCompileErros)) {
- // prevent PDE dialog asking whether to continue in case of compile errors
- DebugUIPlugin.getDefault().getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR, MessageDialogWithToggle.ALWAYS);
- changedDebugPref = true;
- }
- ILaunch launch = lc.launch(mode, monitor, true, true);
-
- // wait for stub generation to be finished
- while (!launch.isTerminated()) {
- if (monitor.isCanceled()) {
- launch.terminate();
- break;
- }
- Thread.sleep(1000);
- }
-
- boolean keepLaunchConfiguration = JaxWsSdk.getDefault().getPreferenceStore().getBoolean(IPreferenceConstants.PREF_STUB_GENERATION_KEEP_LAUNCH_CONFIG);
- if (!keepLaunchConfiguration) {
- lc.delete();
- }
-
- // validate exit code of processes
- for (IProcess process : launch.getProcesses()) {
- if (process.getExitValue() != 0) {
- new CoreException(new ScoutStatus("Stub generation failed"));
- }
- }
- }
- finally {
- if (changedDebugPref) {
- DebugUIPlugin.getDefault().getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR, continueWithCompileErros);
- }
- }
- }
-
- private void notifyListeners(boolean success, Throwable exception) {
- for (IOperationFinishedListener listener : m_operationFinishedListeners.toArray(new IOperationFinishedListener[m_operationFinishedListeners.size()])) {
- try {
- listener.operationFinished(success, exception);
- }
- catch (Exception e) {
- JaxWsSdk.logError("failed to notify listener", e);
- }
- }
- }
-
- private boolean isSuccess(IProcess[] processes) throws DebugException {
- for (IProcess process : processes) {
- if (process.getExitValue() != 0) {
- return false;
- }
- }
- return true;
- }
-
- private List<String> getClasspathEntries() throws Exception {
- List<String> mementoList = new LinkedList<String>();
-
- // add runtime classes to the classpath
- for (IRuntimeClasspathEntry classpathEntry : JavaRuntime.computeUnresolvedRuntimeClasspath(m_bundle.getJavaProject())) {
- mementoList.add(classpathEntry.getMemento());
- }
-
- // check whether the required lib tools.jar is part of the workspace classpath (required for WsImport)
- IType wsImportType = TypeUtility.getType(JaxWsRuntimeClasses.WsImportType);
- if (wsImportType == null || !wsImportType.exists() || !TypeUtility.isOnClasspath(wsImportType, m_bundle.getJavaProject())) {
- // manually add tool.jar to the classpath of the launch-configuration (from JRE).
- File toolsJarFile = locateToolsJar();
- if (toolsJarFile == null || !toolsJarFile.exists() || !toolsJarFile.isFile()) {
- throw new CoreException(new ScoutStatus("Could not locate the Java library 'tools.jar'. Please ensure to have the environment variable JAVA_HOME set and the JAR /lib/tools.jar exists. Alternatively, add the JAR 'tools.jar' to the system libraries of the installed JRE in Eclipse Preferences 'Java | Installed JREs'."));
- }
- mementoList.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(toolsJarFile.getAbsolutePath())).getMemento());
- }
-
- return mementoList;
- }
-
- private File locateToolsJar() {
- String[] defaultToolsLocation = {"lib", "tools.jar"};
-
- File file = new File(System.getProperty("java.home"));
- if (file.getName().equalsIgnoreCase("jre")) {
- file = file.getParentFile();
- }
- for (String name : defaultToolsLocation) {
- file = new File(file, name);
- }
- return file;
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public String getAlias() {
- return m_alias;
- }
-
- public void setAlias(String alias) {
- m_alias = alias;
- }
-
- public String getWsdlFileName() {
- return m_wsdlFileName;
- }
-
- public IFolder getWsdlFolder() {
- return m_wsdlFolder;
- }
-
- public void setWsdlFolder(IFolder wsdlFolder) {
- m_wsdlFolder = wsdlFolder;
- }
-
- public void setWsdlFileName(String wsdlFileName) {
- m_wsdlFileName = wsdlFileName;
- }
-
- public void setProperties(Map<String, List<String>> properties) {
- m_properties = properties;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import java.io.File;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.debug.core.DebugException;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunch;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchConfigurationType;
+import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.core.model.IProcess;
+import org.eclipse.debug.internal.ui.DebugUIPlugin;
+import org.eclipse.debug.internal.ui.IInternalDebugUIConstants;
+import org.eclipse.debug.ui.IDebugUIConstants;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants;
+import org.eclipse.jdt.launching.IRuntimeClasspathEntry;
+import org.eclipse.jdt.launching.JavaRuntime;
+import org.eclipse.jface.dialogs.MessageDialogWithToggle;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.preferences.IPreferenceConstants;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IOperationFinishedListener;
+
+@SuppressWarnings("restriction")
+public class WsStubGenerationOperation implements IOperation {
+
+ private IScoutBundle m_bundle;
+ private String m_alias;
+ private String m_wsdlFileName;
+ private Map<String, List<String>> m_properties;
+ private String m_packageName;
+ private IFolder m_wsdlFolder;
+
+ private Set<IOperationFinishedListener> m_operationFinishedListeners;
+
+ public WsStubGenerationOperation() {
+ m_operationFinishedListeners = new HashSet<IOperationFinishedListener>();
+ }
+
+ public void addOperationFinishedListener(IOperationFinishedListener listener) {
+ m_operationFinishedListeners.add(listener);
+ }
+
+ public void removeOperationFinishedListener(IOperationFinishedListener listener) {
+ m_operationFinishedListeners.remove(listener);
+ }
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_bundle == null) {
+ throw new IllegalArgumentException("bundle not set");
+ }
+ if (m_alias == null) {
+ throw new IllegalArgumentException("alias not set");
+ }
+ if (m_wsdlFolder == null || !m_wsdlFolder.exists()) {
+ throw new IllegalArgumentException("wsdl folder not set");
+ }
+ if (m_wsdlFileName == null) {
+ throw new IllegalArgumentException("wsdlFileName not set");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ JaxWsSdk.getDefault().getMarkerQueueManager().suspend();
+ try {
+ // ensure stub folder created
+ JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.STUB_FOLDER, true);
+
+ // launch JAX-WS Stub generator
+ String launcherName = m_alias + " (JAX-WS stub generation)";
+
+ // ensure WSDL folder to be registered in build.xml
+ JaxWsSdkUtility.prepareFolderAccess(getWsdlFolder(), true);
+
+ IFile jarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, m_properties, m_wsdlFileName);
+ // remove JAR file to ensure successful JAR generation
+ if (jarFile.exists()) {
+ try {
+ jarFile.delete(true, monitor);
+ JaxWsSdkUtility.registerJarLib(m_bundle, jarFile, true, monitor);
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("failed to delete jar file", e);
+ notifyListeners(false, new Exception("Failed to delete stub JAR-file '" + jarFile.getProjectRelativePath().toPortableString() + "'. The file might be locked because the server is running.", e));
+ return;
+ }
+ }
+
+ // assemble arguments to generate stub
+ String args = null;
+ String jarFilePath = JaxWsSdkUtility.normalizePath(jarFile.getProjectRelativePath().toPortableString(), SeparatorType.None);
+ args = StringUtility.join("\n", args, jarFilePath);
+ args = StringUtility.join("\n", args, getWsdlFolder().getProjectRelativePath().append(m_wsdlFileName).toPortableString());
+ args = StringUtility.join("\n", args, "1"); // apply patches
+
+ if (m_properties != null && m_properties.size() > 0) {
+ for (Entry<String, List<String>> property : m_properties.entrySet()) {
+ String propName = property.getKey();
+ if (!StringUtility.hasText(propName)) {
+ continue;
+ }
+ // skip not JAX-WS options
+ if (propName.equals(JaxWsConstants.OPTION_JAR)) {
+ continue;
+ }
+
+ List<String> propValues = property.getValue();
+ if (propValues == null || propValues.size() == 0) {
+ String directive = propName;
+ args = StringUtility.join("\n", args, directive);
+ }
+ else {
+ for (String value : propValues) {
+ // escape paths containing whitespace characters
+ if (propName.equals("b") && StringUtility.hasText(value) && value.matches(".*\\s.*") && !value.startsWith("\\")) {
+ value = "\"" + value + "\"";
+ }
+ String directive = StringUtility.join("=", propName, value);
+ args = StringUtility.join("\n", args, directive);
+ }
+ }
+ }
+ }
+
+ // run stub generation
+ Throwable exception = null;
+ try {
+ launchJavaApplicationSync(launcherName,
+ m_bundle.getProject().getName(),
+ TypeUtility.getType(JaxWsRuntimeClasses.JaxWsStubGenerator).getFullyQualifiedName(),
+ args,
+ monitor);
+ }
+ catch (Throwable e) {
+ exception = e;
+ }
+ finally {
+ // refresh folder to be reflected in SDK
+ JaxWsSdkUtility.refreshLocal(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.STUB_FOLDER, false), IResource.DEPTH_INFINITE);
+ }
+
+ if (exception == null) {
+ // check whether artefacts were created. This is necessary as not all failures are propagated
+ jarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, m_properties, m_wsdlFileName);
+ if (JaxWsSdkUtility.exists(jarFile)) {
+ // register stub JAR
+ if (!JaxWsSdkUtility.registerJarLib(m_bundle, jarFile, false, monitor)) {
+ exception = new Exception("Stub generation was successfull but registration of JAR file '" + jarFilePath + "' failed in .classpath / MANIFEST.MF / build.properties");
+ }
+ }
+ else {
+ exception = new CoreException(new ScoutStatus("Failed to generate webservice artefacts. Probably a corrupt WSDL file, non-standardized WSDL file or a binding file problem."));
+ }
+ }
+
+ if (exception == null) {
+ notifyListeners(true, null);
+ }
+ else {
+ notifyListeners(false, exception);
+ }
+ }
+ finally {
+ JaxWsSdk.getDefault().getMarkerQueueManager().resume();
+ }
+ }
+
+ @Override
+ public String getOperationName() {
+ return WsStubGenerationOperation.class.getName();
+ }
+
+ private void launchJavaApplicationSync(String launchName, String projectName, String javaMainTypeName, String argumentList, IProgressMonitor monitor) throws Exception {
+ ILaunchManager launchManager = DebugPlugin.getDefault().getLaunchManager();
+ ILaunchConfigurationType type = launchManager.getLaunchConfigurationType("org.eclipse.jdt.launching.localJavaApplication");
+ ILaunchConfigurationWorkingCopy wc = type.newInstance(null, launchName);
+ wc.setAttribute(IDebugUIConstants.ATTR_CAPTURE_IN_CONSOLE, true);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, javaMainTypeName);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, argumentList);
+ wc.setAttribute(org.eclipse.debug.internal.core.LaunchConfiguration.ATTR_MAPPED_RESOURCE_TYPES, Arrays.asList(new String[]{Integer.toString(IResource.PROJECT)}));
+ wc.setAttribute(org.eclipse.debug.internal.core.LaunchConfiguration.ATTR_MAPPED_RESOURCE_PATHS, Arrays.asList(new String[]{"/" + projectName}));
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, getClasspathEntries());
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false);
+ wc.setAttribute(IJavaLaunchConfigurationConstants.ATTR_STOP_IN_MAIN, false);
+ wc.setAttribute(ILaunchManager.ATTR_APPEND_ENVIRONMENT_VARIABLES, true);
+ ILaunchConfiguration lc = wc.doSave();
+
+ String mode;
+ boolean debugMode = JaxWsSdk.getDefault().getPreferenceStore().getBoolean(IPreferenceConstants.PREF_STUB_GENERATION_DEBUG_MODE);
+ if (debugMode) {
+ mode = ILaunchManager.DEBUG_MODE;
+ }
+ else {
+ mode = ILaunchManager.RUN_MODE;
+ }
+
+ String continueWithCompileErros = DebugUIPlugin.getDefault().getPreferenceStore().getString(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR);
+ boolean changedDebugPref = false;
+ try {
+ if (!CompareUtility.equals(MessageDialogWithToggle.ALWAYS, continueWithCompileErros)) {
+ // prevent PDE dialog asking whether to continue in case of compile errors
+ DebugUIPlugin.getDefault().getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR, MessageDialogWithToggle.ALWAYS);
+ changedDebugPref = true;
+ }
+ ILaunch launch = lc.launch(mode, monitor, true, true);
+
+ // wait for stub generation to be finished
+ while (!launch.isTerminated()) {
+ if (monitor.isCanceled()) {
+ launch.terminate();
+ break;
+ }
+ Thread.sleep(1000);
+ }
+
+ boolean keepLaunchConfiguration = JaxWsSdk.getDefault().getPreferenceStore().getBoolean(IPreferenceConstants.PREF_STUB_GENERATION_KEEP_LAUNCH_CONFIG);
+ if (!keepLaunchConfiguration) {
+ lc.delete();
+ }
+
+ // validate exit code of processes
+ for (IProcess process : launch.getProcesses()) {
+ if (process.getExitValue() != 0) {
+ new CoreException(new ScoutStatus("Stub generation failed"));
+ }
+ }
+ }
+ finally {
+ if (changedDebugPref) {
+ DebugUIPlugin.getDefault().getPreferenceStore().setValue(IInternalDebugUIConstants.PREF_CONTINUE_WITH_COMPILE_ERROR, continueWithCompileErros);
+ }
+ }
+ }
+
+ private void notifyListeners(boolean success, Throwable exception) {
+ for (IOperationFinishedListener listener : m_operationFinishedListeners.toArray(new IOperationFinishedListener[m_operationFinishedListeners.size()])) {
+ try {
+ listener.operationFinished(success, exception);
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("failed to notify listener", e);
+ }
+ }
+ }
+
+ private boolean isSuccess(IProcess[] processes) throws DebugException {
+ for (IProcess process : processes) {
+ if (process.getExitValue() != 0) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private List<String> getClasspathEntries() throws Exception {
+ List<String> mementoList = new LinkedList<String>();
+
+ // add runtime classes to the classpath
+ for (IRuntimeClasspathEntry classpathEntry : JavaRuntime.computeUnresolvedRuntimeClasspath(m_bundle.getJavaProject())) {
+ mementoList.add(classpathEntry.getMemento());
+ }
+
+ // check whether the required lib tools.jar is part of the workspace classpath (required for WsImport)
+ IType wsImportType = TypeUtility.getType(JaxWsRuntimeClasses.WsImportType);
+ if (wsImportType == null || !wsImportType.exists() || !TypeUtility.isOnClasspath(wsImportType, m_bundle.getJavaProject())) {
+ // manually add tool.jar to the classpath of the launch-configuration (from JRE).
+ File toolsJarFile = locateToolsJar();
+ if (toolsJarFile == null || !toolsJarFile.exists() || !toolsJarFile.isFile()) {
+ throw new CoreException(new ScoutStatus("Could not locate the Java library 'tools.jar'. Please ensure to have the environment variable JAVA_HOME set and the JAR /lib/tools.jar exists. Alternatively, add the JAR 'tools.jar' to the system libraries of the installed JRE in Eclipse Preferences 'Java | Installed JREs'."));
+ }
+ mementoList.add(JavaRuntime.newArchiveRuntimeClasspathEntry(new Path(toolsJarFile.getAbsolutePath())).getMemento());
+ }
+
+ return mementoList;
+ }
+
+ private File locateToolsJar() {
+ String[] defaultToolsLocation = {"lib", "tools.jar"};
+
+ File file = new File(System.getProperty("java.home"));
+ if (file.getName().equalsIgnoreCase("jre")) {
+ file = file.getParentFile();
+ }
+ for (String name : defaultToolsLocation) {
+ file = new File(file, name);
+ }
+ return file;
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public String getAlias() {
+ return m_alias;
+ }
+
+ public void setAlias(String alias) {
+ m_alias = alias;
+ }
+
+ public String getWsdlFileName() {
+ return m_wsdlFileName;
+ }
+
+ public IFolder getWsdlFolder() {
+ return m_wsdlFolder;
+ }
+
+ public void setWsdlFolder(IFolder wsdlFolder) {
+ m_wsdlFolder = wsdlFolder;
+ }
+
+ public void setWsdlFileName(String wsdlFileName) {
+ m_wsdlFileName = wsdlFileName;
+ }
+
+ public void setProperties(Map<String, List<String>> properties) {
+ m_properties = properties;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsdlCreateOperation.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsdlCreateOperation.java
index 6ac1b0d59..a7a27d446 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsdlCreateOperation.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsdlCreateOperation.java
@@ -1,398 +1,398 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import javax.wsdl.Binding;
-import javax.wsdl.BindingInput;
-import javax.wsdl.BindingOperation;
-import javax.wsdl.BindingOutput;
-import javax.wsdl.Definition;
-import javax.wsdl.Input;
-import javax.wsdl.Message;
-import javax.wsdl.Operation;
-import javax.wsdl.Output;
-import javax.wsdl.Part;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.Types;
-import javax.wsdl.extensions.schema.Schema;
-import javax.wsdl.extensions.soap.SOAPAddress;
-import javax.wsdl.extensions.soap.SOAPBinding;
-import javax.wsdl.extensions.soap.SOAPBody;
-import javax.wsdl.extensions.soap.SOAPOperation;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLWriter;
-import javax.xml.namespace.QName;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-
-import com.ibm.wsdl.extensions.soap.SOAPAddressImpl;
-
-public class WsdlCreateOperation implements IOperation {
-
- private IScoutBundle m_bundle;
-
- private WsdlResource m_wsdlResource;
- private String m_alias;
- private String m_targetNamespace;
- private String m_service;
- private String m_portName;
- private String m_portType;
- private String m_binding;
- private String m_urlPattern;
- private String m_serviceOperationName;
- private WsdlStyleEnum m_wsdlStyle;
-
- @Override
- public void validate() throws IllegalArgumentException {
- if (m_bundle == null) {
- throw new IllegalArgumentException("bundle not set");
- }
- if (m_wsdlResource == null) {
- throw new IllegalArgumentException("WSDL resource must not be null");
- }
- if (!StringUtility.hasText(m_alias)) {
- throw new IllegalArgumentException("alias must not be empty");
- }
- if (m_targetNamespace == null) {
- throw new IllegalArgumentException("no targetNamespace set");
- }
- if (m_service == null) {
- throw new IllegalArgumentException("no service set");
- }
- if (m_portName == null) {
- throw new IllegalArgumentException("no port set");
- }
- if (m_portType == null) {
- throw new IllegalArgumentException("no porttype set");
- }
- if (m_binding == null) {
- throw new IllegalArgumentException("no binding set");
- }
- if (m_urlPattern == null) {
- throw new IllegalArgumentException("no urlPattern set");
- }
- if (m_serviceOperationName == null) {
- throw new IllegalArgumentException("no serviceOperationName set");
- }
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- WSDLFactory factory;
- try {
- factory = WSDLFactory.newInstance();
- WSDLWriter writer = factory.newWSDLWriter();
- Definition definition = factory.newDefinition();
-
- definition.setExtensionRegistry(factory.newPopulatedExtensionRegistry());
-
- definition.setQName(new QName(m_alias));
- definition.setTargetNamespace(JaxWsSdkUtility.normalizePath(m_targetNamespace, SeparatorType.TrailingType));
- definition.addNamespace("tns", JaxWsSdkUtility.normalizePath(m_targetNamespace, SeparatorType.TrailingType));
- definition.addNamespace("mime", "http://schemas.xmlsoap.org/wsdl/mime/");
- definition.addNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
- definition.addNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
- definition.addNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
- definition.addNamespace("http", "http://schemas.xmlsoap.org/wsdl/http/");
-
- Document document = writer.getDocument(definition);
-
- // Port type
- PortType portType = definition.createPortType();
- definition.addPortType(portType);
- portType.setUndefined(false);
- portType.setQName(new QName(definition.getNamespace("tns"), m_portType));
-
- // Binding
- Binding binding = definition.createBinding();
- definition.addBinding(binding);
- binding.setUndefined(false);
- binding.setQName(new QName(definition.getNamespace("tns"), m_binding));
- binding.setPortType(portType);
-
- // Binding > Soap Binding
- SOAPBinding soapBinding = (SOAPBinding) definition.getExtensionRegistry().createExtension(Binding.class, new QName(definition.getNamespace("soap"), "binding"));
- binding.addExtensibilityElement(soapBinding);
- soapBinding.setStyle("document");
- soapBinding.setTransportURI("http://schemas.xmlsoap.org/soap/http");
- soapBinding.setElementType(new QName(definition.getNamespace("soap"), "binding"));
-
- // Binding > Binding operation
- BindingOperation bindingOperation = definition.createBindingOperation();
- binding.addBindingOperation(bindingOperation);
- bindingOperation.setName(m_serviceOperationName);
-
- // Binding > Binding operation > Soap operation
- SOAPOperation soapOperation = (SOAPOperation) definition.getExtensionRegistry().createExtension(BindingOperation.class, new QName(definition.getNamespace("soap"), "operation"));
- bindingOperation.addExtensibilityElement(soapOperation);
- soapOperation.setSoapActionURI(JaxWsSdkUtility.normalizePath(m_targetNamespace, SeparatorType.TrailingType) + m_serviceOperationName);
-
- // Binding > Binding operation > Binding input
- BindingInput bindingInput = definition.createBindingInput();
- bindingOperation.setBindingInput(bindingInput);
-
- // Binding > Binding operation > Binding input > Soap body
- SOAPBody soapBody = (SOAPBody) definition.getExtensionRegistry().createExtension(BindingInput.class, new QName(definition.getNamespace("soap"), "body"));
- soapBody.setUse("literal");
- bindingInput.addExtensibilityElement(soapBody);
-
- // Binding > Binding operation > Binding output
- BindingOutput bindingOutput = definition.createBindingOutput();
- bindingOperation.setBindingOutput(bindingOutput);
-
- // Binding > Binding operation > Binding output > Soap body
- soapBody = (SOAPBody) definition.getExtensionRegistry().createExtension(BindingOutput.class, new QName(definition.getNamespace("soap"), "body"));
- soapBody.setUse("literal");
- bindingOutput.addExtensibilityElement(soapBody);
-
- // Service
- Service service = definition.createService();
- definition.addService(service);
- service.setQName(new QName(m_service));
-
- // Port
- Port port = definition.createPort();
- service.addPort(port);
- port.setName(m_portName);
- port.setBinding(binding);
-
- // Port > Soap address
- SOAPAddress httpAddress = new SOAPAddressImpl();
- httpAddress.setLocationURI(JaxWsSdkUtility.normalizePath(m_targetNamespace, SeparatorType.None));
- httpAddress.setElementType(new QName(definition.getNamespace("soap"), "address"));
- port.addExtensibilityElement(httpAddress);
-
- // message (request)
- Message messageRequest = definition.createMessage();
- messageRequest.setUndefined(false);
- messageRequest.setQName(new QName(definition.getNamespace("tns"), m_serviceOperationName + "Request"));
- Part messagePartRequest = definition.createPart();
- if (getWsdlStyle() == WsdlStyleEnum.DocumentLiteralWrapped) {
- // naming of part name and element reference must follow document/literal WRAPPED convention
- messagePartRequest.setName("parameters");
- messagePartRequest.setElementName(new QName(definition.getNamespace("tns"), m_serviceOperationName));
- }
- else {
- // naming of part name and element reference must follow document/literal convention
- messagePartRequest.setName("in");
- messagePartRequest.setElementName(new QName(definition.getNamespace("tns"), "inElement"));
- }
- messageRequest.addPart(messagePartRequest);
- definition.addMessage(messageRequest);
-
- // message (response)
- Message messageResponse = definition.createMessage();
- messageResponse.setUndefined(false);
- messageResponse.setQName(new QName(definition.getNamespace("tns"), m_serviceOperationName + "Response"));
- Part messagePartResponse = definition.createPart();
- if (getWsdlStyle() == WsdlStyleEnum.DocumentLiteralWrapped) {
- // naming of part name and element reference must follow document/literal WRAPPED convention
- messagePartResponse.setName("parameters");
- messagePartResponse.setElementName(new QName(definition.getNamespace("tns"), m_serviceOperationName + "Response"));
- }
- else {
- // naming of part name and element reference must follow document/literal convention
- messagePartResponse.setName("out");
- messagePartResponse.setElementName(new QName(definition.getNamespace("tns"), "outElement"));
- }
- messageResponse.addPart(messagePartResponse);
- definition.addMessage(messageResponse);
-
- // operation
- Operation operation = definition.createOperation();
- operation.setUndefined(false);
- operation.setName(m_serviceOperationName);
-
- // operation > input
- Input input = definition.createInput();
- operation.setInput(input);
- input.setMessage(messageRequest);
-
- // operation > output
- Output output = definition.createOutput();
- operation.setOutput(output);
- portType.addOperation(operation);
- output.setMessage(messageResponse);
-
- // schema
- Types types = definition.createTypes();
- Schema schema = (Schema) definition.getExtensionRegistry().createExtension(Types.class, new QName(definition.getNamespace("xsd"), "schema"));
- types.addExtensibilityElement(schema);
-
- // definition of inline schema
- Element schemaXml = document.createElement("xsd:schema");
- schema.setElement(schemaXml);
- schemaXml.setAttribute("xmlns:xsd", definition.getNamespace("xsd"));
- schemaXml.setAttribute("targetNamespace", JaxWsSdkUtility.normalizePath(m_targetNamespace, SeparatorType.TrailingType));
-
- // definition of request
- Element schemaElementXml;
- if (getWsdlStyle() == WsdlStyleEnum.DocumentLiteralWrapped) {
- schemaElementXml = createDocumentLiteralWrappedSchemaElement(document, messagePartRequest, "in", "xsd:string");
- schemaXml.appendChild(schemaElementXml);
- }
- else {
- schemaElementXml = createDocumentLiteralSchemaElement(document, messagePartRequest, "xsd:string");
- }
- schemaXml.appendChild(schemaElementXml);
-
- // definition of response
- if (getWsdlStyle() == WsdlStyleEnum.DocumentLiteralWrapped) {
- schemaElementXml = createDocumentLiteralWrappedSchemaElement(document, messagePartResponse, "out", "xsd:string");
- schemaXml.appendChild(schemaElementXml);
- }
- else {
- schemaElementXml = createDocumentLiteralSchemaElement(document, messagePartResponse, "xsd:string");
- }
- schemaXml.appendChild(schemaElementXml);
-
- definition.setTypes(types);
-
- m_wsdlResource.storeWsdl(definition, IResourceListener.ELEMENT_FILE, IResourceListener.EVENT_WSDL_REPLACED, monitor);
- }
- catch (Exception e) {
- throw new CoreException(new ScoutStatus(IStatus.ERROR, "Could not persist WSDL file.", e));
- }
- }
-
- private Element createDocumentLiteralWrappedSchemaElement(Document document, Part part, String parameterName, String parameterXsdType) {
- Element xmlElement = document.createElement("xsd:element");
- xmlElement.setAttribute("name", part.getElementName().getLocalPart());
-
- // anonymous inner type
- Element xmlComplexType = document.createElement("xsd:complexType");
- xmlElement.appendChild(xmlComplexType);
-
- Element xmlSequence = document.createElement("xsd:sequence");
- xmlComplexType.appendChild(xmlSequence);
-
- Element xmlParameter = document.createElement("xsd:element");
- xmlParameter.setAttribute("name", parameterName);
- xmlParameter.setAttribute("type", parameterXsdType);
- xmlSequence.appendChild(xmlParameter);
- return xmlElement;
- }
-
- private Element createDocumentLiteralSchemaElement(Document document, Part part, String parameterXsdType) {
- Element xmlElement = document.createElement("xsd:element");
- xmlElement.setAttribute("name", part.getElementName().getLocalPart());
- xmlElement.setAttribute("type", parameterXsdType);
- return xmlElement;
- }
-
- @Override
- public String getOperationName() {
- return WsdlCreateOperation.class.getName();
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public String getAlias() {
- return m_alias;
- }
-
- public void setAlias(String alias) {
- m_alias = alias;
- }
-
- public WsdlResource getWsdlResource() {
- return m_wsdlResource;
- }
-
- public void setWsdlResource(WsdlResource wsdlResource) {
- m_wsdlResource = wsdlResource;
- }
-
- public String getTargetNamespace() {
- return m_targetNamespace;
- }
-
- public void setTargetNamespace(String targetNamespace) {
- m_targetNamespace = targetNamespace;
- }
-
- public String getService() {
- return m_service;
- }
-
- public void setService(String service) {
- m_service = service;
- }
-
- public String getPort() {
- return m_portName;
- }
-
- public void setPortName(String portName) {
- m_portName = portName;
- }
-
- public String getPortType() {
- return m_portType;
- }
-
- public void setPortType(String portType) {
- m_portType = portType;
- }
-
- public String getBinding() {
- return m_binding;
- }
-
- public void setBinding(String binding) {
- m_binding = binding;
- }
-
- public String getUrlPattern() {
- return m_urlPattern;
- }
-
- public void setUrlPattern(String urlPattern) {
- m_urlPattern = urlPattern;
- }
-
- public String getServiceOperationName() {
- return m_serviceOperationName;
- }
-
- public void setServiceOperationName(String serviceOperationName) {
- m_serviceOperationName = serviceOperationName;
- }
-
- public WsdlStyleEnum getWsdlStyle() {
- return m_wsdlStyle;
- }
-
- public void setWsdlStyle(WsdlStyleEnum wsdlStyleEnum) {
- m_wsdlStyle = wsdlStyleEnum;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import javax.wsdl.Binding;
+import javax.wsdl.BindingInput;
+import javax.wsdl.BindingOperation;
+import javax.wsdl.BindingOutput;
+import javax.wsdl.Definition;
+import javax.wsdl.Input;
+import javax.wsdl.Message;
+import javax.wsdl.Operation;
+import javax.wsdl.Output;
+import javax.wsdl.Part;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.soap.SOAPAddress;
+import javax.wsdl.extensions.soap.SOAPBinding;
+import javax.wsdl.extensions.soap.SOAPBody;
+import javax.wsdl.extensions.soap.SOAPOperation;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLWriter;
+import javax.xml.namespace.QName;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+
+import com.ibm.wsdl.extensions.soap.SOAPAddressImpl;
+
+public class WsdlCreateOperation implements IOperation {
+
+ private IScoutBundle m_bundle;
+
+ private WsdlResource m_wsdlResource;
+ private String m_alias;
+ private String m_targetNamespace;
+ private String m_service;
+ private String m_portName;
+ private String m_portType;
+ private String m_binding;
+ private String m_urlPattern;
+ private String m_serviceOperationName;
+ private WsdlStyleEnum m_wsdlStyle;
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ if (m_bundle == null) {
+ throw new IllegalArgumentException("bundle not set");
+ }
+ if (m_wsdlResource == null) {
+ throw new IllegalArgumentException("WSDL resource must not be null");
+ }
+ if (!StringUtility.hasText(m_alias)) {
+ throw new IllegalArgumentException("alias must not be empty");
+ }
+ if (m_targetNamespace == null) {
+ throw new IllegalArgumentException("no targetNamespace set");
+ }
+ if (m_service == null) {
+ throw new IllegalArgumentException("no service set");
+ }
+ if (m_portName == null) {
+ throw new IllegalArgumentException("no port set");
+ }
+ if (m_portType == null) {
+ throw new IllegalArgumentException("no porttype set");
+ }
+ if (m_binding == null) {
+ throw new IllegalArgumentException("no binding set");
+ }
+ if (m_urlPattern == null) {
+ throw new IllegalArgumentException("no urlPattern set");
+ }
+ if (m_serviceOperationName == null) {
+ throw new IllegalArgumentException("no serviceOperationName set");
+ }
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ WSDLFactory factory;
+ try {
+ factory = WSDLFactory.newInstance();
+ WSDLWriter writer = factory.newWSDLWriter();
+ Definition definition = factory.newDefinition();
+
+ definition.setExtensionRegistry(factory.newPopulatedExtensionRegistry());
+
+ definition.setQName(new QName(m_alias));
+ definition.setTargetNamespace(JaxWsSdkUtility.normalizePath(m_targetNamespace, SeparatorType.TrailingType));
+ definition.addNamespace("tns", JaxWsSdkUtility.normalizePath(m_targetNamespace, SeparatorType.TrailingType));
+ definition.addNamespace("mime", "http://schemas.xmlsoap.org/wsdl/mime/");
+ definition.addNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
+ definition.addNamespace("soap", "http://schemas.xmlsoap.org/wsdl/soap/");
+ definition.addNamespace("xsd", "http://www.w3.org/2001/XMLSchema");
+ definition.addNamespace("http", "http://schemas.xmlsoap.org/wsdl/http/");
+
+ Document document = writer.getDocument(definition);
+
+ // Port type
+ PortType portType = definition.createPortType();
+ definition.addPortType(portType);
+ portType.setUndefined(false);
+ portType.setQName(new QName(definition.getNamespace("tns"), m_portType));
+
+ // Binding
+ Binding binding = definition.createBinding();
+ definition.addBinding(binding);
+ binding.setUndefined(false);
+ binding.setQName(new QName(definition.getNamespace("tns"), m_binding));
+ binding.setPortType(portType);
+
+ // Binding > Soap Binding
+ SOAPBinding soapBinding = (SOAPBinding) definition.getExtensionRegistry().createExtension(Binding.class, new QName(definition.getNamespace("soap"), "binding"));
+ binding.addExtensibilityElement(soapBinding);
+ soapBinding.setStyle("document");
+ soapBinding.setTransportURI("http://schemas.xmlsoap.org/soap/http");
+ soapBinding.setElementType(new QName(definition.getNamespace("soap"), "binding"));
+
+ // Binding > Binding operation
+ BindingOperation bindingOperation = definition.createBindingOperation();
+ binding.addBindingOperation(bindingOperation);
+ bindingOperation.setName(m_serviceOperationName);
+
+ // Binding > Binding operation > Soap operation
+ SOAPOperation soapOperation = (SOAPOperation) definition.getExtensionRegistry().createExtension(BindingOperation.class, new QName(definition.getNamespace("soap"), "operation"));
+ bindingOperation.addExtensibilityElement(soapOperation);
+ soapOperation.setSoapActionURI(JaxWsSdkUtility.normalizePath(m_targetNamespace, SeparatorType.TrailingType) + m_serviceOperationName);
+
+ // Binding > Binding operation > Binding input
+ BindingInput bindingInput = definition.createBindingInput();
+ bindingOperation.setBindingInput(bindingInput);
+
+ // Binding > Binding operation > Binding input > Soap body
+ SOAPBody soapBody = (SOAPBody) definition.getExtensionRegistry().createExtension(BindingInput.class, new QName(definition.getNamespace("soap"), "body"));
+ soapBody.setUse("literal");
+ bindingInput.addExtensibilityElement(soapBody);
+
+ // Binding > Binding operation > Binding output
+ BindingOutput bindingOutput = definition.createBindingOutput();
+ bindingOperation.setBindingOutput(bindingOutput);
+
+ // Binding > Binding operation > Binding output > Soap body
+ soapBody = (SOAPBody) definition.getExtensionRegistry().createExtension(BindingOutput.class, new QName(definition.getNamespace("soap"), "body"));
+ soapBody.setUse("literal");
+ bindingOutput.addExtensibilityElement(soapBody);
+
+ // Service
+ Service service = definition.createService();
+ definition.addService(service);
+ service.setQName(new QName(m_service));
+
+ // Port
+ Port port = definition.createPort();
+ service.addPort(port);
+ port.setName(m_portName);
+ port.setBinding(binding);
+
+ // Port > Soap address
+ SOAPAddress httpAddress = new SOAPAddressImpl();
+ httpAddress.setLocationURI(JaxWsSdkUtility.normalizePath(m_targetNamespace, SeparatorType.None));
+ httpAddress.setElementType(new QName(definition.getNamespace("soap"), "address"));
+ port.addExtensibilityElement(httpAddress);
+
+ // message (request)
+ Message messageRequest = definition.createMessage();
+ messageRequest.setUndefined(false);
+ messageRequest.setQName(new QName(definition.getNamespace("tns"), m_serviceOperationName + "Request"));
+ Part messagePartRequest = definition.createPart();
+ if (getWsdlStyle() == WsdlStyleEnum.DocumentLiteralWrapped) {
+ // naming of part name and element reference must follow document/literal WRAPPED convention
+ messagePartRequest.setName("parameters");
+ messagePartRequest.setElementName(new QName(definition.getNamespace("tns"), m_serviceOperationName));
+ }
+ else {
+ // naming of part name and element reference must follow document/literal convention
+ messagePartRequest.setName("in");
+ messagePartRequest.setElementName(new QName(definition.getNamespace("tns"), "inElement"));
+ }
+ messageRequest.addPart(messagePartRequest);
+ definition.addMessage(messageRequest);
+
+ // message (response)
+ Message messageResponse = definition.createMessage();
+ messageResponse.setUndefined(false);
+ messageResponse.setQName(new QName(definition.getNamespace("tns"), m_serviceOperationName + "Response"));
+ Part messagePartResponse = definition.createPart();
+ if (getWsdlStyle() == WsdlStyleEnum.DocumentLiteralWrapped) {
+ // naming of part name and element reference must follow document/literal WRAPPED convention
+ messagePartResponse.setName("parameters");
+ messagePartResponse.setElementName(new QName(definition.getNamespace("tns"), m_serviceOperationName + "Response"));
+ }
+ else {
+ // naming of part name and element reference must follow document/literal convention
+ messagePartResponse.setName("out");
+ messagePartResponse.setElementName(new QName(definition.getNamespace("tns"), "outElement"));
+ }
+ messageResponse.addPart(messagePartResponse);
+ definition.addMessage(messageResponse);
+
+ // operation
+ Operation operation = definition.createOperation();
+ operation.setUndefined(false);
+ operation.setName(m_serviceOperationName);
+
+ // operation > input
+ Input input = definition.createInput();
+ operation.setInput(input);
+ input.setMessage(messageRequest);
+
+ // operation > output
+ Output output = definition.createOutput();
+ operation.setOutput(output);
+ portType.addOperation(operation);
+ output.setMessage(messageResponse);
+
+ // schema
+ Types types = definition.createTypes();
+ Schema schema = (Schema) definition.getExtensionRegistry().createExtension(Types.class, new QName(definition.getNamespace("xsd"), "schema"));
+ types.addExtensibilityElement(schema);
+
+ // definition of inline schema
+ Element schemaXml = document.createElement("xsd:schema");
+ schema.setElement(schemaXml);
+ schemaXml.setAttribute("xmlns:xsd", definition.getNamespace("xsd"));
+ schemaXml.setAttribute("targetNamespace", JaxWsSdkUtility.normalizePath(m_targetNamespace, SeparatorType.TrailingType));
+
+ // definition of request
+ Element schemaElementXml;
+ if (getWsdlStyle() == WsdlStyleEnum.DocumentLiteralWrapped) {
+ schemaElementXml = createDocumentLiteralWrappedSchemaElement(document, messagePartRequest, "in", "xsd:string");
+ schemaXml.appendChild(schemaElementXml);
+ }
+ else {
+ schemaElementXml = createDocumentLiteralSchemaElement(document, messagePartRequest, "xsd:string");
+ }
+ schemaXml.appendChild(schemaElementXml);
+
+ // definition of response
+ if (getWsdlStyle() == WsdlStyleEnum.DocumentLiteralWrapped) {
+ schemaElementXml = createDocumentLiteralWrappedSchemaElement(document, messagePartResponse, "out", "xsd:string");
+ schemaXml.appendChild(schemaElementXml);
+ }
+ else {
+ schemaElementXml = createDocumentLiteralSchemaElement(document, messagePartResponse, "xsd:string");
+ }
+ schemaXml.appendChild(schemaElementXml);
+
+ definition.setTypes(types);
+
+ m_wsdlResource.storeWsdl(definition, IResourceListener.ELEMENT_FILE, IResourceListener.EVENT_WSDL_REPLACED, monitor);
+ }
+ catch (Exception e) {
+ throw new CoreException(new ScoutStatus(IStatus.ERROR, "Could not persist WSDL file.", e));
+ }
+ }
+
+ private Element createDocumentLiteralWrappedSchemaElement(Document document, Part part, String parameterName, String parameterXsdType) {
+ Element xmlElement = document.createElement("xsd:element");
+ xmlElement.setAttribute("name", part.getElementName().getLocalPart());
+
+ // anonymous inner type
+ Element xmlComplexType = document.createElement("xsd:complexType");
+ xmlElement.appendChild(xmlComplexType);
+
+ Element xmlSequence = document.createElement("xsd:sequence");
+ xmlComplexType.appendChild(xmlSequence);
+
+ Element xmlParameter = document.createElement("xsd:element");
+ xmlParameter.setAttribute("name", parameterName);
+ xmlParameter.setAttribute("type", parameterXsdType);
+ xmlSequence.appendChild(xmlParameter);
+ return xmlElement;
+ }
+
+ private Element createDocumentLiteralSchemaElement(Document document, Part part, String parameterXsdType) {
+ Element xmlElement = document.createElement("xsd:element");
+ xmlElement.setAttribute("name", part.getElementName().getLocalPart());
+ xmlElement.setAttribute("type", parameterXsdType);
+ return xmlElement;
+ }
+
+ @Override
+ public String getOperationName() {
+ return WsdlCreateOperation.class.getName();
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public String getAlias() {
+ return m_alias;
+ }
+
+ public void setAlias(String alias) {
+ m_alias = alias;
+ }
+
+ public WsdlResource getWsdlResource() {
+ return m_wsdlResource;
+ }
+
+ public void setWsdlResource(WsdlResource wsdlResource) {
+ m_wsdlResource = wsdlResource;
+ }
+
+ public String getTargetNamespace() {
+ return m_targetNamespace;
+ }
+
+ public void setTargetNamespace(String targetNamespace) {
+ m_targetNamespace = targetNamespace;
+ }
+
+ public String getService() {
+ return m_service;
+ }
+
+ public void setService(String service) {
+ m_service = service;
+ }
+
+ public String getPort() {
+ return m_portName;
+ }
+
+ public void setPortName(String portName) {
+ m_portName = portName;
+ }
+
+ public String getPortType() {
+ return m_portType;
+ }
+
+ public void setPortType(String portType) {
+ m_portType = portType;
+ }
+
+ public String getBinding() {
+ return m_binding;
+ }
+
+ public void setBinding(String binding) {
+ m_binding = binding;
+ }
+
+ public String getUrlPattern() {
+ return m_urlPattern;
+ }
+
+ public void setUrlPattern(String urlPattern) {
+ m_urlPattern = urlPattern;
+ }
+
+ public String getServiceOperationName() {
+ return m_serviceOperationName;
+ }
+
+ public void setServiceOperationName(String serviceOperationName) {
+ m_serviceOperationName = serviceOperationName;
+ }
+
+ public WsdlStyleEnum getWsdlStyle() {
+ return m_wsdlStyle;
+ }
+
+ public void setWsdlStyle(WsdlStyleEnum wsdlStyleEnum) {
+ m_wsdlStyle = wsdlStyleEnum;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsdlStyleEnum.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsdlStyleEnum.java
index 48c641d78..ca44c2695 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsdlStyleEnum.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/operation/WsdlStyleEnum.java
@@ -1,28 +1,28 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.operation;
-
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-
-public enum WsdlStyleEnum {
- DocumentLiteralWrapped(Texts.get("DocumentLiteralWrapped")),
- DocumentLiteral(Texts.get("DocumentLiteral"));
-
- private String m_label;
-
- private WsdlStyleEnum(String label) {
- m_label = label;
- }
-
- public String getLabel() {
- return m_label;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.operation;
+
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+
+public enum WsdlStyleEnum {
+ DocumentLiteralWrapped(Texts.get("DocumentLiteralWrapped")),
+ DocumentLiteral(Texts.get("DocumentLiteral"));
+
+ private String m_label;
+
+ private WsdlStyleEnum(String label) {
+ m_label = label;
+ }
+
+ public String getLabel() {
+ return m_label;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/IPreferenceConstants.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/IPreferenceConstants.java
index 6acc0ff60..b46b15eb3 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/IPreferenceConstants.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/IPreferenceConstants.java
@@ -1,16 +1,16 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.preferences;
-
-public interface IPreferenceConstants {
- static final String PREF_STUB_GENERATION_DEBUG_MODE = "jaxws.stub.generation.debug_mode";
- static final String PREF_STUB_GENERATION_KEEP_LAUNCH_CONFIG = "jaxws.stub.generation.launch_config_keep";
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.preferences;
+
+public interface IPreferenceConstants {
+ static final String PREF_STUB_GENERATION_DEBUG_MODE = "jaxws.stub.generation.debug_mode";
+ static final String PREF_STUB_GENERATION_KEEP_LAUNCH_CONFIG = "jaxws.stub.generation.launch_config_keep";
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/JaxWsPreferencePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/JaxWsPreferencePage.java
index dc738dd8b..b1b329710 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/JaxWsPreferencePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/JaxWsPreferencePage.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.preferences;
-
-import org.eclipse.jface.preference.BooleanFieldEditor;
-import org.eclipse.jface.preference.FieldEditorPreferencePage;
-import org.eclipse.jface.preference.IntegerFieldEditor;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-/**
- * <p>
- * This class represents a preference page that is contributed to the Preferences dialog.
- * </p>
- * <p>
- * This page is used to modify preferences only. Values are stored in the preference store that belongs to the main
- * plug-in class. That way, preferences can be accessed directly via the preference store.
- * </p>
- */
-public class JaxWsPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
-
- private BooleanFieldEditor refreshLocalJobField;
- private IntegerFieldEditor pollingIntervalField;
-
- public JaxWsPreferencePage() {
- super(GRID);
- setPreferenceStore(JaxWsSdk.getDefault().getPreferenceStore());
- setDescription(Texts.get("JaxWsPreferences"));
- }
-
- @Override
- public void init(IWorkbench workbench) {
- }
-
- /**
- * Creates the field editors. Field editors are abstractions of the common GUI
- * blocks needed to manipulate various types of preferences. Each field editor
- * knows how to save and restore itself.
- */
- @Override
- public void createFieldEditors() {
- addField(new BooleanFieldEditor(IPreferenceConstants.PREF_STUB_GENERATION_DEBUG_MODE, Texts.get("BuildStubInDebugMode"), getFieldEditorParent()));
- addField(new BooleanFieldEditor(IPreferenceConstants.PREF_STUB_GENERATION_KEEP_LAUNCH_CONFIG, Texts.get("KeepLaunchConfiguration"), getFieldEditorParent()));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.preferences;
+
+import org.eclipse.jface.preference.BooleanFieldEditor;
+import org.eclipse.jface.preference.FieldEditorPreferencePage;
+import org.eclipse.jface.preference.IntegerFieldEditor;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+/**
+ * <p>
+ * This class represents a preference page that is contributed to the Preferences dialog.
+ * </p>
+ * <p>
+ * This page is used to modify preferences only. Values are stored in the preference store that belongs to the main
+ * plug-in class. That way, preferences can be accessed directly via the preference store.
+ * </p>
+ */
+public class JaxWsPreferencePage extends FieldEditorPreferencePage implements IWorkbenchPreferencePage {
+
+ private BooleanFieldEditor refreshLocalJobField;
+ private IntegerFieldEditor pollingIntervalField;
+
+ public JaxWsPreferencePage() {
+ super(GRID);
+ setPreferenceStore(JaxWsSdk.getDefault().getPreferenceStore());
+ setDescription(Texts.get("JaxWsPreferences"));
+ }
+
+ @Override
+ public void init(IWorkbench workbench) {
+ }
+
+ /**
+ * Creates the field editors. Field editors are abstractions of the common GUI
+ * blocks needed to manipulate various types of preferences. Each field editor
+ * knows how to save and restore itself.
+ */
+ @Override
+ public void createFieldEditors() {
+ addField(new BooleanFieldEditor(IPreferenceConstants.PREF_STUB_GENERATION_DEBUG_MODE, Texts.get("BuildStubInDebugMode"), getFieldEditorParent()));
+ addField(new BooleanFieldEditor(IPreferenceConstants.PREF_STUB_GENERATION_KEEP_LAUNCH_CONFIG, Texts.get("KeepLaunchConfiguration"), getFieldEditorParent()));
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/PreferenceInitializer.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/PreferenceInitializer.java
index da4408975..2e139fc11 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/PreferenceInitializer.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/preferences/PreferenceInitializer.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.preferences;
-
-import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-
-public class PreferenceInitializer extends AbstractPreferenceInitializer {
-
- @Override
- public void initializeDefaultPreferences() {
- IPreferenceStore store = JaxWsSdk.getDefault().getPreferenceStore();
- store.setDefault(IPreferenceConstants.PREF_STUB_GENERATION_DEBUG_MODE, false);
- store.setDefault(IPreferenceConstants.PREF_STUB_GENERATION_KEEP_LAUNCH_CONFIG, false);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.preferences;
+
+import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+
+public class PreferenceInitializer extends AbstractPreferenceInitializer {
+
+ @Override
+ public void initializeDefaultPreferences() {
+ IPreferenceStore store = JaxWsSdk.getDefault().getPreferenceStore();
+ store.setDefault(IPreferenceConstants.PREF_STUB_GENERATION_DEBUG_MODE, false);
+ store.setDefault(IPreferenceConstants.PREF_STUB_GENERATION_KEEP_LAUNCH_CONFIG, false);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/IResourceListener.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/IResourceListener.java
index 60306542e..ec708ab5b 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/IResourceListener.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/IResourceListener.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.resource;
-
-public interface IResourceListener {
-
- public static final String ELEMENT_FILE = "";
-
- public static final int EVENT_UNKNOWN = 1 << 0;
-
- public static final int EVENT_SUNJAXWS_REPLACED = 1 << 1;
- public static final int EVENT_SUNJAXWS_ENTRY_ADDED = 1 << 2;
- public static final int EVENT_SUNJAXWS_ENTRY_REMOVED = 1 << 3;
- public static final int EVENT_SUNJAXWS_WSDL_CHANGED = 1 << 4;
- public static final int EVENT_SUNJAXWS_URL_PATTERN_CHANGED = 1 << 5;
- public static final int EVENT_SUNJAXWS_HANDLER_CHANGED = 1 << 9;
-
- public static final int EVENT_BUILDJAXWS_REPLACED = 1 << 1;
- public static final int EVENT_BUILDJAXWS_ENTRY_ADDED = 1 << 2;
- public static final int EVENT_BUILDJAXWS_PROPERTIES_CHANGED = 1 << 3;
- public static final int EVENT_BUILDJAXWS_WSDL_CHANGED = 1 << 4;
-
- public static final int EVENT_WSDL_REPLACED = 1 << 1;
- public static final int EVENT_STUB_REBUILT = 1 << 2;
-
- public static final int EVENT_MANIFEST_CLASSPATH = 1 << 1;
-
- /**
- * Notification about resource change
- *
- * @param element
- * the element that changed. This is a constant defined in {@link IResourceListener} and is never
- * <code>null</code>.
- * @param event
- * the event that describes the change. Multiple events are encoded by <em>bitwise OR</em>'ing them.
- */
- public void changed(String element, int event);
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.resource;
+
+public interface IResourceListener {
+
+ public static final String ELEMENT_FILE = "";
+
+ public static final int EVENT_UNKNOWN = 1 << 0;
+
+ public static final int EVENT_SUNJAXWS_REPLACED = 1 << 1;
+ public static final int EVENT_SUNJAXWS_ENTRY_ADDED = 1 << 2;
+ public static final int EVENT_SUNJAXWS_ENTRY_REMOVED = 1 << 3;
+ public static final int EVENT_SUNJAXWS_WSDL_CHANGED = 1 << 4;
+ public static final int EVENT_SUNJAXWS_URL_PATTERN_CHANGED = 1 << 5;
+ public static final int EVENT_SUNJAXWS_HANDLER_CHANGED = 1 << 9;
+
+ public static final int EVENT_BUILDJAXWS_REPLACED = 1 << 1;
+ public static final int EVENT_BUILDJAXWS_ENTRY_ADDED = 1 << 2;
+ public static final int EVENT_BUILDJAXWS_PROPERTIES_CHANGED = 1 << 3;
+ public static final int EVENT_BUILDJAXWS_WSDL_CHANGED = 1 << 4;
+
+ public static final int EVENT_WSDL_REPLACED = 1 << 1;
+ public static final int EVENT_STUB_REBUILT = 1 << 2;
+
+ public static final int EVENT_MANIFEST_CLASSPATH = 1 << 1;
+
+ /**
+ * Notification about resource change
+ *
+ * @param element
+ * the element that changed. This is a constant defined in {@link IResourceListener} and is never
+ * <code>null</code>.
+ * @param event
+ * the event that describes the change. Multiple events are encoded by <em>bitwise OR</em>'ing them.
+ */
+ public void changed(String element, int event);
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/ManagedResource.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/ManagedResource.java
index 8147c029b..113c6943f 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/ManagedResource.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/ManagedResource.java
@@ -1,296 +1,296 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.resource;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-
-public class ManagedResource {
-
- /**
- * modification stamp to indicate that API changed resource to omit JDT Resource Changed notification.
- * Invoke {@link ManagedResource#setModificationStamp(long)} with this code prior to write resource to disk. It is
- * important to reset the modification stamp after having written to disk.
- */
- public static final int API_MODIFICATION_STAMP = Integer.MAX_VALUE;
-
- protected long m_modificationStamp;
- private IProject m_project;
- protected IFile m_file;
- protected Object m_fileLock;
- private Object m_registrationLock;
-
- private IResourceChangeListener m_jdtResourceChangedListener;
- private List<P_ResourceListenerEntry> m_resourceListeners;
-
- public ManagedResource(IProject project) {
- m_project = project;
- m_fileLock = new Object();
- m_registrationLock = new Object();
- m_resourceListeners = new ArrayList<P_ResourceListenerEntry>();
- m_jdtResourceChangedListener = new P_JdtResourceChangedListener();
- }
-
- private void attachJdtResourceChangeListener() {
- ResourcesPlugin.getWorkspace().addResourceChangeListener(m_jdtResourceChangedListener);
- }
-
- private void detachJdtResourceChangeListener() {
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(m_jdtResourceChangedListener);
- }
-
- /**
- * To receive notifications when this resource change.
- *
- * @param listener
- */
- public void addResourceListener(IResourceListener listener) {
- addResourceListener(null, null, listener);
- }
-
- /**
- * To receive notifications when this resource change.
- *
- * @param element
- * To only receive notification that origin of the given element within the resource.
- * @param listener
- */
- public void addResourceListener(String element, IResourceListener listener) {
- addResourceListener(element, null, listener);
- }
-
- /**
- * To receive notifications when this resource change.
- *
- * @param event
- * the event to be interested in receiving notifications. This is <em>bitwise OR</em>'ing together event
- * constants defined in {@link IResourceListener}.
- * @param listener
- */
- public void addResourceListener(Integer event, IResourceListener listener) {
- addResourceListener(null, event, listener);
- }
-
- /**
- * To receive notifications when this resource change.
- *
- * @param element
- * To only receive notification that origin of the given element within the resource.
- * @param event
- * To only receive notification of the given event. This is <em>bitwise OR</em>'ing together event
- * constants defined in {@link IResourceListener}.
- * @param listener
- */
- public void addResourceListener(String element, Integer event, IResourceListener listener) {
- P_ResourceListenerEntry entry = new P_ResourceListenerEntry();
- entry.setElement(element);
- entry.setEvent(event);
- entry.setListener(listener);
-
- synchronized (m_registrationLock) {
- if (m_resourceListeners.size() == 0) {
- attachJdtResourceChangeListener();
- }
-
- m_resourceListeners.add(entry);
- }
- }
-
- public void removeResourceListener(IResourceListener listener) {
- synchronized (m_registrationLock) {
- for (P_ResourceListenerEntry entry : m_resourceListeners.toArray(new P_ResourceListenerEntry[m_resourceListeners.size()])) {
- if (entry.getListener() == listener) {
- m_resourceListeners.remove(entry);
- }
- }
-
- if (m_resourceListeners.size() == 0) {
- detachJdtResourceChangeListener();
- }
- }
- }
-
- public IFile getFile() {
- synchronized (m_fileLock) {
- return m_file;
- }
- }
-
- public boolean isSameFile(IFile file) {
- if (file == null || m_file == null) {
- return false;
- }
- return file.getProjectRelativePath().equals(m_file.getProjectRelativePath());
- }
-
- public void setFile(IFile file) {
- synchronized (m_fileLock) {
- m_modificationStamp = IResource.NULL_STAMP;
- m_file = file;
- }
- }
-
- public boolean existsFile() {
- return m_file != null && m_file.exists();
- }
-
- protected long getModificationStamp() {
- return m_modificationStamp;
- }
-
- protected void setModificationStamp(long modificationStamp) {
- m_modificationStamp = modificationStamp;
- }
-
- public void touch() {
- m_modificationStamp = IResource.NULL_STAMP;
- }
-
- /**
- * To notify listeners about a change.
- *
- * @param element
- * the element that changed (defined in {@link IResourceListener})
- * @param event
- * the events that describes the change. This is <em>bitwise OR</em>'ing together events described in
- * {@link IResourceListener}
- */
- protected void notifyResourceListeners(String element, Integer event) {
- if (element == null) {
- throw new IllegalArgumentException("element must not be null");
- }
- if (event == null) {
- throw new IllegalArgumentException("event must not be null");
- }
-
- Set<IResourceListener> listenersProcessed = new HashSet<IResourceListener>();
-
- for (P_ResourceListenerEntry entry : m_resourceListeners.toArray(new P_ResourceListenerEntry[m_resourceListeners.size()])) {
- if (!listenersProcessed.contains(entry.getListener()) &&
- (entry.getElement() == null || entry.getElement().equals(element)) &&
- (entry.getEvent() == null || (entry.getEvent() & event) > 0)) {
- try {
- entry.getListener().changed(element, event);
- }
- catch (Throwable e) {
- // failsafe
- JaxWsSdk.logError("Error occured while notifying listener about change", e);
- }
- finally {
- listenersProcessed.add(entry.getListener());
- }
- }
- }
- }
-
- private class P_JdtResourceChangedListener implements IResourceChangeListener {
-
- @Override
- public void resourceChanged(IResourceChangeEvent event) {
- if (m_file == null) {
- return;
- }
-
- // there is only interest in POST_CHANGE events
- if (event.getType() != IResourceChangeEvent.POST_CHANGE) {
- return;
- }
-
- try {
- IResourceDelta rootDelta = event.getDelta();
- rootDelta.accept(new IResourceDeltaVisitor() {
-
- @Override
- public boolean visit(IResourceDelta delta) throws CoreException {
- if (delta.getKind() == IResourceDelta.REMOVED || delta.getKind() == IResourceDelta.REPLACED || delta.getKind() == IResourceDelta.ADDED || (delta.getKind() == IResourceDelta.CHANGED && (delta.getFlags() & IResourceDelta.CONTENT) != 0)) { // it is crucial to exclude marker update events
- IResource candidate = delta.getResource();
-
- if (candidate.getType() != IResource.FILE) {
- return true;
- }
-
- if (candidate.getProject() != m_project) {
- return false;
- }
-
- if (CompareUtility.equals(candidate, m_file)) {
- // only notify if modification stamp of resource is different to current stamp.
- // This is to exclude workspace modifications caused by API code
- if (m_modificationStamp != API_MODIFICATION_STAMP && (m_modificationStamp == IResource.NULL_STAMP || m_modificationStamp != m_file.getModificationStamp())) {
- notifyResourceListeners(IResourceListener.ELEMENT_FILE, IResourceListener.EVENT_UNKNOWN);
- }
- return false;
- }
- }
- return true;
- }
- });
- }
- catch (Exception e) {
- JaxWsSdk.logError("Unexpected error occured while intercepting 'Resource Change' event.", e);
- }
- }
- }
-
- private class P_ResourceListenerEntry {
- private IResourceListener m_listener;
-
- /**
- * the source the listener is interested in to receive notifications
- */
- private String m_element;
- /**
- * the event the listener is interested in to receive notifications
- */
- private Integer m_event;
-
- public IResourceListener getListener() {
- return m_listener;
- }
-
- public void setListener(IResourceListener listener) {
- m_listener = listener;
- }
-
- public String getElement() {
- return m_element;
- }
-
- public void setElement(String element) {
- m_element = element;
- }
-
- public Integer getEvent() {
- return m_event;
- }
-
- public void setEvent(Integer event) {
- m_event = event;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.resource;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+
+public class ManagedResource {
+
+ /**
+ * modification stamp to indicate that API changed resource to omit JDT Resource Changed notification.
+ * Invoke {@link ManagedResource#setModificationStamp(long)} with this code prior to write resource to disk. It is
+ * important to reset the modification stamp after having written to disk.
+ */
+ public static final int API_MODIFICATION_STAMP = Integer.MAX_VALUE;
+
+ protected long m_modificationStamp;
+ private IProject m_project;
+ protected IFile m_file;
+ protected Object m_fileLock;
+ private Object m_registrationLock;
+
+ private IResourceChangeListener m_jdtResourceChangedListener;
+ private List<P_ResourceListenerEntry> m_resourceListeners;
+
+ public ManagedResource(IProject project) {
+ m_project = project;
+ m_fileLock = new Object();
+ m_registrationLock = new Object();
+ m_resourceListeners = new ArrayList<P_ResourceListenerEntry>();
+ m_jdtResourceChangedListener = new P_JdtResourceChangedListener();
+ }
+
+ private void attachJdtResourceChangeListener() {
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(m_jdtResourceChangedListener);
+ }
+
+ private void detachJdtResourceChangeListener() {
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(m_jdtResourceChangedListener);
+ }
+
+ /**
+ * To receive notifications when this resource change.
+ *
+ * @param listener
+ */
+ public void addResourceListener(IResourceListener listener) {
+ addResourceListener(null, null, listener);
+ }
+
+ /**
+ * To receive notifications when this resource change.
+ *
+ * @param element
+ * To only receive notification that origin of the given element within the resource.
+ * @param listener
+ */
+ public void addResourceListener(String element, IResourceListener listener) {
+ addResourceListener(element, null, listener);
+ }
+
+ /**
+ * To receive notifications when this resource change.
+ *
+ * @param event
+ * the event to be interested in receiving notifications. This is <em>bitwise OR</em>'ing together event
+ * constants defined in {@link IResourceListener}.
+ * @param listener
+ */
+ public void addResourceListener(Integer event, IResourceListener listener) {
+ addResourceListener(null, event, listener);
+ }
+
+ /**
+ * To receive notifications when this resource change.
+ *
+ * @param element
+ * To only receive notification that origin of the given element within the resource.
+ * @param event
+ * To only receive notification of the given event. This is <em>bitwise OR</em>'ing together event
+ * constants defined in {@link IResourceListener}.
+ * @param listener
+ */
+ public void addResourceListener(String element, Integer event, IResourceListener listener) {
+ P_ResourceListenerEntry entry = new P_ResourceListenerEntry();
+ entry.setElement(element);
+ entry.setEvent(event);
+ entry.setListener(listener);
+
+ synchronized (m_registrationLock) {
+ if (m_resourceListeners.size() == 0) {
+ attachJdtResourceChangeListener();
+ }
+
+ m_resourceListeners.add(entry);
+ }
+ }
+
+ public void removeResourceListener(IResourceListener listener) {
+ synchronized (m_registrationLock) {
+ for (P_ResourceListenerEntry entry : m_resourceListeners.toArray(new P_ResourceListenerEntry[m_resourceListeners.size()])) {
+ if (entry.getListener() == listener) {
+ m_resourceListeners.remove(entry);
+ }
+ }
+
+ if (m_resourceListeners.size() == 0) {
+ detachJdtResourceChangeListener();
+ }
+ }
+ }
+
+ public IFile getFile() {
+ synchronized (m_fileLock) {
+ return m_file;
+ }
+ }
+
+ public boolean isSameFile(IFile file) {
+ if (file == null || m_file == null) {
+ return false;
+ }
+ return file.getProjectRelativePath().equals(m_file.getProjectRelativePath());
+ }
+
+ public void setFile(IFile file) {
+ synchronized (m_fileLock) {
+ m_modificationStamp = IResource.NULL_STAMP;
+ m_file = file;
+ }
+ }
+
+ public boolean existsFile() {
+ return m_file != null && m_file.exists();
+ }
+
+ protected long getModificationStamp() {
+ return m_modificationStamp;
+ }
+
+ protected void setModificationStamp(long modificationStamp) {
+ m_modificationStamp = modificationStamp;
+ }
+
+ public void touch() {
+ m_modificationStamp = IResource.NULL_STAMP;
+ }
+
+ /**
+ * To notify listeners about a change.
+ *
+ * @param element
+ * the element that changed (defined in {@link IResourceListener})
+ * @param event
+ * the events that describes the change. This is <em>bitwise OR</em>'ing together events described in
+ * {@link IResourceListener}
+ */
+ protected void notifyResourceListeners(String element, Integer event) {
+ if (element == null) {
+ throw new IllegalArgumentException("element must not be null");
+ }
+ if (event == null) {
+ throw new IllegalArgumentException("event must not be null");
+ }
+
+ Set<IResourceListener> listenersProcessed = new HashSet<IResourceListener>();
+
+ for (P_ResourceListenerEntry entry : m_resourceListeners.toArray(new P_ResourceListenerEntry[m_resourceListeners.size()])) {
+ if (!listenersProcessed.contains(entry.getListener()) &&
+ (entry.getElement() == null || entry.getElement().equals(element)) &&
+ (entry.getEvent() == null || (entry.getEvent() & event) > 0)) {
+ try {
+ entry.getListener().changed(element, event);
+ }
+ catch (Throwable e) {
+ // failsafe
+ JaxWsSdk.logError("Error occured while notifying listener about change", e);
+ }
+ finally {
+ listenersProcessed.add(entry.getListener());
+ }
+ }
+ }
+ }
+
+ private class P_JdtResourceChangedListener implements IResourceChangeListener {
+
+ @Override
+ public void resourceChanged(IResourceChangeEvent event) {
+ if (m_file == null) {
+ return;
+ }
+
+ // there is only interest in POST_CHANGE events
+ if (event.getType() != IResourceChangeEvent.POST_CHANGE) {
+ return;
+ }
+
+ try {
+ IResourceDelta rootDelta = event.getDelta();
+ rootDelta.accept(new IResourceDeltaVisitor() {
+
+ @Override
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ if (delta.getKind() == IResourceDelta.REMOVED || delta.getKind() == IResourceDelta.REPLACED || delta.getKind() == IResourceDelta.ADDED || (delta.getKind() == IResourceDelta.CHANGED && (delta.getFlags() & IResourceDelta.CONTENT) != 0)) { // it is crucial to exclude marker update events
+ IResource candidate = delta.getResource();
+
+ if (candidate.getType() != IResource.FILE) {
+ return true;
+ }
+
+ if (candidate.getProject() != m_project) {
+ return false;
+ }
+
+ if (CompareUtility.equals(candidate, m_file)) {
+ // only notify if modification stamp of resource is different to current stamp.
+ // This is to exclude workspace modifications caused by API code
+ if (m_modificationStamp != API_MODIFICATION_STAMP && (m_modificationStamp == IResource.NULL_STAMP || m_modificationStamp != m_file.getModificationStamp())) {
+ notifyResourceListeners(IResourceListener.ELEMENT_FILE, IResourceListener.EVENT_UNKNOWN);
+ }
+ return false;
+ }
+ }
+ return true;
+ }
+ });
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("Unexpected error occured while intercepting 'Resource Change' event.", e);
+ }
+ }
+ }
+
+ private class P_ResourceListenerEntry {
+ private IResourceListener m_listener;
+
+ /**
+ * the source the listener is interested in to receive notifications
+ */
+ private String m_element;
+ /**
+ * the event the listener is interested in to receive notifications
+ */
+ private Integer m_event;
+
+ public IResourceListener getListener() {
+ return m_listener;
+ }
+
+ public void setListener(IResourceListener listener) {
+ m_listener = listener;
+ }
+
+ public String getElement() {
+ return m_element;
+ }
+
+ public void setElement(String element) {
+ m_element = element;
+ }
+
+ public Integer getEvent() {
+ return m_event;
+ }
+
+ public void setEvent(Integer event) {
+ m_event = event;
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/ResourceFactory.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/ResourceFactory.java
index 6cb74667f..a583bc901 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/ResourceFactory.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/ResourceFactory.java
@@ -1,64 +1,64 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.resource;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public final class ResourceFactory {
-
- private static final Map<IScoutBundle, XmlResource> sm_sunJaxWsResourceMap = new HashMap<IScoutBundle, XmlResource>();
- private static final Map<IScoutBundle, XmlResource> sm_buildJaxWsResourceMap = new HashMap<IScoutBundle, XmlResource>();
-
- private ResourceFactory() {
- }
-
- public static synchronized XmlResource getSunJaxWsResource(IScoutBundle bundle) {
- return getSunJaxWsResource(bundle, false);
- }
-
- public static synchronized XmlResource getSunJaxWsResource(IScoutBundle bundle, boolean autoCreate) {
- if (!sm_sunJaxWsResourceMap.containsKey(bundle)) {
- XmlResource resource = new XmlResource(bundle);
- resource.setFile(JaxWsSdkUtility.getFile(bundle, JaxWsConstants.PATH_SUN_JAXWS, autoCreate));
- sm_sunJaxWsResourceMap.put(bundle, resource);
- }
- XmlResource xmlResource = sm_sunJaxWsResourceMap.get(bundle);
- if (autoCreate && (xmlResource.getFile() == null || !xmlResource.existsFile())) {
- xmlResource.setFile(JaxWsSdkUtility.getFile(bundle, JaxWsConstants.PATH_SUN_JAXWS, autoCreate));
- }
- return xmlResource;
- }
-
- public static synchronized XmlResource getBuildJaxWsResource(IScoutBundle bundle) {
- return getBuildJaxWsResource(bundle, false);
- }
-
- public static synchronized XmlResource getBuildJaxWsResource(IScoutBundle bundle, boolean autoCreate) {
- if (!sm_buildJaxWsResourceMap.containsKey(bundle)) {
- XmlResource resource = new XmlResource(bundle);
- resource.setFile(JaxWsSdkUtility.getFile(bundle, JaxWsConstants.PATH_BUILD_JAXWS, autoCreate));
- sm_buildJaxWsResourceMap.put(bundle, resource);
- }
- XmlResource xmlResource = sm_buildJaxWsResourceMap.get(bundle);
- if (autoCreate && (xmlResource.getFile() == null || !xmlResource.existsFile())) {
- xmlResource.setFile(JaxWsSdkUtility.getFile(bundle, JaxWsConstants.PATH_BUILD_JAXWS, autoCreate));
- }
- return xmlResource;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.resource;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public final class ResourceFactory {
+
+ private static final Map<IScoutBundle, XmlResource> sm_sunJaxWsResourceMap = new HashMap<IScoutBundle, XmlResource>();
+ private static final Map<IScoutBundle, XmlResource> sm_buildJaxWsResourceMap = new HashMap<IScoutBundle, XmlResource>();
+
+ private ResourceFactory() {
+ }
+
+ public static synchronized XmlResource getSunJaxWsResource(IScoutBundle bundle) {
+ return getSunJaxWsResource(bundle, false);
+ }
+
+ public static synchronized XmlResource getSunJaxWsResource(IScoutBundle bundle, boolean autoCreate) {
+ if (!sm_sunJaxWsResourceMap.containsKey(bundle)) {
+ XmlResource resource = new XmlResource(bundle);
+ resource.setFile(JaxWsSdkUtility.getFile(bundle, JaxWsConstants.PATH_SUN_JAXWS, autoCreate));
+ sm_sunJaxWsResourceMap.put(bundle, resource);
+ }
+ XmlResource xmlResource = sm_sunJaxWsResourceMap.get(bundle);
+ if (autoCreate && (xmlResource.getFile() == null || !xmlResource.existsFile())) {
+ xmlResource.setFile(JaxWsSdkUtility.getFile(bundle, JaxWsConstants.PATH_SUN_JAXWS, autoCreate));
+ }
+ return xmlResource;
+ }
+
+ public static synchronized XmlResource getBuildJaxWsResource(IScoutBundle bundle) {
+ return getBuildJaxWsResource(bundle, false);
+ }
+
+ public static synchronized XmlResource getBuildJaxWsResource(IScoutBundle bundle, boolean autoCreate) {
+ if (!sm_buildJaxWsResourceMap.containsKey(bundle)) {
+ XmlResource resource = new XmlResource(bundle);
+ resource.setFile(JaxWsSdkUtility.getFile(bundle, JaxWsConstants.PATH_BUILD_JAXWS, autoCreate));
+ sm_buildJaxWsResourceMap.put(bundle, resource);
+ }
+ XmlResource xmlResource = sm_buildJaxWsResourceMap.get(bundle);
+ if (autoCreate && (xmlResource.getFile() == null || !xmlResource.existsFile())) {
+ xmlResource.setFile(JaxWsSdkUtility.getFile(bundle, JaxWsConstants.PATH_BUILD_JAXWS, autoCreate));
+ }
+ return xmlResource;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/WsdlResource.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/WsdlResource.java
index 6823f92c7..efe18759b 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/WsdlResource.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/WsdlResource.java
@@ -1,120 +1,120 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.resource;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-
-import javax.wsdl.Definition;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-import javax.wsdl.xml.WSDLWriter;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class WsdlResource extends ManagedResource {
-
- private Definition m_wsdlDefinition;
-
- public WsdlResource(IScoutBundle bundle) {
- super(bundle.getProject());
- }
-
- public Definition loadWsdlDefinition() {
- synchronized (m_fileLock) {
- if (!existsFile()) {
- m_wsdlDefinition = null;
- return null;
- }
-
- if (m_wsdlDefinition == null || m_file.getModificationStamp() != m_modificationStamp) {
- m_modificationStamp = m_file.getModificationStamp();
- m_wsdlDefinition = null;
-
- try {
- WSDLFactory factory = WSDLFactory.newInstance();
- WSDLReader reader = factory.newWSDLReader();
- m_wsdlDefinition = reader.readWSDL(m_file.getRawLocationURI().getPath());
- }
- catch (Exception e) {
- JaxWsSdk.logError("Could not load WSDL file '" + m_file.getName() + "'", e);
- }
- }
- }
-
- return m_wsdlDefinition;
- }
-
- public void storeWsdlAsync(final Definition definition, final String notificationElement, final int notificationEvent) {
- IOperation op = new IOperation() {
-
- @Override
- public void validate() throws IllegalArgumentException {
- }
-
- @Override
- public String getOperationName() {
- return "Store WSDL resource to disk";
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- storeWsdl(definition, notificationElement, notificationEvent, monitor);
- }
- };
- new OperationJob(op).schedule();
- }
-
- public void storeWsdl(Definition definition, String notificationElement, int notificationEvent, IProgressMonitor monitor) throws CoreException {
- try {
- synchronized (m_fileLock) {
- if (m_file == null) {
- throw new CoreException(new ScoutStatus("File must not be null"));
- }
-
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- WSDLFactory factory = WSDLFactory.newInstance();
- WSDLWriter writer = factory.newWSDLWriter();
- writer.writeWSDL(definition, os);
-
- m_modificationStamp = ManagedResource.API_MODIFICATION_STAMP;
- try {
- JaxWsSdkUtility.prepareFileAccess(m_file, true);
- m_file.setContents(new ByteArrayInputStream(os.toByteArray()), true, true, monitor);
- m_wsdlDefinition = definition;
- }
- finally {
- m_modificationStamp = m_file.getModificationStamp();
- }
- }
- notifyResourceListeners(notificationElement, notificationEvent);
- }
- catch (Exception e) {
- throw new CoreException(new ScoutStatus(IStatus.ERROR, "Failed to persist XML file '" + m_file.getName() + "'.", e));
- }
- }
-
- public void notifyStubRebuilt(String alias) {
- notifyResourceListeners(alias, IResourceListener.EVENT_STUB_REBUILT);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.resource;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+import javax.wsdl.xml.WSDLWriter;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class WsdlResource extends ManagedResource {
+
+ private Definition m_wsdlDefinition;
+
+ public WsdlResource(IScoutBundle bundle) {
+ super(bundle.getProject());
+ }
+
+ public Definition loadWsdlDefinition() {
+ synchronized (m_fileLock) {
+ if (!existsFile()) {
+ m_wsdlDefinition = null;
+ return null;
+ }
+
+ if (m_wsdlDefinition == null || m_file.getModificationStamp() != m_modificationStamp) {
+ m_modificationStamp = m_file.getModificationStamp();
+ m_wsdlDefinition = null;
+
+ try {
+ WSDLFactory factory = WSDLFactory.newInstance();
+ WSDLReader reader = factory.newWSDLReader();
+ m_wsdlDefinition = reader.readWSDL(m_file.getRawLocationURI().getPath());
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("Could not load WSDL file '" + m_file.getName() + "'", e);
+ }
+ }
+ }
+
+ return m_wsdlDefinition;
+ }
+
+ public void storeWsdlAsync(final Definition definition, final String notificationElement, final int notificationEvent) {
+ IOperation op = new IOperation() {
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ }
+
+ @Override
+ public String getOperationName() {
+ return "Store WSDL resource to disk";
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ storeWsdl(definition, notificationElement, notificationEvent, monitor);
+ }
+ };
+ new OperationJob(op).schedule();
+ }
+
+ public void storeWsdl(Definition definition, String notificationElement, int notificationEvent, IProgressMonitor monitor) throws CoreException {
+ try {
+ synchronized (m_fileLock) {
+ if (m_file == null) {
+ throw new CoreException(new ScoutStatus("File must not be null"));
+ }
+
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ WSDLFactory factory = WSDLFactory.newInstance();
+ WSDLWriter writer = factory.newWSDLWriter();
+ writer.writeWSDL(definition, os);
+
+ m_modificationStamp = ManagedResource.API_MODIFICATION_STAMP;
+ try {
+ JaxWsSdkUtility.prepareFileAccess(m_file, true);
+ m_file.setContents(new ByteArrayInputStream(os.toByteArray()), true, true, monitor);
+ m_wsdlDefinition = definition;
+ }
+ finally {
+ m_modificationStamp = m_file.getModificationStamp();
+ }
+ }
+ notifyResourceListeners(notificationElement, notificationEvent);
+ }
+ catch (Exception e) {
+ throw new CoreException(new ScoutStatus(IStatus.ERROR, "Failed to persist XML file '" + m_file.getName() + "'.", e));
+ }
+ }
+
+ public void notifyStubRebuilt(String alias) {
+ notifyResourceListeners(alias, IResourceListener.EVENT_STUB_REBUILT);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/XmlResource.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/XmlResource.java
index b06b45016..40c2cc124 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/XmlResource.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/resource/XmlResource.java
@@ -1,112 +1,112 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.resource;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlParser;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.util.log.ScoutStatus;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class XmlResource extends ManagedResource {
-
- private ScoutXmlDocument m_xmlDocument;
-
- public XmlResource(IScoutBundle bundle) {
- super(bundle.getProject());
- }
-
- public ScoutXmlDocument loadXml() {
- synchronized (m_fileLock) {
- if (!existsFile()) {
- m_xmlDocument = null;
- return null;
- }
-
- if (m_xmlDocument == null || m_file.getModificationStamp() != m_modificationStamp) {
- m_xmlDocument = null;
- m_modificationStamp = m_file.getModificationStamp();
- ScoutXmlParser parser = new ScoutXmlParser();
- parser.setXmlEncoding("UTF-8");
- try {
- m_xmlDocument = parser.parse(m_file.getLocation().toFile());
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("Failed to parse XML file '" + m_file.getName() + "'.", e);
- }
- }
- }
-
- return m_xmlDocument;
- }
-
- public void storeXmlAsync(final ScoutXmlDocument xmlDocument, final int notificationEvent, final String... notificationElements) {
- IOperation op = new IOperation() {
-
- @Override
- public void validate() throws IllegalArgumentException {
- }
-
- @Override
- public String getOperationName() {
- return "Store resource to disk";
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- storeXml(xmlDocument, notificationEvent, monitor, notificationElements);
- }
- };
- new OperationJob(op).schedule();
- }
-
- public void storeXml(ScoutXmlDocument xmlDocument, int notificationEvent, IProgressMonitor monitor, String... notificationElements) throws CoreException {
- try {
- synchronized (m_fileLock) {
- if (m_file == null) {
- throw new CoreException(new ScoutStatus("File must not be null"));
- }
-
- ByteArrayOutputStream os = new ByteArrayOutputStream();
- xmlDocument.write(os);
-
- m_modificationStamp = ManagedResource.API_MODIFICATION_STAMP;
- try {
- JaxWsSdkUtility.prepareFileAccess(m_file, true);
- m_file.setContents(new ByteArrayInputStream(os.toByteArray()), true, true, monitor);
- m_xmlDocument = xmlDocument;
- }
- finally {
- m_modificationStamp = m_file.getModificationStamp();
- }
- }
- for (String notificationElement : notificationElements) {
- notifyResourceListeners(notificationElement, notificationEvent);
- }
- }
- catch (Exception e) {
- throw new CoreException(new ScoutStatus(IStatus.ERROR, "Failed to persist XML file.", e));
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.resource;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlParser;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.util.log.ScoutStatus;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class XmlResource extends ManagedResource {
+
+ private ScoutXmlDocument m_xmlDocument;
+
+ public XmlResource(IScoutBundle bundle) {
+ super(bundle.getProject());
+ }
+
+ public ScoutXmlDocument loadXml() {
+ synchronized (m_fileLock) {
+ if (!existsFile()) {
+ m_xmlDocument = null;
+ return null;
+ }
+
+ if (m_xmlDocument == null || m_file.getModificationStamp() != m_modificationStamp) {
+ m_xmlDocument = null;
+ m_modificationStamp = m_file.getModificationStamp();
+ ScoutXmlParser parser = new ScoutXmlParser();
+ parser.setXmlEncoding("UTF-8");
+ try {
+ m_xmlDocument = parser.parse(m_file.getLocation().toFile());
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("Failed to parse XML file '" + m_file.getName() + "'.", e);
+ }
+ }
+ }
+
+ return m_xmlDocument;
+ }
+
+ public void storeXmlAsync(final ScoutXmlDocument xmlDocument, final int notificationEvent, final String... notificationElements) {
+ IOperation op = new IOperation() {
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ }
+
+ @Override
+ public String getOperationName() {
+ return "Store resource to disk";
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ storeXml(xmlDocument, notificationEvent, monitor, notificationElements);
+ }
+ };
+ new OperationJob(op).schedule();
+ }
+
+ public void storeXml(ScoutXmlDocument xmlDocument, int notificationEvent, IProgressMonitor monitor, String... notificationElements) throws CoreException {
+ try {
+ synchronized (m_fileLock) {
+ if (m_file == null) {
+ throw new CoreException(new ScoutStatus("File must not be null"));
+ }
+
+ ByteArrayOutputStream os = new ByteArrayOutputStream();
+ xmlDocument.write(os);
+
+ m_modificationStamp = ManagedResource.API_MODIFICATION_STAMP;
+ try {
+ JaxWsSdkUtility.prepareFileAccess(m_file, true);
+ m_file.setContents(new ByteArrayInputStream(os.toByteArray()), true, true, monitor);
+ m_xmlDocument = xmlDocument;
+ }
+ finally {
+ m_modificationStamp = m_file.getModificationStamp();
+ }
+ }
+ for (String notificationElement : notificationElements) {
+ notifyResourceListeners(notificationElement, notificationEvent);
+ }
+ }
+ catch (Exception e) {
+ throw new CoreException(new ScoutStatus(IStatus.ERROR, "Failed to persist XML file.", e));
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/AbstractLinkAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/AbstractLinkAction.java
index ba44b58bb..c5ec4dcae 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/AbstractLinkAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/AbstractLinkAction.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.scout.sdk.ui.action.AbstractScoutHandler;
-
-public abstract class AbstractLinkAction extends AbstractScoutHandler implements IPresenterAction {
-
- private String m_leadingText;
- private String m_linkText;
-
- public AbstractLinkAction(String menuText, ImageDescriptor icon) {
- this(menuText, icon, null);
- }
-
- public AbstractLinkAction(String menuText, ImageDescriptor icon, String keyStroke) {
- super(menuText, icon, keyStroke, false, Category.WS);
- }
-
- @Override
- public String getLeadingText() {
- return m_leadingText;
- }
-
- public void setLeadingText(String leadingText) {
- m_leadingText = leadingText;
- }
-
- @Override
- public String getLinkText() {
- return m_linkText;
- }
-
- public void setLinkText(String linkText) {
- m_linkText = linkText;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.scout.sdk.ui.action.AbstractScoutHandler;
+
+public abstract class AbstractLinkAction extends AbstractScoutHandler implements IPresenterAction {
+
+ private String m_leadingText;
+ private String m_linkText;
+
+ public AbstractLinkAction(String menuText, ImageDescriptor icon) {
+ this(menuText, icon, null);
+ }
+
+ public AbstractLinkAction(String menuText, ImageDescriptor icon, String keyStroke) {
+ super(menuText, icon, keyStroke, false, Category.WS);
+ }
+
+ @Override
+ public String getLeadingText() {
+ return m_leadingText;
+ }
+
+ public void setLeadingText(String leadingText) {
+ m_leadingText = leadingText;
+ }
+
+ @Override
+ public String getLinkText() {
+ return m_linkText;
+ }
+
+ public void setLinkText(String linkText) {
+ m_linkText = linkText;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/AuthenticationHandlerNewWizardAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/AuthenticationHandlerNewWizardAction.java
index f075c5534..32c947c50 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/AuthenticationHandlerNewWizardAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/AuthenticationHandlerNewWizardAction.java
@@ -1,134 +1,134 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.type.ITypeFilter;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.TypeNewWizard;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.TypeNewWizardPage.JavaSearchScopeFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.widgets.Shell;
-
-public class AuthenticationHandlerNewWizardAction extends AbstractLinkAction {
- private int m_result;
- private IScoutBundle m_bundle;
- private WebserviceEnum m_webserviceEnum;
-
- public AuthenticationHandlerNewWizardAction() {
- super(Texts.get("Action_newTypeX", Texts.get("AuthenticationHandler")), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
- setLeadingText(Texts.get("CreateNewX", Texts.get("AuthenticationHandler")));
- setLinkText(Texts.get("here"));
- }
-
- public void init(IScoutBundle bundle, WebserviceEnum webserviceEnum) {
- m_bundle = bundle;
- m_webserviceEnum = webserviceEnum;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- TypeNewWizard wizard = new TypeNewWizard(m_bundle, Texts.get("AuthenticationHandler"));
- wizard.setAllowModifyInterfaceType(false);
- wizard.setAllowModifySuperType(true);
- wizard.setAllowModifyPackage(true);
- wizard.setTypeSuffix("AuthenticationHandler");
- wizard.setInterfaceTypeSearchScopeFactory(new P_JavaSearchScopeFactory(m_webserviceEnum, m_bundle, true));
- wizard.setSuperTypeSearchScopeFactory(new P_JavaSearchScopeFactory(m_webserviceEnum, m_bundle, false));
-
- if (m_webserviceEnum == WebserviceEnum.Provider) {
- wizard.setInterfaceType(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider));
- wizard.setRecommendedPackageFragment(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
- }
- else {
- wizard.setInterfaceType(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer));
- wizard.setRecommendedPackageFragment(JaxWsSdkUtility.getRecommendedConsumerSecurityPackageName(m_bundle));
- }
-
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.setPageSize(680, 350);
- wizardDialog.setHelpAvailable(false);
- m_result = wizardDialog.open();
- return null;
- }
-
- public int getResult() {
- return m_result;
- }
-
- private class P_JavaSearchScopeFactory extends JavaSearchScopeFactory {
-
- private WebserviceEnum m_webserviceEnum;
- private IScoutBundle m_bundle;
- private boolean m_onlyInterfaceTypes;
-
- public P_JavaSearchScopeFactory(WebserviceEnum webserviceEnum, IScoutBundle bundle, boolean onlyInterfaceTypes) {
- m_webserviceEnum = webserviceEnum;
- m_bundle = bundle;
- m_onlyInterfaceTypes = onlyInterfaceTypes;
- }
-
- @Override
- public IJavaSearchScope create() {
- IType type;
- if (m_webserviceEnum == WebserviceEnum.Provider) {
- type = TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider);
- }
- else {
- type = TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer);
- }
- IType[] subTypes;
- if (m_onlyInterfaceTypes) {
- IType[] candidates = TypeUtility.getPrimaryTypeHierarchy(type).getAllSubtypes(type, new ITypeFilter() {
-
- @Override
- public boolean accept(IType candidate) {
- try {
- if (!TypeUtility.exists(candidate) || !candidate.isInterface()) {
- return false;
- }
- return TypeUtility.isOnClasspath(candidate, m_bundle.getJavaProject());
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- return false;
- }
- }
- });
- // add interface type itself
- subTypes = new IType[candidates.length + 1];
- System.arraycopy(candidates, 0, subTypes, 1, candidates.length);
- subTypes[0] = type;
- }
- else {
- subTypes = TypeUtility.getPrimaryTypeHierarchy(type).getAllSubtypes(type, TypeFilters.getTypesOnClasspath(type.getJavaProject()));
- }
- return SearchEngine.createJavaSearchScope(subTypes);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.type.ITypeFilter;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.TypeNewWizard;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.TypeNewWizardPage.JavaSearchScopeFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.widgets.Shell;
+
+public class AuthenticationHandlerNewWizardAction extends AbstractLinkAction {
+ private int m_result;
+ private IScoutBundle m_bundle;
+ private WebserviceEnum m_webserviceEnum;
+
+ public AuthenticationHandlerNewWizardAction() {
+ super(Texts.get("Action_newTypeX", Texts.get("AuthenticationHandler")), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
+ setLeadingText(Texts.get("CreateNewX", Texts.get("AuthenticationHandler")));
+ setLinkText(Texts.get("here"));
+ }
+
+ public void init(IScoutBundle bundle, WebserviceEnum webserviceEnum) {
+ m_bundle = bundle;
+ m_webserviceEnum = webserviceEnum;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ TypeNewWizard wizard = new TypeNewWizard(m_bundle, Texts.get("AuthenticationHandler"));
+ wizard.setAllowModifyInterfaceType(false);
+ wizard.setAllowModifySuperType(true);
+ wizard.setAllowModifyPackage(true);
+ wizard.setTypeSuffix("AuthenticationHandler");
+ wizard.setInterfaceTypeSearchScopeFactory(new P_JavaSearchScopeFactory(m_webserviceEnum, m_bundle, true));
+ wizard.setSuperTypeSearchScopeFactory(new P_JavaSearchScopeFactory(m_webserviceEnum, m_bundle, false));
+
+ if (m_webserviceEnum == WebserviceEnum.Provider) {
+ wizard.setInterfaceType(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider));
+ wizard.setRecommendedPackageFragment(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
+ }
+ else {
+ wizard.setInterfaceType(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer));
+ wizard.setRecommendedPackageFragment(JaxWsSdkUtility.getRecommendedConsumerSecurityPackageName(m_bundle));
+ }
+
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.setPageSize(680, 350);
+ wizardDialog.setHelpAvailable(false);
+ m_result = wizardDialog.open();
+ return null;
+ }
+
+ public int getResult() {
+ return m_result;
+ }
+
+ private class P_JavaSearchScopeFactory extends JavaSearchScopeFactory {
+
+ private WebserviceEnum m_webserviceEnum;
+ private IScoutBundle m_bundle;
+ private boolean m_onlyInterfaceTypes;
+
+ public P_JavaSearchScopeFactory(WebserviceEnum webserviceEnum, IScoutBundle bundle, boolean onlyInterfaceTypes) {
+ m_webserviceEnum = webserviceEnum;
+ m_bundle = bundle;
+ m_onlyInterfaceTypes = onlyInterfaceTypes;
+ }
+
+ @Override
+ public IJavaSearchScope create() {
+ IType type;
+ if (m_webserviceEnum == WebserviceEnum.Provider) {
+ type = TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider);
+ }
+ else {
+ type = TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer);
+ }
+ IType[] subTypes;
+ if (m_onlyInterfaceTypes) {
+ IType[] candidates = TypeUtility.getPrimaryTypeHierarchy(type).getAllSubtypes(type, new ITypeFilter() {
+
+ @Override
+ public boolean accept(IType candidate) {
+ try {
+ if (!TypeUtility.exists(candidate) || !candidate.isInterface()) {
+ return false;
+ }
+ return TypeUtility.isOnClasspath(candidate, m_bundle.getJavaProject());
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ return false;
+ }
+ }
+ });
+ // add interface type itself
+ subTypes = new IType[candidates.length + 1];
+ System.arraycopy(candidates, 0, subTypes, 1, candidates.length);
+ subTypes[0] = type;
+ }
+ else {
+ subTypes = TypeUtility.getPrimaryTypeHierarchy(type).getAllSubtypes(type, TypeFilters.getTypesOnClasspath(type.getJavaProject()));
+ }
+ return SearchEngine.createJavaSearchScope(subTypes);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/BindingFileNewAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/BindingFileNewAction.java
index ca5405ae2..90a8aa57e 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/BindingFileNewAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/BindingFileNewAction.java
@@ -1,97 +1,97 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.BindingFileCreateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper;
-import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper.SchemaCandidate;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
-import org.eclipse.swt.widgets.Shell;
-
-public class BindingFileNewAction extends AbstractLinkAction {
-
- private BuildJaxWsBean m_buildJaxWsBean;
- private IScoutBundle m_bundle;
- private WsdlResource m_wsdlResource;
-
- public BindingFileNewAction() {
- super(Texts.get("AddBindingFile"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
- setLinkText(Texts.get("AddBindingFile"));
- setToolTip(Texts.get("TooltipBindingFileNew"));
- }
-
- public void init(IScoutBundle bundle, BuildJaxWsBean buildJaxWsBean, WsdlResource wsdlResource) {
- m_buildJaxWsBean = buildJaxWsBean;
- m_bundle = bundle;
- m_wsdlResource = wsdlResource;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- SchemaCandidate schemaCandidate = null;
- try {
- schemaCandidate = GlobalBindingRegistrationHelper.popupForSchema(m_bundle, m_wsdlResource.getFile());
- }
- catch (CoreException e) {
- if (e.getStatus() != null && e.getStatus().getCode() == Status.CANCEL_STATUS.getCode()) {
- return null;
- }
- }
-
- BindingFileCreateOperation op = new BindingFileCreateOperation();
- if (schemaCandidate != null) {
- WsdlArtefact wsdlArtefact = schemaCandidate.getWsdlArtefact();
- if (wsdlArtefact.getInlineSchemas().length > 1) {
- op.setSchemaTargetNamespace(SchemaUtility.getSchemaTargetNamespace(schemaCandidate.getSchema()));
- }
- if (schemaCandidate.getWsdlArtefact().getTypeEnum() == TypeEnum.ReferencedWsdl) {
- IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, schemaCandidate.getWsdlArtefact().getFile());
- op.setWsdlLocation(referencedWsdlFile);
- }
- }
-
- String bindingFileName = JaxWsSdkUtility.createUniqueBindingFileNamePath(m_bundle, m_buildJaxWsBean.getAlias(), op.getSchemaTargetNamespace());
- Map<String, List<String>> properties = m_buildJaxWsBean.getPropertiers();
- JaxWsSdkUtility.addBuildProperty(properties, JaxWsConstants.OPTION_BINDING_FILE, bindingFileName);
-
- op.setBundle(m_bundle);
- op.setProjectRelativeFilePath(new Path(bindingFileName));
- op.setWsdlDestinationFolder(JaxWsSdkUtility.getParentFolder(m_bundle, m_wsdlResource.getFile()));
- op.setCreateGlobalBindingSection(!JaxWsSdkUtility.containsGlobalBindingSection(m_bundle, properties, false));
- new OperationJob(op).schedule();
-
- m_buildJaxWsBean.setProperties(properties);
- ResourceFactory.getBuildJaxWsResource(m_bundle).storeXmlAsync(m_buildJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_PROPERTIES_CHANGED, m_buildJaxWsBean.getAlias());
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.BindingFileCreateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper;
+import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper.SchemaCandidate;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
+import org.eclipse.swt.widgets.Shell;
+
+public class BindingFileNewAction extends AbstractLinkAction {
+
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private IScoutBundle m_bundle;
+ private WsdlResource m_wsdlResource;
+
+ public BindingFileNewAction() {
+ super(Texts.get("AddBindingFile"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
+ setLinkText(Texts.get("AddBindingFile"));
+ setToolTip(Texts.get("TooltipBindingFileNew"));
+ }
+
+ public void init(IScoutBundle bundle, BuildJaxWsBean buildJaxWsBean, WsdlResource wsdlResource) {
+ m_buildJaxWsBean = buildJaxWsBean;
+ m_bundle = bundle;
+ m_wsdlResource = wsdlResource;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ SchemaCandidate schemaCandidate = null;
+ try {
+ schemaCandidate = GlobalBindingRegistrationHelper.popupForSchema(m_bundle, m_wsdlResource.getFile());
+ }
+ catch (CoreException e) {
+ if (e.getStatus() != null && e.getStatus().getCode() == Status.CANCEL_STATUS.getCode()) {
+ return null;
+ }
+ }
+
+ BindingFileCreateOperation op = new BindingFileCreateOperation();
+ if (schemaCandidate != null) {
+ WsdlArtefact wsdlArtefact = schemaCandidate.getWsdlArtefact();
+ if (wsdlArtefact.getInlineSchemas().length > 1) {
+ op.setSchemaTargetNamespace(SchemaUtility.getSchemaTargetNamespace(schemaCandidate.getSchema()));
+ }
+ if (schemaCandidate.getWsdlArtefact().getTypeEnum() == TypeEnum.ReferencedWsdl) {
+ IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, schemaCandidate.getWsdlArtefact().getFile());
+ op.setWsdlLocation(referencedWsdlFile);
+ }
+ }
+
+ String bindingFileName = JaxWsSdkUtility.createUniqueBindingFileNamePath(m_bundle, m_buildJaxWsBean.getAlias(), op.getSchemaTargetNamespace());
+ Map<String, List<String>> properties = m_buildJaxWsBean.getPropertiers();
+ JaxWsSdkUtility.addBuildProperty(properties, JaxWsConstants.OPTION_BINDING_FILE, bindingFileName);
+
+ op.setBundle(m_bundle);
+ op.setProjectRelativeFilePath(new Path(bindingFileName));
+ op.setWsdlDestinationFolder(JaxWsSdkUtility.getParentFolder(m_bundle, m_wsdlResource.getFile()));
+ op.setCreateGlobalBindingSection(!JaxWsSdkUtility.containsGlobalBindingSection(m_bundle, properties, false));
+ new OperationJob(op).schedule();
+
+ m_buildJaxWsBean.setProperties(properties);
+ ResourceFactory.getBuildJaxWsResource(m_bundle).storeXmlAsync(m_buildJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_PROPERTIES_CHANGED, m_buildJaxWsBean.getAlias());
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/BuildPropertiesEditAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/BuildPropertiesEditAction.java
index 6f3cc6530..b74dae300 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/BuildPropertiesEditAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/BuildPropertiesEditAction.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.BuildPropertiesWizard;
-import org.eclipse.swt.widgets.Shell;
-
-public class BuildPropertiesEditAction extends AbstractLinkAction {
-
- private BuildJaxWsBean m_buildJaxWsBean;
- private IScoutBundle m_bundle;
-
- public BuildPropertiesEditAction() {
- super(Texts.get("EditBuildProperties"), JaxWsSdk.getImageDescriptor(JaxWsIcons.BuildProperties));
- setLinkText(Texts.get("EditBuildProperties"));
- setToolTip(Texts.get("TooltipEditBuildProperties"));
- }
-
- public void init(IScoutBundle bundle, BuildJaxWsBean buildJaxWsBean) {
- m_buildJaxWsBean = buildJaxWsBean;
- m_bundle = bundle;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- BuildPropertiesWizard wizard = new BuildPropertiesWizard(m_bundle, m_buildJaxWsBean);
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.setHelpAvailable(false);
- wizardDialog.setPageSize(100, 500);
- wizardDialog.open();
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.BuildPropertiesWizard;
+import org.eclipse.swt.widgets.Shell;
+
+public class BuildPropertiesEditAction extends AbstractLinkAction {
+
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private IScoutBundle m_bundle;
+
+ public BuildPropertiesEditAction() {
+ super(Texts.get("EditBuildProperties"), JaxWsSdk.getImageDescriptor(JaxWsIcons.BuildProperties));
+ setLinkText(Texts.get("EditBuildProperties"));
+ setToolTip(Texts.get("TooltipEditBuildProperties"));
+ }
+
+ public void init(IScoutBundle bundle, BuildJaxWsBean buildJaxWsBean) {
+ m_buildJaxWsBean = buildJaxWsBean;
+ m_bundle = bundle;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ BuildPropertiesWizard wizard = new BuildPropertiesWizard(m_bundle, m_buildJaxWsBean);
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.setHelpAvailable(false);
+ wizardDialog.setPageSize(100, 500);
+ wizardDialog.open();
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/CleanupPhantomJarFileAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/CleanupPhantomJarFileAction.java
index c62f44768..6d1592918 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/CleanupPhantomJarFileAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/CleanupPhantomJarFileAction.java
@@ -1,171 +1,171 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.PhantomJarFilesDeleteWizard;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-
-public class CleanupPhantomJarFileAction extends AbstractLinkAction {
-
- private IScoutBundle m_bundle;
-
- public CleanupPhantomJarFileAction() {
- super(Texts.get("CleanupUnreferencedJarFiles"), JaxWsSdk.getImageDescriptor(JaxWsIcons.Jar));
- setLeadingText(Texts.get("CleanupUnreferencedJarFilesByClicking"));
- setLinkText(Texts.get("here"));
- setToolTip(Texts.get("TooltipCleanupUnreferencedJarFiles"));
- }
-
- public void init(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- IFile[] phantomJarFiles = getPhantomJarFiles();
- if (phantomJarFiles.length == 0) {
- MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_INFORMATION | SWT.OK);
- messageBox.setText(Texts.get("Information"));
- messageBox.setMessage(Texts.get("NoPhantomJarFilesFound"));
- messageBox.open();
- return null;
- }
-
- IWizard wizard = new PhantomJarFilesDeleteWizard(m_bundle, phantomJarFiles);
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.setHelpAvailable(false);
- wizardDialog.open();
- return null;
- }
-
- private IFile[] getPhantomJarFiles() {
- IFolder folder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.STUB_FOLDER, false);
- if (folder == null || !folder.exists()) {
- return new IFile[0];
- }
-
- // determine referenced JAR files
- Set<IFile> usedJarFiles = new HashSet<IFile>();
- usedJarFiles.addAll(Arrays.asList(getProviderJarFiles()));
- usedJarFiles.addAll(Arrays.asList(getConsumerJarFiles()));
-
- // get all JAR files in stub folder
- Set<IFile> candidates = new HashSet<IFile>();
- try {
- for (IResource resource : folder.members()) {
- if (!resource.exists() || resource.getType() != IResource.FILE) {
- continue;
- }
- IFile file = (IFile) resource;
- if (file.getFileExtension() != null && file.getFileExtension().equalsIgnoreCase("jar")) {
- candidates.add(file);
- }
- }
-
- // determine phantom JAR files
- Set<IFile> phantomJarFiles = new HashSet<IFile>();
- for (IFile candiate : candidates) {
- if (!usedJarFiles.contains(candiate)) {
- phantomJarFiles.add(candiate);
- }
- }
- return phantomJarFiles.toArray(new IFile[phantomJarFiles.size()]);
- }
- catch (CoreException e) {
- JaxWsSdk.logError(e);
- return new IFile[0];
- }
- }
-
- private IFile[] getProviderJarFiles() {
- Set<IFile> jarFiles = new HashSet<IFile>();
-
- XmlResource sunJaxWsResource = ResourceFactory.getSunJaxWsResource(m_bundle);
- ScoutXmlDocument sunJaxWsXmlDocument = sunJaxWsResource.loadXml();
-
- if (sunJaxWsXmlDocument == null || sunJaxWsXmlDocument.getRoot() == null) {
- return new IFile[0];
- }
-
- for (ScoutXmlElement sunJaxWsXml : sunJaxWsXmlDocument.getRoot().getChildren(StringUtility.join(":", sunJaxWsXmlDocument.getRoot().getNamePrefix(), SunJaxWsBean.XML_ENDPOINT))) {
- SunJaxWsBean sunJaxWsBean = new SunJaxWsBean(sunJaxWsXml);
- BuildJaxWsBean buildJaxWsBean = BuildJaxWsBean.load(m_bundle, sunJaxWsBean.getAlias(), WebserviceEnum.Provider);
- if (buildJaxWsBean == null) {
- // only consider by-contract providers
- continue;
- }
-
- IFile jarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, buildJaxWsBean, sunJaxWsBean.getWsdl());
- if (jarFile != null && jarFile.exists()) {
- jarFiles.add(jarFile);
- }
- }
- return jarFiles.toArray(new IFile[jarFiles.size()]);
- }
-
- private IFile[] getConsumerJarFiles() {
- Set<IFile> jarFiles = new HashSet<IFile>();
-
- IPrimaryTypeTypeHierarchy hierarchy = TypeUtility.getPrimaryTypeHierarchy(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient));
- IType[] wsConsumerTypes = hierarchy.getAllSubtypes(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient), TypeFilters.getClassesInProject(m_bundle.getJavaProject()));
-
- for (IType consumerType : wsConsumerTypes) {
- if (!TypeUtility.exists(consumerType)) {
- continue;
- }
- BuildJaxWsBean buildJaxWsBean = BuildJaxWsBean.load(m_bundle, consumerType.getElementName(), WebserviceEnum.Consumer);
- if (buildJaxWsBean == null) {
- continue;
- }
- IFile jarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, buildJaxWsBean, buildJaxWsBean.getWsdl());
- if (jarFile != null && jarFile.exists()) {
- jarFiles.add(jarFile);
- }
- }
-
- return jarFiles.toArray(new IFile[jarFiles.size()]);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.PhantomJarFilesDeleteWizard;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+
+public class CleanupPhantomJarFileAction extends AbstractLinkAction {
+
+ private IScoutBundle m_bundle;
+
+ public CleanupPhantomJarFileAction() {
+ super(Texts.get("CleanupUnreferencedJarFiles"), JaxWsSdk.getImageDescriptor(JaxWsIcons.Jar));
+ setLeadingText(Texts.get("CleanupUnreferencedJarFilesByClicking"));
+ setLinkText(Texts.get("here"));
+ setToolTip(Texts.get("TooltipCleanupUnreferencedJarFiles"));
+ }
+
+ public void init(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ IFile[] phantomJarFiles = getPhantomJarFiles();
+ if (phantomJarFiles.length == 0) {
+ MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_INFORMATION | SWT.OK);
+ messageBox.setText(Texts.get("Information"));
+ messageBox.setMessage(Texts.get("NoPhantomJarFilesFound"));
+ messageBox.open();
+ return null;
+ }
+
+ IWizard wizard = new PhantomJarFilesDeleteWizard(m_bundle, phantomJarFiles);
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.setHelpAvailable(false);
+ wizardDialog.open();
+ return null;
+ }
+
+ private IFile[] getPhantomJarFiles() {
+ IFolder folder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.STUB_FOLDER, false);
+ if (folder == null || !folder.exists()) {
+ return new IFile[0];
+ }
+
+ // determine referenced JAR files
+ Set<IFile> usedJarFiles = new HashSet<IFile>();
+ usedJarFiles.addAll(Arrays.asList(getProviderJarFiles()));
+ usedJarFiles.addAll(Arrays.asList(getConsumerJarFiles()));
+
+ // get all JAR files in stub folder
+ Set<IFile> candidates = new HashSet<IFile>();
+ try {
+ for (IResource resource : folder.members()) {
+ if (!resource.exists() || resource.getType() != IResource.FILE) {
+ continue;
+ }
+ IFile file = (IFile) resource;
+ if (file.getFileExtension() != null && file.getFileExtension().equalsIgnoreCase("jar")) {
+ candidates.add(file);
+ }
+ }
+
+ // determine phantom JAR files
+ Set<IFile> phantomJarFiles = new HashSet<IFile>();
+ for (IFile candiate : candidates) {
+ if (!usedJarFiles.contains(candiate)) {
+ phantomJarFiles.add(candiate);
+ }
+ }
+ return phantomJarFiles.toArray(new IFile[phantomJarFiles.size()]);
+ }
+ catch (CoreException e) {
+ JaxWsSdk.logError(e);
+ return new IFile[0];
+ }
+ }
+
+ private IFile[] getProviderJarFiles() {
+ Set<IFile> jarFiles = new HashSet<IFile>();
+
+ XmlResource sunJaxWsResource = ResourceFactory.getSunJaxWsResource(m_bundle);
+ ScoutXmlDocument sunJaxWsXmlDocument = sunJaxWsResource.loadXml();
+
+ if (sunJaxWsXmlDocument == null || sunJaxWsXmlDocument.getRoot() == null) {
+ return new IFile[0];
+ }
+
+ for (ScoutXmlElement sunJaxWsXml : sunJaxWsXmlDocument.getRoot().getChildren(StringUtility.join(":", sunJaxWsXmlDocument.getRoot().getNamePrefix(), SunJaxWsBean.XML_ENDPOINT))) {
+ SunJaxWsBean sunJaxWsBean = new SunJaxWsBean(sunJaxWsXml);
+ BuildJaxWsBean buildJaxWsBean = BuildJaxWsBean.load(m_bundle, sunJaxWsBean.getAlias(), WebserviceEnum.Provider);
+ if (buildJaxWsBean == null) {
+ // only consider by-contract providers
+ continue;
+ }
+
+ IFile jarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, buildJaxWsBean, sunJaxWsBean.getWsdl());
+ if (jarFile != null && jarFile.exists()) {
+ jarFiles.add(jarFile);
+ }
+ }
+ return jarFiles.toArray(new IFile[jarFiles.size()]);
+ }
+
+ private IFile[] getConsumerJarFiles() {
+ Set<IFile> jarFiles = new HashSet<IFile>();
+
+ IPrimaryTypeTypeHierarchy hierarchy = TypeUtility.getPrimaryTypeHierarchy(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient));
+ IType[] wsConsumerTypes = hierarchy.getAllSubtypes(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient), TypeFilters.getClassesInProject(m_bundle.getJavaProject()));
+
+ for (IType consumerType : wsConsumerTypes) {
+ if (!TypeUtility.exists(consumerType)) {
+ continue;
+ }
+ BuildJaxWsBean buildJaxWsBean = BuildJaxWsBean.load(m_bundle, consumerType.getElementName(), WebserviceEnum.Consumer);
+ if (buildJaxWsBean == null) {
+ continue;
+ }
+ IFile jarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, buildJaxWsBean, buildJaxWsBean.getWsdl());
+ if (jarFile != null && jarFile.exists()) {
+ jarFiles.add(jarFile);
+ }
+ }
+
+ return jarFiles.toArray(new IFile[jarFiles.size()]);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/ConsumerNewWizardAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/ConsumerNewWizardAction.java
index 9acd71558..f66c60ec8 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/ConsumerNewWizardAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/ConsumerNewWizardAction.java
@@ -1,49 +1,49 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsConsumerNewWizard;
-import org.eclipse.swt.widgets.Shell;
-
-public class ConsumerNewWizardAction extends AbstractLinkAction {
- private IScoutBundle m_bundle;
-
- public ConsumerNewWizardAction() {
- super(Texts.get("Action_newTypeX", Texts.get("Consumer")), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
- setLeadingText(Texts.get("CreateNewWsConsumerByClicking"));
- setLinkText(Texts.get("here"));
- }
-
- public void init(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- IWizard wizard = new WsConsumerNewWizard(m_bundle);
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.setPageSize(680, 350);
- wizardDialog.setHelpAvailable(false);
- wizardDialog.open();
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsConsumerNewWizard;
+import org.eclipse.swt.widgets.Shell;
+
+public class ConsumerNewWizardAction extends AbstractLinkAction {
+ private IScoutBundle m_bundle;
+
+ public ConsumerNewWizardAction() {
+ super(Texts.get("Action_newTypeX", Texts.get("Consumer")), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
+ setLeadingText(Texts.get("CreateNewWsConsumerByClicking"));
+ setLinkText(Texts.get("here"));
+ }
+
+ public void init(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ IWizard wizard = new WsConsumerNewWizard(m_bundle);
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.setPageSize(680, 350);
+ wizardDialog.setHelpAvailable(false);
+ wizardDialog.open();
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/CredentialValidationStrategyNewAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/CredentialValidationStrategyNewAction.java
index 34d39afb6..b0833a62d 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/CredentialValidationStrategyNewAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/CredentialValidationStrategyNewAction.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class CredentialValidationStrategyNewAction extends TypeNewAction {
-
- public CredentialValidationStrategyNewAction() {
- super(Texts.get("CredentialValidationStrategy"));
- }
-
- @Override
- public void init(IScoutBundle bundle) {
- super.init(bundle);
- setPackageFragment(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(bundle), true);
- List<String> interfaceTypeSignatures = new ArrayList<String>();
- interfaceTypeSignatures.add(Signature.createTypeSignature(TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy).getFullyQualifiedName(), true));
- setInterfaceTypeSignatures(interfaceTypeSignatures, false);
- setSuperTypeSignature(null, false);
- setTypeName("CredentialValidationStrategy");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class CredentialValidationStrategyNewAction extends TypeNewAction {
+
+ public CredentialValidationStrategyNewAction() {
+ super(Texts.get("CredentialValidationStrategy"));
+ }
+
+ @Override
+ public void init(IScoutBundle bundle) {
+ super.init(bundle);
+ setPackageFragment(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(bundle), true);
+ List<String> interfaceTypeSignatures = new ArrayList<String>();
+ interfaceTypeSignatures.add(Signature.createTypeSignature(TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy).getFullyQualifiedName(), true));
+ setInterfaceTypeSignatures(interfaceTypeSignatures, false);
+ setSuperTypeSignature(null, false);
+ setTypeName("CredentialValidationStrategy");
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/FileOpenAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/FileOpenAction.java
index 705fe2ff6..dd9707e8a 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/FileOpenAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/FileOpenAction.java
@@ -1,90 +1,90 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.IEditorDescriptor;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-
-public class FileOpenAction extends AbstractLinkAction {
- private IFile m_file;
- private FileExtensionType m_extensionType;
-
- public FileOpenAction() {
- super("", null);
- }
-
- public void init(IFile file, String linkText, ImageDescriptor icon, FileExtensionType extensionType) {
- init(file, null, linkText, icon, extensionType);
- }
-
- public void init(IFile file, String leadingText, String linkText, ImageDescriptor icon, FileExtensionType extensionType) {
- setLeadingText(leadingText);
- setLinkText(linkText);
- setImage(icon);
- m_file = file;
- m_extensionType = extensionType;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- try {
- if (m_extensionType == FileExtensionType.Auto) {
- IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), getFile(), true);
- }
- else {
- IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(m_extensionType.getExtension());
- if (desc == null) {
- IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), getFile(), true);
- }
- else {
- IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), getFile(), desc.getId(), true);
- }
- }
- }
- catch (PartInitException e) {
- JaxWsSdk.logError("could not open file '" + m_file + "'.", e);
- }
- return null;
- }
-
- private IFile getFile() {
- return m_file;
- }
-
- public static enum FileExtensionType {
- Auto, Xml("*.xml"), Txt("*.txt");
- private String m_extension;
-
- private FileExtensionType() {
- }
-
- private FileExtensionType(String extension) {
- m_extension = extension;
- }
-
- public String getExtension() {
- return m_extension;
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IEditorDescriptor;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
+public class FileOpenAction extends AbstractLinkAction {
+ private IFile m_file;
+ private FileExtensionType m_extensionType;
+
+ public FileOpenAction() {
+ super("", null);
+ }
+
+ public void init(IFile file, String linkText, ImageDescriptor icon, FileExtensionType extensionType) {
+ init(file, null, linkText, icon, extensionType);
+ }
+
+ public void init(IFile file, String leadingText, String linkText, ImageDescriptor icon, FileExtensionType extensionType) {
+ setLeadingText(leadingText);
+ setLinkText(linkText);
+ setImage(icon);
+ m_file = file;
+ m_extensionType = extensionType;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ try {
+ if (m_extensionType == FileExtensionType.Auto) {
+ IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), getFile(), true);
+ }
+ else {
+ IEditorDescriptor desc = PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(m_extensionType.getExtension());
+ if (desc == null) {
+ IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), getFile(), true);
+ }
+ else {
+ IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), getFile(), desc.getId(), true);
+ }
+ }
+ }
+ catch (PartInitException e) {
+ JaxWsSdk.logError("could not open file '" + m_file + "'.", e);
+ }
+ return null;
+ }
+
+ private IFile getFile() {
+ return m_file;
+ }
+
+ public static enum FileExtensionType {
+ Auto, Xml("*.xml"), Txt("*.txt");
+ private String m_extension;
+
+ private FileExtensionType() {
+ }
+
+ private FileExtensionType(String extension) {
+ m_extension = extension;
+ }
+
+ public String getExtension() {
+ return m_extension;
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerAddAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerAddAction.java
index 2b6dd65dc..742efd8b5 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerAddAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerAddAction.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.swt.widgets.Shell;
-
-public class HandlerAddAction extends AbstractLinkAction {
-
- private IScoutBundle m_bundle;
-
- private SunJaxWsBean m_sunJaxWsBean;
- private ScoutXmlElement m_xmlHandlerChain;
-
- public HandlerAddAction() {
- super(Texts.get("AddHandler"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
- setLinkText(Texts.get("AddHandler"));
- setToolTip(Texts.get("TooltipHandlerNew"));
- }
-
- public void init(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, ScoutXmlElement xmlHandlerChain) {
- m_bundle = bundle;
- m_sunJaxWsBean = sunJaxWsBean;
- m_xmlHandlerChain = xmlHandlerChain;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- ScoutXmlElement xmlHandler = m_xmlHandlerChain.addChild();
- xmlHandler.setName(m_sunJaxWsBean.toQualifiedName("handler"));
-
- // persist
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.swt.widgets.Shell;
+
+public class HandlerAddAction extends AbstractLinkAction {
+
+ private IScoutBundle m_bundle;
+
+ private SunJaxWsBean m_sunJaxWsBean;
+ private ScoutXmlElement m_xmlHandlerChain;
+
+ public HandlerAddAction() {
+ super(Texts.get("AddHandler"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
+ setLinkText(Texts.get("AddHandler"));
+ setToolTip(Texts.get("TooltipHandlerNew"));
+ }
+
+ public void init(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, ScoutXmlElement xmlHandlerChain) {
+ m_bundle = bundle;
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_xmlHandlerChain = xmlHandlerChain;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ ScoutXmlElement xmlHandler = m_xmlHandlerChain.addChild();
+ xmlHandler.setName(m_sunJaxWsBean.toQualifiedName("handler"));
+
+ // persist
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainFilterEditAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainFilterEditAction.java
index 8a01338f4..3d4b86f96 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainFilterEditAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainFilterEditAction.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.HandlerChainFilterWizard;
-import org.eclipse.swt.widgets.Shell;
-
-public class HandlerChainFilterEditAction extends AbstractLinkAction {
-
- private SunJaxWsBean m_sunJaxWsBean;
- private ScoutXmlElement m_xmlHandlerChain;
- private IScoutBundle m_bundle;
-
- public HandlerChainFilterEditAction() {
- super(Texts.get("EditFilter"), JaxWsSdk.getImageDescriptor(JaxWsIcons.Filter));
- setLinkText(Texts.get("EditFilter"));
- setToolTip(Texts.get("TooltipEditFilter"));
- }
-
- public void init(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, ScoutXmlElement xmlHandlerChain) {
- m_bundle = bundle;
- m_sunJaxWsBean = sunJaxWsBean;
- m_xmlHandlerChain = xmlHandlerChain;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- HandlerChainFilterWizard wizard = new HandlerChainFilterWizard();
- wizard.init(m_bundle, m_sunJaxWsBean, m_xmlHandlerChain);
-
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.setHelpAvailable(false);
- wizardDialog.setPageSize(100, 350);
- wizardDialog.open();
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.HandlerChainFilterWizard;
+import org.eclipse.swt.widgets.Shell;
+
+public class HandlerChainFilterEditAction extends AbstractLinkAction {
+
+ private SunJaxWsBean m_sunJaxWsBean;
+ private ScoutXmlElement m_xmlHandlerChain;
+ private IScoutBundle m_bundle;
+
+ public HandlerChainFilterEditAction() {
+ super(Texts.get("EditFilter"), JaxWsSdk.getImageDescriptor(JaxWsIcons.Filter));
+ setLinkText(Texts.get("EditFilter"));
+ setToolTip(Texts.get("TooltipEditFilter"));
+ }
+
+ public void init(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, ScoutXmlElement xmlHandlerChain) {
+ m_bundle = bundle;
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_xmlHandlerChain = xmlHandlerChain;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ HandlerChainFilterWizard wizard = new HandlerChainFilterWizard();
+ wizard.init(m_bundle, m_sunJaxWsBean, m_xmlHandlerChain);
+
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.setHelpAvailable(false);
+ wizardDialog.setPageSize(100, 350);
+ wizardDialog.open();
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainNewAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainNewAction.java
index a4aa05b27..fbd2bacd7 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainNewAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainNewAction.java
@@ -1,61 +1,61 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.swt.widgets.Shell;
-
-public class HandlerChainNewAction extends AbstractLinkAction {
-
- private SunJaxWsBean m_sunJaxWsBean;
- private IScoutBundle m_bundle;
-
- public HandlerChainNewAction() {
- super(Texts.get("HandlerChainNewAction"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
- setLinkText(Texts.get("HandlerChainNewAction"));
- setToolTip(Texts.get("TooltipHanderChainNew"));
- }
-
- public void init(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean) {
- m_sunJaxWsBean = sunJaxWsBean;
- m_bundle = bundle;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- String handlerChainsQName = toQualifiedName(SunJaxWsBean.XML_HANDLER_CHAINS);
- ScoutXmlElement xmlHandlerChains = m_sunJaxWsBean.getXml().getChild(handlerChainsQName);
- if (xmlHandlerChains == null) {
- xmlHandlerChains = m_sunJaxWsBean.getXml().addChild(SunJaxWsBean.XML_HANDLER_CHAINS);
- xmlHandlerChains.setNamespace(m_sunJaxWsBean.getXml().getRoot().getNamePrefix(), SunJaxWsBean.NS_HANDLER_CHAINS);
- xmlHandlerChains.setName(handlerChainsQName);
- }
- ScoutXmlElement xmlHandlerChain = xmlHandlerChains.addChild();
- xmlHandlerChain.setName(toQualifiedName(SunJaxWsBean.XML_HANDLER_CHAIN));
-
- // persist
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(xmlHandlerChain.getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
- return null;
- }
-
- private String toQualifiedName(String elementName) {
- return m_sunJaxWsBean.toQualifiedName(elementName);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.swt.widgets.Shell;
+
+public class HandlerChainNewAction extends AbstractLinkAction {
+
+ private SunJaxWsBean m_sunJaxWsBean;
+ private IScoutBundle m_bundle;
+
+ public HandlerChainNewAction() {
+ super(Texts.get("HandlerChainNewAction"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
+ setLinkText(Texts.get("HandlerChainNewAction"));
+ setToolTip(Texts.get("TooltipHanderChainNew"));
+ }
+
+ public void init(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean) {
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_bundle = bundle;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ String handlerChainsQName = toQualifiedName(SunJaxWsBean.XML_HANDLER_CHAINS);
+ ScoutXmlElement xmlHandlerChains = m_sunJaxWsBean.getXml().getChild(handlerChainsQName);
+ if (xmlHandlerChains == null) {
+ xmlHandlerChains = m_sunJaxWsBean.getXml().addChild(SunJaxWsBean.XML_HANDLER_CHAINS);
+ xmlHandlerChains.setNamespace(m_sunJaxWsBean.getXml().getRoot().getNamePrefix(), SunJaxWsBean.NS_HANDLER_CHAINS);
+ xmlHandlerChains.setName(handlerChainsQName);
+ }
+ ScoutXmlElement xmlHandlerChain = xmlHandlerChains.addChild();
+ xmlHandlerChain.setName(toQualifiedName(SunJaxWsBean.XML_HANDLER_CHAIN));
+
+ // persist
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(xmlHandlerChain.getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
+ return null;
+ }
+
+ private String toQualifiedName(String elementName) {
+ return m_sunJaxWsBean.toQualifiedName(elementName);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainRemoveAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainRemoveAction.java
index ea984f2fd..db0f8fb34 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainRemoveAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerChainRemoveAction.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-
-public class HandlerChainRemoveAction extends AbstractLinkAction {
-
- private SunJaxWsBean m_sunJaxWsBean;
- private ScoutXmlElement m_xmlHandlerChain;
- private IScoutBundle m_bundle;
-
- public HandlerChainRemoveAction() {
- super(Texts.get("RemoveChain"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolRemove));
- setLinkText(Texts.get("RemoveChain"));
- setToolTip(Texts.get("TooltipHandlerChainRemove"));
- }
-
- public void init(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, ScoutXmlElement xmlHandlerChain) {
- m_sunJaxWsBean = sunJaxWsBean;
- m_bundle = bundle;
- m_xmlHandlerChain = xmlHandlerChain;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
- messageBox.setMessage(Texts.get("QuestionRemoveHandlerChain"));
- if (messageBox.open() == SWT.YES) {
- ScoutXmlElement xmlHandlerChains = m_sunJaxWsBean.getXml().getChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_CHAINS));
- xmlHandlerChains.removeChild(m_xmlHandlerChain);
-
- // persist
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_xmlHandlerChain.getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
- }
- return null;
- }
-
- private String toQualifiedName(String elementName) {
- return m_sunJaxWsBean.toQualifiedName(elementName);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+
+public class HandlerChainRemoveAction extends AbstractLinkAction {
+
+ private SunJaxWsBean m_sunJaxWsBean;
+ private ScoutXmlElement m_xmlHandlerChain;
+ private IScoutBundle m_bundle;
+
+ public HandlerChainRemoveAction() {
+ super(Texts.get("RemoveChain"), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolRemove));
+ setLinkText(Texts.get("RemoveChain"));
+ setToolTip(Texts.get("TooltipHandlerChainRemove"));
+ }
+
+ public void init(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, ScoutXmlElement xmlHandlerChain) {
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_bundle = bundle;
+ m_xmlHandlerChain = xmlHandlerChain;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO);
+ messageBox.setMessage(Texts.get("QuestionRemoveHandlerChain"));
+ if (messageBox.open() == SWT.YES) {
+ ScoutXmlElement xmlHandlerChains = m_sunJaxWsBean.getXml().getChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_CHAINS));
+ xmlHandlerChains.removeChild(m_xmlHandlerChain);
+
+ // persist
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_xmlHandlerChain.getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
+ }
+ return null;
+ }
+
+ private String toQualifiedName(String elementName) {
+ return m_sunJaxWsBean.toQualifiedName(elementName);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerNewWizardAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerNewWizardAction.java
index b6d14e284..21236267d 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerNewWizardAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/HandlerNewWizardAction.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.HandlerNewWizard;
-import org.eclipse.swt.widgets.Shell;
-
-public class HandlerNewWizardAction extends AbstractLinkAction {
- private int m_result;
- private IScoutBundle m_bundle;
-
- public HandlerNewWizardAction() {
- super(Texts.get("Action_newTypeX", Texts.get("Handler")), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
- setLeadingText(Texts.get("CreateNewHandlerByClicking"));
- setLinkText(Texts.get("here"));
- }
-
- public void init(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- IWizard wizard = new HandlerNewWizard(m_bundle);
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.setPageSize(680, 350);
- wizardDialog.setHelpAvailable(false);
- m_result = wizardDialog.open();
- return null;
- }
-
- public int getResult() {
- return m_result;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.HandlerNewWizard;
+import org.eclipse.swt.widgets.Shell;
+
+public class HandlerNewWizardAction extends AbstractLinkAction {
+ private int m_result;
+ private IScoutBundle m_bundle;
+
+ public HandlerNewWizardAction() {
+ super(Texts.get("Action_newTypeX", Texts.get("Handler")), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
+ setLeadingText(Texts.get("CreateNewHandlerByClicking"));
+ setLinkText(Texts.get("here"));
+ }
+
+ public void init(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ IWizard wizard = new HandlerNewWizard(m_bundle);
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.setPageSize(680, 350);
+ wizardDialog.setHelpAvailable(false);
+ m_result = wizardDialog.open();
+ return null;
+ }
+
+ public int getResult() {
+ return m_result;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/IPresenterAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/IPresenterAction.java
index 8863c25ed..352d9806b 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/IPresenterAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/IPresenterAction.java
@@ -1,20 +1,20 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-
-public interface IPresenterAction extends IScoutHandler {
-
- public String getLeadingText();
-
- public String getLinkText();
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+
+public interface IPresenterAction extends IScoutHandler {
+
+ public String getLeadingText();
+
+ public String getLinkText();
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/JaxWsAliasChangeWizardAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/JaxWsAliasChangeWizardAction.java
index cb726af6d..9a28fa4c9 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/JaxWsAliasChangeWizardAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/JaxWsAliasChangeWizardAction.java
@@ -1,51 +1,51 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.JaxWsServletRegistrationWizard;
-import org.eclipse.swt.widgets.Shell;
-
-public class JaxWsAliasChangeWizardAction extends AbstractLinkAction {
-
- private IScoutBundle m_bundle;
-
- public JaxWsAliasChangeWizardAction() {
- super(Texts.get("ChangeJaxWsAlias"), JaxWsSdk.getImageDescriptor(JaxWsIcons.JaxWsAlias));
- setLeadingText(Texts.get("ChangeJaxWsAliasByClicking"));
- setLinkText(Texts.get("here"));
- }
-
- public void init(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- IWizard wizard = new JaxWsServletRegistrationWizard(m_bundle);
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.setPageSize(650, 150);
- wizardDialog.setHelpAvailable(false);
- wizardDialog.open();
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.JaxWsServletRegistrationWizard;
+import org.eclipse.swt.widgets.Shell;
+
+public class JaxWsAliasChangeWizardAction extends AbstractLinkAction {
+
+ private IScoutBundle m_bundle;
+
+ public JaxWsAliasChangeWizardAction() {
+ super(Texts.get("ChangeJaxWsAlias"), JaxWsSdk.getImageDescriptor(JaxWsIcons.JaxWsAlias));
+ setLeadingText(Texts.get("ChangeJaxWsAliasByClicking"));
+ setLinkText(Texts.get("here"));
+ }
+
+ public void init(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ IWizard wizard = new JaxWsServletRegistrationWizard(m_bundle);
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.setPageSize(650, 150);
+ wizardDialog.setHelpAvailable(false);
+ wizardDialog.open();
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/ProviderNewWizardAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/ProviderNewWizardAction.java
index 1169dc310..bfa75c0bf 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/ProviderNewWizardAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/ProviderNewWizardAction.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsProviderNewWizard;
-import org.eclipse.swt.widgets.Shell;
-
-public class ProviderNewWizardAction extends AbstractLinkAction {
-
- private IScoutBundle m_bundle;
-
- public ProviderNewWizardAction() {
- super(Texts.get("Action_newTypeX", Texts.get("Provider")), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
- setLeadingText(Texts.get("CreateNewWsProviderByClicking"));
- setLinkText(Texts.get("here"));
- }
-
- public void init(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- IWizard wizard = new WsProviderNewWizard(m_bundle);
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.setHelpAvailable(false);
- wizardDialog.setPageSize(680, 410);
- wizardDialog.open();
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsProviderNewWizard;
+import org.eclipse.swt.widgets.Shell;
+
+public class ProviderNewWizardAction extends AbstractLinkAction {
+
+ private IScoutBundle m_bundle;
+
+ public ProviderNewWizardAction() {
+ super(Texts.get("Action_newTypeX", Texts.get("Provider")), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
+ setLeadingText(Texts.get("CreateNewWsProviderByClicking"));
+ setLinkText(Texts.get("here"));
+ }
+
+ public void init(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ IWizard wizard = new WsProviderNewWizard(m_bundle);
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.setHelpAvailable(false);
+ wizardDialog.setPageSize(680, 410);
+ wizardDialog.open();
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/RefreshAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/RefreshAction.java
index e2e9449a1..7ccb910f1 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/RefreshAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/RefreshAction.java
@@ -1,37 +1,37 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.swt.widgets.Shell;
-
-public class RefreshAction extends AbstractLinkAction {
-
- public RefreshAction() {
- super(Texts.get("Refresh"), JaxWsSdk.getImageDescriptor(JaxWsIcons.Refresh));
- setLeadingText(Texts.get("RefreshByClicking"));
- setLinkText("here");
- setToolTip(Texts.get("ReloadResourcesFromDisk"));
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- for (IPage p : selection) {
- p.refresh(true);
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.swt.widgets.Shell;
+
+public class RefreshAction extends AbstractLinkAction {
+
+ public RefreshAction() {
+ super(Texts.get("Refresh"), JaxWsSdk.getImageDescriptor(JaxWsIcons.Refresh));
+ setLeadingText(Texts.get("RefreshByClicking"));
+ setLinkText("here");
+ setToolTip(Texts.get("ReloadResourcesFromDisk"));
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ for (IPage p : selection) {
+ p.refresh(true);
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/RepairAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/RepairAction.java
index bda213c50..41106d1f1 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/RepairAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/RepairAction.java
@@ -1,102 +1,102 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.IMarkerCommand;
-import org.eclipse.scout.sdk.ws.jaxws.operation.CommandExecutionOperation;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.CommandExecutionDialog;
-import org.eclipse.swt.widgets.Shell;
-
-public class RepairAction extends AbstractLinkAction {
-
- private IScoutBundle m_bundle;
- private String m_markerGroupUUID;
-
- public RepairAction() {
- super(Texts.get("Repair"), null);
- setLeadingText(Texts.get("presenterRepair"));
- setLinkText(Texts.get("repairTools"));
- setToolTip(Texts.get("ClickToFixTheProblems"));
- }
-
- public void init(String markerGroupUUID, IScoutBundle bundle) {
- m_markerGroupUUID = markerGroupUUID;
- m_bundle = bundle;
-
- IMarkerCommand[] markerCommands = MarkerUtility.getMarkerCommands(m_markerGroupUUID, m_bundle);
- int severity = IMarker.SEVERITY_INFO;
- for (IMarkerCommand cmd : markerCommands) {
- severity = Math.max(cmd.getMarker().getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO), severity);
- if (severity == IMarker.SEVERITY_ERROR) {
- break;
- }
- }
-
- switch (severity) {
- case IMarker.SEVERITY_INFO: {
- setImage(JaxWsSdk.getImageDescriptor(JaxWsIcons.RepairInfo));
- break;
- }
- case IMarker.SEVERITY_WARNING: {
- setImage(JaxWsSdk.getImageDescriptor(JaxWsIcons.RepairWarning));
- break;
- }
- default: {
- setImage(JaxWsSdk.getImageDescriptor(JaxWsIcons.RepairError));
- break;
- }
- }
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- IMarkerCommand[] markerCommands = MarkerUtility.getMarkerCommands(m_markerGroupUUID, m_bundle);
-
- CommandExecutionDialog dialog = new CommandExecutionDialog(Texts.get("RepairTools"));
- dialog.setHeaderMessage(Texts.get("TheFollowingProblemsWereEncountered"));
- dialog.setCommands(markerCommands);
-
- if (dialog.open() == Window.OK) {
- // prepare UI commands
- List<IMarkerCommand> commandsToBeExecuted = new LinkedList<IMarkerCommand>();
- for (IMarkerCommand command : markerCommands) {
- if (command.isDoExecute()) {
- try {
- if (command.prepareForUi()) {
- commandsToBeExecuted.add(command);
- }
- }
- catch (CoreException e) {
- JaxWsSdk.logError("Error occured while preparing command to be executed", e);
- }
- }
- }
- OperationJob job = new OperationJob(new CommandExecutionOperation(commandsToBeExecuted.toArray(new IMarkerCommand[commandsToBeExecuted.size()])));
- job.schedule();
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.IMarkerCommand;
+import org.eclipse.scout.sdk.ws.jaxws.operation.CommandExecutionOperation;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.CommandExecutionDialog;
+import org.eclipse.swt.widgets.Shell;
+
+public class RepairAction extends AbstractLinkAction {
+
+ private IScoutBundle m_bundle;
+ private String m_markerGroupUUID;
+
+ public RepairAction() {
+ super(Texts.get("Repair"), null);
+ setLeadingText(Texts.get("presenterRepair"));
+ setLinkText(Texts.get("repairTools"));
+ setToolTip(Texts.get("ClickToFixTheProblems"));
+ }
+
+ public void init(String markerGroupUUID, IScoutBundle bundle) {
+ m_markerGroupUUID = markerGroupUUID;
+ m_bundle = bundle;
+
+ IMarkerCommand[] markerCommands = MarkerUtility.getMarkerCommands(m_markerGroupUUID, m_bundle);
+ int severity = IMarker.SEVERITY_INFO;
+ for (IMarkerCommand cmd : markerCommands) {
+ severity = Math.max(cmd.getMarker().getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO), severity);
+ if (severity == IMarker.SEVERITY_ERROR) {
+ break;
+ }
+ }
+
+ switch (severity) {
+ case IMarker.SEVERITY_INFO: {
+ setImage(JaxWsSdk.getImageDescriptor(JaxWsIcons.RepairInfo));
+ break;
+ }
+ case IMarker.SEVERITY_WARNING: {
+ setImage(JaxWsSdk.getImageDescriptor(JaxWsIcons.RepairWarning));
+ break;
+ }
+ default: {
+ setImage(JaxWsSdk.getImageDescriptor(JaxWsIcons.RepairError));
+ break;
+ }
+ }
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ IMarkerCommand[] markerCommands = MarkerUtility.getMarkerCommands(m_markerGroupUUID, m_bundle);
+
+ CommandExecutionDialog dialog = new CommandExecutionDialog(Texts.get("RepairTools"));
+ dialog.setHeaderMessage(Texts.get("TheFollowingProblemsWereEncountered"));
+ dialog.setCommands(markerCommands);
+
+ if (dialog.open() == Window.OK) {
+ // prepare UI commands
+ List<IMarkerCommand> commandsToBeExecuted = new LinkedList<IMarkerCommand>();
+ for (IMarkerCommand command : markerCommands) {
+ if (command.isDoExecute()) {
+ try {
+ if (command.prepareForUi()) {
+ commandsToBeExecuted.add(command);
+ }
+ }
+ catch (CoreException e) {
+ JaxWsSdk.logError("Error occured while preparing command to be executed", e);
+ }
+ }
+ }
+ OperationJob job = new OperationJob(new CommandExecutionOperation(commandsToBeExecuted.toArray(new IMarkerCommand[commandsToBeExecuted.size()])));
+ job.schedule();
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/SessionFactoryNewAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/SessionFactoryNewAction.java
index 5169995a9..cabb56ab9 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/SessionFactoryNewAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/SessionFactoryNewAction.java
@@ -1,42 +1,42 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class SessionFactoryNewAction extends TypeNewAction {
-
- public SessionFactoryNewAction() {
- super(Texts.get("ServerSessionFactory"));
- }
-
- @Override
- public void init(IScoutBundle bundle) {
- super.init(bundle);
- setPackageFragment(JaxWsSdkUtility.getRecommendedSessionPackageName(bundle), true);
- List<String> interfaceTypeSignatures = new ArrayList<String>();
- interfaceTypeSignatures.add(Signature.createTypeSignature(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory).getFullyQualifiedName(), true));
- setInterfaceTypeSignatures(interfaceTypeSignatures, false);
- setSuperTypeSignature(null, false);
- setTypeName("ServerSessionFactory");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class SessionFactoryNewAction extends TypeNewAction {
+
+ public SessionFactoryNewAction() {
+ super(Texts.get("ServerSessionFactory"));
+ }
+
+ @Override
+ public void init(IScoutBundle bundle) {
+ super.init(bundle);
+ setPackageFragment(JaxWsSdkUtility.getRecommendedSessionPackageName(bundle), true);
+ List<String> interfaceTypeSignatures = new ArrayList<String>();
+ interfaceTypeSignatures.add(Signature.createTypeSignature(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory).getFullyQualifiedName(), true));
+ setInterfaceTypeSignatures(interfaceTypeSignatures, false);
+ setSuperTypeSignature(null, false);
+ setTypeName("ServerSessionFactory");
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/StubRebuildAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/StubRebuildAction.java
index fcc54e80f..22f0758dc 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/StubRebuildAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/StubRebuildAction.java
@@ -1,118 +1,118 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsStubGenerationOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ErrorDialog;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceConsumerNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IOperationFinishedListener;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.MessageBox;
-import org.eclipse.swt.widgets.Shell;
-
-public class StubRebuildAction extends AbstractLinkAction {
-
- private IScoutBundle m_bundle;
- private WsdlResource m_wsdlResource;
- private String m_markerGroupUUID;
- private WebserviceEnum m_webserviceEnum;
- private BuildJaxWsBean m_buildJaxWsBean;
-
- public StubRebuildAction() {
- super(Texts.get("RebuildWebserviceStub"), JaxWsSdk.getImageDescriptor(JaxWsIcons.RebuildWsStub));
- setLinkText(Texts.get("RebuildWebserviceStub"));
- setToolTip(Texts.get("ClickToGenerateWsStub"));
- }
-
- public void init(IScoutBundle bundle, BuildJaxWsBean buildJaxWsBean, WsdlResource wsdlResource, String markerGroupUUID, WebserviceEnum webserviceEnum) {
- m_bundle = bundle;
- m_buildJaxWsBean = buildJaxWsBean;
- m_wsdlResource = wsdlResource;
- m_markerGroupUUID = markerGroupUUID;
- m_webserviceEnum = webserviceEnum;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- WsStubGenerationOperation op = new WsStubGenerationOperation();
- op.setBundle(m_bundle);
- op.setAlias(m_buildJaxWsBean.getAlias());
- IPath wsdlFolderPath = m_wsdlResource.getFile().getProjectRelativePath().removeLastSegments(1);// get folder of WSDL file
- op.setWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, wsdlFolderPath.toPortableString(), false));
- op.setProperties(m_buildJaxWsBean.getPropertiers());
- op.addOperationFinishedListener(new P_OperationFinishedListener());
- op.setWsdlFileName(m_wsdlResource.getFile().getName());
- OperationJob job = new OperationJob(op);
- job.setSystem(false);
- job.setUser(false);
- job.setPriority(Job.INTERACTIVE);
- job.schedule();
- return null;
- }
-
- private class P_OperationFinishedListener implements IOperationFinishedListener {
-
- @Override
- public void operationFinished(final boolean success, final Throwable e) {
- if (m_webserviceEnum == WebserviceEnum.Provider) {
- JaxWsSdk.getDefault().notifyPageReload(WebServiceProviderNodePage.class, m_markerGroupUUID, WebServiceProviderNodePage.DATA_STUB_FILES);
- }
- else {
- JaxWsSdk.getDefault().notifyPageReload(WebServiceConsumerNodePage.class, m_markerGroupUUID, WebServiceConsumerNodePage.DATA_STUB_FILES);
- }
-
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (success) {
- MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_INFORMATION | SWT.OK);
- messageBox.setMessage(Texts.get("WsStubSuccessfullyGenerated"));
- messageBox.open();
- }
- else {
- ErrorDialog dialog = new ErrorDialog(Texts.get("StubGenerationFailed"));
- dialog.setError(Texts.get("WsStubGenerationFailed"), e);
- dialog.open();
- }
- }
- });
- }
- }
-
- private String getStacktrace(Throwable t) {
- if (t == null) {
- return null;
- }
- StringWriter writer = new StringWriter();
- t.printStackTrace(new PrintWriter(writer));
- return writer.toString();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsStubGenerationOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ErrorDialog;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceConsumerNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IOperationFinishedListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.MessageBox;
+import org.eclipse.swt.widgets.Shell;
+
+public class StubRebuildAction extends AbstractLinkAction {
+
+ private IScoutBundle m_bundle;
+ private WsdlResource m_wsdlResource;
+ private String m_markerGroupUUID;
+ private WebserviceEnum m_webserviceEnum;
+ private BuildJaxWsBean m_buildJaxWsBean;
+
+ public StubRebuildAction() {
+ super(Texts.get("RebuildWebserviceStub"), JaxWsSdk.getImageDescriptor(JaxWsIcons.RebuildWsStub));
+ setLinkText(Texts.get("RebuildWebserviceStub"));
+ setToolTip(Texts.get("ClickToGenerateWsStub"));
+ }
+
+ public void init(IScoutBundle bundle, BuildJaxWsBean buildJaxWsBean, WsdlResource wsdlResource, String markerGroupUUID, WebserviceEnum webserviceEnum) {
+ m_bundle = bundle;
+ m_buildJaxWsBean = buildJaxWsBean;
+ m_wsdlResource = wsdlResource;
+ m_markerGroupUUID = markerGroupUUID;
+ m_webserviceEnum = webserviceEnum;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ WsStubGenerationOperation op = new WsStubGenerationOperation();
+ op.setBundle(m_bundle);
+ op.setAlias(m_buildJaxWsBean.getAlias());
+ IPath wsdlFolderPath = m_wsdlResource.getFile().getProjectRelativePath().removeLastSegments(1);// get folder of WSDL file
+ op.setWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, wsdlFolderPath.toPortableString(), false));
+ op.setProperties(m_buildJaxWsBean.getPropertiers());
+ op.addOperationFinishedListener(new P_OperationFinishedListener());
+ op.setWsdlFileName(m_wsdlResource.getFile().getName());
+ OperationJob job = new OperationJob(op);
+ job.setSystem(false);
+ job.setUser(false);
+ job.setPriority(Job.INTERACTIVE);
+ job.schedule();
+ return null;
+ }
+
+ private class P_OperationFinishedListener implements IOperationFinishedListener {
+
+ @Override
+ public void operationFinished(final boolean success, final Throwable e) {
+ if (m_webserviceEnum == WebserviceEnum.Provider) {
+ JaxWsSdk.getDefault().notifyPageReload(WebServiceProviderNodePage.class, m_markerGroupUUID, WebServiceProviderNodePage.DATA_STUB_FILES);
+ }
+ else {
+ JaxWsSdk.getDefault().notifyPageReload(WebServiceConsumerNodePage.class, m_markerGroupUUID, WebServiceConsumerNodePage.DATA_STUB_FILES);
+ }
+
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (success) {
+ MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_INFORMATION | SWT.OK);
+ messageBox.setMessage(Texts.get("WsStubSuccessfullyGenerated"));
+ messageBox.open();
+ }
+ else {
+ ErrorDialog dialog = new ErrorDialog(Texts.get("StubGenerationFailed"));
+ dialog.setError(Texts.get("WsStubGenerationFailed"), e);
+ dialog.open();
+ }
+ }
+ });
+ }
+ }
+
+ private String getStacktrace(Throwable t) {
+ if (t == null) {
+ return null;
+ }
+ StringWriter writer = new StringWriter();
+ t.printStackTrace(new PrintWriter(writer));
+ return writer.toString();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/TypeNewAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/TypeNewAction.java
index f0869cb93..e38bfc858 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/TypeNewAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/TypeNewAction.java
@@ -1,178 +1,178 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.internal.corext.template.java.SignatureUtil;
-import org.eclipse.jdt.ui.actions.OpenNewClassWizardAction;
-import org.eclipse.jdt.ui.wizards.NewClassWizardPage;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.util.typecache.TypeCacheAccessor;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.swt.widgets.Shell;
-
-@SuppressWarnings("restriction")
-public abstract class TypeNewAction extends AbstractLinkAction {
- private IScoutBundle m_bundle;
- private String m_packageFragment;
- private boolean m_allowModifyPackageFragment;
- private String m_superTypeSignature;
- private boolean m_allowModifySuperType;
- private List<String> m_interfaceTypeSignatures;
- private boolean m_allowModifyInterfaces;
- private String m_typeName;
- private IType m_createdType;
-
- public TypeNewAction(String label) {
- super(Texts.get("Action_newTypeX", label), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
- setLinkText(Texts.get("here"));
- setLeadingText(Texts.get("CreateNewXByClicking", label));
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- m_createdType = openNewTypeDialog();
- return null;
- }
-
- public void init(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- protected IType openNewTypeDialog() {
- NewClassWizardPage page = new NewClassWizardPage();
- page.setDescription(getLabel());
- page.setEnclosingTypeSelection(false, false);
- page.setMethodStubSelection(false, true, true, true);
- IPackageFragment packageFragment = null;
- packageFragment = m_bundle.getPackageFragment(m_packageFragment);
-
- if (packageFragment != null) {
- page.setPackageFragmentRoot((IPackageFragmentRoot) packageFragment.getParent(), m_allowModifyPackageFragment);
- page.setPackageFragment(packageFragment, m_allowModifyPackageFragment);
- }
- else {
- String rootPackageName = m_bundle.getRootPackageName();
- page.setPackageFragmentRoot((IPackageFragmentRoot) m_bundle.getPackageFragment(rootPackageName).getParent(), true);
- }
- if (m_superTypeSignature != null) {
- page.setSuperClass(stripSignatureToFQN(m_superTypeSignature, false), m_allowModifySuperType);
- }
- if (m_interfaceTypeSignatures != null && m_interfaceTypeSignatures.size() > 0) {
- List<String> interfaceTypeNames = new LinkedList<String>();
- for (String signature : m_interfaceTypeSignatures) {
- interfaceTypeNames.add(stripSignatureToFQN(signature, false));
- }
- page.setSuperInterfaces(interfaceTypeNames, m_allowModifyInterfaces);
- }
-
- if (m_typeName != null) {
- page.setTypeName(Signature.getSimpleName(m_typeName), true);
- }
- OpenNewClassWizardAction action = new OpenNewClassWizardAction();
- action.setConfiguredWizardPage(page);
- action.run();
-
- m_createdType = page.getCreatedType();
- if (TypeUtility.exists(m_createdType)) {
- IWorkingCopyManager level = TypeCacheAccessor.createWorkingCopyManger();
- try {
- level.register(m_createdType.getCompilationUnit(), new NullProgressMonitor());
- TypeUtility.getType(m_createdType.getFullyQualifiedName());
- level.reconcile(m_createdType.getCompilationUnit(), new NullProgressMonitor());
- TypeUtility.getPrimaryTypeHierarchy(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)).invalidate();
- }
- catch (JavaModelException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- level.unregisterAll(new NullProgressMonitor());
-
- return m_createdType;
- }
- return null;
- }
-
- private String stripSignatureToFQN(String signature, boolean eraseGenericTypes) {
- if (signature == null) {
- return null;
- }
-
- String typeSignature = SignatureUtil.stripSignatureToFQN(signature);
- if (!eraseGenericTypes) {
- // support for generic type parameters
- String typeArguments = null;
- for (String typeArgument : Signature.getTypeArguments(signature)) {
- typeArguments = StringUtility.join(",", typeArguments, SignatureUtil.stripSignatureToFQN(typeArgument));
- }
- if (typeArguments != null) {
- typeSignature = typeSignature + "<" + typeArguments + ">";
- }
- }
-
- return typeSignature;
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public void setSuperTypeSignature(String superTypeSignature, boolean allowModify) {
- m_superTypeSignature = superTypeSignature;
- m_allowModifySuperType = allowModify;
- }
-
- public void setInterfaceTypeSignatures(List<String> interfaceTypeSignatures, boolean allowModify) {
- m_interfaceTypeSignatures = interfaceTypeSignatures;
- m_allowModifyInterfaces = allowModify;
- }
-
- public void setPackageFragment(String packageFragment, boolean allowModify) {
- m_packageFragment = packageFragment;
- m_allowModifyPackageFragment = allowModify;
- }
-
- public IType getCreatedType() {
- return m_createdType;
- }
-
- public void setTypeName(String typeName) {
- m_typeName = typeName;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.internal.corext.template.java.SignatureUtil;
+import org.eclipse.jdt.ui.actions.OpenNewClassWizardAction;
+import org.eclipse.jdt.ui.wizards.NewClassWizardPage;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.util.typecache.TypeCacheAccessor;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.swt.widgets.Shell;
+
+@SuppressWarnings("restriction")
+public abstract class TypeNewAction extends AbstractLinkAction {
+ private IScoutBundle m_bundle;
+ private String m_packageFragment;
+ private boolean m_allowModifyPackageFragment;
+ private String m_superTypeSignature;
+ private boolean m_allowModifySuperType;
+ private List<String> m_interfaceTypeSignatures;
+ private boolean m_allowModifyInterfaces;
+ private String m_typeName;
+ private IType m_createdType;
+
+ public TypeNewAction(String label) {
+ super(Texts.get("Action_newTypeX", label), ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolAdd));
+ setLinkText(Texts.get("here"));
+ setLeadingText(Texts.get("CreateNewXByClicking", label));
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ m_createdType = openNewTypeDialog();
+ return null;
+ }
+
+ public void init(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ protected IType openNewTypeDialog() {
+ NewClassWizardPage page = new NewClassWizardPage();
+ page.setDescription(getLabel());
+ page.setEnclosingTypeSelection(false, false);
+ page.setMethodStubSelection(false, true, true, true);
+ IPackageFragment packageFragment = null;
+ packageFragment = m_bundle.getPackageFragment(m_packageFragment);
+
+ if (packageFragment != null) {
+ page.setPackageFragmentRoot((IPackageFragmentRoot) packageFragment.getParent(), m_allowModifyPackageFragment);
+ page.setPackageFragment(packageFragment, m_allowModifyPackageFragment);
+ }
+ else {
+ String rootPackageName = m_bundle.getRootPackageName();
+ page.setPackageFragmentRoot((IPackageFragmentRoot) m_bundle.getPackageFragment(rootPackageName).getParent(), true);
+ }
+ if (m_superTypeSignature != null) {
+ page.setSuperClass(stripSignatureToFQN(m_superTypeSignature, false), m_allowModifySuperType);
+ }
+ if (m_interfaceTypeSignatures != null && m_interfaceTypeSignatures.size() > 0) {
+ List<String> interfaceTypeNames = new LinkedList<String>();
+ for (String signature : m_interfaceTypeSignatures) {
+ interfaceTypeNames.add(stripSignatureToFQN(signature, false));
+ }
+ page.setSuperInterfaces(interfaceTypeNames, m_allowModifyInterfaces);
+ }
+
+ if (m_typeName != null) {
+ page.setTypeName(Signature.getSimpleName(m_typeName), true);
+ }
+ OpenNewClassWizardAction action = new OpenNewClassWizardAction();
+ action.setConfiguredWizardPage(page);
+ action.run();
+
+ m_createdType = page.getCreatedType();
+ if (TypeUtility.exists(m_createdType)) {
+ IWorkingCopyManager level = TypeCacheAccessor.createWorkingCopyManger();
+ try {
+ level.register(m_createdType.getCompilationUnit(), new NullProgressMonitor());
+ TypeUtility.getType(m_createdType.getFullyQualifiedName());
+ level.reconcile(m_createdType.getCompilationUnit(), new NullProgressMonitor());
+ TypeUtility.getPrimaryTypeHierarchy(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)).invalidate();
+ }
+ catch (JavaModelException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ level.unregisterAll(new NullProgressMonitor());
+
+ return m_createdType;
+ }
+ return null;
+ }
+
+ private String stripSignatureToFQN(String signature, boolean eraseGenericTypes) {
+ if (signature == null) {
+ return null;
+ }
+
+ String typeSignature = SignatureUtil.stripSignatureToFQN(signature);
+ if (!eraseGenericTypes) {
+ // support for generic type parameters
+ String typeArguments = null;
+ for (String typeArgument : Signature.getTypeArguments(signature)) {
+ typeArguments = StringUtility.join(",", typeArguments, SignatureUtil.stripSignatureToFQN(typeArgument));
+ }
+ if (typeArguments != null) {
+ typeSignature = typeSignature + "<" + typeArguments + ">";
+ }
+ }
+
+ return typeSignature;
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public void setSuperTypeSignature(String superTypeSignature, boolean allowModify) {
+ m_superTypeSignature = superTypeSignature;
+ m_allowModifySuperType = allowModify;
+ }
+
+ public void setInterfaceTypeSignatures(List<String> interfaceTypeSignatures, boolean allowModify) {
+ m_interfaceTypeSignatures = interfaceTypeSignatures;
+ m_allowModifyInterfaces = allowModify;
+ }
+
+ public void setPackageFragment(String packageFragment, boolean allowModify) {
+ m_packageFragment = packageFragment;
+ m_allowModifyPackageFragment = allowModify;
+ }
+
+ public IType getCreatedType() {
+ return m_createdType;
+ }
+
+ public void setTypeName(String typeName) {
+ m_typeName = typeName;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/TypeOpenAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/TypeOpenAction.java
index 4ca5025de..b68c73d52 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/TypeOpenAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/TypeOpenAction.java
@@ -1,74 +1,74 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.ui.JavaElementImageDescriptor;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Shell;
-
-public class TypeOpenAction extends AbstractLinkAction {
- private IType m_type;
-
- public TypeOpenAction() {
- super("Open", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class));
- }
-
- public void init(IType type) {
- m_type = type;
-
- if (type != null) {
- setLabel(Texts.get("openX", type.getElementName()));
- setLinkText(type.getElementName());
- try {
- if (type.isInterface()) {
- setImage(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface));
- }
- else if (Flags.isAbstract(type.getFlags())) {
- setImage(new JavaElementImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), JavaElementImageDescriptor.ABSTRACT, new Point(16, 16)));
- }
- else {
- setImage(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class));
- }
- }
- catch (JavaModelException e) {
- setImage(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class));
- }
- }
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- if (m_type == null) {
- return null;
- }
- // open the class in the editor
- try {
- JavaUI.openInEditor(m_type);
- }
- catch (Exception e) {
- JaxWsSdk.logWarning(e);
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.ui.JavaElementImageDescriptor;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Shell;
+
+public class TypeOpenAction extends AbstractLinkAction {
+ private IType m_type;
+
+ public TypeOpenAction() {
+ super("Open", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class));
+ }
+
+ public void init(IType type) {
+ m_type = type;
+
+ if (type != null) {
+ setLabel(Texts.get("openX", type.getElementName()));
+ setLinkText(type.getElementName());
+ try {
+ if (type.isInterface()) {
+ setImage(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface));
+ }
+ else if (Flags.isAbstract(type.getFlags())) {
+ setImage(new JavaElementImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), JavaElementImageDescriptor.ABSTRACT, new Point(16, 16)));
+ }
+ else {
+ setImage(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class));
+ }
+ }
+ catch (JavaModelException e) {
+ setImage(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class));
+ }
+ }
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ if (m_type == null) {
+ return null;
+ }
+ // open the class in the editor
+ try {
+ JavaUI.openInEditor(m_type);
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning(e);
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsConsumerDeleteAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsConsumerDeleteAction.java
index c38e74da9..8605466cc 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsConsumerDeleteAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsConsumerDeleteAction.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.ui.action.AbstractScoutHandler;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsConsumerDeleteWizard;
-import org.eclipse.swt.widgets.Shell;
-
-public class WsConsumerDeleteAction extends AbstractScoutHandler {
-
- private IScoutBundle m_bundle;
- private BuildJaxWsBean m_buildJaxWsBean;
- private IType m_type;
-
- public WsConsumerDeleteAction() {
- super("Delete...", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolRemove), "Delete", false, Category.DELETE);
- }
-
- public void init(IScoutBundle bundle, IType type, BuildJaxWsBean buildJaxWsBean) {
- setLabel(Texts.get("Action_deleteTypeX", "'" + type.getElementName() + "'"));
- m_bundle = bundle;
- m_type = type;
- m_buildJaxWsBean = buildJaxWsBean;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- WsConsumerDeleteWizard wizard = new WsConsumerDeleteWizard();
- wizard.setBundle(m_bundle);
- wizard.setType(m_type);
- wizard.setBuildJaxWsBean(m_buildJaxWsBean);
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.open();
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.ui.action.AbstractScoutHandler;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsConsumerDeleteWizard;
+import org.eclipse.swt.widgets.Shell;
+
+public class WsConsumerDeleteAction extends AbstractScoutHandler {
+
+ private IScoutBundle m_bundle;
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private IType m_type;
+
+ public WsConsumerDeleteAction() {
+ super("Delete...", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolRemove), "Delete", false, Category.DELETE);
+ }
+
+ public void init(IScoutBundle bundle, IType type, BuildJaxWsBean buildJaxWsBean) {
+ setLabel(Texts.get("Action_deleteTypeX", "'" + type.getElementName() + "'"));
+ m_bundle = bundle;
+ m_type = type;
+ m_buildJaxWsBean = buildJaxWsBean;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ WsConsumerDeleteWizard wizard = new WsConsumerDeleteWizard();
+ wizard.setBundle(m_bundle);
+ wizard.setType(m_type);
+ wizard.setBuildJaxWsBean(m_buildJaxWsBean);
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.open();
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsProviderCodeFirstDeleteAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsProviderCodeFirstDeleteAction.java
index 5722670fa..b916b5c61 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsProviderCodeFirstDeleteAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsProviderCodeFirstDeleteAction.java
@@ -1,48 +1,48 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsProviderCodeFirstDeleteWizard;
-import org.eclipse.swt.widgets.Shell;
-
-public class WsProviderCodeFirstDeleteAction extends AbstractLinkAction {
-
- private IScoutBundle m_bundle;
- private SunJaxWsBean m_sunJaxWsBean;
-
- public WsProviderCodeFirstDeleteAction() {
- super("Delete...", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolRemove));
- }
-
- public void init(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean) {
- setLabel(Texts.get("Action_deleteTypeX", "'" + sunJaxWsBean.getAlias() + "'"));
- m_bundle = bundle;
- m_sunJaxWsBean = sunJaxWsBean;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- WsProviderCodeFirstDeleteWizard wizard = new WsProviderCodeFirstDeleteWizard();
- wizard.setBundle(m_bundle);
- wizard.setSunJaxWsBean(m_sunJaxWsBean);
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.open();
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsProviderCodeFirstDeleteWizard;
+import org.eclipse.swt.widgets.Shell;
+
+public class WsProviderCodeFirstDeleteAction extends AbstractLinkAction {
+
+ private IScoutBundle m_bundle;
+ private SunJaxWsBean m_sunJaxWsBean;
+
+ public WsProviderCodeFirstDeleteAction() {
+ super("Delete...", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolRemove));
+ }
+
+ public void init(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean) {
+ setLabel(Texts.get("Action_deleteTypeX", "'" + sunJaxWsBean.getAlias() + "'"));
+ m_bundle = bundle;
+ m_sunJaxWsBean = sunJaxWsBean;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ WsProviderCodeFirstDeleteWizard wizard = new WsProviderCodeFirstDeleteWizard();
+ wizard.setBundle(m_bundle);
+ wizard.setSunJaxWsBean(m_sunJaxWsBean);
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.open();
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsProviderDeleteAction.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsProviderDeleteAction.java
index 4d4948f56..5448a5279 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsProviderDeleteAction.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/action/WsProviderDeleteAction.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.action;
-
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.scout.sdk.ui.action.AbstractScoutHandler;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsProviderDeleteWizard;
-import org.eclipse.swt.widgets.Shell;
-
-public class WsProviderDeleteAction extends AbstractScoutHandler {
-
- private IScoutBundle m_bundle;
- private BuildJaxWsBean m_buildJaxWsBean;
- private SunJaxWsBean m_sunJaxWsBean;
-
- public WsProviderDeleteAction() {
- super("Delete...", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolRemove), "Delete", false, Category.DELETE);
- }
-
- public void init(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, BuildJaxWsBean buildJaxWsBean) {
- setLabel(Texts.get("Action_deleteTypeX", "'" + sunJaxWsBean.getAlias() + "'"));
- m_bundle = bundle;
- m_sunJaxWsBean = sunJaxWsBean;
- m_buildJaxWsBean = buildJaxWsBean;
- }
-
- @Override
- public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
- WsProviderDeleteWizard wizard = new WsProviderDeleteWizard();
- wizard.setBundle(m_bundle);
- wizard.setSunJaxWsBean(m_sunJaxWsBean);
- wizard.setBuildJaxWsBean(m_buildJaxWsBean);
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.open();
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.action;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.scout.sdk.ui.action.AbstractScoutHandler;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsProviderDeleteWizard;
+import org.eclipse.swt.widgets.Shell;
+
+public class WsProviderDeleteAction extends AbstractScoutHandler {
+
+ private IScoutBundle m_bundle;
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private SunJaxWsBean m_sunJaxWsBean;
+
+ public WsProviderDeleteAction() {
+ super("Delete...", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ToolRemove), "Delete", false, Category.DELETE);
+ }
+
+ public void init(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, BuildJaxWsBean buildJaxWsBean) {
+ setLabel(Texts.get("Action_deleteTypeX", "'" + sunJaxWsBean.getAlias() + "'"));
+ m_bundle = bundle;
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_buildJaxWsBean = buildJaxWsBean;
+ }
+
+ @Override
+ public Object execute(Shell shell, IPage[] selection, ExecutionEvent event) throws ExecutionException {
+ WsProviderDeleteWizard wizard = new WsProviderDeleteWizard();
+ wizard.setBundle(m_bundle);
+ wizard.setSunJaxWsBean(m_sunJaxWsBean);
+ wizard.setBuildJaxWsBean(m_buildJaxWsBean);
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.open();
+ return null;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/CommandExecutionDialog.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/CommandExecutionDialog.java
index 240b8b406..0d220bd55 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/CommandExecutionDialog.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/CommandExecutionDialog.java
@@ -1,226 +1,226 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.dialog;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.marker.commands.IMarkerCommand;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.widgets.FormToolkit;
-import org.eclipse.ui.forms.widgets.ScrolledForm;
-import org.eclipse.ui.forms.widgets.Section;
-import org.eclipse.ui.forms.widgets.TableWrapData;
-import org.eclipse.ui.forms.widgets.TableWrapLayout;
-
-public class CommandExecutionDialog extends TitleAreaDialog {
-
- // fields
- private FormToolkit m_toolkit;
- private SelectionListener m_selectAllSelectionListener;
- private String m_dialogTitle;
- private String m_headerMessage;
-
- // process fields
- private IMarkerCommand[] m_commands;
-
- // ui fields
- private Button m_selectAllButton;
- private Set<Button> m_commandSelectorFields;
-
- public CommandExecutionDialog(String dialogTitle) {
- super(ScoutSdkUi.getShell());
- m_dialogTitle = dialogTitle;
-
- m_toolkit = new FormToolkit(ScoutSdkUi.getDisplay());
- m_commandSelectorFields = new HashSet<Button>();
- setShellStyle(SWT.CLOSE | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | SWT.RESIZE | getDefaultOrientation());
- }
-
- @Override
- protected final void configureShell(Shell shell) {
- super.configureShell(shell);
- if (m_dialogTitle != null) {
- shell.setText(m_dialogTitle);
- }
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- // create the top level composite for the dialog area
- Composite composite = new Composite(parent, SWT.NONE);
- composite.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
-
- if (m_headerMessage != null) {
- setMessage(m_headerMessage, IMessageProvider.WARNING);
- }
- setTitle(m_dialogTitle);
- setHelpAvailable(false);
-
- GridLayout gridLayout = new GridLayout();
- gridLayout.marginHeight = 0;
- gridLayout.marginWidth = 0;
- gridLayout.verticalSpacing = 0;
- gridLayout.horizontalSpacing = 0;
- composite.setLayout(gridLayout);
-
- // Build the separator line
- Label titleBarSeparator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
- titleBarSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // Build the form
- ScrolledForm form = m_toolkit.createScrolledForm(composite);
- form.setLayoutData(new GridData(GridData.FILL_BOTH));
-
- // Build the form body
- Composite formBody = form.getBody();
- TableWrapLayout tableWrapLayout = new TableWrapLayout();
- tableWrapLayout.makeColumnsEqualWidth = true;
- tableWrapLayout.numColumns = 1;
- formBody.setLayout(tableWrapLayout);
-
- createCommandSections(formBody);
-
- // Build the separator line
- Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
- separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- m_selectAllButton = new Button(composite, SWT.CHECK);
- m_selectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- ((GridData) m_selectAllButton.getLayoutData()).verticalIndent = 5;
- ((GridData) m_selectAllButton.getLayoutData()).horizontalIndent = 16;
- m_selectAllButton.setText(Texts.get("SelectAll"));
- m_selectAllButton.setEnabled(hasExecutableCommands());
- m_selectAllButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- for (Button button : m_commandSelectorFields) {
- button.setSelection(m_selectAllButton.getSelection());
- ((IMarkerCommand) button.getData()).setDoExecute(m_selectAllButton.getSelection());
- }
- }
- });
-
- form.updateToolBar();
- form.reflow(true);
- // form.getShell().layout();
-
- return composite;
- }
-
- protected void createCommandSections(Composite parent) {
- for (IMarkerCommand command : m_commands) {
- Composite section = createSection(parent, command.getProblemName(), command.getMarker().getAttribute(IMarker.MESSAGE, ""));
-
- int numOfColumns = 1;
- if (command.isExecutable()) {
- numOfColumns = 2;
- }
-
- section.setLayout(new GridLayout(numOfColumns, false));
-
- if (command.isExecutable()) {
- Button commandButton = m_toolkit.createButton(section, null, SWT.CHECK);
- m_commandSelectorFields.add(commandButton);
- GridData data = new GridData();
- data.verticalAlignment = SWT.TOP;
- data.horizontalAlignment = SWT.LEFT;
- commandButton.setLayoutData(data);
- commandButton.setData(command);
- commandButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- Button checkBox = (Button) e.getSource();
- IMarkerCommand cmd = (IMarkerCommand) checkBox.getData();
- cmd.setDoExecute(checkBox.getSelection());
- checkForSelectAll();
- }
- });
- }
-
- Text solutionField = new Text(section, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY);
- solutionField.setText(command.getSolutionDescription());
- GridData gridData = new GridData();
- gridData.widthHint = 550; // this hint is just because of a bug in SWT. If not provided the text does not wrap at all.
- solutionField.setLayoutData(gridData);
- }
- }
-
- private boolean hasExecutableCommands() {
- for (IMarkerCommand command : m_commands) {
- if (command.isExecutable()) {
- return true;
- }
- }
-
- return false;
- }
-
- public void setCommands(IMarkerCommand[] commands) {
- m_commands = commands;
- }
-
- public void setHeaderMessage(String headerMessage) {
- m_headerMessage = headerMessage;
- }
-
- private void checkForSelectAll() {
- boolean selectAll = true;
- for (Button commandButton : m_commandSelectorFields) {
- selectAll = commandButton.getSelection();
- if (!selectAll) {
- break;
- }
- }
-
- m_selectAllButton.setSelection(selectAll);
- }
-
- private Composite createSection(Composite parent, String problemName, String problemDescription) {
- int style = Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED;
-
- // Build the section header
- Section section = m_toolkit.createSection(parent, style);
- section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
- section.setText(problemName);
- section.setDescription(problemDescription);
-
- // Build the section client
- Composite sectionClient = m_toolkit.createComposite(section);
- section.setClient(sectionClient);
-
- GridLayout gridLayout = new GridLayout(1, false);
- gridLayout.marginWidth = 0;
- gridLayout.verticalSpacing = 30;
- sectionClient.setLayout(gridLayout);
-
- Composite commandComposite = m_toolkit.createComposite(sectionClient);
- commandComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
- return commandComposite;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.dialog;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.marker.commands.IMarkerCommand;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.widgets.FormToolkit;
+import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.TableWrapData;
+import org.eclipse.ui.forms.widgets.TableWrapLayout;
+
+public class CommandExecutionDialog extends TitleAreaDialog {
+
+ // fields
+ private FormToolkit m_toolkit;
+ private SelectionListener m_selectAllSelectionListener;
+ private String m_dialogTitle;
+ private String m_headerMessage;
+
+ // process fields
+ private IMarkerCommand[] m_commands;
+
+ // ui fields
+ private Button m_selectAllButton;
+ private Set<Button> m_commandSelectorFields;
+
+ public CommandExecutionDialog(String dialogTitle) {
+ super(ScoutSdkUi.getShell());
+ m_dialogTitle = dialogTitle;
+
+ m_toolkit = new FormToolkit(ScoutSdkUi.getDisplay());
+ m_commandSelectorFields = new HashSet<Button>();
+ setShellStyle(SWT.CLOSE | SWT.TITLE | SWT.BORDER | SWT.APPLICATION_MODAL | SWT.RESIZE | getDefaultOrientation());
+ }
+
+ @Override
+ protected final void configureShell(Shell shell) {
+ super.configureShell(shell);
+ if (m_dialogTitle != null) {
+ shell.setText(m_dialogTitle);
+ }
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ // create the top level composite for the dialog area
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+
+ if (m_headerMessage != null) {
+ setMessage(m_headerMessage, IMessageProvider.WARNING);
+ }
+ setTitle(m_dialogTitle);
+ setHelpAvailable(false);
+
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.marginHeight = 0;
+ gridLayout.marginWidth = 0;
+ gridLayout.verticalSpacing = 0;
+ gridLayout.horizontalSpacing = 0;
+ composite.setLayout(gridLayout);
+
+ // Build the separator line
+ Label titleBarSeparator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ titleBarSeparator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // Build the form
+ ScrolledForm form = m_toolkit.createScrolledForm(composite);
+ form.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ // Build the form body
+ Composite formBody = form.getBody();
+ TableWrapLayout tableWrapLayout = new TableWrapLayout();
+ tableWrapLayout.makeColumnsEqualWidth = true;
+ tableWrapLayout.numColumns = 1;
+ formBody.setLayout(tableWrapLayout);
+
+ createCommandSections(formBody);
+
+ // Build the separator line
+ Label separator = new Label(composite, SWT.HORIZONTAL | SWT.SEPARATOR);
+ separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ m_selectAllButton = new Button(composite, SWT.CHECK);
+ m_selectAllButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ ((GridData) m_selectAllButton.getLayoutData()).verticalIndent = 5;
+ ((GridData) m_selectAllButton.getLayoutData()).horizontalIndent = 16;
+ m_selectAllButton.setText(Texts.get("SelectAll"));
+ m_selectAllButton.setEnabled(hasExecutableCommands());
+ m_selectAllButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ for (Button button : m_commandSelectorFields) {
+ button.setSelection(m_selectAllButton.getSelection());
+ ((IMarkerCommand) button.getData()).setDoExecute(m_selectAllButton.getSelection());
+ }
+ }
+ });
+
+ form.updateToolBar();
+ form.reflow(true);
+ // form.getShell().layout();
+
+ return composite;
+ }
+
+ protected void createCommandSections(Composite parent) {
+ for (IMarkerCommand command : m_commands) {
+ Composite section = createSection(parent, command.getProblemName(), command.getMarker().getAttribute(IMarker.MESSAGE, ""));
+
+ int numOfColumns = 1;
+ if (command.isExecutable()) {
+ numOfColumns = 2;
+ }
+
+ section.setLayout(new GridLayout(numOfColumns, false));
+
+ if (command.isExecutable()) {
+ Button commandButton = m_toolkit.createButton(section, null, SWT.CHECK);
+ m_commandSelectorFields.add(commandButton);
+ GridData data = new GridData();
+ data.verticalAlignment = SWT.TOP;
+ data.horizontalAlignment = SWT.LEFT;
+ commandButton.setLayoutData(data);
+ commandButton.setData(command);
+ commandButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ Button checkBox = (Button) e.getSource();
+ IMarkerCommand cmd = (IMarkerCommand) checkBox.getData();
+ cmd.setDoExecute(checkBox.getSelection());
+ checkForSelectAll();
+ }
+ });
+ }
+
+ Text solutionField = new Text(section, SWT.MULTI | SWT.WRAP | SWT.READ_ONLY);
+ solutionField.setText(command.getSolutionDescription());
+ GridData gridData = new GridData();
+ gridData.widthHint = 550; // this hint is just because of a bug in SWT. If not provided the text does not wrap at all.
+ solutionField.setLayoutData(gridData);
+ }
+ }
+
+ private boolean hasExecutableCommands() {
+ for (IMarkerCommand command : m_commands) {
+ if (command.isExecutable()) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ public void setCommands(IMarkerCommand[] commands) {
+ m_commands = commands;
+ }
+
+ public void setHeaderMessage(String headerMessage) {
+ m_headerMessage = headerMessage;
+ }
+
+ private void checkForSelectAll() {
+ boolean selectAll = true;
+ for (Button commandButton : m_commandSelectorFields) {
+ selectAll = commandButton.getSelection();
+ if (!selectAll) {
+ break;
+ }
+ }
+
+ m_selectAllButton.setSelection(selectAll);
+ }
+
+ private Composite createSection(Composite parent, String problemName, String problemDescription) {
+ int style = Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED;
+
+ // Build the section header
+ Section section = m_toolkit.createSection(parent, style);
+ section.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB));
+ section.setText(problemName);
+ section.setDescription(problemDescription);
+
+ // Build the section client
+ Composite sectionClient = m_toolkit.createComposite(section);
+ section.setClient(sectionClient);
+
+ GridLayout gridLayout = new GridLayout(1, false);
+ gridLayout.marginWidth = 0;
+ gridLayout.verticalSpacing = 30;
+ sectionClient.setLayout(gridLayout);
+
+ Composite commandComposite = m_toolkit.createComposite(sectionClient);
+ commandComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
+ return commandComposite;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/ScoutWizardDialogEx.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/ScoutWizardDialogEx.java
index ccd58479d..5971406a8 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/ScoutWizardDialogEx.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/ScoutWizardDialogEx.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.dialog;
-
-import org.eclipse.jface.wizard.IWizard;
-import org.eclipse.scout.commons.NumberUtility;
-import org.eclipse.scout.sdk.ui.wizard.ScoutWizardDialog;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Shell;
-
-public class ScoutWizardDialogEx extends ScoutWizardDialog {
-
- private Integer m_width;
- private Integer m_height;
-
- public ScoutWizardDialogEx(IWizard newWizard) {
- super(newWizard);
- }
-
- public ScoutWizardDialogEx(Shell parentShell, IWizard newWizard) {
- super(parentShell, newWizard);
- }
-
- @Override
- protected void configureShell(Shell newShell) {
- Point pt = newShell.getDisplay().getCursorLocation();
-
- int width = NumberUtility.nvl(m_width, newShell.getBounds().width);
- int height = NumberUtility.nvl(m_height, newShell.getBounds().height);
-
- newShell.setLocation(pt.x - width / 2, pt.y - height / 2);
- newShell.setSize(width, height);
- super.configureShell(newShell);
- }
-
- public void setWidth(int width) {
- m_width = width;
- }
-
- public void setHeight(int height) {
- m_height = height;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.dialog;
+
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.scout.commons.NumberUtility;
+import org.eclipse.scout.sdk.ui.wizard.ScoutWizardDialog;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Shell;
+
+public class ScoutWizardDialogEx extends ScoutWizardDialog {
+
+ private Integer m_width;
+ private Integer m_height;
+
+ public ScoutWizardDialogEx(IWizard newWizard) {
+ super(newWizard);
+ }
+
+ public ScoutWizardDialogEx(Shell parentShell, IWizard newWizard) {
+ super(parentShell, newWizard);
+ }
+
+ @Override
+ protected void configureShell(Shell newShell) {
+ Point pt = newShell.getDisplay().getCursorLocation();
+
+ int width = NumberUtility.nvl(m_width, newShell.getBounds().width);
+ int height = NumberUtility.nvl(m_height, newShell.getBounds().height);
+
+ newShell.setLocation(pt.x - width / 2, pt.y - height / 2);
+ newShell.setSize(width, height);
+ super.configureShell(newShell);
+ }
+
+ public void setWidth(int width) {
+ m_width = width;
+ }
+
+ public void setHeight(int height) {
+ m_height = height;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/SelectionDialog.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/SelectionDialog.java
index 752a702c3..17975e442 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/SelectionDialog.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/SelectionDialog.java
@@ -1,192 +1,192 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.dialog;
-
-import java.util.Collection;
-import java.util.LinkedList;
-
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.layout.TableColumnLayout;
-import org.eclipse.jface.viewers.CellLabelProvider;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-
-public class SelectionDialog<T> extends TitleAreaDialog {
-
- protected static final String IStructuredSelection = null;
- private T m_element;
- private TableViewer m_viewer;
- private String m_dialogTitle;
- private String m_dialogMessage;
- private Collection<T> m_elements;
-
- public SelectionDialog(Shell shell, String dialogTitle, String dialogMessage) {
- super(shell);
- m_dialogTitle = dialogTitle;
- m_dialogMessage = dialogMessage;
- m_elements = new LinkedList<T>();
- setDialogHelpAvailable(false);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- @Override
- protected final void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(m_dialogTitle);
- }
-
- @Override
- protected Control createContents(Composite parent) {
- Control control = super.createContents(parent);
- setTitle(m_dialogTitle);
- setMessage(m_dialogMessage, IMessageProvider.INFORMATION);
- getOkButton().setEnabled(false);
- return control;
- }
-
- public void setElements(Collection<T> elements) {
- m_elements = elements;
- }
-
- public T getElement() {
- return m_element;
- }
-
- public Button getOkButton() {
- return getButton(OK);
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite tableComposite = new Composite(parent, SWT.NONE);
- m_viewer = new TableViewer(new Table(tableComposite, SWT.BORDER | SWT.FULL_SELECTION));
- m_viewer.setUseHashlookup(true);
- m_viewer.getTable().setHeaderVisible(true);
- m_viewer.getTable().setLinesVisible(false);
- m_viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @SuppressWarnings("unchecked")
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) m_viewer.getSelection();
- m_element = (T) selection.getFirstElement();
-
- getOkButton().setEnabled(true);
- }
- });
-
- m_viewer.addDoubleClickListener(new IDoubleClickListener() {
-
- @SuppressWarnings("unchecked")
- @Override
- public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection selection = (IStructuredSelection) m_viewer.getSelection();
- m_element = (T) selection.getFirstElement();
- getOkButton().setEnabled(true);
- close();
- }
- });
-
- TableViewerColumn nameColumn = new TableViewerColumn(m_viewer, SWT.LEFT, 0);
- nameColumn.setLabelProvider(new P_LabelProvider());
- nameColumn.getColumn().setResizable(true);
- nameColumn.getColumn().setText(getConfiguredNameColumnText());
-
- TableViewerColumn descriptionColumn = null;
- if (getConfiguredIsDescriptionColumnVisible()) {
- descriptionColumn = new TableViewerColumn(m_viewer, SWT.LEFT, 1);
- descriptionColumn.setLabelProvider(new P_LabelProvider());
- descriptionColumn.getColumn().setResizable(true);
- descriptionColumn.getColumn().setText(getConfiguredDescriptionColumnText());
- }
-
- m_viewer.setContentProvider(new P_ContentProvider());
- m_viewer.setInput(m_elements.toArray());
-
- // layout
- parent.setLayout(new GridLayout());
- tableComposite.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
-
- TableColumnLayout tableLayout = new TableColumnLayout();
- tableComposite.setLayout(tableLayout);
- if (descriptionColumn == null) {
- tableLayout.setColumnData(nameColumn.getColumn(), new ColumnWeightData(1, false));
- }
- else {
- tableLayout.setColumnData(nameColumn.getColumn(), new ColumnPixelData(120, true));
- tableLayout.setColumnData(descriptionColumn.getColumn(), new ColumnWeightData(1, true));
- }
-
- return tableComposite;
- }
-
- protected void execDecorateElement(T element, ViewerCell cell) {
- cell.setText(element.toString());
- }
-
- protected boolean getConfiguredIsDescriptionColumnVisible() {
- return false;
- }
-
- protected String getConfiguredNameColumnText() {
- return Texts.get("Name");
- }
-
- protected String getConfiguredDescriptionColumnText() {
- return Texts.get("Description");
- }
-
- private class P_LabelProvider extends CellLabelProvider {
-
- @SuppressWarnings("unchecked")
- @Override
- public void update(ViewerCell cell) {
- execDecorateElement((T) cell.getElement(), cell);
- }
- }
-
- public class P_ContentProvider implements IStructuredContentProvider {
-
- @SuppressWarnings("unchecked")
- @Override
- public Object[] getElements(Object inputElement) {
- return (T[]) inputElement;
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.dialog;
+
+import java.util.Collection;
+import java.util.LinkedList;
+
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.layout.TableColumnLayout;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.ColumnPixelData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+
+public class SelectionDialog<T> extends TitleAreaDialog {
+
+ protected static final String IStructuredSelection = null;
+ private T m_element;
+ private TableViewer m_viewer;
+ private String m_dialogTitle;
+ private String m_dialogMessage;
+ private Collection<T> m_elements;
+
+ public SelectionDialog(Shell shell, String dialogTitle, String dialogMessage) {
+ super(shell);
+ m_dialogTitle = dialogTitle;
+ m_dialogMessage = dialogMessage;
+ m_elements = new LinkedList<T>();
+ setDialogHelpAvailable(false);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ @Override
+ protected final void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(m_dialogTitle);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Control control = super.createContents(parent);
+ setTitle(m_dialogTitle);
+ setMessage(m_dialogMessage, IMessageProvider.INFORMATION);
+ getOkButton().setEnabled(false);
+ return control;
+ }
+
+ public void setElements(Collection<T> elements) {
+ m_elements = elements;
+ }
+
+ public T getElement() {
+ return m_element;
+ }
+
+ public Button getOkButton() {
+ return getButton(OK);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite tableComposite = new Composite(parent, SWT.NONE);
+ m_viewer = new TableViewer(new Table(tableComposite, SWT.BORDER | SWT.FULL_SELECTION));
+ m_viewer.setUseHashlookup(true);
+ m_viewer.getTable().setHeaderVisible(true);
+ m_viewer.getTable().setLinesVisible(false);
+ m_viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) m_viewer.getSelection();
+ m_element = (T) selection.getFirstElement();
+
+ getOkButton().setEnabled(true);
+ }
+ });
+
+ m_viewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) m_viewer.getSelection();
+ m_element = (T) selection.getFirstElement();
+ getOkButton().setEnabled(true);
+ close();
+ }
+ });
+
+ TableViewerColumn nameColumn = new TableViewerColumn(m_viewer, SWT.LEFT, 0);
+ nameColumn.setLabelProvider(new P_LabelProvider());
+ nameColumn.getColumn().setResizable(true);
+ nameColumn.getColumn().setText(getConfiguredNameColumnText());
+
+ TableViewerColumn descriptionColumn = null;
+ if (getConfiguredIsDescriptionColumnVisible()) {
+ descriptionColumn = new TableViewerColumn(m_viewer, SWT.LEFT, 1);
+ descriptionColumn.setLabelProvider(new P_LabelProvider());
+ descriptionColumn.getColumn().setResizable(true);
+ descriptionColumn.getColumn().setText(getConfiguredDescriptionColumnText());
+ }
+
+ m_viewer.setContentProvider(new P_ContentProvider());
+ m_viewer.setInput(m_elements.toArray());
+
+ // layout
+ parent.setLayout(new GridLayout());
+ tableComposite.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+
+ TableColumnLayout tableLayout = new TableColumnLayout();
+ tableComposite.setLayout(tableLayout);
+ if (descriptionColumn == null) {
+ tableLayout.setColumnData(nameColumn.getColumn(), new ColumnWeightData(1, false));
+ }
+ else {
+ tableLayout.setColumnData(nameColumn.getColumn(), new ColumnPixelData(120, true));
+ tableLayout.setColumnData(descriptionColumn.getColumn(), new ColumnWeightData(1, true));
+ }
+
+ return tableComposite;
+ }
+
+ protected void execDecorateElement(T element, ViewerCell cell) {
+ cell.setText(element.toString());
+ }
+
+ protected boolean getConfiguredIsDescriptionColumnVisible() {
+ return false;
+ }
+
+ protected String getConfiguredNameColumnText() {
+ return Texts.get("Name");
+ }
+
+ protected String getConfiguredDescriptionColumnText() {
+ return Texts.get("Description");
+ }
+
+ private class P_LabelProvider extends CellLabelProvider {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void update(ViewerCell cell) {
+ execDecorateElement((T) cell.getElement(), cell);
+ }
+ }
+
+ public class P_ContentProvider implements IStructuredContentProvider {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return (T[]) inputElement;
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/SourceFolderSelectionDialog.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/SourceFolderSelectionDialog.java
index c6027648e..16a0f2099 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/SourceFolderSelectionDialog.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/SourceFolderSelectionDialog.java
@@ -1,165 +1,165 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.dialog;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.viewers.CellLabelProvider;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-
-public class SourceFolderSelectionDialog extends TitleAreaDialog {
-
- protected static final String IStructuredSelection = null;
- private IScoutBundle m_bundle;
- private IPath m_sourceFolderPath;
- private TableViewer m_viewer;
-
- public SourceFolderSelectionDialog(Shell shell, IScoutBundle bundle) {
- super(shell);
- m_bundle = bundle;
- setDialogHelpAvailable(false);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- @Override
- protected final void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(Texts.get("SourceFolder"));
- }
-
- @Override
- protected Control createContents(Composite parent) {
- Control control = super.createContents(parent);
- setTitle(Texts.get("SourceFolder"));
- setMessage(Texts.get("SelectSourceFolder"), IMessageProvider.INFORMATION);
- getOkButton().setEnabled(false);
- return control;
- }
-
- public IPath getSourceFolderPath() {
- return m_sourceFolderPath;
- }
-
- public Button getOkButton() {
- return getButton(OK);
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- m_viewer = new TableViewer(new Table(parent, SWT.BORDER | SWT.FULL_SELECTION));
- m_viewer.setUseHashlookup(true);
- m_viewer.getTable().setHeaderVisible(false);
- m_viewer.getTable().setLinesVisible(false);
- m_viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) m_viewer.getSelection();
- IClasspathEntry classpathEntry = (IClasspathEntry) selection.getFirstElement();
- m_sourceFolderPath = classpathEntry.getPath();
-
- getOkButton().setEnabled(true);
- }
- });
-
- m_viewer.addDoubleClickListener(new IDoubleClickListener() {
-
- @Override
- public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection selection = (IStructuredSelection) m_viewer.getSelection();
- IClasspathEntry classpathEntry = (IClasspathEntry) selection.getFirstElement();
- m_sourceFolderPath = classpathEntry.getPath();
-
- getOkButton().setEnabled(true);
- close();
- }
- });
-
- TableViewerColumn nameColumn = new TableViewerColumn(m_viewer, SWT.LEFT);
- nameColumn.setLabelProvider(new P_LabelProvider());
- nameColumn.getColumn().setResizable(true);
- nameColumn.getColumn().setWidth(500);
-
- m_viewer.setContentProvider(new P_ContentProvider());
- m_viewer.setInput("");
-
- // layout
- parent.setLayout(new GridLayout());
- m_viewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
- return m_viewer.getTable();
- }
-
- private class P_LabelProvider extends CellLabelProvider {
-
- @Override
- public void update(ViewerCell cell) {
- IClasspathEntry sourceFolderEntry = (IClasspathEntry) cell.getElement();
- cell.setText(sourceFolderEntry.getPath().toPortableString());
-
- cell.setImage(JaxWsSdk.getImage(JaxWsIcons.SourceFolder));
- }
- }
-
- public class P_ContentProvider implements IStructuredContentProvider {
-
- @Override
- public Object[] getElements(Object inputElement) {
- List<IClasspathEntry> sourceFolderEntries = new LinkedList<IClasspathEntry>();
- try {
- for (IClasspathEntry classpathEntry : m_bundle.getJavaProject().getRawClasspath()) {
- if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
- sourceFolderEntries.add(classpathEntry);
- }
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("Error occured while fetching source folders.", e);
- }
-
- return sourceFolderEntries.toArray(new IClasspathEntry[sourceFolderEntries.size()]);
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.dialog;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+
+public class SourceFolderSelectionDialog extends TitleAreaDialog {
+
+ protected static final String IStructuredSelection = null;
+ private IScoutBundle m_bundle;
+ private IPath m_sourceFolderPath;
+ private TableViewer m_viewer;
+
+ public SourceFolderSelectionDialog(Shell shell, IScoutBundle bundle) {
+ super(shell);
+ m_bundle = bundle;
+ setDialogHelpAvailable(false);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ @Override
+ protected final void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(Texts.get("SourceFolder"));
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Control control = super.createContents(parent);
+ setTitle(Texts.get("SourceFolder"));
+ setMessage(Texts.get("SelectSourceFolder"), IMessageProvider.INFORMATION);
+ getOkButton().setEnabled(false);
+ return control;
+ }
+
+ public IPath getSourceFolderPath() {
+ return m_sourceFolderPath;
+ }
+
+ public Button getOkButton() {
+ return getButton(OK);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ m_viewer = new TableViewer(new Table(parent, SWT.BORDER | SWT.FULL_SELECTION));
+ m_viewer.setUseHashlookup(true);
+ m_viewer.getTable().setHeaderVisible(false);
+ m_viewer.getTable().setLinesVisible(false);
+ m_viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) m_viewer.getSelection();
+ IClasspathEntry classpathEntry = (IClasspathEntry) selection.getFirstElement();
+ m_sourceFolderPath = classpathEntry.getPath();
+
+ getOkButton().setEnabled(true);
+ }
+ });
+
+ m_viewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) m_viewer.getSelection();
+ IClasspathEntry classpathEntry = (IClasspathEntry) selection.getFirstElement();
+ m_sourceFolderPath = classpathEntry.getPath();
+
+ getOkButton().setEnabled(true);
+ close();
+ }
+ });
+
+ TableViewerColumn nameColumn = new TableViewerColumn(m_viewer, SWT.LEFT);
+ nameColumn.setLabelProvider(new P_LabelProvider());
+ nameColumn.getColumn().setResizable(true);
+ nameColumn.getColumn().setWidth(500);
+
+ m_viewer.setContentProvider(new P_ContentProvider());
+ m_viewer.setInput("");
+
+ // layout
+ parent.setLayout(new GridLayout());
+ m_viewer.getTable().setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+ return m_viewer.getTable();
+ }
+
+ private class P_LabelProvider extends CellLabelProvider {
+
+ @Override
+ public void update(ViewerCell cell) {
+ IClasspathEntry sourceFolderEntry = (IClasspathEntry) cell.getElement();
+ cell.setText(sourceFolderEntry.getPath().toPortableString());
+
+ cell.setImage(JaxWsSdk.getImage(JaxWsIcons.SourceFolder));
+ }
+ }
+
+ public class P_ContentProvider implements IStructuredContentProvider {
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ List<IClasspathEntry> sourceFolderEntries = new LinkedList<IClasspathEntry>();
+ try {
+ for (IClasspathEntry classpathEntry : m_bundle.getJavaProject().getRawClasspath()) {
+ if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ sourceFolderEntries.add(classpathEntry);
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("Error occured while fetching source folders.", e);
+ }
+
+ return sourceFolderEntries.toArray(new IClasspathEntry[sourceFolderEntries.size()]);
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeBrowseDialog.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeBrowseDialog.java
index 59304abbf..8487ea110 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeBrowseDialog.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeBrowseDialog.java
@@ -1,218 +1,218 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.dialog;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.tooltip.JavadocTooltip;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.TypePresenter.ISearchJavaSearchScopeFactory;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-public class TypeBrowseDialog extends TitleAreaDialog {
-
- protected static final String IStructuredSelection = null;
- private IType m_type;
- private StyledTextField m_typeField;
- private Button m_typeBrowseButton;
- private JavadocTooltip m_tooltipType;
-
- private String m_dialogTitle;
- private String m_dialogMessage;
- private ISearchJavaSearchScopeFactory m_javaSearchScopeFactory;
- private int m_typeStyle;
-
- public TypeBrowseDialog(Shell shell, String dialogTitle, String dialogMessage) {
- super(shell);
- m_dialogTitle = dialogTitle;
- m_dialogMessage = dialogMessage;
- m_typeStyle = IJavaElementSearchConstants.CONSIDER_CLASSES | IJavaElementSearchConstants.CONSIDER_INTERFACES;
- setDialogHelpAvailable(false);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- @Override
- protected final void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(m_dialogTitle);
- }
-
- @Override
- protected Control createContents(Composite parent) {
- Control control = super.createContents(parent);
- setTitle(m_dialogTitle);
- setMessage(m_dialogMessage, IMessageProvider.INFORMATION);
- getOkButton().setEnabled(false);
- return control;
- }
-
- public Button getOkButton() {
- return getButton(OK);
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
- m_typeField = new StyledTextField(composite, Texts.get("Type"));
- if (TypeUtility.exists(getType())) {
- m_typeField.setText(getType().getElementName());
- }
- m_typeField.setEditable(false);
- m_typeField.addKeyListener(new KeyAdapter() {
-
- @Override
- public void keyPressed(KeyEvent e) {
- openTypeDialog();
- }
-
- });
- m_tooltipType = new JavadocTooltip(m_typeField.getTextComponent());
- updateJavaDoc(m_tooltipType, getType());
-
- m_typeBrowseButton = new Button(composite, SWT.PUSH | SWT.FLAT);
- m_typeBrowseButton.setText(Texts.get("Browse"));
- m_typeBrowseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- openTypeDialog();
- }
- });
-
- // layout
- parent.setLayout(new GridLayout());
- composite.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
-
- composite.setLayout(new FormLayout());
-
- FormData formData = new FormData();
- formData.top = new FormAttachment(20, 0);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_typeField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_typeField, -2, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_typeBrowseButton.setLayoutData(formData);
-
- return composite;
- }
-
- protected boolean getConfiguredIsDescriptionColumnVisible() {
- return false;
- }
-
- protected String getConfiguredNameColumnText() {
- return Texts.get("Name");
- }
-
- protected String getConfiguredDescriptionColumnText() {
- return Texts.get("Description");
- }
-
- public IType getType() {
- return m_type;
- }
-
- public void setType(IType type) {
- m_type = type;
- }
-
- public int getTypeStyle() {
- return m_typeStyle;
- }
-
- public void setTypeStyle(int typeStyle) {
- m_typeStyle = typeStyle;
- }
-
- public ISearchJavaSearchScopeFactory getJavaSearchScopeFactory() {
- return m_javaSearchScopeFactory;
- }
-
- public void setJavaSearchScopeFactory(ISearchJavaSearchScopeFactory javaSearchScopeFactory) {
- m_javaSearchScopeFactory = javaSearchScopeFactory;
- }
-
- private void updateJavaDoc(JavadocTooltip javadocTooltip, IType type) {
- try {
- javadocTooltip.setMember(null);
- if (TypeUtility.exists(type)) {
- javadocTooltip.setMember(type);
- }
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("Could not render tooltip", e);
- }
- }
-
- private void openTypeDialog() {
- try {
- IJavaSearchScope searchScope;
- if (m_javaSearchScopeFactory == null) {
- searchScope = SearchEngine.createWorkspaceScope();
- }
- else {
- searchScope = m_javaSearchScopeFactory.create();
- }
- SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, m_typeStyle, false, "*.*");
- dialog.setTitle(Texts.get("Type"));
- dialog.setMessage(Texts.get("ChooseXY", Texts.get("Type")));
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- IType type = (IType) dialog.getResult()[0];
- if (TypeUtility.exists(type)) {
- m_typeField.setText(type.getFullyQualifiedName());
- updateJavaDoc(m_tooltipType, type);
- getOkButton().setEnabled(true);
- }
- else {
- updateJavaDoc(m_tooltipType, null);
- m_typeField.setText("");
- getOkButton().setEnabled(false);
- }
- setType(type);
- }
- }
- }
- catch (JavaModelException exception) {
- JaxWsSdk.logError(exception);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.dialog;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.ui.IJavaElementSearchConstants;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.tooltip.JavadocTooltip;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.TypePresenter.ISearchJavaSearchScopeFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+public class TypeBrowseDialog extends TitleAreaDialog {
+
+ protected static final String IStructuredSelection = null;
+ private IType m_type;
+ private StyledTextField m_typeField;
+ private Button m_typeBrowseButton;
+ private JavadocTooltip m_tooltipType;
+
+ private String m_dialogTitle;
+ private String m_dialogMessage;
+ private ISearchJavaSearchScopeFactory m_javaSearchScopeFactory;
+ private int m_typeStyle;
+
+ public TypeBrowseDialog(Shell shell, String dialogTitle, String dialogMessage) {
+ super(shell);
+ m_dialogTitle = dialogTitle;
+ m_dialogMessage = dialogMessage;
+ m_typeStyle = IJavaElementSearchConstants.CONSIDER_CLASSES | IJavaElementSearchConstants.CONSIDER_INTERFACES;
+ setDialogHelpAvailable(false);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ @Override
+ protected final void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(m_dialogTitle);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Control control = super.createContents(parent);
+ setTitle(m_dialogTitle);
+ setMessage(m_dialogMessage, IMessageProvider.INFORMATION);
+ getOkButton().setEnabled(false);
+ return control;
+ }
+
+ public Button getOkButton() {
+ return getButton(OK);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ m_typeField = new StyledTextField(composite, Texts.get("Type"));
+ if (TypeUtility.exists(getType())) {
+ m_typeField.setText(getType().getElementName());
+ }
+ m_typeField.setEditable(false);
+ m_typeField.addKeyListener(new KeyAdapter() {
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ openTypeDialog();
+ }
+
+ });
+ m_tooltipType = new JavadocTooltip(m_typeField.getTextComponent());
+ updateJavaDoc(m_tooltipType, getType());
+
+ m_typeBrowseButton = new Button(composite, SWT.PUSH | SWT.FLAT);
+ m_typeBrowseButton.setText(Texts.get("Browse"));
+ m_typeBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ openTypeDialog();
+ }
+ });
+
+ // layout
+ parent.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+
+ composite.setLayout(new FormLayout());
+
+ FormData formData = new FormData();
+ formData.top = new FormAttachment(20, 0);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_typeField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_typeField, -2, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_typeBrowseButton.setLayoutData(formData);
+
+ return composite;
+ }
+
+ protected boolean getConfiguredIsDescriptionColumnVisible() {
+ return false;
+ }
+
+ protected String getConfiguredNameColumnText() {
+ return Texts.get("Name");
+ }
+
+ protected String getConfiguredDescriptionColumnText() {
+ return Texts.get("Description");
+ }
+
+ public IType getType() {
+ return m_type;
+ }
+
+ public void setType(IType type) {
+ m_type = type;
+ }
+
+ public int getTypeStyle() {
+ return m_typeStyle;
+ }
+
+ public void setTypeStyle(int typeStyle) {
+ m_typeStyle = typeStyle;
+ }
+
+ public ISearchJavaSearchScopeFactory getJavaSearchScopeFactory() {
+ return m_javaSearchScopeFactory;
+ }
+
+ public void setJavaSearchScopeFactory(ISearchJavaSearchScopeFactory javaSearchScopeFactory) {
+ m_javaSearchScopeFactory = javaSearchScopeFactory;
+ }
+
+ private void updateJavaDoc(JavadocTooltip javadocTooltip, IType type) {
+ try {
+ javadocTooltip.setMember(null);
+ if (TypeUtility.exists(type)) {
+ javadocTooltip.setMember(type);
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("Could not render tooltip", e);
+ }
+ }
+
+ private void openTypeDialog() {
+ try {
+ IJavaSearchScope searchScope;
+ if (m_javaSearchScopeFactory == null) {
+ searchScope = SearchEngine.createWorkspaceScope();
+ }
+ else {
+ searchScope = m_javaSearchScopeFactory.create();
+ }
+ SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, m_typeStyle, false, "*.*");
+ dialog.setTitle(Texts.get("Type"));
+ dialog.setMessage(Texts.get("ChooseXY", Texts.get("Type")));
+ dialog.setBlockOnOpen(true);
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ IType type = (IType) dialog.getResult()[0];
+ if (TypeUtility.exists(type)) {
+ m_typeField.setText(type.getFullyQualifiedName());
+ updateJavaDoc(m_tooltipType, type);
+ getOkButton().setEnabled(true);
+ }
+ else {
+ updateJavaDoc(m_tooltipType, null);
+ m_typeField.setText("");
+ getOkButton().setEnabled(false);
+ }
+ setType(type);
+ }
+ }
+ }
+ catch (JavaModelException exception) {
+ JaxWsSdk.logError(exception);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeSelectionDialog.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeSelectionDialog.java
index 05703bb46..77fedea6f 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeSelectionDialog.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeSelectionDialog.java
@@ -1,71 +1,71 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.dialog;
-
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.ui.JavaElementImageDescriptor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Shell;
-
-public class TypeSelectionDialog extends SelectionDialog<IType> {
-
- public TypeSelectionDialog(Shell shell, String dialogTitle, String dialogMessage) {
- super(shell, dialogTitle, dialogMessage);
- }
-
- @Override
- protected void execDecorateElement(IType type, ViewerCell cell) {
- if (cell.getColumnIndex() == 0) {
- cell.setText(type.getElementName());
- try {
- ImageDescriptor desc;
- if (Flags.isAbstract(type.getFlags())) {
- desc = new JavaElementImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), JavaElementImageDescriptor.ABSTRACT, new Point(16, 16));
- }
- else if (type.isInterface()) {
- desc = ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface);
- }
- else {
- desc = ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class);
- }
- cell.setImage(desc.createImage());
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- }
- else {
- cell.setText(type.getFullyQualifiedName());
- }
- }
-
- @Override
- protected boolean getConfiguredIsDescriptionColumnVisible() {
- return true;
- }
-
- @Override
- protected String getConfiguredNameColumnText() {
- return Texts.get("Type");
- }
-
- @Override
- protected String getConfiguredDescriptionColumnText() {
- return Texts.get("FullyQualifiedName");
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.dialog;
+
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.ui.JavaElementImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Shell;
+
+public class TypeSelectionDialog extends SelectionDialog<IType> {
+
+ public TypeSelectionDialog(Shell shell, String dialogTitle, String dialogMessage) {
+ super(shell, dialogTitle, dialogMessage);
+ }
+
+ @Override
+ protected void execDecorateElement(IType type, ViewerCell cell) {
+ if (cell.getColumnIndex() == 0) {
+ cell.setText(type.getElementName());
+ try {
+ ImageDescriptor desc;
+ if (Flags.isAbstract(type.getFlags())) {
+ desc = new JavaElementImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), JavaElementImageDescriptor.ABSTRACT, new Point(16, 16));
+ }
+ else if (type.isInterface()) {
+ desc = ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface);
+ }
+ else {
+ desc = ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class);
+ }
+ cell.setImage(desc.createImage());
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+ else {
+ cell.setText(type.getFullyQualifiedName());
+ }
+ }
+
+ @Override
+ protected boolean getConfiguredIsDescriptionColumnVisible() {
+ return true;
+ }
+
+ @Override
+ protected String getConfiguredNameColumnText() {
+ return Texts.get("Type");
+ }
+
+ @Override
+ protected String getConfiguredDescriptionColumnText() {
+ return Texts.get("FullyQualifiedName");
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeSelectionDialogOld.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeSelectionDialogOld.java
index b19627e6d..9aa3bf0e8 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeSelectionDialogOld.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/dialog/TypeSelectionDialogOld.java
@@ -1,191 +1,191 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.dialog;
-
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.ui.JavaElementImageDescriptor;
-import org.eclipse.jface.dialogs.IMessageProvider;
-import org.eclipse.jface.dialogs.TitleAreaDialog;
-import org.eclipse.jface.layout.TableColumnLayout;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.viewers.CellLabelProvider;
-import org.eclipse.jface.viewers.ColumnPixelData;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Table;
-
-public class TypeSelectionDialogOld extends TitleAreaDialog {
-
- protected static final String IStructuredSelection = null;
- private IType m_type;
- private TableViewer m_viewer;
- private String m_dialogTitle;
- private String m_dialogMessage;
- private IType[] m_types;
-
- public TypeSelectionDialogOld(Shell shell, String dialogTitle, String dialogMessage) {
- super(shell);
- m_dialogTitle = dialogTitle;
- m_dialogMessage = dialogMessage;
- m_types = new IType[0];
- setDialogHelpAvailable(false);
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- @Override
- protected final void configureShell(Shell shell) {
- super.configureShell(shell);
- shell.setText(m_dialogTitle);
- }
-
- @Override
- protected Control createContents(Composite parent) {
- Control control = super.createContents(parent);
- setTitle(m_dialogTitle);
- setMessage(m_dialogMessage, IMessageProvider.INFORMATION);
- getOkButton().setEnabled(false);
- return control;
- }
-
- public IType getType() {
- return m_type;
- }
-
- public Button getOkButton() {
- return getButton(OK);
- }
-
- @Override
- protected Control createDialogArea(Composite parent) {
- Composite tableComposite = new Composite(parent, SWT.NONE);
- m_viewer = new TableViewer(new Table(tableComposite, SWT.BORDER | SWT.FULL_SELECTION));
- m_viewer.setUseHashlookup(true);
- m_viewer.getTable().setHeaderVisible(false);
- m_viewer.getTable().setLinesVisible(false);
- m_viewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) m_viewer.getSelection();
- m_type = (IType) selection.getFirstElement();
-
- getOkButton().setEnabled(true);
- }
- });
-
- m_viewer.addDoubleClickListener(new IDoubleClickListener() {
-
- @Override
- public void doubleClick(DoubleClickEvent event) {
- IStructuredSelection selection = (IStructuredSelection) m_viewer.getSelection();
- m_type = (IType) selection.getFirstElement();
- getOkButton().setEnabled(true);
- close();
- }
- });
-
- TableViewerColumn nameColumn = new TableViewerColumn(m_viewer, SWT.LEFT, 0);
- nameColumn.setLabelProvider(new P_LabelProvider());
- nameColumn.getColumn().setResizable(true);
- nameColumn.getColumn().setWidth(200);
-
- TableViewerColumn pathColumn = new TableViewerColumn(m_viewer, SWT.LEFT, 1);
- pathColumn.setLabelProvider(new P_LabelProvider());
- pathColumn.getColumn().setResizable(true);
- pathColumn.getColumn().setWidth(400);
-
- m_viewer.setContentProvider(new P_ContentProvider());
- m_viewer.setInput(m_types);
-
- // layout
- parent.setLayout(new GridLayout());
- tableComposite.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
-
- TableColumnLayout tableLayout = new TableColumnLayout();
- tableComposite.setLayout(tableLayout);
- tableLayout.setColumnData(nameColumn.getColumn(), new ColumnPixelData(300));
- tableLayout.setColumnData(pathColumn.getColumn(), new ColumnWeightData(100));
-
- return tableComposite;
- }
-
- private class P_LabelProvider extends CellLabelProvider {
-
- @Override
- public void update(ViewerCell cell) {
- IType type = (IType) cell.getElement();
- if (cell.getColumnIndex() == 0) {
- cell.setText(type.getElementName());
- try {
- ImageDescriptor desc;
- if (Flags.isAbstract(type.getFlags())) {
- desc = new JavaElementImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), JavaElementImageDescriptor.ABSTRACT, new Point(16, 16));
- }
- else if (type.isInterface()) {
- desc = ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface);
- }
- else {
- desc = ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class);
- }
- cell.setImage(desc.createImage());
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- }
- else {
- cell.setText(type.getFullyQualifiedName());
- }
- }
- }
-
- public class P_ContentProvider implements IStructuredContentProvider {
-
- @Override
- public Object[] getElements(Object inputElement) {
- return (IType[]) inputElement;
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- }
-
- public void setTypes(IType[] types) {
- m_types = types;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.dialog;
+
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.ui.JavaElementImageDescriptor;
+import org.eclipse.jface.dialogs.IMessageProvider;
+import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.layout.TableColumnLayout;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.ColumnPixelData;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Table;
+
+public class TypeSelectionDialogOld extends TitleAreaDialog {
+
+ protected static final String IStructuredSelection = null;
+ private IType m_type;
+ private TableViewer m_viewer;
+ private String m_dialogTitle;
+ private String m_dialogMessage;
+ private IType[] m_types;
+
+ public TypeSelectionDialogOld(Shell shell, String dialogTitle, String dialogMessage) {
+ super(shell);
+ m_dialogTitle = dialogTitle;
+ m_dialogMessage = dialogMessage;
+ m_types = new IType[0];
+ setDialogHelpAvailable(false);
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ @Override
+ protected final void configureShell(Shell shell) {
+ super.configureShell(shell);
+ shell.setText(m_dialogTitle);
+ }
+
+ @Override
+ protected Control createContents(Composite parent) {
+ Control control = super.createContents(parent);
+ setTitle(m_dialogTitle);
+ setMessage(m_dialogMessage, IMessageProvider.INFORMATION);
+ getOkButton().setEnabled(false);
+ return control;
+ }
+
+ public IType getType() {
+ return m_type;
+ }
+
+ public Button getOkButton() {
+ return getButton(OK);
+ }
+
+ @Override
+ protected Control createDialogArea(Composite parent) {
+ Composite tableComposite = new Composite(parent, SWT.NONE);
+ m_viewer = new TableViewer(new Table(tableComposite, SWT.BORDER | SWT.FULL_SELECTION));
+ m_viewer.setUseHashlookup(true);
+ m_viewer.getTable().setHeaderVisible(false);
+ m_viewer.getTable().setLinesVisible(false);
+ m_viewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) m_viewer.getSelection();
+ m_type = (IType) selection.getFirstElement();
+
+ getOkButton().setEnabled(true);
+ }
+ });
+
+ m_viewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) m_viewer.getSelection();
+ m_type = (IType) selection.getFirstElement();
+ getOkButton().setEnabled(true);
+ close();
+ }
+ });
+
+ TableViewerColumn nameColumn = new TableViewerColumn(m_viewer, SWT.LEFT, 0);
+ nameColumn.setLabelProvider(new P_LabelProvider());
+ nameColumn.getColumn().setResizable(true);
+ nameColumn.getColumn().setWidth(200);
+
+ TableViewerColumn pathColumn = new TableViewerColumn(m_viewer, SWT.LEFT, 1);
+ pathColumn.setLabelProvider(new P_LabelProvider());
+ pathColumn.getColumn().setResizable(true);
+ pathColumn.getColumn().setWidth(400);
+
+ m_viewer.setContentProvider(new P_ContentProvider());
+ m_viewer.setInput(m_types);
+
+ // layout
+ parent.setLayout(new GridLayout());
+ tableComposite.setLayoutData(new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));
+
+ TableColumnLayout tableLayout = new TableColumnLayout();
+ tableComposite.setLayout(tableLayout);
+ tableLayout.setColumnData(nameColumn.getColumn(), new ColumnPixelData(300));
+ tableLayout.setColumnData(pathColumn.getColumn(), new ColumnWeightData(100));
+
+ return tableComposite;
+ }
+
+ private class P_LabelProvider extends CellLabelProvider {
+
+ @Override
+ public void update(ViewerCell cell) {
+ IType type = (IType) cell.getElement();
+ if (cell.getColumnIndex() == 0) {
+ cell.setText(type.getElementName());
+ try {
+ ImageDescriptor desc;
+ if (Flags.isAbstract(type.getFlags())) {
+ desc = new JavaElementImageDescriptor(ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), JavaElementImageDescriptor.ABSTRACT, new Point(16, 16));
+ }
+ else if (type.isInterface()) {
+ desc = ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Interface);
+ }
+ else {
+ desc = ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class);
+ }
+ cell.setImage(desc.createImage());
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+ else {
+ cell.setText(type.getFullyQualifiedName());
+ }
+ }
+ }
+
+ public class P_ContentProvider implements IStructuredContentProvider {
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return (IType[]) inputElement;
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ }
+
+ public void setTypes(IType[] types) {
+ m_types = types;
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/model/BuildJaxWsBean.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/model/BuildJaxWsBean.java
index 4e6c81261..64dcd4a83 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/model/BuildJaxWsBean.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/model/BuildJaxWsBean.java
@@ -1,181 +1,181 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.model;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-
-public class BuildJaxWsBean {
-
- public static final String XML_PROVIDER = "provider";
- public static final String XML_CONSUMER = "consumer";
- public static final String XML_ALIAS = "name";
- public static final String XML_PROPERTY = "property";
- public static final String XML_PROPERTY_NAME = "name";
- public static final String XML_PROPERTY_VALUE = "value";
- public static final String XML_WSDL = "wsdl";
-
- private ScoutXmlElement m_xml;
- private WebserviceEnum m_webserviceEnum;
-
- public BuildJaxWsBean(ScoutXmlElement xml, WebserviceEnum webserviceEnum) {
- m_xml = xml;
- m_webserviceEnum = webserviceEnum;
- }
-
- public ScoutXmlElement getXml() {
- return m_xml;
- }
-
- public void setXml(ScoutXmlElement xml) {
- m_xml = xml;
- }
-
- public String getAlias() {
- return m_xml.getAttribute(XML_ALIAS, null);
- }
-
- public void setAlias(String alias) {
- m_xml.removeAttribute(XML_ALIAS);
- m_xml.setAttribute(XML_ALIAS, alias);
- }
-
- /**
- * is only used if consumer build entry
- *
- * @param wsdl
- */
- public void setWsdl(String wsdl) {
- m_xml.removeAttribute(XML_WSDL);
- m_xml.setAttribute(XML_WSDL, wsdl);
- }
-
- /**
- * is only used if consumer build entry
- *
- * @return
- */
- public String getWsdl() {
- return m_xml.getAttribute(XML_WSDL, null);
- }
-
- public Map<String, List<String>> getPropertiers() {
- Map<String, List<String>> properties = new HashMap<String, List<String>>();
-
- List<ScoutXmlElement> children = m_xml.getChildren(XML_PROPERTY);
- for (ScoutXmlElement xmlProperty : children) {
- String name = xmlProperty.getAttribute(XML_PROPERTY_NAME, null);
- if (!StringUtility.isNullOrEmpty(name)) {
- String value = xmlProperty.getAttribute(XML_PROPERTY_VALUE, null);
- if (!properties.containsKey(name)) {
- properties.put(name, new LinkedList<String>());
- }
- properties.get(name).add(value);
- }
- }
- return properties;
- }
-
- public void setProperties(Map<String, List<String>> properties) {
- m_xml.removeChildren(XML_PROPERTY);
-
- if (properties == null || properties.size() == 0) {
- return;
- }
- for (Entry<String, List<String>> property : properties.entrySet()) {
- String name = property.getKey();
- if (property.getValue() == null || property.getValue().size() == 0) {
- ScoutXmlElement xmlProperty = m_xml.addChild(XML_PROPERTY);
- xmlProperty.setAttribute(XML_PROPERTY_NAME, property.getKey());
- }
- else {
- for (String value : property.getValue()) {
- ScoutXmlElement xmlProperty = m_xml.addChild(XML_PROPERTY);
- xmlProperty.setAttribute(XML_PROPERTY_NAME, name);
- xmlProperty.setAttribute(XML_PROPERTY_VALUE, value);
- }
- }
- }
- }
-
- /**
- * Reloads the entry from disk
- *
- * @param bundle
- * @return true if successful, false otherwise
- */
- public boolean reload(IScoutBundle bundle) {
- ScoutXmlDocument newDocument = ResourceFactory.getBuildJaxWsResource(bundle).loadXml();
- if (newDocument == null || newDocument.getRoot() == null) {
- return false;
- }
-
- ScoutXmlElement rootXml = newDocument.getRoot();
- if (rootXml == null) {
- return false;
- }
-
- String nodeName;
- if (m_webserviceEnum == WebserviceEnum.Provider) {
- nodeName = BuildJaxWsBean.XML_PROVIDER;
- }
- else {
- nodeName = BuildJaxWsBean.XML_CONSUMER;
- }
- ScoutXmlElement xml = newDocument.getRoot().getChild(nodeName, BuildJaxWsBean.XML_ALIAS, getAlias());
- if (xml == null) {
- return false;
- }
-
- setXml(xml);
- return true;
- }
-
- public static BuildJaxWsBean load(IScoutBundle bundle, String alias, WebserviceEnum webserviceEnum) {
- if (!StringUtility.hasText(alias)) {
- return null;
- }
- ScoutXmlDocument document = ResourceFactory.getBuildJaxWsResource(bundle).loadXml();
- if (document == null || document.getRoot() == null) {
- return null;
- }
-
- String nodeName;
- if (webserviceEnum == WebserviceEnum.Provider) {
- nodeName = BuildJaxWsBean.XML_PROVIDER;
- }
- else {
- nodeName = BuildJaxWsBean.XML_CONSUMER;
- }
-
- ScoutXmlElement rootXml = document.getRoot();
- if (rootXml == null || !rootXml.hasChild(nodeName)) {
- return null;
- }
-
- ScoutXmlElement xml = document.getRoot().getChild(nodeName, BuildJaxWsBean.XML_ALIAS, alias);
- if (xml == null) {
- return null;
- }
-
- return new BuildJaxWsBean(xml, webserviceEnum);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.model;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+
+public class BuildJaxWsBean {
+
+ public static final String XML_PROVIDER = "provider";
+ public static final String XML_CONSUMER = "consumer";
+ public static final String XML_ALIAS = "name";
+ public static final String XML_PROPERTY = "property";
+ public static final String XML_PROPERTY_NAME = "name";
+ public static final String XML_PROPERTY_VALUE = "value";
+ public static final String XML_WSDL = "wsdl";
+
+ private ScoutXmlElement m_xml;
+ private WebserviceEnum m_webserviceEnum;
+
+ public BuildJaxWsBean(ScoutXmlElement xml, WebserviceEnum webserviceEnum) {
+ m_xml = xml;
+ m_webserviceEnum = webserviceEnum;
+ }
+
+ public ScoutXmlElement getXml() {
+ return m_xml;
+ }
+
+ public void setXml(ScoutXmlElement xml) {
+ m_xml = xml;
+ }
+
+ public String getAlias() {
+ return m_xml.getAttribute(XML_ALIAS, null);
+ }
+
+ public void setAlias(String alias) {
+ m_xml.removeAttribute(XML_ALIAS);
+ m_xml.setAttribute(XML_ALIAS, alias);
+ }
+
+ /**
+ * is only used if consumer build entry
+ *
+ * @param wsdl
+ */
+ public void setWsdl(String wsdl) {
+ m_xml.removeAttribute(XML_WSDL);
+ m_xml.setAttribute(XML_WSDL, wsdl);
+ }
+
+ /**
+ * is only used if consumer build entry
+ *
+ * @return
+ */
+ public String getWsdl() {
+ return m_xml.getAttribute(XML_WSDL, null);
+ }
+
+ public Map<String, List<String>> getPropertiers() {
+ Map<String, List<String>> properties = new HashMap<String, List<String>>();
+
+ List<ScoutXmlElement> children = m_xml.getChildren(XML_PROPERTY);
+ for (ScoutXmlElement xmlProperty : children) {
+ String name = xmlProperty.getAttribute(XML_PROPERTY_NAME, null);
+ if (!StringUtility.isNullOrEmpty(name)) {
+ String value = xmlProperty.getAttribute(XML_PROPERTY_VALUE, null);
+ if (!properties.containsKey(name)) {
+ properties.put(name, new LinkedList<String>());
+ }
+ properties.get(name).add(value);
+ }
+ }
+ return properties;
+ }
+
+ public void setProperties(Map<String, List<String>> properties) {
+ m_xml.removeChildren(XML_PROPERTY);
+
+ if (properties == null || properties.size() == 0) {
+ return;
+ }
+ for (Entry<String, List<String>> property : properties.entrySet()) {
+ String name = property.getKey();
+ if (property.getValue() == null || property.getValue().size() == 0) {
+ ScoutXmlElement xmlProperty = m_xml.addChild(XML_PROPERTY);
+ xmlProperty.setAttribute(XML_PROPERTY_NAME, property.getKey());
+ }
+ else {
+ for (String value : property.getValue()) {
+ ScoutXmlElement xmlProperty = m_xml.addChild(XML_PROPERTY);
+ xmlProperty.setAttribute(XML_PROPERTY_NAME, name);
+ xmlProperty.setAttribute(XML_PROPERTY_VALUE, value);
+ }
+ }
+ }
+ }
+
+ /**
+ * Reloads the entry from disk
+ *
+ * @param bundle
+ * @return true if successful, false otherwise
+ */
+ public boolean reload(IScoutBundle bundle) {
+ ScoutXmlDocument newDocument = ResourceFactory.getBuildJaxWsResource(bundle).loadXml();
+ if (newDocument == null || newDocument.getRoot() == null) {
+ return false;
+ }
+
+ ScoutXmlElement rootXml = newDocument.getRoot();
+ if (rootXml == null) {
+ return false;
+ }
+
+ String nodeName;
+ if (m_webserviceEnum == WebserviceEnum.Provider) {
+ nodeName = BuildJaxWsBean.XML_PROVIDER;
+ }
+ else {
+ nodeName = BuildJaxWsBean.XML_CONSUMER;
+ }
+ ScoutXmlElement xml = newDocument.getRoot().getChild(nodeName, BuildJaxWsBean.XML_ALIAS, getAlias());
+ if (xml == null) {
+ return false;
+ }
+
+ setXml(xml);
+ return true;
+ }
+
+ public static BuildJaxWsBean load(IScoutBundle bundle, String alias, WebserviceEnum webserviceEnum) {
+ if (!StringUtility.hasText(alias)) {
+ return null;
+ }
+ ScoutXmlDocument document = ResourceFactory.getBuildJaxWsResource(bundle).loadXml();
+ if (document == null || document.getRoot() == null) {
+ return null;
+ }
+
+ String nodeName;
+ if (webserviceEnum == WebserviceEnum.Provider) {
+ nodeName = BuildJaxWsBean.XML_PROVIDER;
+ }
+ else {
+ nodeName = BuildJaxWsBean.XML_CONSUMER;
+ }
+
+ ScoutXmlElement rootXml = document.getRoot();
+ if (rootXml == null || !rootXml.hasChild(nodeName)) {
+ return null;
+ }
+
+ ScoutXmlElement xml = document.getRoot().getChild(nodeName, BuildJaxWsBean.XML_ALIAS, alias);
+ if (xml == null) {
+ return null;
+ }
+
+ return new BuildJaxWsBean(xml, webserviceEnum);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/model/SunJaxWsBean.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/model/SunJaxWsBean.java
index 14fe058b1..b0aa937d1 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/model/SunJaxWsBean.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/model/SunJaxWsBean.java
@@ -1,287 +1,287 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.model;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-
-public class SunJaxWsBean {
-
- public static final String XML_ENDPOINT = "endpoint";
- public static final String XML_ALIAS = "name";
- public static final String XML_SERVICE = "service";
- public static final String XML_PORT = "port";
- public static final String XML_WSDL = "wsdl";
- public static final String XML_IMPLEMENTATION = "implementation";
- public static final String XML_URL_PATTERN = "url-pattern";
- public static final String XML_HANDLER_CHAINS = "handler-chains";
- public static final String XML_HANDLER_CHAIN = "handler-chain";
- public static final String XML_HANDLER = "handler";
- public static final String XML_HANDLER_CLASS = "handler-class";
- public static final String NS_ENDPOINT = "http://java.sun.com/xml/ns/jax-ws/ri/runtime";
- public static final String NS_HANDLER_CHAINS = "http://java.sun.com/xml/ns/javaee";
-
- public static final String XML_HANDLER_FILTER_PROTOCOL = "protocol-bindings";
- public static final String XML_HANDLER_FILTER_SERVICE = "service-name-pattern";
- public static final String XML_HANDLER_FILTER_PORT = "port-name-pattern";
-
- private ScoutXmlElement m_xml;
-
- public SunJaxWsBean(ScoutXmlElement xml) {
- m_xml = xml;
- }
-
- public ScoutXmlElement getXml() {
- return m_xml;
- }
-
- public void setXml(ScoutXmlElement xml) {
- m_xml = xml;
- }
-
- public String getAlias() {
- return m_xml.getAttribute(XML_ALIAS, null);
- }
-
- public void setAlias(String alias) {
- m_xml.removeAttribute(XML_ALIAS);
- m_xml.setAttribute(XML_ALIAS, alias);
- }
-
- public String getImplementation() {
- return m_xml.getAttribute(XML_IMPLEMENTATION, null);
- }
-
- public void setImplementation(String implementation) {
- m_xml.removeAttribute(XML_IMPLEMENTATION);
- m_xml.setAttribute(XML_IMPLEMENTATION, implementation);
- }
-
- public String getService() {
- return m_xml.getAttribute(XML_SERVICE, null);
- }
-
- public QName getServiceQNameSafe() {
- try {
- return QName.valueOf(getService());
- }
- catch (Exception e) {
- return null;
- }
- }
-
- public void setService(String service) {
- m_xml.removeAttribute(XML_SERVICE);
- m_xml.setAttribute(XML_SERVICE, service);
- }
-
- public String getPort() {
- return m_xml.getAttribute(XML_PORT, null);
- }
-
- public QName getPortQNameSafe() {
- try {
- return QName.valueOf(getPort());
- }
- catch (Exception e) {
- return null;
- }
- }
-
- public void setPort(String port) {
- m_xml.removeAttribute(XML_PORT);
- m_xml.setAttribute(XML_PORT, port);
- }
-
- public String getWsdl() {
- return m_xml.getAttribute(XML_WSDL, null);
- }
-
- public void setWsdl(String wsdl) {
- m_xml.removeAttribute(XML_WSDL);
- m_xml.setAttribute(XML_WSDL, wsdl);
- }
-
- public String getUrlPattern() {
- return m_xml.getAttribute(XML_URL_PATTERN, null);
- }
-
- public void setUrlPattern(String urlPattern) {
- m_xml.removeAttribute(XML_URL_PATTERN);
- m_xml.setAttribute(XML_URL_PATTERN, urlPattern);
- }
-
- public List<ScoutXmlElement> getHandlerChains() {
- ScoutXmlElement xmlChains = m_xml.getChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_CHAINS));
-
- if (xmlChains == null) {
- return new ArrayList<ScoutXmlElement>(0);
- }
-
- List<ScoutXmlElement> children = xmlChains.getChildren(toQualifiedName(SunJaxWsBean.XML_HANDLER_CHAIN));
- if (children == null) {
- return new ArrayList<ScoutXmlElement>(0);
- }
-
- List<ScoutXmlElement> chains = new ArrayList<ScoutXmlElement>();
- for (ScoutXmlElement child : children) {
- chains.add(child);
- }
- return chains;
- }
-
- public void setHandlerChains(List<ScoutXmlElement> xmlHandlerChains) {
- if (m_xml.hasChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_CHAINS))) {
- m_xml.removeChildren(toQualifiedName(SunJaxWsBean.XML_HANDLER_CHAINS));
- }
- for (ScoutXmlElement chain : xmlHandlerChains) {
- m_xml.addChild(chain);
- }
- }
-
- public String toQualifiedName(String elementName) {
- return StringUtility.join(":", m_xml.getRoot().getNamePrefix(), elementName);
- }
-
- public void visitHandlers(IHandlerVisitor visitor) {
- String handlerXmlElementName = toQualifiedName(SunJaxWsBean.XML_HANDLER);
- String handlerClazzXmlElementName = toQualifiedName(SunJaxWsBean.XML_HANDLER_CLASS);
-
- for (ScoutXmlElement xmlHandlerChain : getHandlerChains()) {
- List<ScoutXmlElement> children = xmlHandlerChain.getChildren(handlerXmlElementName);
- if (children == null || children.size() == 0) {
- continue;
- }
-
- List<ScoutXmlElement> handlers = new LinkedList<ScoutXmlElement>();
- for (ScoutXmlElement child : children) {
- handlers.add(child);
- }
- for (int i = 0; i < handlers.size(); i++) {
- ScoutXmlElement xmlHandler = handlers.get(i);
-
- ScoutXmlElement xmlHandlerClazzElement = xmlHandler.getChild(handlerClazzXmlElementName);
- String fqn = null;
- if (xmlHandlerClazzElement != null) {
- fqn = xmlHandlerClazzElement.getText();
- }
- if (!visitor.visit(xmlHandler, fqn, i, handlers.size())) {
- return;
- }
- }
- }
- }
-
- public void visitHandlers(ScoutXmlElement xmlHandlerChain, IHandlerVisitor visitor) {
- String handlerXmlElementName = toQualifiedName(SunJaxWsBean.XML_HANDLER);
- String handlerClazzXmlElementName = toQualifiedName(SunJaxWsBean.XML_HANDLER_CLASS);
-
- List<ScoutXmlElement> children = xmlHandlerChain.getChildren(handlerXmlElementName);
- if (children == null || children.size() == 0) {
- return;
- }
-
- List<ScoutXmlElement> handlers = new LinkedList<ScoutXmlElement>();
- for (ScoutXmlElement child : children) {
- handlers.add((ScoutXmlElement) child);
- }
- for (int i = 0; i < handlers.size(); i++) {
- ScoutXmlElement xmlHandler = handlers.get(i);
-
- ScoutXmlElement xmlHandlerClazzElement = xmlHandler.getChild(handlerClazzXmlElementName);
- String fqn = null;
- if (xmlHandlerClazzElement != null) {
- fqn = xmlHandlerClazzElement.getText();
- }
- if (!visitor.visit(xmlHandler, fqn, i, handlers.size())) {
- return;
- }
- }
- }
-
- public boolean swapHandler(ScoutXmlElement xmlHandlerChain, int oldIndex, int newIndex) {
- String handlerXmlElementName = toQualifiedName(SunJaxWsBean.XML_HANDLER);
- List<ScoutXmlElement> handlerChildren = xmlHandlerChain.getChildren(handlerXmlElementName);
- try {
- Collections.swap(handlerChildren, oldIndex, newIndex);
-
- // update chain in memory
- xmlHandlerChain.removeChildren(handlerChildren);
- xmlHandlerChain.addChildren(handlerChildren);
- return true;
- }
- catch (IndexOutOfBoundsException e) {
- return false;
- }
- }
-
- /**
- * Reloads the entry from disk
- *
- * @param bundle
- * @return true if successful, false otherwise
- */
- public boolean reload(IScoutBundle bundle) {
- ScoutXmlDocument newDocument = ResourceFactory.getSunJaxWsResource(bundle).loadXml();
- if (newDocument == null || newDocument.getRoot() == null) {
- return false;
- }
-
- ScoutXmlElement rootXml = newDocument.getRoot();
- if (rootXml == null || !rootXml.hasChild(toQualifiedName(SunJaxWsBean.XML_ENDPOINT))) {
- return false;
- }
-
- ScoutXmlElement xml = rootXml.getChild(toQualifiedName(SunJaxWsBean.XML_ENDPOINT), SunJaxWsBean.XML_ALIAS, getAlias());
- if (xml == null) {
- return false;
- }
- setXml(xml);
- return true;
- }
-
- public static SunJaxWsBean load(IScoutBundle bundle, String alias) {
- if (!StringUtility.hasText(alias)) {
- return null;
- }
- ScoutXmlDocument document = ResourceFactory.getSunJaxWsResource(bundle).loadXml();
- if (document == null || document.getRoot() == null) {
- return null;
- }
-
- ScoutXmlElement rootXml = document.getRoot();
- if (rootXml == null || !rootXml.hasChild(SunJaxWsBean.XML_ENDPOINT)) {
- return null;
- }
-
- ScoutXmlElement xml = rootXml.getChild(StringUtility.join(":", rootXml.getRoot().getNamePrefix(), SunJaxWsBean.XML_ENDPOINT), SunJaxWsBean.XML_ALIAS, alias);
- if (xml == null) {
- return null;
- }
-
- return new SunJaxWsBean(xml);
- }
-
- public static interface IHandlerVisitor {
-
- public boolean visit(ScoutXmlElement xmlHandlerElement, String fullyQualifiedName, int handlerIndex, int handlerCount);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+
+public class SunJaxWsBean {
+
+ public static final String XML_ENDPOINT = "endpoint";
+ public static final String XML_ALIAS = "name";
+ public static final String XML_SERVICE = "service";
+ public static final String XML_PORT = "port";
+ public static final String XML_WSDL = "wsdl";
+ public static final String XML_IMPLEMENTATION = "implementation";
+ public static final String XML_URL_PATTERN = "url-pattern";
+ public static final String XML_HANDLER_CHAINS = "handler-chains";
+ public static final String XML_HANDLER_CHAIN = "handler-chain";
+ public static final String XML_HANDLER = "handler";
+ public static final String XML_HANDLER_CLASS = "handler-class";
+ public static final String NS_ENDPOINT = "http://java.sun.com/xml/ns/jax-ws/ri/runtime";
+ public static final String NS_HANDLER_CHAINS = "http://java.sun.com/xml/ns/javaee";
+
+ public static final String XML_HANDLER_FILTER_PROTOCOL = "protocol-bindings";
+ public static final String XML_HANDLER_FILTER_SERVICE = "service-name-pattern";
+ public static final String XML_HANDLER_FILTER_PORT = "port-name-pattern";
+
+ private ScoutXmlElement m_xml;
+
+ public SunJaxWsBean(ScoutXmlElement xml) {
+ m_xml = xml;
+ }
+
+ public ScoutXmlElement getXml() {
+ return m_xml;
+ }
+
+ public void setXml(ScoutXmlElement xml) {
+ m_xml = xml;
+ }
+
+ public String getAlias() {
+ return m_xml.getAttribute(XML_ALIAS, null);
+ }
+
+ public void setAlias(String alias) {
+ m_xml.removeAttribute(XML_ALIAS);
+ m_xml.setAttribute(XML_ALIAS, alias);
+ }
+
+ public String getImplementation() {
+ return m_xml.getAttribute(XML_IMPLEMENTATION, null);
+ }
+
+ public void setImplementation(String implementation) {
+ m_xml.removeAttribute(XML_IMPLEMENTATION);
+ m_xml.setAttribute(XML_IMPLEMENTATION, implementation);
+ }
+
+ public String getService() {
+ return m_xml.getAttribute(XML_SERVICE, null);
+ }
+
+ public QName getServiceQNameSafe() {
+ try {
+ return QName.valueOf(getService());
+ }
+ catch (Exception e) {
+ return null;
+ }
+ }
+
+ public void setService(String service) {
+ m_xml.removeAttribute(XML_SERVICE);
+ m_xml.setAttribute(XML_SERVICE, service);
+ }
+
+ public String getPort() {
+ return m_xml.getAttribute(XML_PORT, null);
+ }
+
+ public QName getPortQNameSafe() {
+ try {
+ return QName.valueOf(getPort());
+ }
+ catch (Exception e) {
+ return null;
+ }
+ }
+
+ public void setPort(String port) {
+ m_xml.removeAttribute(XML_PORT);
+ m_xml.setAttribute(XML_PORT, port);
+ }
+
+ public String getWsdl() {
+ return m_xml.getAttribute(XML_WSDL, null);
+ }
+
+ public void setWsdl(String wsdl) {
+ m_xml.removeAttribute(XML_WSDL);
+ m_xml.setAttribute(XML_WSDL, wsdl);
+ }
+
+ public String getUrlPattern() {
+ return m_xml.getAttribute(XML_URL_PATTERN, null);
+ }
+
+ public void setUrlPattern(String urlPattern) {
+ m_xml.removeAttribute(XML_URL_PATTERN);
+ m_xml.setAttribute(XML_URL_PATTERN, urlPattern);
+ }
+
+ public List<ScoutXmlElement> getHandlerChains() {
+ ScoutXmlElement xmlChains = m_xml.getChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_CHAINS));
+
+ if (xmlChains == null) {
+ return new ArrayList<ScoutXmlElement>(0);
+ }
+
+ List<ScoutXmlElement> children = xmlChains.getChildren(toQualifiedName(SunJaxWsBean.XML_HANDLER_CHAIN));
+ if (children == null) {
+ return new ArrayList<ScoutXmlElement>(0);
+ }
+
+ List<ScoutXmlElement> chains = new ArrayList<ScoutXmlElement>();
+ for (ScoutXmlElement child : children) {
+ chains.add(child);
+ }
+ return chains;
+ }
+
+ public void setHandlerChains(List<ScoutXmlElement> xmlHandlerChains) {
+ if (m_xml.hasChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_CHAINS))) {
+ m_xml.removeChildren(toQualifiedName(SunJaxWsBean.XML_HANDLER_CHAINS));
+ }
+ for (ScoutXmlElement chain : xmlHandlerChains) {
+ m_xml.addChild(chain);
+ }
+ }
+
+ public String toQualifiedName(String elementName) {
+ return StringUtility.join(":", m_xml.getRoot().getNamePrefix(), elementName);
+ }
+
+ public void visitHandlers(IHandlerVisitor visitor) {
+ String handlerXmlElementName = toQualifiedName(SunJaxWsBean.XML_HANDLER);
+ String handlerClazzXmlElementName = toQualifiedName(SunJaxWsBean.XML_HANDLER_CLASS);
+
+ for (ScoutXmlElement xmlHandlerChain : getHandlerChains()) {
+ List<ScoutXmlElement> children = xmlHandlerChain.getChildren(handlerXmlElementName);
+ if (children == null || children.size() == 0) {
+ continue;
+ }
+
+ List<ScoutXmlElement> handlers = new LinkedList<ScoutXmlElement>();
+ for (ScoutXmlElement child : children) {
+ handlers.add(child);
+ }
+ for (int i = 0; i < handlers.size(); i++) {
+ ScoutXmlElement xmlHandler = handlers.get(i);
+
+ ScoutXmlElement xmlHandlerClazzElement = xmlHandler.getChild(handlerClazzXmlElementName);
+ String fqn = null;
+ if (xmlHandlerClazzElement != null) {
+ fqn = xmlHandlerClazzElement.getText();
+ }
+ if (!visitor.visit(xmlHandler, fqn, i, handlers.size())) {
+ return;
+ }
+ }
+ }
+ }
+
+ public void visitHandlers(ScoutXmlElement xmlHandlerChain, IHandlerVisitor visitor) {
+ String handlerXmlElementName = toQualifiedName(SunJaxWsBean.XML_HANDLER);
+ String handlerClazzXmlElementName = toQualifiedName(SunJaxWsBean.XML_HANDLER_CLASS);
+
+ List<ScoutXmlElement> children = xmlHandlerChain.getChildren(handlerXmlElementName);
+ if (children == null || children.size() == 0) {
+ return;
+ }
+
+ List<ScoutXmlElement> handlers = new LinkedList<ScoutXmlElement>();
+ for (ScoutXmlElement child : children) {
+ handlers.add((ScoutXmlElement) child);
+ }
+ for (int i = 0; i < handlers.size(); i++) {
+ ScoutXmlElement xmlHandler = handlers.get(i);
+
+ ScoutXmlElement xmlHandlerClazzElement = xmlHandler.getChild(handlerClazzXmlElementName);
+ String fqn = null;
+ if (xmlHandlerClazzElement != null) {
+ fqn = xmlHandlerClazzElement.getText();
+ }
+ if (!visitor.visit(xmlHandler, fqn, i, handlers.size())) {
+ return;
+ }
+ }
+ }
+
+ public boolean swapHandler(ScoutXmlElement xmlHandlerChain, int oldIndex, int newIndex) {
+ String handlerXmlElementName = toQualifiedName(SunJaxWsBean.XML_HANDLER);
+ List<ScoutXmlElement> handlerChildren = xmlHandlerChain.getChildren(handlerXmlElementName);
+ try {
+ Collections.swap(handlerChildren, oldIndex, newIndex);
+
+ // update chain in memory
+ xmlHandlerChain.removeChildren(handlerChildren);
+ xmlHandlerChain.addChildren(handlerChildren);
+ return true;
+ }
+ catch (IndexOutOfBoundsException e) {
+ return false;
+ }
+ }
+
+ /**
+ * Reloads the entry from disk
+ *
+ * @param bundle
+ * @return true if successful, false otherwise
+ */
+ public boolean reload(IScoutBundle bundle) {
+ ScoutXmlDocument newDocument = ResourceFactory.getSunJaxWsResource(bundle).loadXml();
+ if (newDocument == null || newDocument.getRoot() == null) {
+ return false;
+ }
+
+ ScoutXmlElement rootXml = newDocument.getRoot();
+ if (rootXml == null || !rootXml.hasChild(toQualifiedName(SunJaxWsBean.XML_ENDPOINT))) {
+ return false;
+ }
+
+ ScoutXmlElement xml = rootXml.getChild(toQualifiedName(SunJaxWsBean.XML_ENDPOINT), SunJaxWsBean.XML_ALIAS, getAlias());
+ if (xml == null) {
+ return false;
+ }
+ setXml(xml);
+ return true;
+ }
+
+ public static SunJaxWsBean load(IScoutBundle bundle, String alias) {
+ if (!StringUtility.hasText(alias)) {
+ return null;
+ }
+ ScoutXmlDocument document = ResourceFactory.getSunJaxWsResource(bundle).loadXml();
+ if (document == null || document.getRoot() == null) {
+ return null;
+ }
+
+ ScoutXmlElement rootXml = document.getRoot();
+ if (rootXml == null || !rootXml.hasChild(SunJaxWsBean.XML_ENDPOINT)) {
+ return null;
+ }
+
+ ScoutXmlElement xml = rootXml.getChild(StringUtility.join(":", rootXml.getRoot().getNamePrefix(), SunJaxWsBean.XML_ENDPOINT), SunJaxWsBean.XML_ALIAS, alias);
+ if (xml == null) {
+ return null;
+ }
+
+ return new SunJaxWsBean(xml);
+ }
+
+ public static interface IHandlerVisitor {
+
+ public boolean visit(ScoutXmlElement xmlHandlerElement, String fullyQualifiedName, int handlerIndex, int handlerCount);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/AuthenticationHandlerNodePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/AuthenticationHandlerNodePage.java
index 9d95a946f..8df90a9e5 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/AuthenticationHandlerNodePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/AuthenticationHandlerNodePage.java
@@ -1,185 +1,185 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.action.ShowJavaReferencesAction;
-import org.eclipse.scout.sdk.ui.action.delete.DeleteAction;
-import org.eclipse.scout.sdk.ui.action.rename.TypeRenameAction;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.AbstractTypeChangedListener;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
-
-public class AuthenticationHandlerNodePage extends AbstractPage {
-
- private IType m_type;
-
- private boolean m_pageUnloaded = false;
- private Object m_pageLoadedListenerLock;
- private Set<IPageLoadedListener> m_pageLoadedListeners;
- private P_TypeChangeListener m_handlerChangedListener;
-
- private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
-
- public AuthenticationHandlerNodePage(IPage parent, IType type) {
- setParent(parent);
- setName(type.getElementName());
- m_type = type;
- if (type.isBinary()) {
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.AuthenticationHandlerBinary));
- }
- else {
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.AuthenticationHandler));
- }
-
- m_bundle = getScoutResource();
-
- m_pageLoadedListeners = new HashSet<IPageLoadedListener>();
- m_pageLoadedListenerLock = new Object();
-
- m_handlerChangedListener = new P_TypeChangeListener();
- m_handlerChangedListener.setType(m_type);
- ResourcesPlugin.getWorkspace().addResourceChangeListener(m_handlerChangedListener);
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.AUTHENTICATION_HANDLER_NODE_PAGE;
- }
-
- @Override
- public void unloadPage() {
- m_pageUnloaded = true;
-
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(m_handlerChangedListener);
- super.unloadPage();
- }
-
- @Override
- public int getQuality() {
- int quality = IMarker.SEVERITY_INFO;
- if (getType().exists()) {
- quality = ScoutSeverityManager.getInstance().getSeverityOf(getType());
- }
- return quality;
- }
-
- @Override
- public boolean handleDoubleClickedDelegate() {
- if (getType() != null) {
- try {
- JavaUI.openInEditor(getType());
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("could not open type in editor", e);
- }
- return true;
- }
- return false;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- if (!m_type.isBinary()) {
- return new Class[]{DeleteAction.class, TypeRenameAction.class, ShowJavaReferencesAction.class};
- }
- return new Class[]{ShowJavaReferencesAction.class};
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof TypeRenameAction) {
- TypeRenameAction action = (TypeRenameAction) menu;
- action.setOldName(getType().getElementName());
- action.setType(getType());
- }
- else if (menu instanceof ShowJavaReferencesAction) {
- ((ShowJavaReferencesAction) menu).setElement(getType());
- }
- else if (menu instanceof DeleteAction) {
- ((DeleteAction) menu).addType(getType());
- ((DeleteAction) menu).setName(getType().getElementName());
- }
- }
-
- @Override
- public boolean isFolder() {
- return false;
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- public void addPageLoadedListener(IPageLoadedListener listener) {
- synchronized (m_pageLoadedListenerLock) {
- m_pageLoadedListeners.add(listener);
- }
- }
-
- public void removePageLoadedListener(IPageLoadedListener listener) {
- synchronized (m_pageLoadedListenerLock) {
- m_pageLoadedListeners.remove(listener);
- }
- }
-
- private void notifyPageLoadedListeners() {
- IPageLoadedListener[] listeners;
- synchronized (m_pageLoadedListenerLock) {
- listeners = m_pageLoadedListeners.toArray(new IPageLoadedListener[m_pageLoadedListeners.size()]);
- }
-
- for (IPageLoadedListener listener : listeners) {
- try {
- listener.pageLoaded();
- }
- catch (Exception e) {
- JaxWsSdk.logError("error while notifying pageLoaded listener", e);
- }
- }
- }
-
- public boolean isPageUnloaded() {
- return m_pageUnloaded;
- }
-
- public IType getType() {
- return m_type;
- }
-
- private class P_TypeChangeListener extends AbstractTypeChangedListener {
-
- @Override
- protected boolean shouldAnalayseForChange(IResourceChangeEvent event) {
- return !isPageUnloaded();
- }
-
- @Override
- protected void typeChanged() {
- markStructureDirty();
- notifyPageLoadedListeners();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.action.ShowJavaReferencesAction;
+import org.eclipse.scout.sdk.ui.action.delete.DeleteAction;
+import org.eclipse.scout.sdk.ui.action.rename.TypeRenameAction;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.AbstractTypeChangedListener;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
+
+public class AuthenticationHandlerNodePage extends AbstractPage {
+
+ private IType m_type;
+
+ private boolean m_pageUnloaded = false;
+ private Object m_pageLoadedListenerLock;
+ private Set<IPageLoadedListener> m_pageLoadedListeners;
+ private P_TypeChangeListener m_handlerChangedListener;
+
+ private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
+
+ public AuthenticationHandlerNodePage(IPage parent, IType type) {
+ setParent(parent);
+ setName(type.getElementName());
+ m_type = type;
+ if (type.isBinary()) {
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.AuthenticationHandlerBinary));
+ }
+ else {
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.AuthenticationHandler));
+ }
+
+ m_bundle = getScoutResource();
+
+ m_pageLoadedListeners = new HashSet<IPageLoadedListener>();
+ m_pageLoadedListenerLock = new Object();
+
+ m_handlerChangedListener = new P_TypeChangeListener();
+ m_handlerChangedListener.setType(m_type);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(m_handlerChangedListener);
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.AUTHENTICATION_HANDLER_NODE_PAGE;
+ }
+
+ @Override
+ public void unloadPage() {
+ m_pageUnloaded = true;
+
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(m_handlerChangedListener);
+ super.unloadPage();
+ }
+
+ @Override
+ public int getQuality() {
+ int quality = IMarker.SEVERITY_INFO;
+ if (getType().exists()) {
+ quality = ScoutSeverityManager.getInstance().getSeverityOf(getType());
+ }
+ return quality;
+ }
+
+ @Override
+ public boolean handleDoubleClickedDelegate() {
+ if (getType() != null) {
+ try {
+ JavaUI.openInEditor(getType());
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("could not open type in editor", e);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ if (!m_type.isBinary()) {
+ return new Class[]{DeleteAction.class, TypeRenameAction.class, ShowJavaReferencesAction.class};
+ }
+ return new Class[]{ShowJavaReferencesAction.class};
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof TypeRenameAction) {
+ TypeRenameAction action = (TypeRenameAction) menu;
+ action.setOldName(getType().getElementName());
+ action.setType(getType());
+ }
+ else if (menu instanceof ShowJavaReferencesAction) {
+ ((ShowJavaReferencesAction) menu).setElement(getType());
+ }
+ else if (menu instanceof DeleteAction) {
+ ((DeleteAction) menu).addType(getType());
+ ((DeleteAction) menu).setName(getType().getElementName());
+ }
+ }
+
+ @Override
+ public boolean isFolder() {
+ return false;
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ public void addPageLoadedListener(IPageLoadedListener listener) {
+ synchronized (m_pageLoadedListenerLock) {
+ m_pageLoadedListeners.add(listener);
+ }
+ }
+
+ public void removePageLoadedListener(IPageLoadedListener listener) {
+ synchronized (m_pageLoadedListenerLock) {
+ m_pageLoadedListeners.remove(listener);
+ }
+ }
+
+ private void notifyPageLoadedListeners() {
+ IPageLoadedListener[] listeners;
+ synchronized (m_pageLoadedListenerLock) {
+ listeners = m_pageLoadedListeners.toArray(new IPageLoadedListener[m_pageLoadedListeners.size()]);
+ }
+
+ for (IPageLoadedListener listener : listeners) {
+ try {
+ listener.pageLoaded();
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("error while notifying pageLoaded listener", e);
+ }
+ }
+ }
+
+ public boolean isPageUnloaded() {
+ return m_pageUnloaded;
+ }
+
+ public IType getType() {
+ return m_type;
+ }
+
+ private class P_TypeChangeListener extends AbstractTypeChangedListener {
+
+ @Override
+ protected boolean shouldAnalayseForChange(IResourceChangeEvent event) {
+ return !isPageUnloaded();
+ }
+
+ @Override
+ protected void typeChanged() {
+ markStructureDirty();
+ notifyPageLoadedListeners();
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/AuthenticationHandlerTablePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/AuthenticationHandlerTablePage.java
index cbd515bb9..a0f7badad 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/AuthenticationHandlerTablePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/AuthenticationHandlerTablePage.java
@@ -1,168 +1,168 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.ITypeHierarchyChangedListener;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.AuthenticationHandlerNewWizardAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class AuthenticationHandlerTablePage extends AbstractPage {
-
- private ITypeHierarchy m_hierarchy;
- private IType m_superInterfaceType;
- private WebserviceEnum m_webserviceEnum;
-
- private ITypeHierarchyChangedListener m_hierarchyChangedListener;
-
- public AuthenticationHandlerTablePage(IPage parent, WebserviceEnum webserviceEnum) {
- setParent(parent);
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsIcons.AuthenticationHandlerFolder));
- setName(Texts.get("Authentication"));
- m_webserviceEnum = webserviceEnum;
- if (webserviceEnum == WebserviceEnum.Provider) {
- m_superInterfaceType = TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider);
- }
- else {
- m_superInterfaceType = TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer);
- }
- try {
- m_hierarchy = m_superInterfaceType.newTypeHierarchy(new NullProgressMonitor());
- m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
- m_hierarchy.addTypeHierarchyChangedListener(m_hierarchyChangedListener);
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.AUTHENTICATION_HANDLER_TABLE_PAGE;
- }
-
- @Override
- public void unloadPage() {
- if (m_hierarchy != null && m_hierarchyChangedListener != null) {
- m_hierarchy.removeTypeHierarchyChangedListener(m_hierarchyChangedListener);
- }
- }
-
- @Override
- public boolean isFolder() {
- return true;
- }
-
- @Override
- public void refresh(boolean clearCache) {
- if (clearCache) {
- try {
- if (m_hierarchy == null) {
- m_hierarchy = m_superInterfaceType.newTypeHierarchy(new NullProgressMonitor());
- m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
- m_hierarchy.addTypeHierarchyChangedListener(m_hierarchyChangedListener);
- }
- else {
- m_hierarchy.refresh(new NullProgressMonitor());
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- }
- super.refresh(clearCache);
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof AuthenticationHandlerNewWizardAction) {
- ((AuthenticationHandlerNewWizardAction) menu).init(getScoutResource(), m_webserviceEnum);
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- return new Class[]{AuthenticationHandlerNewWizardAction.class};
- }
-
- @Override
- protected void loadChildrenImpl() {
- if (m_hierarchy == null) {
- return;
- }
-
- // Scout SDK hierarchy (IPrimaryTypeTypeHierarchy) cannot be used as type creation events are not propagates because they are created by JDT NewClassWizardPage.
- List<IType> types = new ArrayList<IType>();
- try {
- for (IType type : m_hierarchy.getAllSubtypes(m_superInterfaceType)) {
- if (TypeUtility.isOnClasspath(type, getScoutResource().getJavaProject()) && !type.isInterface() && !Flags.isAbstract(type.getFlags()) && !Signature.getQualifier(type.getFullyQualifiedName()).contains("internal")) {
- if (type.getDeclaringType() != null && type.getDeclaringType().equals(m_superInterfaceType)) {
- // skip NONE authentication
- continue;
- }
-
- types.add(type);
- }
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
-
- JaxWsSdkUtility.sortTypesByName(types, true);
-
- for (IType type : types) {
- new AuthenticationHandlerNodePage(this, type);
- }
- }
-
- public WebserviceEnum getWebserviceEnum() {
- return m_webserviceEnum;
- }
-
- private class P_TypeHierarchyChangedListener implements ITypeHierarchyChangedListener {
-
- @Override
- public void typeHierarchyChanged(ITypeHierarchy typeHierarchy) {
- try {
- m_hierarchy.refresh(new NullProgressMonitor());
- markStructureDirty();
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.ITypeHierarchyChangedListener;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.AuthenticationHandlerNewWizardAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class AuthenticationHandlerTablePage extends AbstractPage {
+
+ private ITypeHierarchy m_hierarchy;
+ private IType m_superInterfaceType;
+ private WebserviceEnum m_webserviceEnum;
+
+ private ITypeHierarchyChangedListener m_hierarchyChangedListener;
+
+ public AuthenticationHandlerTablePage(IPage parent, WebserviceEnum webserviceEnum) {
+ setParent(parent);
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsIcons.AuthenticationHandlerFolder));
+ setName(Texts.get("Authentication"));
+ m_webserviceEnum = webserviceEnum;
+ if (webserviceEnum == WebserviceEnum.Provider) {
+ m_superInterfaceType = TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider);
+ }
+ else {
+ m_superInterfaceType = TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer);
+ }
+ try {
+ m_hierarchy = m_superInterfaceType.newTypeHierarchy(new NullProgressMonitor());
+ m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
+ m_hierarchy.addTypeHierarchyChangedListener(m_hierarchyChangedListener);
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.AUTHENTICATION_HANDLER_TABLE_PAGE;
+ }
+
+ @Override
+ public void unloadPage() {
+ if (m_hierarchy != null && m_hierarchyChangedListener != null) {
+ m_hierarchy.removeTypeHierarchyChangedListener(m_hierarchyChangedListener);
+ }
+ }
+
+ @Override
+ public boolean isFolder() {
+ return true;
+ }
+
+ @Override
+ public void refresh(boolean clearCache) {
+ if (clearCache) {
+ try {
+ if (m_hierarchy == null) {
+ m_hierarchy = m_superInterfaceType.newTypeHierarchy(new NullProgressMonitor());
+ m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
+ m_hierarchy.addTypeHierarchyChangedListener(m_hierarchyChangedListener);
+ }
+ else {
+ m_hierarchy.refresh(new NullProgressMonitor());
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+ super.refresh(clearCache);
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof AuthenticationHandlerNewWizardAction) {
+ ((AuthenticationHandlerNewWizardAction) menu).init(getScoutResource(), m_webserviceEnum);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ return new Class[]{AuthenticationHandlerNewWizardAction.class};
+ }
+
+ @Override
+ protected void loadChildrenImpl() {
+ if (m_hierarchy == null) {
+ return;
+ }
+
+ // Scout SDK hierarchy (IPrimaryTypeTypeHierarchy) cannot be used as type creation events are not propagates because they are created by JDT NewClassWizardPage.
+ List<IType> types = new ArrayList<IType>();
+ try {
+ for (IType type : m_hierarchy.getAllSubtypes(m_superInterfaceType)) {
+ if (TypeUtility.isOnClasspath(type, getScoutResource().getJavaProject()) && !type.isInterface() && !Flags.isAbstract(type.getFlags()) && !Signature.getQualifier(type.getFullyQualifiedName()).contains("internal")) {
+ if (type.getDeclaringType() != null && type.getDeclaringType().equals(m_superInterfaceType)) {
+ // skip NONE authentication
+ continue;
+ }
+
+ types.add(type);
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+
+ JaxWsSdkUtility.sortTypesByName(types, true);
+
+ for (IType type : types) {
+ new AuthenticationHandlerNodePage(this, type);
+ }
+ }
+
+ public WebserviceEnum getWebserviceEnum() {
+ return m_webserviceEnum;
+ }
+
+ private class P_TypeHierarchyChangedListener implements ITypeHierarchyChangedListener {
+
+ @Override
+ public void typeHierarchyChanged(ITypeHierarchy typeHierarchy) {
+ try {
+ m_hierarchy.refresh(new NullProgressMonitor());
+ markStructureDirty();
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/ConsumerTablePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/ConsumerTablePage.java
index 193022c6b..ba1b72c68 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/ConsumerTablePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/ConsumerTablePage.java
@@ -1,46 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-
-public class ConsumerTablePage extends AbstractPage {
-
- public ConsumerTablePage(IPage parent) {
- setParent(parent);
- setName(Texts.get("Consumer"));
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.CONSUMER_TABLE_PAGE;
- }
-
- @Override
- public boolean isFolder() {
- return true;
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- @Override
- protected void loadChildrenImpl() {
- new WebServiceConsumerTablePage(this);
- new AuthenticationHandlerTablePage(this, WebserviceEnum.Consumer);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+
+public class ConsumerTablePage extends AbstractPage {
+
+ public ConsumerTablePage(IPage parent) {
+ setParent(parent);
+ setName(Texts.get("Consumer"));
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.CONSUMER_TABLE_PAGE;
+ }
+
+ @Override
+ public boolean isFolder() {
+ return true;
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ @Override
+ protected void loadChildrenImpl() {
+ new WebServiceConsumerTablePage(this);
+ new AuthenticationHandlerTablePage(this, WebserviceEnum.Consumer);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/CredentialValidationStrategyNodePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/CredentialValidationStrategyNodePage.java
index 0c34242c6..8446fb246 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/CredentialValidationStrategyNodePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/CredentialValidationStrategyNodePage.java
@@ -1,112 +1,112 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.action.ShowJavaReferencesAction;
-import org.eclipse.scout.sdk.ui.action.delete.DeleteAction;
-import org.eclipse.scout.sdk.ui.action.rename.TypeRenameAction;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-
-public class CredentialValidationStrategyNodePage extends AbstractPage {
-
- private IType m_type;
-
- private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
-
- public CredentialValidationStrategyNodePage(IPage parent, IType type) {
- setParent(parent);
- setName(type.getElementName());
- m_type = type;
- if (type.isBinary()) {
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.CredentialValidationStrategyBinary));
- }
- else {
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.CredentialValidationStrategy));
- }
-
- m_bundle = getScoutResource();
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.CREDENTIAL_VALIDATION_STRATEGY_NODE_PAGE;
- }
-
- @Override
- public int getQuality() {
- int quality = IMarker.SEVERITY_INFO;
- if (getType().exists()) {
- quality = ScoutSeverityManager.getInstance().getSeverityOf(getType());
- }
- return quality;
- }
-
- @Override
- public boolean handleDoubleClickedDelegate() {
- if (getType() != null) {
- try {
- JavaUI.openInEditor(getType());
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("could not open type in editor", e);
- }
- return true;
- }
- return false;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- if (!m_type.isBinary()) {
- return new Class[]{DeleteAction.class, TypeRenameAction.class, ShowJavaReferencesAction.class};
- }
- return new Class[]{ShowJavaReferencesAction.class};
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof TypeRenameAction) {
- TypeRenameAction action = (TypeRenameAction) menu;
- action.setOldName(getType().getElementName());
- action.setType(getType());
- }
- else if (menu instanceof ShowJavaReferencesAction) {
- ((ShowJavaReferencesAction) menu).setElement(getType());
- }
- else if (menu instanceof DeleteAction) {
- ((DeleteAction) menu).addType(getType());
- ((DeleteAction) menu).setName(getType().getElementName());
- }
- }
-
- @Override
- public boolean isFolder() {
- return false;
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- public IType getType() {
- return m_type;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.action.ShowJavaReferencesAction;
+import org.eclipse.scout.sdk.ui.action.delete.DeleteAction;
+import org.eclipse.scout.sdk.ui.action.rename.TypeRenameAction;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+
+public class CredentialValidationStrategyNodePage extends AbstractPage {
+
+ private IType m_type;
+
+ private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
+
+ public CredentialValidationStrategyNodePage(IPage parent, IType type) {
+ setParent(parent);
+ setName(type.getElementName());
+ m_type = type;
+ if (type.isBinary()) {
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.CredentialValidationStrategyBinary));
+ }
+ else {
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.CredentialValidationStrategy));
+ }
+
+ m_bundle = getScoutResource();
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.CREDENTIAL_VALIDATION_STRATEGY_NODE_PAGE;
+ }
+
+ @Override
+ public int getQuality() {
+ int quality = IMarker.SEVERITY_INFO;
+ if (getType().exists()) {
+ quality = ScoutSeverityManager.getInstance().getSeverityOf(getType());
+ }
+ return quality;
+ }
+
+ @Override
+ public boolean handleDoubleClickedDelegate() {
+ if (getType() != null) {
+ try {
+ JavaUI.openInEditor(getType());
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("could not open type in editor", e);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ if (!m_type.isBinary()) {
+ return new Class[]{DeleteAction.class, TypeRenameAction.class, ShowJavaReferencesAction.class};
+ }
+ return new Class[]{ShowJavaReferencesAction.class};
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof TypeRenameAction) {
+ TypeRenameAction action = (TypeRenameAction) menu;
+ action.setOldName(getType().getElementName());
+ action.setType(getType());
+ }
+ else if (menu instanceof ShowJavaReferencesAction) {
+ ((ShowJavaReferencesAction) menu).setElement(getType());
+ }
+ else if (menu instanceof DeleteAction) {
+ ((DeleteAction) menu).addType(getType());
+ ((DeleteAction) menu).setName(getType().getElementName());
+ }
+ }
+
+ @Override
+ public boolean isFolder() {
+ return false;
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ public IType getType() {
+ return m_type;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/CredentialValidationStrategyTablePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/CredentialValidationStrategyTablePage.java
index f417dbdc1..cee04dbfc 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/CredentialValidationStrategyTablePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/CredentialValidationStrategyTablePage.java
@@ -1,150 +1,150 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.ITypeHierarchyChangedListener;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.CredentialValidationStrategyNewAction;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class CredentialValidationStrategyTablePage extends AbstractPage {
-
- private ITypeHierarchy m_hierarchy;
-
- private ITypeHierarchyChangedListener m_hierarchyChangedListener;
-
- public CredentialValidationStrategyTablePage(IPage parent) {
- setParent(parent);
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsIcons.CredentialValidationStrategyFolder));
- setName(Texts.get("CredentialValidation1"));
-
- try {
- m_hierarchy = TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy).newTypeHierarchy(new NullProgressMonitor());
- m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
- m_hierarchy.addTypeHierarchyChangedListener(m_hierarchyChangedListener);
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.CREDENTIAL_VALIDATION_STRATEGY_TABLE_PAGE;
- }
-
- @Override
- public void unloadPage() {
- if (m_hierarchy != null && m_hierarchyChangedListener != null) {
- m_hierarchy.removeTypeHierarchyChangedListener(m_hierarchyChangedListener);
- }
- }
-
- @Override
- public boolean isFolder() {
- return true;
- }
-
- @Override
- public void refresh(boolean clearCache) {
- if (clearCache) {
- try {
- if (m_hierarchy == null) {
- m_hierarchy = TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy).newTypeHierarchy(new NullProgressMonitor());
- m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
- m_hierarchy.addTypeHierarchyChangedListener(m_hierarchyChangedListener);
- }
- else {
- m_hierarchy.refresh(new NullProgressMonitor());
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- }
- super.refresh(clearCache);
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof CredentialValidationStrategyNewAction) {
- ((CredentialValidationStrategyNewAction) menu).init(getScoutResource());
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- return new Class[]{CredentialValidationStrategyNewAction.class};
- }
-
- @Override
- protected void loadChildrenImpl() {
- if (m_hierarchy == null) {
- return;
- }
-
- // Scout SDK hierarchy (IPrimaryTypeTypeHierarchy) cannot be used as type creation events are not propagates because they are created by JDT NewClassWizardPage.
- List<IType> types = new ArrayList<IType>();
- try {
- for (IType type : m_hierarchy.getAllSubtypes(TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy))) {
- if (TypeUtility.isOnClasspath(type, getScoutResource().getJavaProject()) &&
- !type.isInterface() && !Flags.isAbstract(type.getFlags()) && !Signature.getQualifier(type.getFullyQualifiedName()).contains("internal")) {
- types.add(type);
- }
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- JaxWsSdkUtility.sortTypesByName(types, true);
-
- for (IType type : types) {
- new CredentialValidationStrategyNodePage(this, type);
- }
- }
-
- private class P_TypeHierarchyChangedListener implements ITypeHierarchyChangedListener {
-
- @Override
- public void typeHierarchyChanged(ITypeHierarchy typeHierarchy) {
- try {
- m_hierarchy.refresh(new NullProgressMonitor());
- markStructureDirty();
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.ITypeHierarchyChangedListener;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.CredentialValidationStrategyNewAction;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class CredentialValidationStrategyTablePage extends AbstractPage {
+
+ private ITypeHierarchy m_hierarchy;
+
+ private ITypeHierarchyChangedListener m_hierarchyChangedListener;
+
+ public CredentialValidationStrategyTablePage(IPage parent) {
+ setParent(parent);
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsIcons.CredentialValidationStrategyFolder));
+ setName(Texts.get("CredentialValidation1"));
+
+ try {
+ m_hierarchy = TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy).newTypeHierarchy(new NullProgressMonitor());
+ m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
+ m_hierarchy.addTypeHierarchyChangedListener(m_hierarchyChangedListener);
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.CREDENTIAL_VALIDATION_STRATEGY_TABLE_PAGE;
+ }
+
+ @Override
+ public void unloadPage() {
+ if (m_hierarchy != null && m_hierarchyChangedListener != null) {
+ m_hierarchy.removeTypeHierarchyChangedListener(m_hierarchyChangedListener);
+ }
+ }
+
+ @Override
+ public boolean isFolder() {
+ return true;
+ }
+
+ @Override
+ public void refresh(boolean clearCache) {
+ if (clearCache) {
+ try {
+ if (m_hierarchy == null) {
+ m_hierarchy = TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy).newTypeHierarchy(new NullProgressMonitor());
+ m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
+ m_hierarchy.addTypeHierarchyChangedListener(m_hierarchyChangedListener);
+ }
+ else {
+ m_hierarchy.refresh(new NullProgressMonitor());
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+ super.refresh(clearCache);
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof CredentialValidationStrategyNewAction) {
+ ((CredentialValidationStrategyNewAction) menu).init(getScoutResource());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ return new Class[]{CredentialValidationStrategyNewAction.class};
+ }
+
+ @Override
+ protected void loadChildrenImpl() {
+ if (m_hierarchy == null) {
+ return;
+ }
+
+ // Scout SDK hierarchy (IPrimaryTypeTypeHierarchy) cannot be used as type creation events are not propagates because they are created by JDT NewClassWizardPage.
+ List<IType> types = new ArrayList<IType>();
+ try {
+ for (IType type : m_hierarchy.getAllSubtypes(TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy))) {
+ if (TypeUtility.isOnClasspath(type, getScoutResource().getJavaProject()) &&
+ !type.isInterface() && !Flags.isAbstract(type.getFlags()) && !Signature.getQualifier(type.getFullyQualifiedName()).contains("internal")) {
+ types.add(type);
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ JaxWsSdkUtility.sortTypesByName(types, true);
+
+ for (IType type : types) {
+ new CredentialValidationStrategyNodePage(this, type);
+ }
+ }
+
+ private class P_TypeHierarchyChangedListener implements ITypeHierarchyChangedListener {
+
+ @Override
+ public void typeHierarchyChanged(ITypeHierarchy typeHierarchy) {
+ try {
+ m_hierarchy.refresh(new NullProgressMonitor());
+ markStructureDirty();
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/HandlerNodePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/HandlerNodePage.java
index 5d8482ca5..c6d8d8ded 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/HandlerNodePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/HandlerNodePage.java
@@ -1,185 +1,185 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.action.ShowJavaReferencesAction;
-import org.eclipse.scout.sdk.ui.action.delete.DeleteAction;
-import org.eclipse.scout.sdk.ui.action.rename.TypeRenameAction;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.AbstractTypeChangedListener;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
-
-public class HandlerNodePage extends AbstractPage {
-
- private IType m_type;
-
- private boolean m_pageUnloaded = false;
- private Object m_pageLoadedListenerLock;
- private Set<IPageLoadedListener> m_pageLoadedListeners;
- private P_TypeChangeListener m_handlerChangedListener;
-
- private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
-
- public HandlerNodePage(IPage parent, IType type) {
- setParent(parent);
- setName(type.getElementName());
- m_type = type;
- if (type.isBinary()) {
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.HandlerBinary));
- }
- else {
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.Handler));
- }
-
- m_bundle = getScoutResource();
-
- m_pageLoadedListeners = new HashSet<IPageLoadedListener>();
- m_pageLoadedListenerLock = new Object();
-
- m_handlerChangedListener = new P_TypeChangeListener();
- m_handlerChangedListener.setType(m_type);
- ResourcesPlugin.getWorkspace().addResourceChangeListener(m_handlerChangedListener);
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.HANDLER_NODE_PAGE;
- }
-
- @Override
- public void unloadPage() {
- m_pageUnloaded = true;
-
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(m_handlerChangedListener);
- super.unloadPage();
- }
-
- @Override
- public int getQuality() {
- int quality = IMarker.SEVERITY_INFO;
- if (getType().exists()) {
- quality = ScoutSeverityManager.getInstance().getSeverityOf(getType());
- }
- return quality;
- }
-
- @Override
- public boolean handleDoubleClickedDelegate() {
- if (getType() != null) {
- try {
- JavaUI.openInEditor(getType());
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("could not open type in editor", e);
- }
- return true;
- }
- return false;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- if (!m_type.isBinary()) {
- return new Class[]{DeleteAction.class, TypeRenameAction.class, ShowJavaReferencesAction.class};
- }
- return new Class[]{ShowJavaReferencesAction.class};
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof TypeRenameAction) {
- TypeRenameAction action = (TypeRenameAction) menu;
- action.setOldName(getType().getElementName());
- action.setType(getType());
- }
- else if (menu instanceof ShowJavaReferencesAction) {
- ((ShowJavaReferencesAction) menu).setElement(getType());
- }
- else if (menu instanceof DeleteAction) {
- ((DeleteAction) menu).addType(getType());
- ((DeleteAction) menu).setName(getType().getElementName());
- }
- }
-
- @Override
- public boolean isFolder() {
- return false;
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- public void addPageLoadedListener(IPageLoadedListener listener) {
- synchronized (m_pageLoadedListenerLock) {
- m_pageLoadedListeners.add(listener);
- }
- }
-
- public void removePageLoadedListener(IPageLoadedListener listener) {
- synchronized (m_pageLoadedListenerLock) {
- m_pageLoadedListeners.remove(listener);
- }
- }
-
- private void notifyPageLoadedListeners() {
- IPageLoadedListener[] listeners;
- synchronized (m_pageLoadedListenerLock) {
- listeners = m_pageLoadedListeners.toArray(new IPageLoadedListener[m_pageLoadedListeners.size()]);
- }
-
- for (IPageLoadedListener listener : listeners) {
- try {
- listener.pageLoaded();
- }
- catch (Exception e) {
- JaxWsSdk.logError("error while notifying pageLoaded listener", e);
- }
- }
- }
-
- public IType getType() {
- return m_type;
- }
-
- public boolean isPageUnloaded() {
- return m_pageUnloaded;
- }
-
- private class P_TypeChangeListener extends AbstractTypeChangedListener {
-
- @Override
- protected boolean shouldAnalayseForChange(IResourceChangeEvent event) {
- return !isPageUnloaded();
- }
-
- @Override
- protected void typeChanged() {
- markStructureDirty();
- notifyPageLoadedListeners();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.action.ShowJavaReferencesAction;
+import org.eclipse.scout.sdk.ui.action.delete.DeleteAction;
+import org.eclipse.scout.sdk.ui.action.rename.TypeRenameAction;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.AbstractTypeChangedListener;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
+
+public class HandlerNodePage extends AbstractPage {
+
+ private IType m_type;
+
+ private boolean m_pageUnloaded = false;
+ private Object m_pageLoadedListenerLock;
+ private Set<IPageLoadedListener> m_pageLoadedListeners;
+ private P_TypeChangeListener m_handlerChangedListener;
+
+ private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
+
+ public HandlerNodePage(IPage parent, IType type) {
+ setParent(parent);
+ setName(type.getElementName());
+ m_type = type;
+ if (type.isBinary()) {
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.HandlerBinary));
+ }
+ else {
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.Handler));
+ }
+
+ m_bundle = getScoutResource();
+
+ m_pageLoadedListeners = new HashSet<IPageLoadedListener>();
+ m_pageLoadedListenerLock = new Object();
+
+ m_handlerChangedListener = new P_TypeChangeListener();
+ m_handlerChangedListener.setType(m_type);
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(m_handlerChangedListener);
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.HANDLER_NODE_PAGE;
+ }
+
+ @Override
+ public void unloadPage() {
+ m_pageUnloaded = true;
+
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(m_handlerChangedListener);
+ super.unloadPage();
+ }
+
+ @Override
+ public int getQuality() {
+ int quality = IMarker.SEVERITY_INFO;
+ if (getType().exists()) {
+ quality = ScoutSeverityManager.getInstance().getSeverityOf(getType());
+ }
+ return quality;
+ }
+
+ @Override
+ public boolean handleDoubleClickedDelegate() {
+ if (getType() != null) {
+ try {
+ JavaUI.openInEditor(getType());
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("could not open type in editor", e);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ if (!m_type.isBinary()) {
+ return new Class[]{DeleteAction.class, TypeRenameAction.class, ShowJavaReferencesAction.class};
+ }
+ return new Class[]{ShowJavaReferencesAction.class};
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof TypeRenameAction) {
+ TypeRenameAction action = (TypeRenameAction) menu;
+ action.setOldName(getType().getElementName());
+ action.setType(getType());
+ }
+ else if (menu instanceof ShowJavaReferencesAction) {
+ ((ShowJavaReferencesAction) menu).setElement(getType());
+ }
+ else if (menu instanceof DeleteAction) {
+ ((DeleteAction) menu).addType(getType());
+ ((DeleteAction) menu).setName(getType().getElementName());
+ }
+ }
+
+ @Override
+ public boolean isFolder() {
+ return false;
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ public void addPageLoadedListener(IPageLoadedListener listener) {
+ synchronized (m_pageLoadedListenerLock) {
+ m_pageLoadedListeners.add(listener);
+ }
+ }
+
+ public void removePageLoadedListener(IPageLoadedListener listener) {
+ synchronized (m_pageLoadedListenerLock) {
+ m_pageLoadedListeners.remove(listener);
+ }
+ }
+
+ private void notifyPageLoadedListeners() {
+ IPageLoadedListener[] listeners;
+ synchronized (m_pageLoadedListenerLock) {
+ listeners = m_pageLoadedListeners.toArray(new IPageLoadedListener[m_pageLoadedListeners.size()]);
+ }
+
+ for (IPageLoadedListener listener : listeners) {
+ try {
+ listener.pageLoaded();
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("error while notifying pageLoaded listener", e);
+ }
+ }
+ }
+
+ public IType getType() {
+ return m_type;
+ }
+
+ public boolean isPageUnloaded() {
+ return m_pageUnloaded;
+ }
+
+ private class P_TypeChangeListener extends AbstractTypeChangedListener {
+
+ @Override
+ protected boolean shouldAnalayseForChange(IResourceChangeEvent event) {
+ return !isPageUnloaded();
+ }
+
+ @Override
+ protected void typeChanged() {
+ markStructureDirty();
+ notifyPageLoadedListeners();
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/HandlerTablePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/HandlerTablePage.java
index e3f7f7c0e..6fe43449f 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/HandlerTablePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/HandlerTablePage.java
@@ -1,170 +1,170 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import javax.xml.ws.handler.Handler;
-
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.sdk.ScoutSdkCore;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.type.ITypeFilter;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
-import org.eclipse.scout.sdk.util.typecache.ITypeHierarchyChangedListener;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerNewWizardAction;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class HandlerTablePage extends AbstractPage {
-
- private Map<IPrimaryTypeTypeHierarchy, IType> m_handlerHierarchyMap;
-
- private ITypeHierarchyChangedListener m_hierarchyChangedListener;
-
- public HandlerTablePage(IPage parent) {
- setParent(parent);
- setName(Texts.get("Handlers"));
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsIcons.HandlerFolder));
- m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
- m_handlerHierarchyMap = new HashMap<IPrimaryTypeTypeHierarchy, IType>();
-
- for (IType type : TypeUtility.getTypes(Handler.class.getName())) {
- IPrimaryTypeTypeHierarchy hierarchy = TypeUtility.getPrimaryTypeHierarchy(type);
- hierarchy.addHierarchyListener(m_hierarchyChangedListener);
- m_handlerHierarchyMap.put(hierarchy, type);
- }
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.HANDLER_TABLE_PAGE;
- }
-
- @Override
- public void unloadPage() {
- if (m_hierarchyChangedListener != null) {
- for (IPrimaryTypeTypeHierarchy hierarchy : m_handlerHierarchyMap.keySet()) {
- hierarchy.removeHierarchyListener(m_hierarchyChangedListener);
- }
- }
- }
-
- @Override
- public boolean isFolder() {
- return true;
- }
-
- @Override
- public void refresh(boolean clearCache) {
- if (clearCache) {
- for (IPrimaryTypeTypeHierarchy hierarchy : m_handlerHierarchyMap.keySet()) {
- hierarchy.invalidate();
- }
- }
- super.refresh(clearCache);
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof HandlerNewWizardAction) {
- ((HandlerNewWizardAction) menu).init(getScoutResource());
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- return new Class[]{HandlerNewWizardAction.class};
- }
-
- @Override
- protected void loadChildrenImpl() {
- List<IType> types = new ArrayList<IType>();
-
- ITypeFilter filter = new ITypeFilter() {
- @Override
- public boolean accept(IType candidate) {
- try {
- if (!TypeUtility.exists(candidate)) {
- return false;
- }
- if (!candidate.isClass() || candidate.isInterface() || Flags.isAbstract(candidate.getFlags())) {
- return false;
- }
- if (!TypeUtility.isOnClasspath(candidate, getScoutResource().getJavaProject())) {
- return false;
- }
- return true;
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- return false;
- }
- }
- };
-
- for (Entry<IPrimaryTypeTypeHierarchy, IType> entry : m_handlerHierarchyMap.entrySet()) {
- IPrimaryTypeTypeHierarchy hierarchy = entry.getKey();
- IType type = entry.getValue();
- types.addAll(Arrays.asList(hierarchy.getAllSubtypes(type, filter)));
- }
- JaxWsSdkUtility.sortTypesByName(types, true);
-
- for (IType handlerType : types) {
- // skip internal classes
- if (!Signature.getQualifier(handlerType.getFullyQualifiedName()).contains("internal")) {
- // skipt authentication handlers
- if (!JaxWsSdkUtility.isJdtSubType(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer).getFullyQualifiedName(), handlerType) &&
- !JaxWsSdkUtility.isJdtSubType(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider).getFullyQualifiedName(), handlerType)) {
- new HandlerNodePage(this, handlerType);
- }
- }
- }
- }
-
- private class P_TypeHierarchyChangedListener implements ITypeHierarchyChangedListener {
-
- @Override
- public void handleEvent(int eventType, IType type) {
- switch (eventType) {
- // important: ignore CHANGE events to exclude marker updates
- case POST_TYPE_REMOVING:
- case POST_TYPE_ADDING:
- IScoutBundle bundle = ScoutSdkCore.getScoutWorkspace().getScoutBundle(type.getJavaProject().getProject());
- if (bundle.getScoutProject() == getScoutResource().getScoutProject()) {
- markStructureDirty();
- }
- break;
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import javax.xml.ws.handler.Handler;
+
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.sdk.ScoutSdkCore;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.type.ITypeFilter;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
+import org.eclipse.scout.sdk.util.typecache.ITypeHierarchyChangedListener;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerNewWizardAction;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class HandlerTablePage extends AbstractPage {
+
+ private Map<IPrimaryTypeTypeHierarchy, IType> m_handlerHierarchyMap;
+
+ private ITypeHierarchyChangedListener m_hierarchyChangedListener;
+
+ public HandlerTablePage(IPage parent) {
+ setParent(parent);
+ setName(Texts.get("Handlers"));
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsIcons.HandlerFolder));
+ m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
+ m_handlerHierarchyMap = new HashMap<IPrimaryTypeTypeHierarchy, IType>();
+
+ for (IType type : TypeUtility.getTypes(Handler.class.getName())) {
+ IPrimaryTypeTypeHierarchy hierarchy = TypeUtility.getPrimaryTypeHierarchy(type);
+ hierarchy.addHierarchyListener(m_hierarchyChangedListener);
+ m_handlerHierarchyMap.put(hierarchy, type);
+ }
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.HANDLER_TABLE_PAGE;
+ }
+
+ @Override
+ public void unloadPage() {
+ if (m_hierarchyChangedListener != null) {
+ for (IPrimaryTypeTypeHierarchy hierarchy : m_handlerHierarchyMap.keySet()) {
+ hierarchy.removeHierarchyListener(m_hierarchyChangedListener);
+ }
+ }
+ }
+
+ @Override
+ public boolean isFolder() {
+ return true;
+ }
+
+ @Override
+ public void refresh(boolean clearCache) {
+ if (clearCache) {
+ for (IPrimaryTypeTypeHierarchy hierarchy : m_handlerHierarchyMap.keySet()) {
+ hierarchy.invalidate();
+ }
+ }
+ super.refresh(clearCache);
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof HandlerNewWizardAction) {
+ ((HandlerNewWizardAction) menu).init(getScoutResource());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ return new Class[]{HandlerNewWizardAction.class};
+ }
+
+ @Override
+ protected void loadChildrenImpl() {
+ List<IType> types = new ArrayList<IType>();
+
+ ITypeFilter filter = new ITypeFilter() {
+ @Override
+ public boolean accept(IType candidate) {
+ try {
+ if (!TypeUtility.exists(candidate)) {
+ return false;
+ }
+ if (!candidate.isClass() || candidate.isInterface() || Flags.isAbstract(candidate.getFlags())) {
+ return false;
+ }
+ if (!TypeUtility.isOnClasspath(candidate, getScoutResource().getJavaProject())) {
+ return false;
+ }
+ return true;
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ return false;
+ }
+ }
+ };
+
+ for (Entry<IPrimaryTypeTypeHierarchy, IType> entry : m_handlerHierarchyMap.entrySet()) {
+ IPrimaryTypeTypeHierarchy hierarchy = entry.getKey();
+ IType type = entry.getValue();
+ types.addAll(Arrays.asList(hierarchy.getAllSubtypes(type, filter)));
+ }
+ JaxWsSdkUtility.sortTypesByName(types, true);
+
+ for (IType handlerType : types) {
+ // skip internal classes
+ if (!Signature.getQualifier(handlerType.getFullyQualifiedName()).contains("internal")) {
+ // skipt authentication handlers
+ if (!JaxWsSdkUtility.isJdtSubType(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer).getFullyQualifiedName(), handlerType) &&
+ !JaxWsSdkUtility.isJdtSubType(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider).getFullyQualifiedName(), handlerType)) {
+ new HandlerNodePage(this, handlerType);
+ }
+ }
+ }
+ }
+
+ private class P_TypeHierarchyChangedListener implements ITypeHierarchyChangedListener {
+
+ @Override
+ public void handleEvent(int eventType, IType type) {
+ switch (eventType) {
+ // important: ignore CHANGE events to exclude marker updates
+ case POST_TYPE_REMOVING:
+ case POST_TYPE_ADDING:
+ IScoutBundle bundle = ScoutSdkCore.getScoutWorkspace().getScoutBundle(type.getJavaProject().getProject());
+ if (bundle.getScoutProject() == getScoutResource().getScoutProject()) {
+ markStructureDirty();
+ }
+ break;
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/IJaxWsPageConstants.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/IJaxWsPageConstants.java
index 713c744a3..69105f85f 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/IJaxWsPageConstants.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/IJaxWsPageConstants.java
@@ -1,31 +1,31 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-public abstract interface IJaxWsPageConstants {
- public static final String WEBSERVICES_TABLE_PAGE = WebServicesTablePage.class.getName();
- public static final String PROVIDER_TABLE_PAGE = ProviderTablePage.class.getName();
- public static final String CONSUMER_TABLE_PAGE = ConsumerTablePage.class.getName();
- public static final String WEBSERVICE_PROVIDER_TABLE_PAGE = WebServiceProviderTablePage.class.getName();
- public static final String PROVIDER_NODE_PAGE = WebServiceProviderNodePage.class.getName();
- public static final String PROVIDER_CODE_FIRST_NODE_PAGE = WebServiceProviderCodeFirstNodePage.class.getName();
- public static final String WEBSERVICE_CONSUMER_TABLE_PAGE = WebServiceConsumerTablePage.class.getName();
- public static final String CONSUMER_NODE_PAGE = WebServiceConsumerNodePage.class.getName();
- public static final String PROVIDER_HANDLER_NODE_PAGE = WebServiceProviderHandlerNodePage.class.getName();
- public static final String HANDLER_TABLE_PAGE = HandlerTablePage.class.getName();
- public static final String HANDLER_NODE_PAGE = HandlerNodePage.class.getName();
- public static final String SESSION_FACTORY_TABLE_PAGE = SessionFactoryTablePage.class.getName();
- public static final String SESSION_FACTORY_NODE_PAGE = SessionFactoryNodePage.class.getName();
- public static final String CREDENTIAL_VALIDATION_STRATEGY_TABLE_PAGE = CredentialValidationStrategyTablePage.class.getName();
- public static final String CREDENTIAL_VALIDATION_STRATEGY_NODE_PAGE = CredentialValidationStrategyNodePage.class.getName();
- public static final String AUTHENTICATION_HANDLER_TABLE_PAGE = AuthenticationHandlerTablePage.class.getName();
- public static final String AUTHENTICATION_HANDLER_NODE_PAGE = AuthenticationHandlerNodePage.class.getName();
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+public abstract interface IJaxWsPageConstants {
+ public static final String WEBSERVICES_TABLE_PAGE = WebServicesTablePage.class.getName();
+ public static final String PROVIDER_TABLE_PAGE = ProviderTablePage.class.getName();
+ public static final String CONSUMER_TABLE_PAGE = ConsumerTablePage.class.getName();
+ public static final String WEBSERVICE_PROVIDER_TABLE_PAGE = WebServiceProviderTablePage.class.getName();
+ public static final String PROVIDER_NODE_PAGE = WebServiceProviderNodePage.class.getName();
+ public static final String PROVIDER_CODE_FIRST_NODE_PAGE = WebServiceProviderCodeFirstNodePage.class.getName();
+ public static final String WEBSERVICE_CONSUMER_TABLE_PAGE = WebServiceConsumerTablePage.class.getName();
+ public static final String CONSUMER_NODE_PAGE = WebServiceConsumerNodePage.class.getName();
+ public static final String PROVIDER_HANDLER_NODE_PAGE = WebServiceProviderHandlerNodePage.class.getName();
+ public static final String HANDLER_TABLE_PAGE = HandlerTablePage.class.getName();
+ public static final String HANDLER_NODE_PAGE = HandlerNodePage.class.getName();
+ public static final String SESSION_FACTORY_TABLE_PAGE = SessionFactoryTablePage.class.getName();
+ public static final String SESSION_FACTORY_NODE_PAGE = SessionFactoryNodePage.class.getName();
+ public static final String CREDENTIAL_VALIDATION_STRATEGY_TABLE_PAGE = CredentialValidationStrategyTablePage.class.getName();
+ public static final String CREDENTIAL_VALIDATION_STRATEGY_NODE_PAGE = CredentialValidationStrategyNodePage.class.getName();
+ public static final String AUTHENTICATION_HANDLER_TABLE_PAGE = AuthenticationHandlerTablePage.class.getName();
+ public static final String AUTHENTICATION_HANDLER_NODE_PAGE = AuthenticationHandlerNodePage.class.getName();
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/ProviderTablePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/ProviderTablePage.java
index ff7d0aaf3..bc8368ac5 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/ProviderTablePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/ProviderTablePage.java
@@ -1,62 +1,62 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.JaxWsAliasChangeWizardAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-
-public class ProviderTablePage extends AbstractPage {
-
- public ProviderTablePage(IPage parent) {
- setParent(parent);
- setName(Texts.get("Provider"));
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.PROVIDER_TABLE_PAGE;
- }
-
- @Override
- public boolean isFolder() {
- return true;
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof JaxWsAliasChangeWizardAction) {
- ((JaxWsAliasChangeWizardAction) menu).init(getScoutResource());
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- return new Class[]{JaxWsAliasChangeWizardAction.class};
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- @Override
- protected void loadChildrenImpl() {
- new WebServiceProviderTablePage(this);
- new AuthenticationHandlerTablePage(this, WebserviceEnum.Provider);
- new CredentialValidationStrategyTablePage(this);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.JaxWsAliasChangeWizardAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+
+public class ProviderTablePage extends AbstractPage {
+
+ public ProviderTablePage(IPage parent) {
+ setParent(parent);
+ setName(Texts.get("Provider"));
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.PROVIDER_TABLE_PAGE;
+ }
+
+ @Override
+ public boolean isFolder() {
+ return true;
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof JaxWsAliasChangeWizardAction) {
+ ((JaxWsAliasChangeWizardAction) menu).init(getScoutResource());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ return new Class[]{JaxWsAliasChangeWizardAction.class};
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ @Override
+ protected void loadChildrenImpl() {
+ new WebServiceProviderTablePage(this);
+ new AuthenticationHandlerTablePage(this, WebserviceEnum.Provider);
+ new CredentialValidationStrategyTablePage(this);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/SessionFactoryNodePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/SessionFactoryNodePage.java
index e5672da69..5582c4b25 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/SessionFactoryNodePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/SessionFactoryNodePage.java
@@ -1,112 +1,112 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.action.ShowJavaReferencesAction;
-import org.eclipse.scout.sdk.ui.action.delete.DeleteAction;
-import org.eclipse.scout.sdk.ui.action.rename.TypeRenameAction;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-
-public class SessionFactoryNodePage extends AbstractPage {
-
- private IType m_type;
-
- private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
-
- public SessionFactoryNodePage(IPage parent, IType type) {
- setParent(parent);
- setName(type.getElementName());
- m_type = type;
- if (type.isBinary()) {
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.SessionFactoryBinary));
- }
- else {
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.SessionFactory));
- }
-
- m_bundle = getScoutResource();
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.SESSION_FACTORY_NODE_PAGE;
- }
-
- @Override
- public int getQuality() {
- int quality = IMarker.SEVERITY_INFO;
- if (getType().exists()) {
- quality = ScoutSeverityManager.getInstance().getSeverityOf(getType());
- }
- return quality;
- }
-
- @Override
- public boolean handleDoubleClickedDelegate() {
- if (getType() != null) {
- try {
- JavaUI.openInEditor(getType());
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("could not open type in editor", e);
- }
- return true;
- }
- return false;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- if (!m_type.isBinary()) {
- return new Class[]{DeleteAction.class, TypeRenameAction.class, ShowJavaReferencesAction.class};
- }
- return new Class[]{ShowJavaReferencesAction.class};
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof TypeRenameAction) {
- TypeRenameAction action = (TypeRenameAction) menu;
- action.setOldName(getType().getElementName());
- action.setType(getType());
- }
- else if (menu instanceof ShowJavaReferencesAction) {
- ((ShowJavaReferencesAction) menu).setElement(getType());
- }
- else if (menu instanceof DeleteAction) {
- ((DeleteAction) menu).addType(getType());
- ((DeleteAction) menu).setName(getType().getElementName());
- }
- }
-
- @Override
- public boolean isFolder() {
- return false;
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- public IType getType() {
- return m_type;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.action.ShowJavaReferencesAction;
+import org.eclipse.scout.sdk.ui.action.delete.DeleteAction;
+import org.eclipse.scout.sdk.ui.action.rename.TypeRenameAction;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+
+public class SessionFactoryNodePage extends AbstractPage {
+
+ private IType m_type;
+
+ private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
+
+ public SessionFactoryNodePage(IPage parent, IType type) {
+ setParent(parent);
+ setName(type.getElementName());
+ m_type = type;
+ if (type.isBinary()) {
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.SessionFactoryBinary));
+ }
+ else {
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.SessionFactory));
+ }
+
+ m_bundle = getScoutResource();
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.SESSION_FACTORY_NODE_PAGE;
+ }
+
+ @Override
+ public int getQuality() {
+ int quality = IMarker.SEVERITY_INFO;
+ if (getType().exists()) {
+ quality = ScoutSeverityManager.getInstance().getSeverityOf(getType());
+ }
+ return quality;
+ }
+
+ @Override
+ public boolean handleDoubleClickedDelegate() {
+ if (getType() != null) {
+ try {
+ JavaUI.openInEditor(getType());
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("could not open type in editor", e);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ if (!m_type.isBinary()) {
+ return new Class[]{DeleteAction.class, TypeRenameAction.class, ShowJavaReferencesAction.class};
+ }
+ return new Class[]{ShowJavaReferencesAction.class};
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof TypeRenameAction) {
+ TypeRenameAction action = (TypeRenameAction) menu;
+ action.setOldName(getType().getElementName());
+ action.setType(getType());
+ }
+ else if (menu instanceof ShowJavaReferencesAction) {
+ ((ShowJavaReferencesAction) menu).setElement(getType());
+ }
+ else if (menu instanceof DeleteAction) {
+ ((DeleteAction) menu).addType(getType());
+ ((DeleteAction) menu).setName(getType().getElementName());
+ }
+ }
+
+ @Override
+ public boolean isFolder() {
+ return false;
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ public IType getType() {
+ return m_type;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/SessionFactoryTablePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/SessionFactoryTablePage.java
index d51aa3675..46260f933 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/SessionFactoryTablePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/SessionFactoryTablePage.java
@@ -1,151 +1,151 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.ITypeHierarchyChangedListener;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.SessionFactoryNewAction;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class SessionFactoryTablePage extends AbstractPage {
-
- private ITypeHierarchy m_hierarchy;
-
- private ITypeHierarchyChangedListener m_hierarchyChangedListener;
-
- public SessionFactoryTablePage(IPage parent) {
- setParent(parent);
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsIcons.SessionFactoryFolder));
- setName(Texts.get("SessionFactories1"));
-
- try {
- m_hierarchy = TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory).newTypeHierarchy(new NullProgressMonitor());
- m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
- m_hierarchy.addTypeHierarchyChangedListener(m_hierarchyChangedListener);
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.SESSION_FACTORY_TABLE_PAGE;
- }
-
- @Override
- public void unloadPage() {
- if (m_hierarchy != null && m_hierarchyChangedListener != null) {
- m_hierarchy.removeTypeHierarchyChangedListener(m_hierarchyChangedListener);
- }
- }
-
- @Override
- public boolean isFolder() {
- return true;
- }
-
- @Override
- public void refresh(boolean clearCache) {
- if (clearCache) {
- try {
- if (m_hierarchy == null) {
- m_hierarchy = TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory).newTypeHierarchy(new NullProgressMonitor());
- m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
- m_hierarchy.addTypeHierarchyChangedListener(m_hierarchyChangedListener);
- }
- else {
- m_hierarchy.refresh(new NullProgressMonitor());
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- }
- super.refresh(clearCache);
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof SessionFactoryNewAction) {
- ((SessionFactoryNewAction) menu).init(getScoutResource());
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- return new Class[]{SessionFactoryNewAction.class};
- }
-
- @Override
- protected void loadChildrenImpl() {
- if (m_hierarchy == null) {
- return;
- }
-
- // Scout SDK hierarchy (IPrimaryTypeTypeHierarchy) cannot be used as type creation events are not propagates because they are created by JDT NewClassWizardPage.
- List<IType> types = new ArrayList<IType>();
- try {
- for (IType type : m_hierarchy.getAllSubtypes(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory))) {
- if (TypeUtility.isOnClasspath(type, getScoutResource().getJavaProject()) &&
- !type.isInterface() && !Flags.isAbstract(type.getFlags()) &&
- !Signature.getQualifier(type.getFullyQualifiedName()).contains("internal")) {
- types.add(type);
- }
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- JaxWsSdkUtility.sortTypesByName(types, true);
-
- for (IType type : types) {
- new SessionFactoryNodePage(this, type);
- }
- }
-
- private class P_TypeHierarchyChangedListener implements ITypeHierarchyChangedListener {
-
- @Override
- public void typeHierarchyChanged(ITypeHierarchy typeHierarchy) {
- try {
- m_hierarchy.refresh(new NullProgressMonitor());
- markStructureDirty();
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.ITypeHierarchyChangedListener;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.SessionFactoryNewAction;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class SessionFactoryTablePage extends AbstractPage {
+
+ private ITypeHierarchy m_hierarchy;
+
+ private ITypeHierarchyChangedListener m_hierarchyChangedListener;
+
+ public SessionFactoryTablePage(IPage parent) {
+ setParent(parent);
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsIcons.SessionFactoryFolder));
+ setName(Texts.get("SessionFactories1"));
+
+ try {
+ m_hierarchy = TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory).newTypeHierarchy(new NullProgressMonitor());
+ m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
+ m_hierarchy.addTypeHierarchyChangedListener(m_hierarchyChangedListener);
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.SESSION_FACTORY_TABLE_PAGE;
+ }
+
+ @Override
+ public void unloadPage() {
+ if (m_hierarchy != null && m_hierarchyChangedListener != null) {
+ m_hierarchy.removeTypeHierarchyChangedListener(m_hierarchyChangedListener);
+ }
+ }
+
+ @Override
+ public boolean isFolder() {
+ return true;
+ }
+
+ @Override
+ public void refresh(boolean clearCache) {
+ if (clearCache) {
+ try {
+ if (m_hierarchy == null) {
+ m_hierarchy = TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory).newTypeHierarchy(new NullProgressMonitor());
+ m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
+ m_hierarchy.addTypeHierarchyChangedListener(m_hierarchyChangedListener);
+ }
+ else {
+ m_hierarchy.refresh(new NullProgressMonitor());
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+ super.refresh(clearCache);
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof SessionFactoryNewAction) {
+ ((SessionFactoryNewAction) menu).init(getScoutResource());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ return new Class[]{SessionFactoryNewAction.class};
+ }
+
+ @Override
+ protected void loadChildrenImpl() {
+ if (m_hierarchy == null) {
+ return;
+ }
+
+ // Scout SDK hierarchy (IPrimaryTypeTypeHierarchy) cannot be used as type creation events are not propagates because they are created by JDT NewClassWizardPage.
+ List<IType> types = new ArrayList<IType>();
+ try {
+ for (IType type : m_hierarchy.getAllSubtypes(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory))) {
+ if (TypeUtility.isOnClasspath(type, getScoutResource().getJavaProject()) &&
+ !type.isInterface() && !Flags.isAbstract(type.getFlags()) &&
+ !Signature.getQualifier(type.getFullyQualifiedName()).contains("internal")) {
+ types.add(type);
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ JaxWsSdkUtility.sortTypesByName(types, true);
+
+ for (IType type : types) {
+ new SessionFactoryNodePage(this, type);
+ }
+ }
+
+ private class P_TypeHierarchyChangedListener implements ITypeHierarchyChangedListener {
+
+ @Override
+ public void typeHierarchyChanged(ITypeHierarchy typeHierarchy) {
+ try {
+ m_hierarchy.refresh(new NullProgressMonitor());
+ markStructureDirty();
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceConsumerNodePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceConsumerNodePage.java
index 990d06137..993a6dd7b 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceConsumerNodePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceConsumerNodePage.java
@@ -1,451 +1,451 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import javax.wsdl.Definition;
-import javax.xml.namespace.QName;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractScoutTypePage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.util.pde.PluginModelHelper;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.marker.IMarkerRebuildListener;
-import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerRebuildUtility;
-import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ManagedResource;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.RefreshAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.StubRebuildAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.WsConsumerDeleteAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.AbstractTypeChangedListener;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageReloadNotification;
-
-public class WebServiceConsumerNodePage extends AbstractScoutTypePage implements IMarkerRebuildListener, IPageReloadNotification {
-
- public static final int DATA_BUILD_JAXWS_ENTRY = 1 << 0;
- public static final int DATA_WSDL_FILE = 1 << 1;
- public static final int DATA_BINDING_FILE = 1 << 2;
- public static final int DATA_STUB_FILES = 1 << 3;
- public static final int DATA_JDT_TYPE = 1 << 4;
-
- private Object m_pageLoadedListenerLock;
- private boolean m_pageUnloaded = false;
- private String m_markerGroupUUID;
- private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
- private BuildJaxWsBean m_buildJaxWsBean;
-
- private IResourceListener m_buildJaxWsResourceListener;
- private IResourceListener m_wsdlResourceListener;
- private IResourceListener m_bindingFileResourceListener;
- private Set<IPageLoadedListener> m_pageLoadedListeners;
- private IResourceListener m_manifestResourceListener;
- private IResourceListener m_stubJarResourceListener;
- private P_TypeChangeListener m_typeChangedListener;
-
- private WsdlResource m_wsdlResource;
- private Definition m_wsdlDefinition;
- private XmlResource[] m_bindingFileResources;
- private ManagedResource m_manifestResource;
- private ManagedResource m_stubJarResource;
-
- public WebServiceConsumerNodePage(IPage parent, IType type) {
- setParent(parent);
- setType(type);
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.WebserviceConsumer));
-
- m_bundle = getScoutResource();
- m_markerGroupUUID = UUID.randomUUID().toString();
-
- m_wsdlResource = new WsdlResource(m_bundle);
- m_wsdlResourceListener = new P_WsdlResourceListener();
-
- m_manifestResource = new ManagedResource(m_bundle.getProject());
- m_manifestResource.setFile(new PluginModelHelper(m_bundle.getProject()).Manifest.getFile());
- m_manifestResourceListener = new P_ManifestResourceListener();
-
- m_stubJarResource = new ManagedResource(m_bundle.getProject());
- m_stubJarResourceListener = new P_StubJarResourceListener();
-
- m_buildJaxWsResourceListener = new P_BuildJaxWsListener();
-
- m_bindingFileResources = new XmlResource[0];
- m_bindingFileResourceListener = new P_BindingFileResourceListener();
-
- m_pageLoadedListeners = new HashSet<IPageLoadedListener>();
- m_pageLoadedListenerLock = new Object();
-
- // register for events being of interest
- getBuildJaxWsResource().addResourceListener(getType().getElementName(), m_buildJaxWsResourceListener);
- getWsdlResource().addResourceListener(IResourceListener.EVENT_WSDL_REPLACED | IResourceListener.EVENT_UNKNOWN | IResourceListener.EVENT_STUB_REBUILT, m_wsdlResourceListener);
- m_manifestResource.addResourceListener(IResourceListener.EVENT_MANIFEST_CLASSPATH | IResourceListener.EVENT_UNKNOWN, m_manifestResourceListener);
- m_stubJarResource.addResourceListener(m_stubJarResourceListener);
-
- // register page to receive page reload notification
- JaxWsSdk.getDefault().registerPage(WebServiceConsumerNodePage.class, this);
-
- m_typeChangedListener = new P_TypeChangeListener();
- m_typeChangedListener.setType(getType());
- ResourcesPlugin.getWorkspace().addResourceChangeListener(m_typeChangedListener);
-
- reloadPage(DATA_BINDING_FILE | DATA_BUILD_JAXWS_ENTRY | DATA_WSDL_FILE | DATA_STUB_FILES);
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.CONSUMER_NODE_PAGE;
- }
-
- @Override
- public boolean isFolder() {
- return false;
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- List<Class<? extends IScoutHandler>> list = new ArrayList<Class<? extends IScoutHandler>>();
- for (Class<? extends IScoutHandler> c : super.getSupportedMenuActions()) {
- list.add(c);
- }
-
- if (getBuildJaxWsBean() != null &&
- !MarkerUtility.containsMarker(m_bundle, MarkerType.StubFolder, getMarkerGroupUUID(), IMarker.SEVERITY_ERROR) &&
- !MarkerUtility.containsMarker(m_bundle, MarkerType.Wsdl, getMarkerGroupUUID(), IMarker.SEVERITY_ERROR)) {
- list.add(StubRebuildAction.class);
- }
- list.add(RefreshAction.class);
- list.add(WsConsumerDeleteAction.class);
- return list.toArray(new Class[list.size()]);
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- super.prepareMenuAction(menu);
- if (menu instanceof WsConsumerDeleteAction) {
- ((WsConsumerDeleteAction) menu).init(m_bundle, getType(), getBuildJaxWsBean());
- }
- else if (menu instanceof StubRebuildAction) {
- ((StubRebuildAction) menu).init(m_bundle, getBuildJaxWsBean(), getWsdlResource(), m_markerGroupUUID, WebserviceEnum.Consumer);
- }
- }
-
- @Override
- public void reloadPage(int dataMask) {
- try {
- if ((dataMask & DATA_BUILD_JAXWS_ENTRY) > 0) {
- if (getBuildJaxWsBean() == null) {
- m_buildJaxWsBean = BuildJaxWsBean.load(m_bundle, getType().getElementName(), WebserviceEnum.Consumer);
- }
- else {
- m_buildJaxWsBean.reload(m_bundle);
- }
- if (m_buildJaxWsBean != null) {
- m_stubJarResource.setFile(JaxWsSdkUtility.getStubJarFile(m_bundle, m_buildJaxWsBean, m_buildJaxWsBean.getWsdl()));
- }
- }
- if ((dataMask & DATA_WSDL_FILE) > 0) {
- m_wsdlDefinition = loadWsdlDefinition();
- }
- if ((dataMask & DATA_BINDING_FILE) > 0) {
- m_bindingFileResources = loadBindingFiles();
- }
- if ((dataMask & DATA_STUB_FILES) > 0) {
- m_stubJarResource.setFile(JaxWsSdkUtility.getStubJarFile(m_bundle, m_buildJaxWsBean, m_buildJaxWsBean.getWsdl()));
- }
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- }
-
- // notify listeners
- notifyPageLoadedListeners();
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
- }
-
- @Override
- public void refresh(boolean clearCache) {
- if (clearCache) {
- reloadPage(DATA_BINDING_FILE | DATA_BUILD_JAXWS_ENTRY | DATA_WSDL_FILE);
- }
- else {
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
- }
- super.refresh(clearCache);
- }
-
- @Override
- public void unloadPage() {
- m_pageUnloaded = true;
-
- MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
- getBuildJaxWsResource().removeResourceListener(m_buildJaxWsResourceListener);
- getWsdlResource().removeResourceListener(m_wsdlResourceListener);
- m_manifestResource.removeResourceListener(m_manifestResourceListener);
- m_stubJarResource.removeResourceListener(m_stubJarResourceListener);
-
- for (XmlResource resource : m_bindingFileResources) {
- resource.removeResourceListener(m_bindingFileResourceListener);
- }
-
- // unregister page to not receive page reload notification anymore
- JaxWsSdk.getDefault().unregisterPage(WebServiceConsumerNodePage.class, this);
-
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(m_typeChangedListener);
-
- super.unloadPage();
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- @Override
- public int getQuality() {
- int quality = MarkerUtility.getQuality(this, m_bundle, m_markerGroupUUID);
-
- if (quality == IMarker.SEVERITY_ERROR) {
- return quality;
- }
-
- if (TypeUtility.exists(getType())) {
- quality = Math.max(quality, ScoutSeverityManager.getInstance().getSeverityOf(getType()));
- }
- return quality;
- }
-
- @Override
- public void rebuildMarkers() {
- synchronized (m_markerGroupUUID) {
- try {
- MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
-
- if (isPageUnloaded() || !TypeUtility.exists(getType())) {
- return;
- }
- if (!MarkerRebuildUtility.rebuildBuildJaxWsMarkers(getBuildJaxWsResource().getFile(), m_buildJaxWsBean, getType().getElementName(), m_wsdlResource, m_markerGroupUUID, m_bundle, WebserviceEnum.Consumer)) {
- return;
- }
- if (!MarkerRebuildUtility.rebuildBindingFileMarkers(getBuildJaxWsResource().getFile(), m_bindingFileResources, m_wsdlResource, m_markerGroupUUID, m_bundle)) {
- return;
- }
- if (!MarkerRebuildUtility.rebuildWebserviceClientType(getType(), m_buildJaxWsBean, m_wsdlResource, m_markerGroupUUID, m_bundle)) {
- return;
- }
- if (!MarkerRebuildUtility.rebuildWsdlMarkers(m_wsdlResource, m_buildJaxWsBean, null, m_markerGroupUUID, m_bundle)) {
- return;
- }
-
- QName portTypeQName = JaxWsSdkUtility.extractPortTypeQNameFromWsClient(getType());
- QName serviceQName = JaxWsSdkUtility.extractServiceQNameFromWsClient(getType());
- MarkerRebuildUtility.rebuildStubJarFileMarkers(m_buildJaxWsBean, m_wsdlResource, portTypeQName, serviceQName, m_bundle, m_markerGroupUUID);
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("failed to update markers", e);
- }
- finally {
- Set<IResource> resources = new HashSet<IResource>();
- if (JaxWsSdkUtility.exists(getBuildJaxWsResource().getFile())) {
- resources.add(getBuildJaxWsResource().getFile());
- }
- if (JaxWsSdkUtility.exists(getWsdlResource().getFile())) {
- resources.add(getWsdlResource().getFile());
- }
- for (XmlResource resource : m_bindingFileResources) {
- if (JaxWsSdkUtility.exists(resource.getFile())) {
- resources.add(resource.getFile());
- }
- }
- ScoutSeverityManager.getInstance().fireSeverityChanged(resources);
- }
- }
- }
-
- private Definition loadWsdlDefinition() {
- if (m_buildJaxWsBean == null) {
- return null;
- }
- IFile file = JaxWsSdkUtility.getFile(m_bundle, m_buildJaxWsBean.getWsdl(), false);
- if (!getWsdlResource().isSameFile(file)) {
- getWsdlResource().setFile(file);
- }
- return getWsdlResource().loadWsdlDefinition();
- }
-
- private XmlResource[] loadBindingFiles() {
- for (XmlResource resource : m_bindingFileResources) {
- resource.removeResourceListener(m_bindingFileResourceListener);
- }
-
- List<XmlResource> bindingFileResources = new LinkedList<XmlResource>();
-
- if (m_buildJaxWsBean != null) {
- IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(m_bundle, m_buildJaxWsBean.getPropertiers());
- for (IFile bindingFile : bindingFiles) {
- XmlResource xmlResource = new XmlResource(m_bundle);
- xmlResource.setFile(bindingFile);
- xmlResource.addResourceListener(m_bindingFileResourceListener);
- bindingFileResources.add(xmlResource);
- }
- }
-
- return bindingFileResources.toArray(new XmlResource[bindingFileResources.size()]);
- }
-
- @Override
- public WebServiceConsumerTablePage getParent() {
- return (WebServiceConsumerTablePage) super.getParent();
- }
-
- @Override
- public String getMarkerGroupUUID() {
- return m_markerGroupUUID;
- }
-
- public BuildJaxWsBean getBuildJaxWsBean() {
- return m_buildJaxWsBean;
- }
-
- public Definition getWsdlDefinition() {
- if (m_wsdlDefinition == null) {
- m_wsdlDefinition = loadWsdlDefinition();
- }
- return m_wsdlDefinition;
- }
-
- public void addPageLoadedListener(IPageLoadedListener listener) {
- synchronized (m_pageLoadedListenerLock) {
- m_pageLoadedListeners.add(listener);
- }
- }
-
- public void removePageLoadedListener(IPageLoadedListener listener) {
- synchronized (m_pageLoadedListenerLock) {
- m_pageLoadedListeners.remove(listener);
- }
- }
-
- private void notifyPageLoadedListeners() {
- IPageLoadedListener[] listeners;
- synchronized (m_pageLoadedListenerLock) {
- listeners = m_pageLoadedListeners.toArray(new IPageLoadedListener[m_pageLoadedListeners.size()]);
- }
-
- for (IPageLoadedListener listener : listeners) {
- try {
- listener.pageLoaded();
- }
- catch (Exception e) {
- JaxWsSdk.logError("error while notifying pageLoaded listener", e);
- }
- }
- }
-
- public XmlResource getBuildJaxWsResource() {
- return ResourceFactory.getBuildJaxWsResource(m_bundle);
- }
-
- public WsdlResource getWsdlResource() {
- return m_wsdlResource;
- }
-
- public XmlResource[] getBindingFileResources() {
- return m_bindingFileResources;
- }
-
- public boolean isPageUnloaded() {
- return m_pageUnloaded;
- }
-
- private class P_BuildJaxWsListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- if (event == IResourceListener.EVENT_BUILDJAXWS_PROPERTIES_CHANGED ||
- event == IResourceListener.EVENT_SUNJAXWS_WSDL_CHANGED) {
- reloadPage(DATA_BUILD_JAXWS_ENTRY | DATA_WSDL_FILE);
- }
- else {
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(WebServiceConsumerNodePage.this);
- }
- }
- }
-
- private class P_WsdlResourceListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- reloadPage(DATA_WSDL_FILE);
- }
- }
-
- private class P_BindingFileResourceListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- reloadPage(DATA_BINDING_FILE);
- }
- }
-
- private class P_ManifestResourceListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- reloadPage(DATA_STUB_FILES); // Bundle-ClassPath
- }
- }
-
- private class P_StubJarResourceListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- reloadPage(DATA_STUB_FILES);
- }
- }
-
- private class P_TypeChangeListener extends AbstractTypeChangedListener {
-
- @Override
- protected boolean shouldAnalayseForChange(IResourceChangeEvent event) {
- return !isPageUnloaded();
- }
-
- @Override
- protected void typeChanged() {
- reloadPage(DATA_JDT_TYPE);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractScoutTypePage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.util.pde.PluginModelHelper;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.marker.IMarkerRebuildListener;
+import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerRebuildUtility;
+import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ManagedResource;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.RefreshAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.StubRebuildAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.WsConsumerDeleteAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.AbstractTypeChangedListener;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageReloadNotification;
+
+public class WebServiceConsumerNodePage extends AbstractScoutTypePage implements IMarkerRebuildListener, IPageReloadNotification {
+
+ public static final int DATA_BUILD_JAXWS_ENTRY = 1 << 0;
+ public static final int DATA_WSDL_FILE = 1 << 1;
+ public static final int DATA_BINDING_FILE = 1 << 2;
+ public static final int DATA_STUB_FILES = 1 << 3;
+ public static final int DATA_JDT_TYPE = 1 << 4;
+
+ private Object m_pageLoadedListenerLock;
+ private boolean m_pageUnloaded = false;
+ private String m_markerGroupUUID;
+ private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
+ private BuildJaxWsBean m_buildJaxWsBean;
+
+ private IResourceListener m_buildJaxWsResourceListener;
+ private IResourceListener m_wsdlResourceListener;
+ private IResourceListener m_bindingFileResourceListener;
+ private Set<IPageLoadedListener> m_pageLoadedListeners;
+ private IResourceListener m_manifestResourceListener;
+ private IResourceListener m_stubJarResourceListener;
+ private P_TypeChangeListener m_typeChangedListener;
+
+ private WsdlResource m_wsdlResource;
+ private Definition m_wsdlDefinition;
+ private XmlResource[] m_bindingFileResources;
+ private ManagedResource m_manifestResource;
+ private ManagedResource m_stubJarResource;
+
+ public WebServiceConsumerNodePage(IPage parent, IType type) {
+ setParent(parent);
+ setType(type);
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.WebserviceConsumer));
+
+ m_bundle = getScoutResource();
+ m_markerGroupUUID = UUID.randomUUID().toString();
+
+ m_wsdlResource = new WsdlResource(m_bundle);
+ m_wsdlResourceListener = new P_WsdlResourceListener();
+
+ m_manifestResource = new ManagedResource(m_bundle.getProject());
+ m_manifestResource.setFile(new PluginModelHelper(m_bundle.getProject()).Manifest.getFile());
+ m_manifestResourceListener = new P_ManifestResourceListener();
+
+ m_stubJarResource = new ManagedResource(m_bundle.getProject());
+ m_stubJarResourceListener = new P_StubJarResourceListener();
+
+ m_buildJaxWsResourceListener = new P_BuildJaxWsListener();
+
+ m_bindingFileResources = new XmlResource[0];
+ m_bindingFileResourceListener = new P_BindingFileResourceListener();
+
+ m_pageLoadedListeners = new HashSet<IPageLoadedListener>();
+ m_pageLoadedListenerLock = new Object();
+
+ // register for events being of interest
+ getBuildJaxWsResource().addResourceListener(getType().getElementName(), m_buildJaxWsResourceListener);
+ getWsdlResource().addResourceListener(IResourceListener.EVENT_WSDL_REPLACED | IResourceListener.EVENT_UNKNOWN | IResourceListener.EVENT_STUB_REBUILT, m_wsdlResourceListener);
+ m_manifestResource.addResourceListener(IResourceListener.EVENT_MANIFEST_CLASSPATH | IResourceListener.EVENT_UNKNOWN, m_manifestResourceListener);
+ m_stubJarResource.addResourceListener(m_stubJarResourceListener);
+
+ // register page to receive page reload notification
+ JaxWsSdk.getDefault().registerPage(WebServiceConsumerNodePage.class, this);
+
+ m_typeChangedListener = new P_TypeChangeListener();
+ m_typeChangedListener.setType(getType());
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(m_typeChangedListener);
+
+ reloadPage(DATA_BINDING_FILE | DATA_BUILD_JAXWS_ENTRY | DATA_WSDL_FILE | DATA_STUB_FILES);
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.CONSUMER_NODE_PAGE;
+ }
+
+ @Override
+ public boolean isFolder() {
+ return false;
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ List<Class<? extends IScoutHandler>> list = new ArrayList<Class<? extends IScoutHandler>>();
+ for (Class<? extends IScoutHandler> c : super.getSupportedMenuActions()) {
+ list.add(c);
+ }
+
+ if (getBuildJaxWsBean() != null &&
+ !MarkerUtility.containsMarker(m_bundle, MarkerType.StubFolder, getMarkerGroupUUID(), IMarker.SEVERITY_ERROR) &&
+ !MarkerUtility.containsMarker(m_bundle, MarkerType.Wsdl, getMarkerGroupUUID(), IMarker.SEVERITY_ERROR)) {
+ list.add(StubRebuildAction.class);
+ }
+ list.add(RefreshAction.class);
+ list.add(WsConsumerDeleteAction.class);
+ return list.toArray(new Class[list.size()]);
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ super.prepareMenuAction(menu);
+ if (menu instanceof WsConsumerDeleteAction) {
+ ((WsConsumerDeleteAction) menu).init(m_bundle, getType(), getBuildJaxWsBean());
+ }
+ else if (menu instanceof StubRebuildAction) {
+ ((StubRebuildAction) menu).init(m_bundle, getBuildJaxWsBean(), getWsdlResource(), m_markerGroupUUID, WebserviceEnum.Consumer);
+ }
+ }
+
+ @Override
+ public void reloadPage(int dataMask) {
+ try {
+ if ((dataMask & DATA_BUILD_JAXWS_ENTRY) > 0) {
+ if (getBuildJaxWsBean() == null) {
+ m_buildJaxWsBean = BuildJaxWsBean.load(m_bundle, getType().getElementName(), WebserviceEnum.Consumer);
+ }
+ else {
+ m_buildJaxWsBean.reload(m_bundle);
+ }
+ if (m_buildJaxWsBean != null) {
+ m_stubJarResource.setFile(JaxWsSdkUtility.getStubJarFile(m_bundle, m_buildJaxWsBean, m_buildJaxWsBean.getWsdl()));
+ }
+ }
+ if ((dataMask & DATA_WSDL_FILE) > 0) {
+ m_wsdlDefinition = loadWsdlDefinition();
+ }
+ if ((dataMask & DATA_BINDING_FILE) > 0) {
+ m_bindingFileResources = loadBindingFiles();
+ }
+ if ((dataMask & DATA_STUB_FILES) > 0) {
+ m_stubJarResource.setFile(JaxWsSdkUtility.getStubJarFile(m_bundle, m_buildJaxWsBean, m_buildJaxWsBean.getWsdl()));
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ }
+
+ // notify listeners
+ notifyPageLoadedListeners();
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
+ }
+
+ @Override
+ public void refresh(boolean clearCache) {
+ if (clearCache) {
+ reloadPage(DATA_BINDING_FILE | DATA_BUILD_JAXWS_ENTRY | DATA_WSDL_FILE);
+ }
+ else {
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
+ }
+ super.refresh(clearCache);
+ }
+
+ @Override
+ public void unloadPage() {
+ m_pageUnloaded = true;
+
+ MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
+ getBuildJaxWsResource().removeResourceListener(m_buildJaxWsResourceListener);
+ getWsdlResource().removeResourceListener(m_wsdlResourceListener);
+ m_manifestResource.removeResourceListener(m_manifestResourceListener);
+ m_stubJarResource.removeResourceListener(m_stubJarResourceListener);
+
+ for (XmlResource resource : m_bindingFileResources) {
+ resource.removeResourceListener(m_bindingFileResourceListener);
+ }
+
+ // unregister page to not receive page reload notification anymore
+ JaxWsSdk.getDefault().unregisterPage(WebServiceConsumerNodePage.class, this);
+
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(m_typeChangedListener);
+
+ super.unloadPage();
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ @Override
+ public int getQuality() {
+ int quality = MarkerUtility.getQuality(this, m_bundle, m_markerGroupUUID);
+
+ if (quality == IMarker.SEVERITY_ERROR) {
+ return quality;
+ }
+
+ if (TypeUtility.exists(getType())) {
+ quality = Math.max(quality, ScoutSeverityManager.getInstance().getSeverityOf(getType()));
+ }
+ return quality;
+ }
+
+ @Override
+ public void rebuildMarkers() {
+ synchronized (m_markerGroupUUID) {
+ try {
+ MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
+
+ if (isPageUnloaded() || !TypeUtility.exists(getType())) {
+ return;
+ }
+ if (!MarkerRebuildUtility.rebuildBuildJaxWsMarkers(getBuildJaxWsResource().getFile(), m_buildJaxWsBean, getType().getElementName(), m_wsdlResource, m_markerGroupUUID, m_bundle, WebserviceEnum.Consumer)) {
+ return;
+ }
+ if (!MarkerRebuildUtility.rebuildBindingFileMarkers(getBuildJaxWsResource().getFile(), m_bindingFileResources, m_wsdlResource, m_markerGroupUUID, m_bundle)) {
+ return;
+ }
+ if (!MarkerRebuildUtility.rebuildWebserviceClientType(getType(), m_buildJaxWsBean, m_wsdlResource, m_markerGroupUUID, m_bundle)) {
+ return;
+ }
+ if (!MarkerRebuildUtility.rebuildWsdlMarkers(m_wsdlResource, m_buildJaxWsBean, null, m_markerGroupUUID, m_bundle)) {
+ return;
+ }
+
+ QName portTypeQName = JaxWsSdkUtility.extractPortTypeQNameFromWsClient(getType());
+ QName serviceQName = JaxWsSdkUtility.extractServiceQNameFromWsClient(getType());
+ MarkerRebuildUtility.rebuildStubJarFileMarkers(m_buildJaxWsBean, m_wsdlResource, portTypeQName, serviceQName, m_bundle, m_markerGroupUUID);
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("failed to update markers", e);
+ }
+ finally {
+ Set<IResource> resources = new HashSet<IResource>();
+ if (JaxWsSdkUtility.exists(getBuildJaxWsResource().getFile())) {
+ resources.add(getBuildJaxWsResource().getFile());
+ }
+ if (JaxWsSdkUtility.exists(getWsdlResource().getFile())) {
+ resources.add(getWsdlResource().getFile());
+ }
+ for (XmlResource resource : m_bindingFileResources) {
+ if (JaxWsSdkUtility.exists(resource.getFile())) {
+ resources.add(resource.getFile());
+ }
+ }
+ ScoutSeverityManager.getInstance().fireSeverityChanged(resources);
+ }
+ }
+ }
+
+ private Definition loadWsdlDefinition() {
+ if (m_buildJaxWsBean == null) {
+ return null;
+ }
+ IFile file = JaxWsSdkUtility.getFile(m_bundle, m_buildJaxWsBean.getWsdl(), false);
+ if (!getWsdlResource().isSameFile(file)) {
+ getWsdlResource().setFile(file);
+ }
+ return getWsdlResource().loadWsdlDefinition();
+ }
+
+ private XmlResource[] loadBindingFiles() {
+ for (XmlResource resource : m_bindingFileResources) {
+ resource.removeResourceListener(m_bindingFileResourceListener);
+ }
+
+ List<XmlResource> bindingFileResources = new LinkedList<XmlResource>();
+
+ if (m_buildJaxWsBean != null) {
+ IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(m_bundle, m_buildJaxWsBean.getPropertiers());
+ for (IFile bindingFile : bindingFiles) {
+ XmlResource xmlResource = new XmlResource(m_bundle);
+ xmlResource.setFile(bindingFile);
+ xmlResource.addResourceListener(m_bindingFileResourceListener);
+ bindingFileResources.add(xmlResource);
+ }
+ }
+
+ return bindingFileResources.toArray(new XmlResource[bindingFileResources.size()]);
+ }
+
+ @Override
+ public WebServiceConsumerTablePage getParent() {
+ return (WebServiceConsumerTablePage) super.getParent();
+ }
+
+ @Override
+ public String getMarkerGroupUUID() {
+ return m_markerGroupUUID;
+ }
+
+ public BuildJaxWsBean getBuildJaxWsBean() {
+ return m_buildJaxWsBean;
+ }
+
+ public Definition getWsdlDefinition() {
+ if (m_wsdlDefinition == null) {
+ m_wsdlDefinition = loadWsdlDefinition();
+ }
+ return m_wsdlDefinition;
+ }
+
+ public void addPageLoadedListener(IPageLoadedListener listener) {
+ synchronized (m_pageLoadedListenerLock) {
+ m_pageLoadedListeners.add(listener);
+ }
+ }
+
+ public void removePageLoadedListener(IPageLoadedListener listener) {
+ synchronized (m_pageLoadedListenerLock) {
+ m_pageLoadedListeners.remove(listener);
+ }
+ }
+
+ private void notifyPageLoadedListeners() {
+ IPageLoadedListener[] listeners;
+ synchronized (m_pageLoadedListenerLock) {
+ listeners = m_pageLoadedListeners.toArray(new IPageLoadedListener[m_pageLoadedListeners.size()]);
+ }
+
+ for (IPageLoadedListener listener : listeners) {
+ try {
+ listener.pageLoaded();
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("error while notifying pageLoaded listener", e);
+ }
+ }
+ }
+
+ public XmlResource getBuildJaxWsResource() {
+ return ResourceFactory.getBuildJaxWsResource(m_bundle);
+ }
+
+ public WsdlResource getWsdlResource() {
+ return m_wsdlResource;
+ }
+
+ public XmlResource[] getBindingFileResources() {
+ return m_bindingFileResources;
+ }
+
+ public boolean isPageUnloaded() {
+ return m_pageUnloaded;
+ }
+
+ private class P_BuildJaxWsListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ if (event == IResourceListener.EVENT_BUILDJAXWS_PROPERTIES_CHANGED ||
+ event == IResourceListener.EVENT_SUNJAXWS_WSDL_CHANGED) {
+ reloadPage(DATA_BUILD_JAXWS_ENTRY | DATA_WSDL_FILE);
+ }
+ else {
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(WebServiceConsumerNodePage.this);
+ }
+ }
+ }
+
+ private class P_WsdlResourceListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ reloadPage(DATA_WSDL_FILE);
+ }
+ }
+
+ private class P_BindingFileResourceListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ reloadPage(DATA_BINDING_FILE);
+ }
+ }
+
+ private class P_ManifestResourceListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ reloadPage(DATA_STUB_FILES); // Bundle-ClassPath
+ }
+ }
+
+ private class P_StubJarResourceListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ reloadPage(DATA_STUB_FILES);
+ }
+ }
+
+ private class P_TypeChangeListener extends AbstractTypeChangedListener {
+
+ @Override
+ protected boolean shouldAnalayseForChange(IResourceChangeEvent event) {
+ return !isPageUnloaded();
+ }
+
+ @Override
+ protected void typeChanged() {
+ reloadPage(DATA_JDT_TYPE);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceConsumerTablePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceConsumerTablePage.java
index 36621809c..e9d0a73eb 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceConsumerTablePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceConsumerTablePage.java
@@ -1,139 +1,139 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.ScoutSdkCore;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.type.TypeComparators;
-import org.eclipse.scout.sdk.util.type.TypeFilters;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
-import org.eclipse.scout.sdk.util.typecache.ITypeHierarchyChangedListener;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.ConsumerNewWizardAction;
-
-public class WebServiceConsumerTablePage extends AbstractPage {
-
- private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
-
- private IPrimaryTypeTypeHierarchy m_hierarchy;
- private ITypeHierarchyChangedListener m_hierarchyChangedListener;
- private IResourceListener m_resourceListener;
-
- public WebServiceConsumerTablePage(IPage parent) {
- setParent(parent);
- setName(Texts.get("Services"));
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsIcons.WebserviceConsumerFolder));
-
- m_bundle = getScoutResource();
-
- m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
- m_hierarchy = TypeUtility.getPrimaryTypeHierarchy(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient));
- m_hierarchy.addHierarchyListener(m_hierarchyChangedListener);
-
- // listener on build-jaxws.xml is necessary to reflect created consumers. That is because type listener is not notified about created types (bug).
- m_resourceListener = new P_BuildJaxWsResourceListener();
- getBuildJaxWsResource().addResourceListener(IResourceListener.EVENT_BUILDJAXWS_ENTRY_ADDED, m_resourceListener);
- getBuildJaxWsResource().addResourceListener(IResourceListener.ELEMENT_FILE, m_resourceListener);
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.WEBSERVICE_CONSUMER_TABLE_PAGE;
- }
-
- @Override
- public void unloadPage() {
- if (m_hierarchy != null && m_hierarchyChangedListener != null) {
- m_hierarchy.removeHierarchyListener(m_hierarchyChangedListener);
- }
- getBuildJaxWsResource().removeResourceListener(m_resourceListener);
- super.unloadPage();
- }
-
- @Override
- public boolean isFolder() {
- return true;
- }
-
- @Override
- public void refresh(boolean clearCache) {
- if (clearCache) {
- m_hierarchy.invalidate();
- }
- super.refresh(clearCache);
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof ConsumerNewWizardAction) {
- ((ConsumerNewWizardAction) menu).init(getScoutResource());
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- return new Class[]{ConsumerNewWizardAction.class};
- }
-
- @Override
- protected void loadChildrenImpl() {
- IType[] wsConsumerTypes = m_hierarchy.getAllSubtypes(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient), TypeFilters.getClassesInProject(getScoutResource().getJavaProject()), TypeComparators.getTypeNameComparator());
- for (IType consumerType : wsConsumerTypes) {
- new WebServiceConsumerNodePage(this, consumerType);
- }
- }
-
- public XmlResource getBuildJaxWsResource() {
- return ResourceFactory.getBuildJaxWsResource(m_bundle);
- }
-
- private class P_TypeHierarchyChangedListener implements ITypeHierarchyChangedListener {
-
- @Override
- public void handleEvent(int eventType, IType type) {
- switch (eventType) {
- // important: ignore CHANGE events to exclude marker updates
- case POST_TYPE_REMOVING:
- case POST_TYPE_ADDING:
- IScoutBundle bundle = ScoutSdkCore.getScoutWorkspace().getScoutBundle(type.getJavaProject().getProject());
- if (bundle.getScoutProject() == getScoutResource().getScoutProject()) {
- markStructureDirty();
- }
- break;
- }
- }
- }
-
- private class P_BuildJaxWsResourceListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- markStructureDirty();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.ScoutSdkCore;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.type.TypeComparators;
+import org.eclipse.scout.sdk.util.type.TypeFilters;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
+import org.eclipse.scout.sdk.util.typecache.ITypeHierarchyChangedListener;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.ConsumerNewWizardAction;
+
+public class WebServiceConsumerTablePage extends AbstractPage {
+
+ private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
+
+ private IPrimaryTypeTypeHierarchy m_hierarchy;
+ private ITypeHierarchyChangedListener m_hierarchyChangedListener;
+ private IResourceListener m_resourceListener;
+
+ public WebServiceConsumerTablePage(IPage parent) {
+ setParent(parent);
+ setName(Texts.get("Services"));
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsIcons.WebserviceConsumerFolder));
+
+ m_bundle = getScoutResource();
+
+ m_hierarchyChangedListener = new P_TypeHierarchyChangedListener();
+ m_hierarchy = TypeUtility.getPrimaryTypeHierarchy(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient));
+ m_hierarchy.addHierarchyListener(m_hierarchyChangedListener);
+
+ // listener on build-jaxws.xml is necessary to reflect created consumers. That is because type listener is not notified about created types (bug).
+ m_resourceListener = new P_BuildJaxWsResourceListener();
+ getBuildJaxWsResource().addResourceListener(IResourceListener.EVENT_BUILDJAXWS_ENTRY_ADDED, m_resourceListener);
+ getBuildJaxWsResource().addResourceListener(IResourceListener.ELEMENT_FILE, m_resourceListener);
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.WEBSERVICE_CONSUMER_TABLE_PAGE;
+ }
+
+ @Override
+ public void unloadPage() {
+ if (m_hierarchy != null && m_hierarchyChangedListener != null) {
+ m_hierarchy.removeHierarchyListener(m_hierarchyChangedListener);
+ }
+ getBuildJaxWsResource().removeResourceListener(m_resourceListener);
+ super.unloadPage();
+ }
+
+ @Override
+ public boolean isFolder() {
+ return true;
+ }
+
+ @Override
+ public void refresh(boolean clearCache) {
+ if (clearCache) {
+ m_hierarchy.invalidate();
+ }
+ super.refresh(clearCache);
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof ConsumerNewWizardAction) {
+ ((ConsumerNewWizardAction) menu).init(getScoutResource());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ return new Class[]{ConsumerNewWizardAction.class};
+ }
+
+ @Override
+ protected void loadChildrenImpl() {
+ IType[] wsConsumerTypes = m_hierarchy.getAllSubtypes(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient), TypeFilters.getClassesInProject(getScoutResource().getJavaProject()), TypeComparators.getTypeNameComparator());
+ for (IType consumerType : wsConsumerTypes) {
+ new WebServiceConsumerNodePage(this, consumerType);
+ }
+ }
+
+ public XmlResource getBuildJaxWsResource() {
+ return ResourceFactory.getBuildJaxWsResource(m_bundle);
+ }
+
+ private class P_TypeHierarchyChangedListener implements ITypeHierarchyChangedListener {
+
+ @Override
+ public void handleEvent(int eventType, IType type) {
+ switch (eventType) {
+ // important: ignore CHANGE events to exclude marker updates
+ case POST_TYPE_REMOVING:
+ case POST_TYPE_ADDING:
+ IScoutBundle bundle = ScoutSdkCore.getScoutWorkspace().getScoutBundle(type.getJavaProject().getProject());
+ if (bundle.getScoutProject() == getScoutResource().getScoutProject()) {
+ markStructureDirty();
+ }
+ break;
+ }
+ }
+ }
+
+ private class P_BuildJaxWsResourceListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ markStructureDirty();
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderCodeFirstNodePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderCodeFirstNodePage.java
index fa42dff6c..e19b9feb7 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderCodeFirstNodePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderCodeFirstNodePage.java
@@ -1,319 +1,319 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.action.AbstractScoutHandler;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.marker.IMarkerRebuildListener;
-import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerRebuildUtility;
-import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.WsProviderCodeFirstDeleteAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.AbstractTypeChangedListener;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageReloadNotification;
-
-public class WebServiceProviderCodeFirstNodePage extends AbstractPage implements IMarkerRebuildListener, IPageReloadNotification {
-
- public static final int DATA_JDT_TYPE = 1 << 0;
- public static final int DATA_SUN_JAXWS_ENTRY = 1 << 1;
-
- private boolean m_pageUnloaded = false;
- private String m_markerGroupUUID;
- private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
- private String m_alias;
-
- private Object m_pageLoadedListenerLock;
- private IType m_portType;
-
- private SunJaxWsBean m_sunJaxWsBean;
-
- private IResourceListener m_sunJaxWsResourceListener;
- private P_PortTypeChangeListener m_portTypeChangedListener;
- private Set<IPageLoadedListener> m_pageLoadedListeners;
-
- public WebServiceProviderCodeFirstNodePage(IPage parent, SunJaxWsBean sunJaxWsBean) {
- setParent(parent);
- setName(StringUtility.nvl(sunJaxWsBean.getAlias(), "?"));
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.WebServiceProviderCodeFirst));
-
- m_sunJaxWsBean = sunJaxWsBean;
- m_alias = sunJaxWsBean.getAlias();
- m_bundle = getScoutResource();
- m_markerGroupUUID = UUID.randomUUID().toString();
-
- m_sunJaxWsResourceListener = new P_SunJaxWsResourceListener();
- m_pageLoadedListeners = new HashSet<IPageLoadedListener>();
- m_pageLoadedListenerLock = new Object();
-
- // register for events being of interest
- getSunJaxWsResource().addResourceListener(sunJaxWsBean.getAlias(), m_sunJaxWsResourceListener);
-
- m_portTypeChangedListener = new P_PortTypeChangeListener();
- ResourcesPlugin.getWorkspace().addResourceChangeListener(m_portTypeChangedListener);
-
- // register page to receive page reload notification
- JaxWsSdk.getDefault().registerPage(WebServiceProviderNodePage.class, this);
-
- reloadPage(DATA_JDT_TYPE);
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.PROVIDER_CODE_FIRST_NODE_PAGE;
- }
-
- @Override
- public boolean isFolder() {
- return false;
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof WsProviderCodeFirstDeleteAction) {
- ((WsProviderCodeFirstDeleteAction) menu).init(m_bundle, getSunJaxWsBean());
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- List<Class<? extends AbstractScoutHandler>> actions = new ArrayList<Class<? extends AbstractScoutHandler>>();
- actions.add(WsProviderCodeFirstDeleteAction.class);
- return actions.toArray(new Class[actions.size()]);
- }
-
- @Override
- public void reloadPage(int dataMask) {
- if (isPageUnloaded()) {
- return;
- }
-
- if ((dataMask & DATA_SUN_JAXWS_ENTRY) > 0) {
- SunJaxWsBean sunJaxWsBean = getSunJaxWsBean();
- if (sunJaxWsBean == null) {
- m_sunJaxWsBean = SunJaxWsBean.load(m_bundle, m_alias);
- }
- else {
- if (!sunJaxWsBean.reload(m_bundle)) {
- m_sunJaxWsBean = null;
- }
- }
- }
-
- if ((dataMask & DATA_JDT_TYPE) > 0) {
- m_portType = null;
- if (m_sunJaxWsBean != null && m_sunJaxWsBean.getImplementation() != null && TypeUtility.existsType(m_sunJaxWsBean.getImplementation())) {
- m_portType = TypeUtility.getType(m_sunJaxWsBean.getImplementation());
- }
- m_portTypeChangedListener.setType(m_portType);
- }
-
- // notify listeners
- notifyPageLoadedListeners();
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
- }
-
- @Override
- public void refresh(boolean clearCache) {
- if (clearCache) {
- super.refresh(clearCache);
- }
- else {
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
- }
- }
-
- @Override
- public void unloadPage() {
- m_pageUnloaded = true;
-
- MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
- getSunJaxWsResource().removeResourceListener(m_sunJaxWsResourceListener);
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(m_portTypeChangedListener);
-
- // unregister page to not receive page reload notification anymore
- JaxWsSdk.getDefault().unregisterPage(WebServiceProviderNodePage.class, this);
-
- super.unloadPage();
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- @Override
- public int getQuality() {
- int quality = MarkerUtility.getQuality(this, m_bundle, m_markerGroupUUID);
-
- if (quality == IMarker.SEVERITY_ERROR) {
- return quality;
- }
-
- IType portType = getPortType();
- if (portType != null) {
- quality = Math.max(quality, ScoutSeverityManager.getInstance().getSeverityOf(portType));
- }
- return quality;
- }
-
- @Override
- public boolean handleDoubleClickedDelegate() {
- if (getPortType() != null) {
- try {
- JavaUI.openInEditor(getPortType());
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("could not open type in editor", e);
- }
- return true;
- }
- return false;
- }
-
- @Override
- protected void loadChildrenImpl() {
- // handler page
- new WebServiceProviderHandlerNodePage(this, getSunJaxWsBean());
- }
-
- @Override
- public void rebuildMarkers() {
- synchronized (m_markerGroupUUID) {
- try {
- MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
-
- if (isPageUnloaded()) {
- return;
- }
-
- MarkerRebuildUtility.rebuildCodeFirstPortTypeMarkers(m_bundle, getPortType(), getSunJaxWsBean(), getMarkerGroupUUID());
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("failed to update markers", e);
- }
- finally {
- Set<IResource> resources = new HashSet<IResource>();
- if (JaxWsSdkUtility.exists(getSunJaxWsResource().getFile())) {
- resources.add(getSunJaxWsResource().getFile());
- }
- if (TypeUtility.exists(getPortType())) {
- resources.add(getPortType().getResource());
- }
- ScoutSeverityManager.getInstance().fireSeverityChanged(resources);
- }
- }
- }
-
- @Override
- public WebServiceProviderTablePage getParent() {
- return (WebServiceProviderTablePage) super.getParent();
- }
-
- @Override
- public String getMarkerGroupUUID() {
- return m_markerGroupUUID;
- }
-
- public IType getPortType() {
- return m_portType;
- }
-
- public SunJaxWsBean getSunJaxWsBean() {
- return m_sunJaxWsBean;
- }
-
- public void addPageLoadedListener(IPageLoadedListener listener) {
- synchronized (m_pageLoadedListenerLock) {
- m_pageLoadedListeners.add(listener);
- }
- }
-
- public void removePageLoadedListener(IPageLoadedListener listener) {
- synchronized (m_pageLoadedListenerLock) {
- m_pageLoadedListeners.remove(listener);
- }
- }
-
- private void notifyPageLoadedListeners() {
- IPageLoadedListener[] listeners;
- synchronized (m_pageLoadedListenerLock) {
- listeners = m_pageLoadedListeners.toArray(new IPageLoadedListener[m_pageLoadedListeners.size()]);
- }
-
- for (IPageLoadedListener listener : listeners) {
- try {
- listener.pageLoaded();
- }
- catch (Exception e) {
- JaxWsSdk.logError("error while notifying pageLoaded listener", e);
- }
- }
- }
-
- public XmlResource getSunJaxWsResource() {
- return ResourceFactory.getSunJaxWsResource(m_bundle);
- }
-
- public boolean isPageUnloaded() {
- return m_pageUnloaded;
- }
-
- private class P_SunJaxWsResourceListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- if (event == IResourceListener.EVENT_SUNJAXWS_WSDL_CHANGED || event == EVENT_SUNJAXWS_HANDLER_CHANGED || event == EVENT_SUNJAXWS_URL_PATTERN_CHANGED) {
- reloadPage(DATA_SUN_JAXWS_ENTRY);
- }
- else {
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(WebServiceProviderCodeFirstNodePage.this);
- }
- }
- }
-
- private class P_PortTypeChangeListener extends AbstractTypeChangedListener {
-
- @Override
- protected boolean shouldAnalayseForChange(IResourceChangeEvent event) {
- return !isPageUnloaded();
- }
-
- @Override
- protected void typeChanged() {
- reloadPage(DATA_JDT_TYPE);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.action.AbstractScoutHandler;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.marker.IMarkerRebuildListener;
+import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerRebuildUtility;
+import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.WsProviderCodeFirstDeleteAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.AbstractTypeChangedListener;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageReloadNotification;
+
+public class WebServiceProviderCodeFirstNodePage extends AbstractPage implements IMarkerRebuildListener, IPageReloadNotification {
+
+ public static final int DATA_JDT_TYPE = 1 << 0;
+ public static final int DATA_SUN_JAXWS_ENTRY = 1 << 1;
+
+ private boolean m_pageUnloaded = false;
+ private String m_markerGroupUUID;
+ private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
+ private String m_alias;
+
+ private Object m_pageLoadedListenerLock;
+ private IType m_portType;
+
+ private SunJaxWsBean m_sunJaxWsBean;
+
+ private IResourceListener m_sunJaxWsResourceListener;
+ private P_PortTypeChangeListener m_portTypeChangedListener;
+ private Set<IPageLoadedListener> m_pageLoadedListeners;
+
+ public WebServiceProviderCodeFirstNodePage(IPage parent, SunJaxWsBean sunJaxWsBean) {
+ setParent(parent);
+ setName(StringUtility.nvl(sunJaxWsBean.getAlias(), "?"));
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.WebServiceProviderCodeFirst));
+
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_alias = sunJaxWsBean.getAlias();
+ m_bundle = getScoutResource();
+ m_markerGroupUUID = UUID.randomUUID().toString();
+
+ m_sunJaxWsResourceListener = new P_SunJaxWsResourceListener();
+ m_pageLoadedListeners = new HashSet<IPageLoadedListener>();
+ m_pageLoadedListenerLock = new Object();
+
+ // register for events being of interest
+ getSunJaxWsResource().addResourceListener(sunJaxWsBean.getAlias(), m_sunJaxWsResourceListener);
+
+ m_portTypeChangedListener = new P_PortTypeChangeListener();
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(m_portTypeChangedListener);
+
+ // register page to receive page reload notification
+ JaxWsSdk.getDefault().registerPage(WebServiceProviderNodePage.class, this);
+
+ reloadPage(DATA_JDT_TYPE);
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.PROVIDER_CODE_FIRST_NODE_PAGE;
+ }
+
+ @Override
+ public boolean isFolder() {
+ return false;
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof WsProviderCodeFirstDeleteAction) {
+ ((WsProviderCodeFirstDeleteAction) menu).init(m_bundle, getSunJaxWsBean());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ List<Class<? extends AbstractScoutHandler>> actions = new ArrayList<Class<? extends AbstractScoutHandler>>();
+ actions.add(WsProviderCodeFirstDeleteAction.class);
+ return actions.toArray(new Class[actions.size()]);
+ }
+
+ @Override
+ public void reloadPage(int dataMask) {
+ if (isPageUnloaded()) {
+ return;
+ }
+
+ if ((dataMask & DATA_SUN_JAXWS_ENTRY) > 0) {
+ SunJaxWsBean sunJaxWsBean = getSunJaxWsBean();
+ if (sunJaxWsBean == null) {
+ m_sunJaxWsBean = SunJaxWsBean.load(m_bundle, m_alias);
+ }
+ else {
+ if (!sunJaxWsBean.reload(m_bundle)) {
+ m_sunJaxWsBean = null;
+ }
+ }
+ }
+
+ if ((dataMask & DATA_JDT_TYPE) > 0) {
+ m_portType = null;
+ if (m_sunJaxWsBean != null && m_sunJaxWsBean.getImplementation() != null && TypeUtility.existsType(m_sunJaxWsBean.getImplementation())) {
+ m_portType = TypeUtility.getType(m_sunJaxWsBean.getImplementation());
+ }
+ m_portTypeChangedListener.setType(m_portType);
+ }
+
+ // notify listeners
+ notifyPageLoadedListeners();
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
+ }
+
+ @Override
+ public void refresh(boolean clearCache) {
+ if (clearCache) {
+ super.refresh(clearCache);
+ }
+ else {
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
+ }
+ }
+
+ @Override
+ public void unloadPage() {
+ m_pageUnloaded = true;
+
+ MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
+ getSunJaxWsResource().removeResourceListener(m_sunJaxWsResourceListener);
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(m_portTypeChangedListener);
+
+ // unregister page to not receive page reload notification anymore
+ JaxWsSdk.getDefault().unregisterPage(WebServiceProviderNodePage.class, this);
+
+ super.unloadPage();
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ @Override
+ public int getQuality() {
+ int quality = MarkerUtility.getQuality(this, m_bundle, m_markerGroupUUID);
+
+ if (quality == IMarker.SEVERITY_ERROR) {
+ return quality;
+ }
+
+ IType portType = getPortType();
+ if (portType != null) {
+ quality = Math.max(quality, ScoutSeverityManager.getInstance().getSeverityOf(portType));
+ }
+ return quality;
+ }
+
+ @Override
+ public boolean handleDoubleClickedDelegate() {
+ if (getPortType() != null) {
+ try {
+ JavaUI.openInEditor(getPortType());
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("could not open type in editor", e);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected void loadChildrenImpl() {
+ // handler page
+ new WebServiceProviderHandlerNodePage(this, getSunJaxWsBean());
+ }
+
+ @Override
+ public void rebuildMarkers() {
+ synchronized (m_markerGroupUUID) {
+ try {
+ MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
+
+ if (isPageUnloaded()) {
+ return;
+ }
+
+ MarkerRebuildUtility.rebuildCodeFirstPortTypeMarkers(m_bundle, getPortType(), getSunJaxWsBean(), getMarkerGroupUUID());
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("failed to update markers", e);
+ }
+ finally {
+ Set<IResource> resources = new HashSet<IResource>();
+ if (JaxWsSdkUtility.exists(getSunJaxWsResource().getFile())) {
+ resources.add(getSunJaxWsResource().getFile());
+ }
+ if (TypeUtility.exists(getPortType())) {
+ resources.add(getPortType().getResource());
+ }
+ ScoutSeverityManager.getInstance().fireSeverityChanged(resources);
+ }
+ }
+ }
+
+ @Override
+ public WebServiceProviderTablePage getParent() {
+ return (WebServiceProviderTablePage) super.getParent();
+ }
+
+ @Override
+ public String getMarkerGroupUUID() {
+ return m_markerGroupUUID;
+ }
+
+ public IType getPortType() {
+ return m_portType;
+ }
+
+ public SunJaxWsBean getSunJaxWsBean() {
+ return m_sunJaxWsBean;
+ }
+
+ public void addPageLoadedListener(IPageLoadedListener listener) {
+ synchronized (m_pageLoadedListenerLock) {
+ m_pageLoadedListeners.add(listener);
+ }
+ }
+
+ public void removePageLoadedListener(IPageLoadedListener listener) {
+ synchronized (m_pageLoadedListenerLock) {
+ m_pageLoadedListeners.remove(listener);
+ }
+ }
+
+ private void notifyPageLoadedListeners() {
+ IPageLoadedListener[] listeners;
+ synchronized (m_pageLoadedListenerLock) {
+ listeners = m_pageLoadedListeners.toArray(new IPageLoadedListener[m_pageLoadedListeners.size()]);
+ }
+
+ for (IPageLoadedListener listener : listeners) {
+ try {
+ listener.pageLoaded();
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("error while notifying pageLoaded listener", e);
+ }
+ }
+ }
+
+ public XmlResource getSunJaxWsResource() {
+ return ResourceFactory.getSunJaxWsResource(m_bundle);
+ }
+
+ public boolean isPageUnloaded() {
+ return m_pageUnloaded;
+ }
+
+ private class P_SunJaxWsResourceListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ if (event == IResourceListener.EVENT_SUNJAXWS_WSDL_CHANGED || event == EVENT_SUNJAXWS_HANDLER_CHANGED || event == EVENT_SUNJAXWS_URL_PATTERN_CHANGED) {
+ reloadPage(DATA_SUN_JAXWS_ENTRY);
+ }
+ else {
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(WebServiceProviderCodeFirstNodePage.this);
+ }
+ }
+ }
+
+ private class P_PortTypeChangeListener extends AbstractTypeChangedListener {
+
+ @Override
+ protected boolean shouldAnalayseForChange(IResourceChangeEvent event) {
+ return !isPageUnloaded();
+ }
+
+ @Override
+ protected void typeChanged() {
+ reloadPage(DATA_JDT_TYPE);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderHandlerNodePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderHandlerNodePage.java
index 2843a8e8e..34b7eecd3 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderHandlerNodePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderHandlerNodePage.java
@@ -1,220 +1,220 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.UUID;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.holders.IntegerHolder;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.marker.IMarkerRebuildListener;
-import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerRebuildUtility;
-import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean.IHandlerVisitor;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
-
-public class WebServiceProviderHandlerNodePage extends AbstractPage implements IMarkerRebuildListener {
-
- public static final int DATA_SUN_JAXWS_ENTRY = 1 << 0;
-
- private String m_markerGroupUUID;
- private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
- private String m_alias;
- private boolean m_pageUnloaded = false;
-
- private Object m_pageLoadedListenerLock;
- private SunJaxWsBean m_sunJaxWsBean;
- private IResourceListener m_sunJaxWsResourceListener;
- private Set<IPageLoadedListener> m_pageLoadedListeners;
-
- public WebServiceProviderHandlerNodePage(IPage parent, SunJaxWsBean sunJaxWsBean) {
- setParent(parent);
- setName(Texts.get("HandlerRegistration"));
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.Handlers));
-
- m_sunJaxWsBean = sunJaxWsBean;
- m_alias = sunJaxWsBean.getAlias();
- m_bundle = getScoutResource();
- m_markerGroupUUID = UUID.randomUUID().toString();
-
- m_pageLoadedListeners = new HashSet<IPageLoadedListener>();
- m_pageLoadedListenerLock = new Object();
-
- m_sunJaxWsResourceListener = new P_SunJaxWsResourceListener();
- ResourceFactory.getSunJaxWsResource(m_bundle).addResourceListener(getSunJaxWsBean().getAlias(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsResourceListener);
-
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
- }
-
- public void reloadPage(int dataMask) {
- if ((dataMask & DATA_SUN_JAXWS_ENTRY) > 0) {
- ScoutXmlElement xmlRoot = getSunJaxWsResource().loadXml().getRoot();
- ScoutXmlElement sunJaxWsXml = xmlRoot.getChild(StringUtility.join(":", xmlRoot.getNamePrefix(), SunJaxWsBean.XML_ENDPOINT), "name", m_alias);
- m_sunJaxWsBean = new SunJaxWsBean(sunJaxWsXml);
- }
-
- // notify listeners
- notifyPageLoadedListeners();
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.PROVIDER_HANDLER_NODE_PAGE;
- }
-
- @Override
- public boolean isFolder() {
- return false;
- }
-
- @Override
- public void refresh(boolean clearCache) {
- if (clearCache) {
- super.refresh(clearCache);
- }
- else {
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
- }
- }
-
- @Override
- public void unloadPage() {
- m_pageUnloaded = true;
-
- MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
- ResourceFactory.getSunJaxWsResource(m_bundle).removeResourceListener(m_sunJaxWsResourceListener);
- super.unloadPage();
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- @Override
- public int getQuality() {
- final IntegerHolder qualityHolder = new IntegerHolder(MarkerUtility.getQuality(this, m_bundle, m_markerGroupUUID));
-
- if (qualityHolder.getValue() >= IMarker.SEVERITY_ERROR) {
- return IMarker.SEVERITY_ERROR;
- }
-
- // calculate quality of handlers
- getSunJaxWsBean().visitHandlers(new IHandlerVisitor() {
-
- @Override
- public boolean visit(ScoutXmlElement xmlHandlerElement, String fullyQualifiedName, int handlerIndex, int handlerCount) {
- IType type = TypeUtility.getType(fullyQualifiedName);
- if (TypeUtility.exists(type)) {
- qualityHolder.setValue(Math.max(qualityHolder.getValue(), ScoutSeverityManager.getInstance().getSeverityOf(type)));
- if (qualityHolder.getValue() >= IMarker.SEVERITY_ERROR) {
- return false;
- }
- }
- return true;
- }
- });
-
- return qualityHolder.getValue();
- }
-
- @Override
- public void rebuildMarkers() {
- synchronized (m_markerGroupUUID) {
- try {
- MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
-
- if (isPageUnloaded()) {
- return;
- }
-
- MarkerRebuildUtility.rebuildHandlerMarkers(getSunJaxWsBean(), m_bundle, m_markerGroupUUID);
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("failed to update markers", e);
- }
- finally {
- Set<IResource> resources = new HashSet<IResource>();
- resources.add(ResourceFactory.getSunJaxWsResource(m_bundle).getFile());
- ScoutSeverityManager.getInstance().fireSeverityChanged(resources);
- }
- }
- }
-
- public String getMarkerGroupUUID() {
- return m_markerGroupUUID;
- }
-
- public SunJaxWsBean getSunJaxWsBean() {
- return m_sunJaxWsBean;
- }
-
- public XmlResource getSunJaxWsResource() {
- return ResourceFactory.getSunJaxWsResource(m_bundle);
- }
-
- public void addPageLoadedListener(IPageLoadedListener listener) {
- synchronized (m_pageLoadedListenerLock) {
- m_pageLoadedListeners.add(listener);
- }
- }
-
- public void removePageLoadedListener(IPageLoadedListener listener) {
- synchronized (m_pageLoadedListenerLock) {
- m_pageLoadedListeners.remove(listener);
- }
- }
-
- private void notifyPageLoadedListeners() {
- IPageLoadedListener[] listeners;
- synchronized (m_pageLoadedListenerLock) {
- listeners = m_pageLoadedListeners.toArray(new IPageLoadedListener[m_pageLoadedListeners.size()]);
- }
-
- for (IPageLoadedListener listener : listeners) {
- try {
- listener.pageLoaded();
- }
- catch (Exception e) {
- JaxWsSdk.logError("error while notifying pageLoaded listener", e);
- }
- }
- }
-
- public boolean isPageUnloaded() {
- return m_pageUnloaded;
- }
-
- private class P_SunJaxWsResourceListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- reloadPage(DATA_SUN_JAXWS_ENTRY);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.holders.IntegerHolder;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.marker.IMarkerRebuildListener;
+import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerRebuildUtility;
+import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean.IHandlerVisitor;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
+
+public class WebServiceProviderHandlerNodePage extends AbstractPage implements IMarkerRebuildListener {
+
+ public static final int DATA_SUN_JAXWS_ENTRY = 1 << 0;
+
+ private String m_markerGroupUUID;
+ private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
+ private String m_alias;
+ private boolean m_pageUnloaded = false;
+
+ private Object m_pageLoadedListenerLock;
+ private SunJaxWsBean m_sunJaxWsBean;
+ private IResourceListener m_sunJaxWsResourceListener;
+ private Set<IPageLoadedListener> m_pageLoadedListeners;
+
+ public WebServiceProviderHandlerNodePage(IPage parent, SunJaxWsBean sunJaxWsBean) {
+ setParent(parent);
+ setName(Texts.get("HandlerRegistration"));
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.Handlers));
+
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_alias = sunJaxWsBean.getAlias();
+ m_bundle = getScoutResource();
+ m_markerGroupUUID = UUID.randomUUID().toString();
+
+ m_pageLoadedListeners = new HashSet<IPageLoadedListener>();
+ m_pageLoadedListenerLock = new Object();
+
+ m_sunJaxWsResourceListener = new P_SunJaxWsResourceListener();
+ ResourceFactory.getSunJaxWsResource(m_bundle).addResourceListener(getSunJaxWsBean().getAlias(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsResourceListener);
+
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
+ }
+
+ public void reloadPage(int dataMask) {
+ if ((dataMask & DATA_SUN_JAXWS_ENTRY) > 0) {
+ ScoutXmlElement xmlRoot = getSunJaxWsResource().loadXml().getRoot();
+ ScoutXmlElement sunJaxWsXml = xmlRoot.getChild(StringUtility.join(":", xmlRoot.getNamePrefix(), SunJaxWsBean.XML_ENDPOINT), "name", m_alias);
+ m_sunJaxWsBean = new SunJaxWsBean(sunJaxWsXml);
+ }
+
+ // notify listeners
+ notifyPageLoadedListeners();
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.PROVIDER_HANDLER_NODE_PAGE;
+ }
+
+ @Override
+ public boolean isFolder() {
+ return false;
+ }
+
+ @Override
+ public void refresh(boolean clearCache) {
+ if (clearCache) {
+ super.refresh(clearCache);
+ }
+ else {
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
+ }
+ }
+
+ @Override
+ public void unloadPage() {
+ m_pageUnloaded = true;
+
+ MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
+ ResourceFactory.getSunJaxWsResource(m_bundle).removeResourceListener(m_sunJaxWsResourceListener);
+ super.unloadPage();
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ @Override
+ public int getQuality() {
+ final IntegerHolder qualityHolder = new IntegerHolder(MarkerUtility.getQuality(this, m_bundle, m_markerGroupUUID));
+
+ if (qualityHolder.getValue() >= IMarker.SEVERITY_ERROR) {
+ return IMarker.SEVERITY_ERROR;
+ }
+
+ // calculate quality of handlers
+ getSunJaxWsBean().visitHandlers(new IHandlerVisitor() {
+
+ @Override
+ public boolean visit(ScoutXmlElement xmlHandlerElement, String fullyQualifiedName, int handlerIndex, int handlerCount) {
+ IType type = TypeUtility.getType(fullyQualifiedName);
+ if (TypeUtility.exists(type)) {
+ qualityHolder.setValue(Math.max(qualityHolder.getValue(), ScoutSeverityManager.getInstance().getSeverityOf(type)));
+ if (qualityHolder.getValue() >= IMarker.SEVERITY_ERROR) {
+ return false;
+ }
+ }
+ return true;
+ }
+ });
+
+ return qualityHolder.getValue();
+ }
+
+ @Override
+ public void rebuildMarkers() {
+ synchronized (m_markerGroupUUID) {
+ try {
+ MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
+
+ if (isPageUnloaded()) {
+ return;
+ }
+
+ MarkerRebuildUtility.rebuildHandlerMarkers(getSunJaxWsBean(), m_bundle, m_markerGroupUUID);
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("failed to update markers", e);
+ }
+ finally {
+ Set<IResource> resources = new HashSet<IResource>();
+ resources.add(ResourceFactory.getSunJaxWsResource(m_bundle).getFile());
+ ScoutSeverityManager.getInstance().fireSeverityChanged(resources);
+ }
+ }
+ }
+
+ public String getMarkerGroupUUID() {
+ return m_markerGroupUUID;
+ }
+
+ public SunJaxWsBean getSunJaxWsBean() {
+ return m_sunJaxWsBean;
+ }
+
+ public XmlResource getSunJaxWsResource() {
+ return ResourceFactory.getSunJaxWsResource(m_bundle);
+ }
+
+ public void addPageLoadedListener(IPageLoadedListener listener) {
+ synchronized (m_pageLoadedListenerLock) {
+ m_pageLoadedListeners.add(listener);
+ }
+ }
+
+ public void removePageLoadedListener(IPageLoadedListener listener) {
+ synchronized (m_pageLoadedListenerLock) {
+ m_pageLoadedListeners.remove(listener);
+ }
+ }
+
+ private void notifyPageLoadedListeners() {
+ IPageLoadedListener[] listeners;
+ synchronized (m_pageLoadedListenerLock) {
+ listeners = m_pageLoadedListeners.toArray(new IPageLoadedListener[m_pageLoadedListeners.size()]);
+ }
+
+ for (IPageLoadedListener listener : listeners) {
+ try {
+ listener.pageLoaded();
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("error while notifying pageLoaded listener", e);
+ }
+ }
+ }
+
+ public boolean isPageUnloaded() {
+ return m_pageUnloaded;
+ }
+
+ private class P_SunJaxWsResourceListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ reloadPage(DATA_SUN_JAXWS_ENTRY);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderNodePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderNodePage.java
index 73d894745..b0f30e07b 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderNodePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderNodePage.java
@@ -1,546 +1,546 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-import java.util.UUID;
-
-import javax.wsdl.Definition;
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.action.AbstractScoutHandler;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.util.pde.PluginModelHelper;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.marker.IMarkerRebuildListener;
-import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerRebuildUtility;
-import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ManagedResource;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.RefreshAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.StubRebuildAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.WsProviderDeleteAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.AbstractTypeChangedListener;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageReloadNotification;
-
-public class WebServiceProviderNodePage extends AbstractPage implements IMarkerRebuildListener, IPageReloadNotification {
-
- public static final int DATA_JDT_TYPE = 1 << 0;
- public static final int DATA_BUILD_JAXWS_ENTRY = 1 << 1;
- public static final int DATA_WSDL_FILE = 1 << 2;
- public static final int DATA_BINDING_FILE = 1 << 3;
- public static final int DATA_STUB_FILES = 1 << 4;
- public static final int DATA_SUN_JAXWS_ENTRY = 1 << 5;
-
- private boolean m_pageUnloaded = false;
- private String m_markerGroupUUID;
- private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
- private String m_alias;
-
- private Object m_pageLoadedListenerLock;
-
- private SunJaxWsBean m_sunJaxWsBean;
- private BuildJaxWsBean m_buildJaxWsBean;
-
- private IPrimaryTypeTypeHierarchy m_portTypeInterfaceTypeHierarchy;
-
- private IResourceListener m_sunJaxWsResourceListener;
- private IResourceListener m_buildJaxWsResourceListener;
- private IResourceListener m_wsdlResourceListener;
- private IResourceListener m_bindingFileResourceListener;
- private IResourceListener m_manifestResourceListener;
- private IResourceListener m_stubJarResourceListener;
- private P_PortTypeChangeListener m_portTypeChangedListener;
- private Set<IPageLoadedListener> m_pageLoadedListeners;
-
- private WsdlResource m_wsdlResource;
- private Definition m_wsdlDefinition;
- private XmlResource[] m_bindingFileResources;
- private ManagedResource m_manifestResource;
- private ManagedResource m_stubJarResource;
-
- public WebServiceProviderNodePage(IPage parent, SunJaxWsBean sunJaxWsBean, BuildJaxWsBean buildJaxWsBean) {
- setParent(parent);
- setName(StringUtility.nvl(sunJaxWsBean.getAlias(), "?"));
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.WebserviceProvider));
-
- m_sunJaxWsBean = sunJaxWsBean;
- m_buildJaxWsBean = buildJaxWsBean;
- m_alias = sunJaxWsBean.getAlias();
- m_bundle = getScoutResource();
- m_markerGroupUUID = UUID.randomUUID().toString();
-
- m_wsdlResource = new WsdlResource(m_bundle);
- m_wsdlResourceListener = new P_WsdlResourceListener();
-
- m_manifestResource = new ManagedResource(m_bundle.getProject());
- m_manifestResource.setFile(new PluginModelHelper(m_bundle.getProject()).Manifest.getFile());
- m_manifestResourceListener = new P_ManifestResourceListener();
-
- m_stubJarResource = new ManagedResource(m_bundle.getProject());
- m_stubJarResource.setFile(JaxWsSdkUtility.getStubJarFile(m_bundle, buildJaxWsBean, sunJaxWsBean.getWsdl()));
- m_stubJarResourceListener = new P_StubJarResourceListener();
-
- m_sunJaxWsResourceListener = new P_SunJaxWsResourceListener();
- m_buildJaxWsResourceListener = new P_BuildJaxWsListener();
-
- m_bindingFileResources = new XmlResource[0];
- m_bindingFileResourceListener = new P_BindingFileResourceListener();
-
- m_pageLoadedListeners = new HashSet<IPageLoadedListener>();
- m_pageLoadedListenerLock = new Object();
-
- // register for events being of interest
- getSunJaxWsResource().addResourceListener(sunJaxWsBean.getAlias(), m_sunJaxWsResourceListener);
- getBuildJaxWsResource().addResourceListener(sunJaxWsBean.getAlias(), m_buildJaxWsResourceListener);
- getWsdlResource().addResourceListener(IResourceListener.EVENT_WSDL_REPLACED | IResourceListener.EVENT_UNKNOWN | IResourceListener.EVENT_STUB_REBUILT, m_wsdlResourceListener);
- m_manifestResource.addResourceListener(IResourceListener.EVENT_MANIFEST_CLASSPATH | IResourceListener.EVENT_UNKNOWN, m_manifestResourceListener);
- m_stubJarResource.addResourceListener(m_stubJarResourceListener);
-
- // register page to receive page reload notification
- JaxWsSdk.getDefault().registerPage(WebServiceProviderNodePage.class, this);
-
- m_portTypeChangedListener = new P_PortTypeChangeListener();
- ResourcesPlugin.getWorkspace().addResourceChangeListener(m_portTypeChangedListener);
-
- reloadPage(DATA_JDT_TYPE | DATA_BINDING_FILE | DATA_WSDL_FILE | DATA_STUB_FILES);
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.PROVIDER_NODE_PAGE;
- }
-
- @Override
- public boolean isFolder() {
- return false;
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof WsProviderDeleteAction) {
- ((WsProviderDeleteAction) menu).init(m_bundle, getSunJaxWsBean(), getBuildJaxWsBean());
- }
- else if (menu instanceof StubRebuildAction) {
- ((StubRebuildAction) menu).init(m_bundle, getBuildJaxWsBean(), getWsdlResource(), m_markerGroupUUID, WebserviceEnum.Provider);
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- List<Class<? extends AbstractScoutHandler>> actions = new ArrayList<Class<? extends AbstractScoutHandler>>();
- actions.add(WsProviderDeleteAction.class);
- actions.add(RefreshAction.class);
- if (getBuildJaxWsBean() != null &&
- getSunJaxWsBean() != null &&
- !MarkerUtility.containsMarker(m_bundle, MarkerType.StubFolder, getMarkerGroupUUID(), IMarker.SEVERITY_ERROR) &&
- !MarkerUtility.containsMarker(m_bundle, MarkerType.Wsdl, getMarkerGroupUUID(), IMarker.SEVERITY_ERROR)) {
- actions.add(StubRebuildAction.class);
- }
-
- return actions.toArray(new Class[actions.size()]);
- }
-
- @Override
- public void reloadPage(int dataMask) {
- if ((dataMask & DATA_SUN_JAXWS_ENTRY) > 0) {
- SunJaxWsBean sunJaxWsBean = getSunJaxWsBean();
- if (sunJaxWsBean == null) {
- m_sunJaxWsBean = SunJaxWsBean.load(m_bundle, m_alias);
- }
- else {
- if (!sunJaxWsBean.reload(m_bundle)) {
- m_sunJaxWsBean = null;
- }
- }
- }
- if ((dataMask & DATA_BUILD_JAXWS_ENTRY) > 0) {
- BuildJaxWsBean buildJaxWsBean = getBuildJaxWsBean();
- if (buildJaxWsBean == null) {
- m_buildJaxWsBean = BuildJaxWsBean.load(m_bundle, m_alias, WebserviceEnum.Provider);
- }
- else {
- if (!buildJaxWsBean.reload(m_bundle)) {
- m_buildJaxWsBean = null;
- }
- }
- }
-
- if ((dataMask & DATA_WSDL_FILE) > 0) {
- m_wsdlDefinition = loadWsdlDefinition();
- }
- if ((dataMask & DATA_BINDING_FILE) > 0 ||
- (dataMask & DATA_BUILD_JAXWS_ENTRY) > 0) {
- m_bindingFileResources = loadBindingFiles();
- }
- if ((dataMask & DATA_STUB_FILES) > 0) {
- String wsdlFileName = null;
- if (m_sunJaxWsBean != null) {
- wsdlFileName = m_sunJaxWsBean.getWsdl();
- }
- m_stubJarResource.setFile(JaxWsSdkUtility.getStubJarFile(m_bundle, m_buildJaxWsBean, wsdlFileName));
- }
-
- // notify listeners
- notifyPageLoadedListeners();
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
- }
-
- @Override
- public void refresh(boolean clearCache) {
- if (clearCache) {
- super.refresh(clearCache);
- }
- else {
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
- }
- }
-
- @Override
- public void unloadPage() {
- m_pageUnloaded = true;
-
- MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
- getSunJaxWsResource().removeResourceListener(m_sunJaxWsResourceListener);
- getBuildJaxWsResource().removeResourceListener(m_buildJaxWsResourceListener);
- getWsdlResource().removeResourceListener(m_wsdlResourceListener);
- m_manifestResource.removeResourceListener(m_manifestResourceListener);
- m_stubJarResource.removeResourceListener(m_stubJarResourceListener);
- ResourcesPlugin.getWorkspace().removeResourceChangeListener(m_portTypeChangedListener);
-
- for (XmlResource resource : m_bindingFileResources) {
- resource.removeResourceListener(m_bindingFileResourceListener);
- }
-
- // unregister page to not receive page reload notification anymore
- JaxWsSdk.getDefault().unregisterPage(WebServiceProviderNodePage.class, this);
-
- super.unloadPage();
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- @Override
- public int getQuality() {
- int quality = MarkerUtility.getQuality(this, m_bundle, m_markerGroupUUID);
-
- if (quality == IMarker.SEVERITY_ERROR) {
- return quality;
- }
-
- IType portType = getPortType();
- if (portType != null) {
- quality = Math.max(quality, ScoutSeverityManager.getInstance().getSeverityOf(portType));
- }
- return quality;
- }
-
- @Override
- public boolean handleDoubleClickedDelegate() {
- if (getPortType() != null) {
- try {
- JavaUI.openInEditor(getPortType());
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("could not open type in editor", e);
- }
- return true;
- }
- return false;
- }
-
- @Override
- protected void loadChildrenImpl() {
- // handler page
- new WebServiceProviderHandlerNodePage(this, getSunJaxWsBean());
- }
-
- @Override
- public void rebuildMarkers() {
- synchronized (m_markerGroupUUID) {
- try {
- MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
-
- if (isPageUnloaded()) {
- return;
- }
-
- if (!MarkerRebuildUtility.rebuildBuildJaxWsMarkers(getBuildJaxWsResource().getFile(), m_buildJaxWsBean, m_sunJaxWsBean.getAlias(), m_wsdlResource, m_markerGroupUUID, m_bundle, WebserviceEnum.Provider)) {
- return;
- }
- if (!MarkerRebuildUtility.rebuildSunJaxWsMarkers(getBuildJaxWsResource().getFile(), m_sunJaxWsBean, m_wsdlResource, m_markerGroupUUID, m_bundle)) {
- return;
- }
- if (!MarkerRebuildUtility.rebuildPortTypeImplMarkers(getSunJaxWsResource().getFile(), m_sunJaxWsBean, m_buildJaxWsBean, getPortType(), m_wsdlDefinition, m_markerGroupUUID, m_bundle)) {
- return;
- }
- if (!MarkerRebuildUtility.rebuildBindingFileMarkers(getBuildJaxWsResource().getFile(), m_bindingFileResources, m_wsdlResource, m_markerGroupUUID, m_bundle)) {
- return;
- }
- if (!MarkerRebuildUtility.rebuildWsdlMarkers(m_wsdlResource, m_buildJaxWsBean, m_sunJaxWsBean, m_markerGroupUUID, m_bundle)) {
- return;
- }
-
- PortType portType = JaxWsSdkUtility.getPortType(getWsdlDefinition(), m_sunJaxWsBean.getServiceQNameSafe(), m_sunJaxWsBean.getPort());
- QName portTypeQName = null;
- if (portType != null) {
- portTypeQName = portType.getQName();
- }
-
- if (!MarkerRebuildUtility.rebuildStubJarFileMarkers(m_buildJaxWsBean, m_wsdlResource, portTypeQName, m_sunJaxWsBean.getServiceQNameSafe(), m_bundle, m_markerGroupUUID)) {
- return;
- }
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("failed to update markers", e);
- }
- finally {
- Set<IResource> resources = new HashSet<IResource>();
- if (JaxWsSdkUtility.exists(getSunJaxWsResource().getFile())) {
- resources.add(getSunJaxWsResource().getFile());
- }
- if (JaxWsSdkUtility.exists(getBuildJaxWsResource().getFile())) {
- resources.add(getBuildJaxWsResource().getFile());
- }
- if (JaxWsSdkUtility.exists(getWsdlResource().getFile())) {
- resources.add(getWsdlResource().getFile());
- }
- for (XmlResource resource : m_bindingFileResources) {
- if (JaxWsSdkUtility.exists(resource.getFile())) {
- resources.add(resource.getFile());
- }
- }
- if (TypeUtility.exists(getPortType())) {
- resources.add(getPortType().getResource());
- }
- ScoutSeverityManager.getInstance().fireSeverityChanged(resources);
- }
- }
- }
-
- private Definition loadWsdlDefinition() {
- IFile file = JaxWsSdkUtility.getFile(m_bundle, m_sunJaxWsBean.getWsdl(), false);
- if (!getWsdlResource().isSameFile(file)) {
- getWsdlResource().setFile(file);
- }
- return getWsdlResource().loadWsdlDefinition();
- }
-
- private XmlResource[] loadBindingFiles() {
- for (XmlResource resource : m_bindingFileResources) {
- resource.removeResourceListener(m_bindingFileResourceListener);
- }
-
- List<XmlResource> bindingFileResources = new LinkedList<XmlResource>();
-
- if (m_buildJaxWsBean != null) {
- IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(m_bundle, m_buildJaxWsBean.getPropertiers());
- for (IFile bindingFile : bindingFiles) {
- XmlResource xmlResource = new XmlResource(m_bundle);
- xmlResource.setFile(bindingFile);
- xmlResource.addResourceListener(m_bindingFileResourceListener);
- bindingFileResources.add(xmlResource);
- }
- }
-
- return bindingFileResources.toArray(new XmlResource[bindingFileResources.size()]);
- }
-
- @Override
- public WebServiceProviderTablePage getParent() {
- return (WebServiceProviderTablePage) super.getParent();
- }
-
- @Override
- public String getMarkerGroupUUID() {
- return m_markerGroupUUID;
- }
-
- public IType getPortType() {
- IType portType = null;
- if (m_sunJaxWsBean != null) {
- portType = TypeUtility.getType(m_sunJaxWsBean.getImplementation());
- }
- if (m_portTypeChangedListener != null) {
- m_portTypeChangedListener.setType(portType);
- }
- return portType;
- }
-
- public SunJaxWsBean getSunJaxWsBean() {
- return m_sunJaxWsBean;
- }
-
- public BuildJaxWsBean getBuildJaxWsBean() {
- return m_buildJaxWsBean;
- }
-
- public Definition getWsdlDefinition() {
- if (m_wsdlDefinition == null) {
- m_wsdlDefinition = loadWsdlDefinition();
- }
- return m_wsdlDefinition;
- }
-
- public void addPageLoadedListener(IPageLoadedListener listener) {
- synchronized (m_pageLoadedListenerLock) {
- m_pageLoadedListeners.add(listener);
- }
- }
-
- public void removePageLoadedListener(IPageLoadedListener listener) {
- synchronized (m_pageLoadedListenerLock) {
- m_pageLoadedListeners.remove(listener);
- }
- }
-
- private void notifyPageLoadedListeners() {
- IPageLoadedListener[] listeners;
- synchronized (m_pageLoadedListenerLock) {
- listeners = m_pageLoadedListeners.toArray(new IPageLoadedListener[m_pageLoadedListeners.size()]);
- }
-
- for (IPageLoadedListener listener : listeners) {
- try {
- listener.pageLoaded();
- }
- catch (Exception e) {
- JaxWsSdk.logError("error while notifying pageLoaded listener", e);
- }
- }
- }
-
- public XmlResource getSunJaxWsResource() {
- return ResourceFactory.getSunJaxWsResource(m_bundle);
- }
-
- public XmlResource getBuildJaxWsResource() {
- return ResourceFactory.getBuildJaxWsResource(m_bundle);
- }
-
- public WsdlResource getWsdlResource() {
- return m_wsdlResource;
- }
-
- public XmlResource[] getBindingFileResources() {
- return m_bindingFileResources;
- }
-
- public boolean isPageUnloaded() {
- return m_pageUnloaded;
- }
-
- private class P_BuildJaxWsListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- if (event == IResourceListener.EVENT_BUILDJAXWS_PROPERTIES_CHANGED) {
- reloadPage(DATA_BUILD_JAXWS_ENTRY);
- }
- else {
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(WebServiceProviderNodePage.this);
- }
- }
- }
-
- private class P_SunJaxWsResourceListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- if (event == EVENT_SUNJAXWS_HANDLER_CHANGED || event == EVENT_SUNJAXWS_URL_PATTERN_CHANGED) {
- reloadPage(DATA_SUN_JAXWS_ENTRY);
- }
- else if (event == IResourceListener.EVENT_SUNJAXWS_WSDL_CHANGED || event == EVENT_WSDL_REPLACED) {
- reloadPage(DATA_SUN_JAXWS_ENTRY | DATA_WSDL_FILE);
- }
- else {
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(WebServiceProviderNodePage.this);
- }
- }
- }
-
- private class P_WsdlResourceListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- reloadPage(DATA_WSDL_FILE);
- }
- }
-
- private class P_BindingFileResourceListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- reloadPage(DATA_BINDING_FILE);
- }
- }
-
- private class P_ManifestResourceListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- reloadPage(DATA_STUB_FILES); // Bundle-ClassPath
- }
- }
-
- private class P_StubJarResourceListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- reloadPage(DATA_STUB_FILES);
- }
- }
-
- private class P_PortTypeChangeListener extends AbstractTypeChangedListener {
-
- @Override
- protected boolean shouldAnalayseForChange(IResourceChangeEvent event) {
- return !isPageUnloaded();
- }
-
- @Override
- protected void typeChanged() {
- reloadPage(DATA_JDT_TYPE);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.action.AbstractScoutHandler;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.util.pde.PluginModelHelper;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IPrimaryTypeTypeHierarchy;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.marker.IMarkerRebuildListener;
+import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerRebuildUtility;
+import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ManagedResource;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.RefreshAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.StubRebuildAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.WsProviderDeleteAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.AbstractTypeChangedListener;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageReloadNotification;
+
+public class WebServiceProviderNodePage extends AbstractPage implements IMarkerRebuildListener, IPageReloadNotification {
+
+ public static final int DATA_JDT_TYPE = 1 << 0;
+ public static final int DATA_BUILD_JAXWS_ENTRY = 1 << 1;
+ public static final int DATA_WSDL_FILE = 1 << 2;
+ public static final int DATA_BINDING_FILE = 1 << 3;
+ public static final int DATA_STUB_FILES = 1 << 4;
+ public static final int DATA_SUN_JAXWS_ENTRY = 1 << 5;
+
+ private boolean m_pageUnloaded = false;
+ private String m_markerGroupUUID;
+ private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
+ private String m_alias;
+
+ private Object m_pageLoadedListenerLock;
+
+ private SunJaxWsBean m_sunJaxWsBean;
+ private BuildJaxWsBean m_buildJaxWsBean;
+
+ private IPrimaryTypeTypeHierarchy m_portTypeInterfaceTypeHierarchy;
+
+ private IResourceListener m_sunJaxWsResourceListener;
+ private IResourceListener m_buildJaxWsResourceListener;
+ private IResourceListener m_wsdlResourceListener;
+ private IResourceListener m_bindingFileResourceListener;
+ private IResourceListener m_manifestResourceListener;
+ private IResourceListener m_stubJarResourceListener;
+ private P_PortTypeChangeListener m_portTypeChangedListener;
+ private Set<IPageLoadedListener> m_pageLoadedListeners;
+
+ private WsdlResource m_wsdlResource;
+ private Definition m_wsdlDefinition;
+ private XmlResource[] m_bindingFileResources;
+ private ManagedResource m_manifestResource;
+ private ManagedResource m_stubJarResource;
+
+ public WebServiceProviderNodePage(IPage parent, SunJaxWsBean sunJaxWsBean, BuildJaxWsBean buildJaxWsBean) {
+ setParent(parent);
+ setName(StringUtility.nvl(sunJaxWsBean.getAlias(), "?"));
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsSdk.WebserviceProvider));
+
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_buildJaxWsBean = buildJaxWsBean;
+ m_alias = sunJaxWsBean.getAlias();
+ m_bundle = getScoutResource();
+ m_markerGroupUUID = UUID.randomUUID().toString();
+
+ m_wsdlResource = new WsdlResource(m_bundle);
+ m_wsdlResourceListener = new P_WsdlResourceListener();
+
+ m_manifestResource = new ManagedResource(m_bundle.getProject());
+ m_manifestResource.setFile(new PluginModelHelper(m_bundle.getProject()).Manifest.getFile());
+ m_manifestResourceListener = new P_ManifestResourceListener();
+
+ m_stubJarResource = new ManagedResource(m_bundle.getProject());
+ m_stubJarResource.setFile(JaxWsSdkUtility.getStubJarFile(m_bundle, buildJaxWsBean, sunJaxWsBean.getWsdl()));
+ m_stubJarResourceListener = new P_StubJarResourceListener();
+
+ m_sunJaxWsResourceListener = new P_SunJaxWsResourceListener();
+ m_buildJaxWsResourceListener = new P_BuildJaxWsListener();
+
+ m_bindingFileResources = new XmlResource[0];
+ m_bindingFileResourceListener = new P_BindingFileResourceListener();
+
+ m_pageLoadedListeners = new HashSet<IPageLoadedListener>();
+ m_pageLoadedListenerLock = new Object();
+
+ // register for events being of interest
+ getSunJaxWsResource().addResourceListener(sunJaxWsBean.getAlias(), m_sunJaxWsResourceListener);
+ getBuildJaxWsResource().addResourceListener(sunJaxWsBean.getAlias(), m_buildJaxWsResourceListener);
+ getWsdlResource().addResourceListener(IResourceListener.EVENT_WSDL_REPLACED | IResourceListener.EVENT_UNKNOWN | IResourceListener.EVENT_STUB_REBUILT, m_wsdlResourceListener);
+ m_manifestResource.addResourceListener(IResourceListener.EVENT_MANIFEST_CLASSPATH | IResourceListener.EVENT_UNKNOWN, m_manifestResourceListener);
+ m_stubJarResource.addResourceListener(m_stubJarResourceListener);
+
+ // register page to receive page reload notification
+ JaxWsSdk.getDefault().registerPage(WebServiceProviderNodePage.class, this);
+
+ m_portTypeChangedListener = new P_PortTypeChangeListener();
+ ResourcesPlugin.getWorkspace().addResourceChangeListener(m_portTypeChangedListener);
+
+ reloadPage(DATA_JDT_TYPE | DATA_BINDING_FILE | DATA_WSDL_FILE | DATA_STUB_FILES);
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.PROVIDER_NODE_PAGE;
+ }
+
+ @Override
+ public boolean isFolder() {
+ return false;
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof WsProviderDeleteAction) {
+ ((WsProviderDeleteAction) menu).init(m_bundle, getSunJaxWsBean(), getBuildJaxWsBean());
+ }
+ else if (menu instanceof StubRebuildAction) {
+ ((StubRebuildAction) menu).init(m_bundle, getBuildJaxWsBean(), getWsdlResource(), m_markerGroupUUID, WebserviceEnum.Provider);
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ List<Class<? extends AbstractScoutHandler>> actions = new ArrayList<Class<? extends AbstractScoutHandler>>();
+ actions.add(WsProviderDeleteAction.class);
+ actions.add(RefreshAction.class);
+ if (getBuildJaxWsBean() != null &&
+ getSunJaxWsBean() != null &&
+ !MarkerUtility.containsMarker(m_bundle, MarkerType.StubFolder, getMarkerGroupUUID(), IMarker.SEVERITY_ERROR) &&
+ !MarkerUtility.containsMarker(m_bundle, MarkerType.Wsdl, getMarkerGroupUUID(), IMarker.SEVERITY_ERROR)) {
+ actions.add(StubRebuildAction.class);
+ }
+
+ return actions.toArray(new Class[actions.size()]);
+ }
+
+ @Override
+ public void reloadPage(int dataMask) {
+ if ((dataMask & DATA_SUN_JAXWS_ENTRY) > 0) {
+ SunJaxWsBean sunJaxWsBean = getSunJaxWsBean();
+ if (sunJaxWsBean == null) {
+ m_sunJaxWsBean = SunJaxWsBean.load(m_bundle, m_alias);
+ }
+ else {
+ if (!sunJaxWsBean.reload(m_bundle)) {
+ m_sunJaxWsBean = null;
+ }
+ }
+ }
+ if ((dataMask & DATA_BUILD_JAXWS_ENTRY) > 0) {
+ BuildJaxWsBean buildJaxWsBean = getBuildJaxWsBean();
+ if (buildJaxWsBean == null) {
+ m_buildJaxWsBean = BuildJaxWsBean.load(m_bundle, m_alias, WebserviceEnum.Provider);
+ }
+ else {
+ if (!buildJaxWsBean.reload(m_bundle)) {
+ m_buildJaxWsBean = null;
+ }
+ }
+ }
+
+ if ((dataMask & DATA_WSDL_FILE) > 0) {
+ m_wsdlDefinition = loadWsdlDefinition();
+ }
+ if ((dataMask & DATA_BINDING_FILE) > 0 ||
+ (dataMask & DATA_BUILD_JAXWS_ENTRY) > 0) {
+ m_bindingFileResources = loadBindingFiles();
+ }
+ if ((dataMask & DATA_STUB_FILES) > 0) {
+ String wsdlFileName = null;
+ if (m_sunJaxWsBean != null) {
+ wsdlFileName = m_sunJaxWsBean.getWsdl();
+ }
+ m_stubJarResource.setFile(JaxWsSdkUtility.getStubJarFile(m_bundle, m_buildJaxWsBean, wsdlFileName));
+ }
+
+ // notify listeners
+ notifyPageLoadedListeners();
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
+ }
+
+ @Override
+ public void refresh(boolean clearCache) {
+ if (clearCache) {
+ super.refresh(clearCache);
+ }
+ else {
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
+ }
+ }
+
+ @Override
+ public void unloadPage() {
+ m_pageUnloaded = true;
+
+ MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
+ getSunJaxWsResource().removeResourceListener(m_sunJaxWsResourceListener);
+ getBuildJaxWsResource().removeResourceListener(m_buildJaxWsResourceListener);
+ getWsdlResource().removeResourceListener(m_wsdlResourceListener);
+ m_manifestResource.removeResourceListener(m_manifestResourceListener);
+ m_stubJarResource.removeResourceListener(m_stubJarResourceListener);
+ ResourcesPlugin.getWorkspace().removeResourceChangeListener(m_portTypeChangedListener);
+
+ for (XmlResource resource : m_bindingFileResources) {
+ resource.removeResourceListener(m_bindingFileResourceListener);
+ }
+
+ // unregister page to not receive page reload notification anymore
+ JaxWsSdk.getDefault().unregisterPage(WebServiceProviderNodePage.class, this);
+
+ super.unloadPage();
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ @Override
+ public int getQuality() {
+ int quality = MarkerUtility.getQuality(this, m_bundle, m_markerGroupUUID);
+
+ if (quality == IMarker.SEVERITY_ERROR) {
+ return quality;
+ }
+
+ IType portType = getPortType();
+ if (portType != null) {
+ quality = Math.max(quality, ScoutSeverityManager.getInstance().getSeverityOf(portType));
+ }
+ return quality;
+ }
+
+ @Override
+ public boolean handleDoubleClickedDelegate() {
+ if (getPortType() != null) {
+ try {
+ JavaUI.openInEditor(getPortType());
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("could not open type in editor", e);
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected void loadChildrenImpl() {
+ // handler page
+ new WebServiceProviderHandlerNodePage(this, getSunJaxWsBean());
+ }
+
+ @Override
+ public void rebuildMarkers() {
+ synchronized (m_markerGroupUUID) {
+ try {
+ MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
+
+ if (isPageUnloaded()) {
+ return;
+ }
+
+ if (!MarkerRebuildUtility.rebuildBuildJaxWsMarkers(getBuildJaxWsResource().getFile(), m_buildJaxWsBean, m_sunJaxWsBean.getAlias(), m_wsdlResource, m_markerGroupUUID, m_bundle, WebserviceEnum.Provider)) {
+ return;
+ }
+ if (!MarkerRebuildUtility.rebuildSunJaxWsMarkers(getBuildJaxWsResource().getFile(), m_sunJaxWsBean, m_wsdlResource, m_markerGroupUUID, m_bundle)) {
+ return;
+ }
+ if (!MarkerRebuildUtility.rebuildPortTypeImplMarkers(getSunJaxWsResource().getFile(), m_sunJaxWsBean, m_buildJaxWsBean, getPortType(), m_wsdlDefinition, m_markerGroupUUID, m_bundle)) {
+ return;
+ }
+ if (!MarkerRebuildUtility.rebuildBindingFileMarkers(getBuildJaxWsResource().getFile(), m_bindingFileResources, m_wsdlResource, m_markerGroupUUID, m_bundle)) {
+ return;
+ }
+ if (!MarkerRebuildUtility.rebuildWsdlMarkers(m_wsdlResource, m_buildJaxWsBean, m_sunJaxWsBean, m_markerGroupUUID, m_bundle)) {
+ return;
+ }
+
+ PortType portType = JaxWsSdkUtility.getPortType(getWsdlDefinition(), m_sunJaxWsBean.getServiceQNameSafe(), m_sunJaxWsBean.getPort());
+ QName portTypeQName = null;
+ if (portType != null) {
+ portTypeQName = portType.getQName();
+ }
+
+ if (!MarkerRebuildUtility.rebuildStubJarFileMarkers(m_buildJaxWsBean, m_wsdlResource, portTypeQName, m_sunJaxWsBean.getServiceQNameSafe(), m_bundle, m_markerGroupUUID)) {
+ return;
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("failed to update markers", e);
+ }
+ finally {
+ Set<IResource> resources = new HashSet<IResource>();
+ if (JaxWsSdkUtility.exists(getSunJaxWsResource().getFile())) {
+ resources.add(getSunJaxWsResource().getFile());
+ }
+ if (JaxWsSdkUtility.exists(getBuildJaxWsResource().getFile())) {
+ resources.add(getBuildJaxWsResource().getFile());
+ }
+ if (JaxWsSdkUtility.exists(getWsdlResource().getFile())) {
+ resources.add(getWsdlResource().getFile());
+ }
+ for (XmlResource resource : m_bindingFileResources) {
+ if (JaxWsSdkUtility.exists(resource.getFile())) {
+ resources.add(resource.getFile());
+ }
+ }
+ if (TypeUtility.exists(getPortType())) {
+ resources.add(getPortType().getResource());
+ }
+ ScoutSeverityManager.getInstance().fireSeverityChanged(resources);
+ }
+ }
+ }
+
+ private Definition loadWsdlDefinition() {
+ IFile file = JaxWsSdkUtility.getFile(m_bundle, m_sunJaxWsBean.getWsdl(), false);
+ if (!getWsdlResource().isSameFile(file)) {
+ getWsdlResource().setFile(file);
+ }
+ return getWsdlResource().loadWsdlDefinition();
+ }
+
+ private XmlResource[] loadBindingFiles() {
+ for (XmlResource resource : m_bindingFileResources) {
+ resource.removeResourceListener(m_bindingFileResourceListener);
+ }
+
+ List<XmlResource> bindingFileResources = new LinkedList<XmlResource>();
+
+ if (m_buildJaxWsBean != null) {
+ IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(m_bundle, m_buildJaxWsBean.getPropertiers());
+ for (IFile bindingFile : bindingFiles) {
+ XmlResource xmlResource = new XmlResource(m_bundle);
+ xmlResource.setFile(bindingFile);
+ xmlResource.addResourceListener(m_bindingFileResourceListener);
+ bindingFileResources.add(xmlResource);
+ }
+ }
+
+ return bindingFileResources.toArray(new XmlResource[bindingFileResources.size()]);
+ }
+
+ @Override
+ public WebServiceProviderTablePage getParent() {
+ return (WebServiceProviderTablePage) super.getParent();
+ }
+
+ @Override
+ public String getMarkerGroupUUID() {
+ return m_markerGroupUUID;
+ }
+
+ public IType getPortType() {
+ IType portType = null;
+ if (m_sunJaxWsBean != null) {
+ portType = TypeUtility.getType(m_sunJaxWsBean.getImplementation());
+ }
+ if (m_portTypeChangedListener != null) {
+ m_portTypeChangedListener.setType(portType);
+ }
+ return portType;
+ }
+
+ public SunJaxWsBean getSunJaxWsBean() {
+ return m_sunJaxWsBean;
+ }
+
+ public BuildJaxWsBean getBuildJaxWsBean() {
+ return m_buildJaxWsBean;
+ }
+
+ public Definition getWsdlDefinition() {
+ if (m_wsdlDefinition == null) {
+ m_wsdlDefinition = loadWsdlDefinition();
+ }
+ return m_wsdlDefinition;
+ }
+
+ public void addPageLoadedListener(IPageLoadedListener listener) {
+ synchronized (m_pageLoadedListenerLock) {
+ m_pageLoadedListeners.add(listener);
+ }
+ }
+
+ public void removePageLoadedListener(IPageLoadedListener listener) {
+ synchronized (m_pageLoadedListenerLock) {
+ m_pageLoadedListeners.remove(listener);
+ }
+ }
+
+ private void notifyPageLoadedListeners() {
+ IPageLoadedListener[] listeners;
+ synchronized (m_pageLoadedListenerLock) {
+ listeners = m_pageLoadedListeners.toArray(new IPageLoadedListener[m_pageLoadedListeners.size()]);
+ }
+
+ for (IPageLoadedListener listener : listeners) {
+ try {
+ listener.pageLoaded();
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("error while notifying pageLoaded listener", e);
+ }
+ }
+ }
+
+ public XmlResource getSunJaxWsResource() {
+ return ResourceFactory.getSunJaxWsResource(m_bundle);
+ }
+
+ public XmlResource getBuildJaxWsResource() {
+ return ResourceFactory.getBuildJaxWsResource(m_bundle);
+ }
+
+ public WsdlResource getWsdlResource() {
+ return m_wsdlResource;
+ }
+
+ public XmlResource[] getBindingFileResources() {
+ return m_bindingFileResources;
+ }
+
+ public boolean isPageUnloaded() {
+ return m_pageUnloaded;
+ }
+
+ private class P_BuildJaxWsListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ if (event == IResourceListener.EVENT_BUILDJAXWS_PROPERTIES_CHANGED) {
+ reloadPage(DATA_BUILD_JAXWS_ENTRY);
+ }
+ else {
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(WebServiceProviderNodePage.this);
+ }
+ }
+ }
+
+ private class P_SunJaxWsResourceListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ if (event == EVENT_SUNJAXWS_HANDLER_CHANGED || event == EVENT_SUNJAXWS_URL_PATTERN_CHANGED) {
+ reloadPage(DATA_SUN_JAXWS_ENTRY);
+ }
+ else if (event == IResourceListener.EVENT_SUNJAXWS_WSDL_CHANGED || event == EVENT_WSDL_REPLACED) {
+ reloadPage(DATA_SUN_JAXWS_ENTRY | DATA_WSDL_FILE);
+ }
+ else {
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(WebServiceProviderNodePage.this);
+ }
+ }
+ }
+
+ private class P_WsdlResourceListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ reloadPage(DATA_WSDL_FILE);
+ }
+ }
+
+ private class P_BindingFileResourceListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ reloadPage(DATA_BINDING_FILE);
+ }
+ }
+
+ private class P_ManifestResourceListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ reloadPage(DATA_STUB_FILES); // Bundle-ClassPath
+ }
+ }
+
+ private class P_StubJarResourceListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ reloadPage(DATA_STUB_FILES);
+ }
+ }
+
+ private class P_PortTypeChangeListener extends AbstractTypeChangedListener {
+
+ @Override
+ protected boolean shouldAnalayseForChange(IResourceChangeEvent event) {
+ return !isPageUnloaded();
+ }
+
+ @Override
+ protected void typeChanged() {
+ reloadPage(DATA_JDT_TYPE);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderTablePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderTablePage.java
index bfcdf3b40..2686538ef 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderTablePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServiceProviderTablePage.java
@@ -1,194 +1,194 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import java.util.UUID;
-
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.ui.action.IScoutHandler;
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.marker.IMarkerRebuildListener;
-import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.ProviderNewWizardAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class WebServiceProviderTablePage extends AbstractPage implements IMarkerRebuildListener {
-
- public static final int DATA_SUN_JAXWS_FILE = 1 << 0;
-
- private String m_markerGroupUUID;
- private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
-
- private ScoutXmlDocument m_sunJaxWsXml;
- private IResourceListener m_resourceListener;
- private boolean m_pageUnloaded = false;
-
- public WebServiceProviderTablePage(IPage parent) {
- setParent(parent);
- setName(Texts.get("Services"));
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsIcons.WebserviceProviderFolder));
-
- m_bundle = getScoutResource();
- m_markerGroupUUID = UUID.randomUUID().toString();
- m_resourceListener = new P_SunJaxWsResourceListener();
-
- // register for events being interest in
- int event = IResourceListener.EVENT_SUNJAXWS_ENTRY_ADDED |
- IResourceListener.EVENT_SUNJAXWS_ENTRY_REMOVED |
- IResourceListener.EVENT_SUNJAXWS_REPLACED |
- IResourceListener.EVENT_UNKNOWN;
- getSunJaxWsResource().addResourceListener(event, m_resourceListener);
- getSunJaxWsResource().addResourceListener(IResourceListener.ELEMENT_FILE, m_resourceListener);
-
- reloadData(DATA_SUN_JAXWS_FILE);
- }
-
- public XmlResource getSunJaxWsResource() {
- return ResourceFactory.getSunJaxWsResource(m_bundle);
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.WEBSERVICE_PROVIDER_TABLE_PAGE;
- }
-
- @Override
- public boolean isFolder() {
- return true;
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- @Override
- public void prepareMenuAction(IScoutHandler menu) {
- if (menu instanceof ProviderNewWizardAction) {
- ((ProviderNewWizardAction) menu).init(getScoutResource());
- }
- }
-
- @SuppressWarnings("unchecked")
- @Override
- public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
- return new Class[]{ProviderNewWizardAction.class};
- }
-
- @Override
- public void unloadPage() {
- m_pageUnloaded = true;
-
- MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
- getSunJaxWsResource().removeResourceListener(m_resourceListener);
- super.unloadPage();
- }
-
- @Override
- public int getQuality() {
- return MarkerUtility.getQuality(this, m_bundle, m_markerGroupUUID);
- }
-
- /**
- * Reloads data of this node page
- * The data value is either one of the data constants defined in
- * class {@link WebServiceProviderTablePage} or must be built by <em>bitwise OR</em>'ing together
- *
- * @param data
- */
- public void reloadData(int data) {
- if ((data & DATA_SUN_JAXWS_FILE) > 0) {
- m_sunJaxWsXml = getSunJaxWsResource().loadXml();
- }
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
- }
-
- @Override
- public void refresh(boolean clearCache) {
- if (clearCache) {
- super.refresh(clearCache);
- }
- else {
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
- }
- }
-
- @Override
- protected void loadChildrenImpl() {
- try {
- if (m_sunJaxWsXml == null || m_sunJaxWsXml.getRoot() == null) {
- return;
- }
-
- for (ScoutXmlElement sunJaxWsXml : m_sunJaxWsXml.getRoot().getChildren(StringUtility.join(":", m_sunJaxWsXml.getRoot().getNamePrefix(), SunJaxWsBean.XML_ENDPOINT))) {
- SunJaxWsBean sunJaxWsBean = new SunJaxWsBean(sunJaxWsXml);
- BuildJaxWsBean buildJaxWsBean = BuildJaxWsBean.load(m_bundle, sunJaxWsBean.getAlias(), WebserviceEnum.Provider);
-
- if (buildJaxWsBean != null) {
- new WebServiceProviderNodePage(this, sunJaxWsBean, buildJaxWsBean);
- }
- else {
- new WebServiceProviderCodeFirstNodePage(this, sunJaxWsBean);
- }
- }
- }
- finally {
- JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
- }
- }
-
- @Override
- public void rebuildMarkers() {
- synchronized (m_markerGroupUUID) {
- try {
- MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
-
- if (isPageUnloaded()) {
- return;
- }
- }
- finally {
- ScoutSeverityManager.getInstance().fireSeverityChanged(JaxWsSdkUtility.createResourceSet(getSunJaxWsResource().getFile()));
- }
- }
- }
-
- public String getMarkerGroupUUID() {
- return m_markerGroupUUID;
- }
-
- public boolean isPageUnloaded() {
- return m_pageUnloaded;
- }
-
- private class P_SunJaxWsResourceListener implements IResourceListener {
-
- @Override
- public void changed(String element, int event) {
- reloadData(DATA_SUN_JAXWS_FILE);
- markStructureDirty();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import java.util.UUID;
+
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.ui.action.IScoutHandler;
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.marker.IMarkerRebuildListener;
+import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.ProviderNewWizardAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class WebServiceProviderTablePage extends AbstractPage implements IMarkerRebuildListener {
+
+ public static final int DATA_SUN_JAXWS_FILE = 1 << 0;
+
+ private String m_markerGroupUUID;
+ private IScoutBundle m_bundle; // necessary to be hold as in method unloadPage, a reference to the bundle is required
+
+ private ScoutXmlDocument m_sunJaxWsXml;
+ private IResourceListener m_resourceListener;
+ private boolean m_pageUnloaded = false;
+
+ public WebServiceProviderTablePage(IPage parent) {
+ setParent(parent);
+ setName(Texts.get("Services"));
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsIcons.WebserviceProviderFolder));
+
+ m_bundle = getScoutResource();
+ m_markerGroupUUID = UUID.randomUUID().toString();
+ m_resourceListener = new P_SunJaxWsResourceListener();
+
+ // register for events being interest in
+ int event = IResourceListener.EVENT_SUNJAXWS_ENTRY_ADDED |
+ IResourceListener.EVENT_SUNJAXWS_ENTRY_REMOVED |
+ IResourceListener.EVENT_SUNJAXWS_REPLACED |
+ IResourceListener.EVENT_UNKNOWN;
+ getSunJaxWsResource().addResourceListener(event, m_resourceListener);
+ getSunJaxWsResource().addResourceListener(IResourceListener.ELEMENT_FILE, m_resourceListener);
+
+ reloadData(DATA_SUN_JAXWS_FILE);
+ }
+
+ public XmlResource getSunJaxWsResource() {
+ return ResourceFactory.getSunJaxWsResource(m_bundle);
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.WEBSERVICE_PROVIDER_TABLE_PAGE;
+ }
+
+ @Override
+ public boolean isFolder() {
+ return true;
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ @Override
+ public void prepareMenuAction(IScoutHandler menu) {
+ if (menu instanceof ProviderNewWizardAction) {
+ ((ProviderNewWizardAction) menu).init(getScoutResource());
+ }
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Class<? extends IScoutHandler>[] getSupportedMenuActions() {
+ return new Class[]{ProviderNewWizardAction.class};
+ }
+
+ @Override
+ public void unloadPage() {
+ m_pageUnloaded = true;
+
+ MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
+ getSunJaxWsResource().removeResourceListener(m_resourceListener);
+ super.unloadPage();
+ }
+
+ @Override
+ public int getQuality() {
+ return MarkerUtility.getQuality(this, m_bundle, m_markerGroupUUID);
+ }
+
+ /**
+ * Reloads data of this node page
+ * The data value is either one of the data constants defined in
+ * class {@link WebServiceProviderTablePage} or must be built by <em>bitwise OR</em>'ing together
+ *
+ * @param data
+ */
+ public void reloadData(int data) {
+ if ((data & DATA_SUN_JAXWS_FILE) > 0) {
+ m_sunJaxWsXml = getSunJaxWsResource().loadXml();
+ }
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
+ }
+
+ @Override
+ public void refresh(boolean clearCache) {
+ if (clearCache) {
+ super.refresh(clearCache);
+ }
+ else {
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
+ }
+ }
+
+ @Override
+ protected void loadChildrenImpl() {
+ try {
+ if (m_sunJaxWsXml == null || m_sunJaxWsXml.getRoot() == null) {
+ return;
+ }
+
+ for (ScoutXmlElement sunJaxWsXml : m_sunJaxWsXml.getRoot().getChildren(StringUtility.join(":", m_sunJaxWsXml.getRoot().getNamePrefix(), SunJaxWsBean.XML_ENDPOINT))) {
+ SunJaxWsBean sunJaxWsBean = new SunJaxWsBean(sunJaxWsXml);
+ BuildJaxWsBean buildJaxWsBean = BuildJaxWsBean.load(m_bundle, sunJaxWsBean.getAlias(), WebserviceEnum.Provider);
+
+ if (buildJaxWsBean != null) {
+ new WebServiceProviderNodePage(this, sunJaxWsBean, buildJaxWsBean);
+ }
+ else {
+ new WebServiceProviderCodeFirstNodePage(this, sunJaxWsBean);
+ }
+ }
+ }
+ finally {
+ JaxWsSdk.getDefault().getMarkerQueueManager().queueRequest(this);
+ }
+ }
+
+ @Override
+ public void rebuildMarkers() {
+ synchronized (m_markerGroupUUID) {
+ try {
+ MarkerUtility.clearMarkers(m_bundle, m_markerGroupUUID);
+
+ if (isPageUnloaded()) {
+ return;
+ }
+ }
+ finally {
+ ScoutSeverityManager.getInstance().fireSeverityChanged(JaxWsSdkUtility.createResourceSet(getSunJaxWsResource().getFile()));
+ }
+ }
+ }
+
+ public String getMarkerGroupUUID() {
+ return m_markerGroupUUID;
+ }
+
+ public boolean isPageUnloaded() {
+ return m_pageUnloaded;
+ }
+
+ private class P_SunJaxWsResourceListener implements IResourceListener {
+
+ @Override
+ public void changed(String element, int event) {
+ reloadData(DATA_SUN_JAXWS_FILE);
+ markStructureDirty();
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServicesTablePage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServicesTablePage.java
index beeec2e5e..0cbaf1198 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServicesTablePage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/pages/WebServicesTablePage.java
@@ -1,50 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
-
-import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
-import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-
-public class WebServicesTablePage extends AbstractPage {
-
- public WebServicesTablePage(IPage parent) {
- setParent(parent);
- setName(Texts.get("Webservices"));
- setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsIcons.WebservicesFolder));
- }
-
- @Override
- public boolean isFolder() {
- return true;
- }
-
- @Override
- public IScoutBundle getScoutResource() {
- return (IScoutBundle) super.getScoutResource();
- }
-
- @Override
- public void loadChildrenImpl() {
- new ProviderTablePage(this);
- new ConsumerTablePage(this);
- new HandlerTablePage(this);
- new SessionFactoryTablePage(this);
- }
-
- @Override
- public String getPageId() {
- return IJaxWsPageConstants.WEBSERVICES_TABLE_PAGE;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.pages;
+
+import org.eclipse.scout.sdk.ui.view.outline.pages.AbstractPage;
+import org.eclipse.scout.sdk.ui.view.outline.pages.IPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+
+public class WebServicesTablePage extends AbstractPage {
+
+ public WebServicesTablePage(IPage parent) {
+ setParent(parent);
+ setName(Texts.get("Webservices"));
+ setImageDescriptor(JaxWsSdk.getImageDescriptor(JaxWsIcons.WebservicesFolder));
+ }
+
+ @Override
+ public boolean isFolder() {
+ return true;
+ }
+
+ @Override
+ public IScoutBundle getScoutResource() {
+ return (IScoutBundle) super.getScoutResource();
+ }
+
+ @Override
+ public void loadChildrenImpl() {
+ new ProviderTablePage(this);
+ new ConsumerTablePage(this);
+ new HandlerTablePage(this);
+ new SessionFactoryTablePage(this);
+ }
+
+ @Override
+ public String getPageId() {
+ return IJaxWsPageConstants.WEBSERVICES_TABLE_PAGE;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AnnotationProperty.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AnnotationProperty.java
index 85affc0b0..f14a03f71 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AnnotationProperty.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AnnotationProperty.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-public class AnnotationProperty {
-
- private boolean m_inherited;
- private String m_fullyQualifiedName;
-
- public boolean isInherited() {
- return m_inherited;
- }
-
- public void setInherited(boolean inherited) {
- m_inherited = inherited;
- }
-
- public String getFullyQualifiedName() {
- return m_fullyQualifiedName;
- }
-
- public void setFullyQualifiedName(String fullyQualifiedName) {
- m_fullyQualifiedName = fullyQualifiedName;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+public class AnnotationProperty {
+
+ private boolean m_inherited;
+ private String m_fullyQualifiedName;
+
+ public boolean isInherited() {
+ return m_inherited;
+ }
+
+ public void setInherited(boolean inherited) {
+ m_inherited = inherited;
+ }
+
+ public String getFullyQualifiedName() {
+ return m_fullyQualifiedName;
+ }
+
+ public void setFullyQualifiedName(String fullyQualifiedName) {
+ m_fullyQualifiedName = fullyQualifiedName;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AuthenticationHandlerNodePagePropertyViewPart.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AuthenticationHandlerNodePagePropertyViewPart.java
index 93d6ffbaf..be265d35b 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AuthenticationHandlerNodePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AuthenticationHandlerNodePagePropertyViewPart.java
@@ -1,228 +1,228 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.util.IScoutSeverityListener;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.TypeOpenAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.AuthenticationHandlerNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.AnnotationPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.AnnotationPropertyTypePresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.TypePresenter.ISearchJavaSearchScopeFactory;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPresenterValueChangedListener;
-import org.eclipse.swt.layout.GridData;
-
-public class AuthenticationHandlerNodePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
-
- public static final String SECTION_ID_LINKS = "section.jaxws.links";
- public static final String SECTION_ID_PROPERTIES = "section.jaxws.properties";
-
- public static final int PRESENTER_ID_SESSION_FACTORY = 1 << 1;
-
- private IPresenterValueChangedListener m_presenterListener;
-
- private AnnotationPresenter m_transactionalPresenter;
- private AnnotationPropertyTypePresenter m_sessionFactoryPresenter;
-
- private P_ScoutSeverityListener m_severityListener;
- private IPageLoadedListener m_pageLoadedListener;
-
- private IScoutBundle m_bundle;
-
- @Override
- protected void init() {
- m_bundle = getPage().getScoutResource();
- m_presenterListener = new P_PresenterListener();
- m_pageLoadedListener = new P_PageLoadedListener();
- m_severityListener = new P_ScoutSeverityListener();
- getPage().addPageLoadedListener(m_pageLoadedListener);
- }
-
- @Override
- protected void cleanup() {
- getPage().removePageLoadedListener(m_pageLoadedListener);
- ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
- super.cleanup();
- }
-
- @Override
- public AuthenticationHandlerNodePage getPage() {
- return (AuthenticationHandlerNodePage) super.getPage();
- }
-
- @Override
- protected void createSections() {
- getForm().setRedraw(true);
- try {
- createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
- createSection(SECTION_ID_PROPERTIES, Texts.get("Properties"));
- if (getPage().getType().isBinary()) {
- getSection(SECTION_ID_PROPERTIES).setText(Texts.get("Properties") + " (" + Texts.get("readOnlyBecauseBinaryFile") + ")");
- }
-
- // QuickLink 'Open Type'
- TypeOpenAction action = new TypeOpenAction();
- action.init(getPage().getType());
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), action, getFormToolkit());
- applyLayoutData(actionPresenter);
-
- m_transactionalPresenter = new AnnotationPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit(),
- getPage().getType(), TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction));
- m_transactionalPresenter.setLabel(Texts.get("Transactional"));
- applyLayoutData(m_transactionalPresenter);
-
- // Scout session factory
- m_sessionFactoryPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_sessionFactoryPresenter.setPresenterId(PRESENTER_ID_SESSION_FACTORY);
- m_sessionFactoryPresenter.setLinkAlwaysEnabled(true);
- m_sessionFactoryPresenter.setLabel(Texts.get("SessionFactory"));
- m_sessionFactoryPresenter.setAcceptNullValue(true);
- m_sessionFactoryPresenter.setBundle(m_bundle);
- m_sessionFactoryPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction));
- m_sessionFactoryPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
- m_sessionFactoryPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedSessionPackageName(m_bundle));
- m_sessionFactoryPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)));
- m_sessionFactoryPresenter.setAllowChangeOfInterfaceType(true);
- m_sessionFactoryPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)});
- m_sessionFactoryPresenter.addValueChangedListener(m_presenterListener);
- applyLayoutData(m_sessionFactoryPresenter);
-
- updatePresenterValues();
- }
- finally {
- getForm().setRedraw(true);
- }
- super.createSections();
- }
-
- private void updatePresenterValues() {
- m_transactionalPresenter.updatePresenter();
-
- IAnnotation scoutTransactionAnnotation = m_transactionalPresenter.getValue();
- boolean transactional = (scoutTransactionAnnotation != null);
- GridData gd = (GridData) m_sessionFactoryPresenter.getContainer().getLayoutData();
- gd.exclude = !transactional;
- m_sessionFactoryPresenter.getContainer().setVisible(transactional);
- JaxWsSdkUtility.doLayout(m_sessionFactoryPresenter.getContainer());
- JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_PROPERTIES));
-
- if (scoutTransactionAnnotation != null) {
- AnnotationProperty propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(getPage().getType(), scoutTransactionAnnotation, JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
- m_sessionFactoryPresenter.setInput(propertyValue.getFullyQualifiedName());
- m_sessionFactoryPresenter.setDeclaringType(getPage().getType());
- m_sessionFactoryPresenter.setResetLinkVisible(!propertyValue.isInherited());
- m_sessionFactoryPresenter.setBoldLabelText(!propertyValue.isInherited());
- m_sessionFactoryPresenter.updateInfo();
- }
-
- if (getPage().getType().isBinary()) {
- m_transactionalPresenter.setEnabled(false);
- m_sessionFactoryPresenter.setEnabled(false);
- }
- }
-
- private void applyLayoutData(AbstractPresenter presenter) {
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- presenter.getContainer().setLayoutData(layoutData);
- }
-
- private ISearchJavaSearchScopeFactory createSubClassesSearchScopeFactory(final IType superType) {
- return new ISearchJavaSearchScopeFactory() {
-
- @Override
- public IJavaSearchScope create() {
- // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
- IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
- return SearchEngine.createJavaSearchScope(subTypes);
- }
- };
- }
-
- private final class P_PresenterListener implements IPresenterValueChangedListener {
-
- @Override
- public void propertyChanged(int presenterId, Object value) {
- switch (presenterId) {
- case PRESENTER_ID_SESSION_FACTORY:
- IType type = getPage().getType();
- if (!TypeUtility.exists(type)) {
- return;
- }
- String factoryFullyQualifiedName = (String) value;
- if (!TypeUtility.existsType(factoryFullyQualifiedName)) {
- return;
- }
- IType factoryType = TypeUtility.getType(factoryFullyQualifiedName);
- AnnotationUpdateOperation op = new AnnotationUpdateOperation();
- op.setDeclaringType(type);
- op.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction));
- op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, factoryType);
- new OperationJob(op).schedule();
- break;
- }
- }
- }
-
- private class P_PageLoadedListener implements IPageLoadedListener {
-
- @Override
- public void pageLoaded() {
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (getForm().isDisposed()) {
- return;
- }
- updatePresenterValues();
- }
- });
- }
- }
-
- private class P_ScoutSeverityListener implements IScoutSeverityListener {
-
- @Override
- public void severityChanged(IResource resource) {
- if (getPage().getType() != null && resource == getPage().getType().getResource()) {
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (getForm().isDisposed()) {
- return;
- }
-
- // update marker status of presenters (quality)
- m_sessionFactoryPresenter.updateInfo();
- }
- });
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.util.IScoutSeverityListener;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.TypeOpenAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.AuthenticationHandlerNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.AnnotationPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.AnnotationPropertyTypePresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.TypePresenter.ISearchJavaSearchScopeFactory;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPresenterValueChangedListener;
+import org.eclipse.swt.layout.GridData;
+
+public class AuthenticationHandlerNodePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+
+ public static final String SECTION_ID_LINKS = "section.jaxws.links";
+ public static final String SECTION_ID_PROPERTIES = "section.jaxws.properties";
+
+ public static final int PRESENTER_ID_SESSION_FACTORY = 1 << 1;
+
+ private IPresenterValueChangedListener m_presenterListener;
+
+ private AnnotationPresenter m_transactionalPresenter;
+ private AnnotationPropertyTypePresenter m_sessionFactoryPresenter;
+
+ private P_ScoutSeverityListener m_severityListener;
+ private IPageLoadedListener m_pageLoadedListener;
+
+ private IScoutBundle m_bundle;
+
+ @Override
+ protected void init() {
+ m_bundle = getPage().getScoutResource();
+ m_presenterListener = new P_PresenterListener();
+ m_pageLoadedListener = new P_PageLoadedListener();
+ m_severityListener = new P_ScoutSeverityListener();
+ getPage().addPageLoadedListener(m_pageLoadedListener);
+ }
+
+ @Override
+ protected void cleanup() {
+ getPage().removePageLoadedListener(m_pageLoadedListener);
+ ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
+ super.cleanup();
+ }
+
+ @Override
+ public AuthenticationHandlerNodePage getPage() {
+ return (AuthenticationHandlerNodePage) super.getPage();
+ }
+
+ @Override
+ protected void createSections() {
+ getForm().setRedraw(true);
+ try {
+ createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
+ createSection(SECTION_ID_PROPERTIES, Texts.get("Properties"));
+ if (getPage().getType().isBinary()) {
+ getSection(SECTION_ID_PROPERTIES).setText(Texts.get("Properties") + " (" + Texts.get("readOnlyBecauseBinaryFile") + ")");
+ }
+
+ // QuickLink 'Open Type'
+ TypeOpenAction action = new TypeOpenAction();
+ action.init(getPage().getType());
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), action, getFormToolkit());
+ applyLayoutData(actionPresenter);
+
+ m_transactionalPresenter = new AnnotationPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit(),
+ getPage().getType(), TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction));
+ m_transactionalPresenter.setLabel(Texts.get("Transactional"));
+ applyLayoutData(m_transactionalPresenter);
+
+ // Scout session factory
+ m_sessionFactoryPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_sessionFactoryPresenter.setPresenterId(PRESENTER_ID_SESSION_FACTORY);
+ m_sessionFactoryPresenter.setLinkAlwaysEnabled(true);
+ m_sessionFactoryPresenter.setLabel(Texts.get("SessionFactory"));
+ m_sessionFactoryPresenter.setAcceptNullValue(true);
+ m_sessionFactoryPresenter.setBundle(m_bundle);
+ m_sessionFactoryPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction));
+ m_sessionFactoryPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
+ m_sessionFactoryPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedSessionPackageName(m_bundle));
+ m_sessionFactoryPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)));
+ m_sessionFactoryPresenter.setAllowChangeOfInterfaceType(true);
+ m_sessionFactoryPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)});
+ m_sessionFactoryPresenter.addValueChangedListener(m_presenterListener);
+ applyLayoutData(m_sessionFactoryPresenter);
+
+ updatePresenterValues();
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ super.createSections();
+ }
+
+ private void updatePresenterValues() {
+ m_transactionalPresenter.updatePresenter();
+
+ IAnnotation scoutTransactionAnnotation = m_transactionalPresenter.getValue();
+ boolean transactional = (scoutTransactionAnnotation != null);
+ GridData gd = (GridData) m_sessionFactoryPresenter.getContainer().getLayoutData();
+ gd.exclude = !transactional;
+ m_sessionFactoryPresenter.getContainer().setVisible(transactional);
+ JaxWsSdkUtility.doLayout(m_sessionFactoryPresenter.getContainer());
+ JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_PROPERTIES));
+
+ if (scoutTransactionAnnotation != null) {
+ AnnotationProperty propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(getPage().getType(), scoutTransactionAnnotation, JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
+ m_sessionFactoryPresenter.setInput(propertyValue.getFullyQualifiedName());
+ m_sessionFactoryPresenter.setDeclaringType(getPage().getType());
+ m_sessionFactoryPresenter.setResetLinkVisible(!propertyValue.isInherited());
+ m_sessionFactoryPresenter.setBoldLabelText(!propertyValue.isInherited());
+ m_sessionFactoryPresenter.updateInfo();
+ }
+
+ if (getPage().getType().isBinary()) {
+ m_transactionalPresenter.setEnabled(false);
+ m_sessionFactoryPresenter.setEnabled(false);
+ }
+ }
+
+ private void applyLayoutData(AbstractPresenter presenter) {
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+
+ private ISearchJavaSearchScopeFactory createSubClassesSearchScopeFactory(final IType superType) {
+ return new ISearchJavaSearchScopeFactory() {
+
+ @Override
+ public IJavaSearchScope create() {
+ // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
+ IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
+ return SearchEngine.createJavaSearchScope(subTypes);
+ }
+ };
+ }
+
+ private final class P_PresenterListener implements IPresenterValueChangedListener {
+
+ @Override
+ public void propertyChanged(int presenterId, Object value) {
+ switch (presenterId) {
+ case PRESENTER_ID_SESSION_FACTORY:
+ IType type = getPage().getType();
+ if (!TypeUtility.exists(type)) {
+ return;
+ }
+ String factoryFullyQualifiedName = (String) value;
+ if (!TypeUtility.existsType(factoryFullyQualifiedName)) {
+ return;
+ }
+ IType factoryType = TypeUtility.getType(factoryFullyQualifiedName);
+ AnnotationUpdateOperation op = new AnnotationUpdateOperation();
+ op.setDeclaringType(type);
+ op.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction));
+ op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, factoryType);
+ new OperationJob(op).schedule();
+ break;
+ }
+ }
+ }
+
+ private class P_PageLoadedListener implements IPageLoadedListener {
+
+ @Override
+ public void pageLoaded() {
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getForm().isDisposed()) {
+ return;
+ }
+ updatePresenterValues();
+ }
+ });
+ }
+ }
+
+ private class P_ScoutSeverityListener implements IScoutSeverityListener {
+
+ @Override
+ public void severityChanged(IResource resource) {
+ if (getPage().getType() != null && resource == getPage().getType().getResource()) {
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getForm().isDisposed()) {
+ return;
+ }
+
+ // update marker status of presenters (quality)
+ m_sessionFactoryPresenter.updateInfo();
+ }
+ });
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AuthenticationHandlerTablePagePropertyViewPart.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AuthenticationHandlerTablePagePropertyViewPart.java
index db17e3d59..d445a7fe3 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AuthenticationHandlerTablePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/AuthenticationHandlerTablePagePropertyViewPart.java
@@ -1,76 +1,76 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.AuthenticationHandlerNewWizardAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.AuthenticationHandlerTablePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.swt.layout.GridData;
-
-public class AuthenticationHandlerTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
-
- public static final String SECTION_ID_FILTER = "section.jaxws.filter";
- public static final String SECTION_ID_AUTHENTICATION_HANDLERS = "section.jaxws.links";
-
- private IScoutBundle m_bundle;
-
- @Override
- protected void init() {
- m_bundle = getPage().getScoutResource();
- }
-
- @Override
- protected void createSections() {
- getForm().setRedraw(false);
- try {
- createSection(SECTION_ID_FILTER, Texts.get("Filter"));
- getSection(SECTION_ID_FILTER).setExpanded(false);
-
- String description;
- if (getPage().getWebserviceEnum() == WebserviceEnum.Provider) {
- description = Texts.get("DescriptionAuthenticationHandlerProvider");
- }
- else {
- description = Texts.get("DescriptionAuthenticationHandlerConsumer");
- }
- createSection(SECTION_ID_AUTHENTICATION_HANDLERS, Texts.get("AuthenticationHandlers"), description, true);
-
- // filter section
- PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), getSection(SECTION_ID_FILTER).getSectionClient(), getPage());
- applyLayoutData(filterPresenter);
-
- // QuickLink 'Create new credential validation strategy'
- AuthenticationHandlerNewWizardAction action = new AuthenticationHandlerNewWizardAction();
- action.init(m_bundle, getPage().getWebserviceEnum());
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_AUTHENTICATION_HANDLERS).getSectionClient(), action, getFormToolkit());
- applyLayoutData(actionPresenter);
- }
- finally {
- getForm().setRedraw(true);
- }
- }
-
- @Override
- public AuthenticationHandlerTablePage getPage() {
- return (AuthenticationHandlerTablePage) super.getPage();
- }
-
- private void applyLayoutData(AbstractPresenter presenter) {
- GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- presenter.getContainer().setLayoutData(layoutData);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.AuthenticationHandlerNewWizardAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.AuthenticationHandlerTablePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.swt.layout.GridData;
+
+public class AuthenticationHandlerTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+
+ public static final String SECTION_ID_FILTER = "section.jaxws.filter";
+ public static final String SECTION_ID_AUTHENTICATION_HANDLERS = "section.jaxws.links";
+
+ private IScoutBundle m_bundle;
+
+ @Override
+ protected void init() {
+ m_bundle = getPage().getScoutResource();
+ }
+
+ @Override
+ protected void createSections() {
+ getForm().setRedraw(false);
+ try {
+ createSection(SECTION_ID_FILTER, Texts.get("Filter"));
+ getSection(SECTION_ID_FILTER).setExpanded(false);
+
+ String description;
+ if (getPage().getWebserviceEnum() == WebserviceEnum.Provider) {
+ description = Texts.get("DescriptionAuthenticationHandlerProvider");
+ }
+ else {
+ description = Texts.get("DescriptionAuthenticationHandlerConsumer");
+ }
+ createSection(SECTION_ID_AUTHENTICATION_HANDLERS, Texts.get("AuthenticationHandlers"), description, true);
+
+ // filter section
+ PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), getSection(SECTION_ID_FILTER).getSectionClient(), getPage());
+ applyLayoutData(filterPresenter);
+
+ // QuickLink 'Create new credential validation strategy'
+ AuthenticationHandlerNewWizardAction action = new AuthenticationHandlerNewWizardAction();
+ action.init(m_bundle, getPage().getWebserviceEnum());
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_AUTHENTICATION_HANDLERS).getSectionClient(), action, getFormToolkit());
+ applyLayoutData(actionPresenter);
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ }
+
+ @Override
+ public AuthenticationHandlerTablePage getPage() {
+ return (AuthenticationHandlerTablePage) super.getPage();
+ }
+
+ private void applyLayoutData(AbstractPresenter presenter) {
+ GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/CredentialValidationStrategyTablePagePropertyViewPart.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/CredentialValidationStrategyTablePagePropertyViewPart.java
index 85d011b87..3e15b0c43 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/CredentialValidationStrategyTablePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/CredentialValidationStrategyTablePagePropertyViewPart.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.CredentialValidationStrategyNewAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.CredentialValidationStrategyTablePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
-import org.eclipse.swt.layout.GridData;
-
-public class CredentialValidationStrategyTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
-
- public static final String SECTION_ID_FILTER = "section.jaxws.filter";
- public static final String SECTION_ID_CREDENTIAL_VALIDATION_STRATEGIES = "section.jaxws.links";
-
- private IScoutBundle m_bundle;
-
- @Override
- protected void init() {
- m_bundle = getPage().getScoutResource();
- }
-
- @Override
- protected void createSections() {
- getForm().setRedraw(false);
- try {
- createSection(SECTION_ID_FILTER, Texts.get("Filter"));
- getSection(SECTION_ID_FILTER).setExpanded(false);
- createSection(SECTION_ID_CREDENTIAL_VALIDATION_STRATEGIES, Texts.get("CredentialValidationStrategies"), Texts.get("DescriptionCredentialValidatinStrategy"), true);
-
- // filter section
- PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), getSection(SECTION_ID_FILTER).getSectionClient(), getPage());
- applyLayoutData(filterPresenter);
-
- // QuickLink 'Create new credential validation strategy'
- CredentialValidationStrategyNewAction action = new CredentialValidationStrategyNewAction();
- action.init(m_bundle);
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_CREDENTIAL_VALIDATION_STRATEGIES).getSectionClient(), action, getFormToolkit());
- applyLayoutData(actionPresenter);
- }
- finally {
- getForm().setRedraw(true);
- }
- }
-
- @Override
- public CredentialValidationStrategyTablePage getPage() {
- return (CredentialValidationStrategyTablePage) super.getPage();
- }
-
- private void applyLayoutData(AbstractPresenter presenter) {
- GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- presenter.getContainer().setLayoutData(layoutData);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.CredentialValidationStrategyNewAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.CredentialValidationStrategyTablePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
+import org.eclipse.swt.layout.GridData;
+
+public class CredentialValidationStrategyTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+
+ public static final String SECTION_ID_FILTER = "section.jaxws.filter";
+ public static final String SECTION_ID_CREDENTIAL_VALIDATION_STRATEGIES = "section.jaxws.links";
+
+ private IScoutBundle m_bundle;
+
+ @Override
+ protected void init() {
+ m_bundle = getPage().getScoutResource();
+ }
+
+ @Override
+ protected void createSections() {
+ getForm().setRedraw(false);
+ try {
+ createSection(SECTION_ID_FILTER, Texts.get("Filter"));
+ getSection(SECTION_ID_FILTER).setExpanded(false);
+ createSection(SECTION_ID_CREDENTIAL_VALIDATION_STRATEGIES, Texts.get("CredentialValidationStrategies"), Texts.get("DescriptionCredentialValidatinStrategy"), true);
+
+ // filter section
+ PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), getSection(SECTION_ID_FILTER).getSectionClient(), getPage());
+ applyLayoutData(filterPresenter);
+
+ // QuickLink 'Create new credential validation strategy'
+ CredentialValidationStrategyNewAction action = new CredentialValidationStrategyNewAction();
+ action.init(m_bundle);
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_CREDENTIAL_VALIDATION_STRATEGIES).getSectionClient(), action, getFormToolkit());
+ applyLayoutData(actionPresenter);
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ }
+
+ @Override
+ public CredentialValidationStrategyTablePage getPage() {
+ return (CredentialValidationStrategyTablePage) super.getPage();
+ }
+
+ private void applyLayoutData(AbstractPresenter presenter) {
+ GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/HandlerNodePagePropertyViewPart.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/HandlerNodePagePropertyViewPart.java
index 5d1e1bc58..de0b21451 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/HandlerNodePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/HandlerNodePagePropertyViewPart.java
@@ -1,226 +1,226 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.util.IScoutSeverityListener;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.TypeOpenAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.HandlerNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.AnnotationPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.AnnotationPropertyTypePresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.TypePresenter.ISearchJavaSearchScopeFactory;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPresenterValueChangedListener;
-import org.eclipse.swt.layout.GridData;
-
-public class HandlerNodePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
-
- public static final String SECTION_ID_LINKS = "section.jaxws.links";
- public static final String SECTION_ID_PROPERTIES = "section.jaxws.properties";
-
- public static final int PRESENTER_ID_SESSION_FACTORY = 1 << 1;
-
- private IPresenterValueChangedListener m_presenterListener;
-
- private AnnotationPresenter m_transactionalPresenter;
- private AnnotationPropertyTypePresenter m_sessionFactoryPresenter;
-
- private P_ScoutSeverityListener m_severityListener;
- private IPageLoadedListener m_pageLoadedListener;
-
- private IScoutBundle m_bundle;
-
- @Override
- protected void init() {
- m_bundle = getPage().getScoutResource();
- m_presenterListener = new P_PresenterListener();
- m_pageLoadedListener = new P_PageLoadedListener();
- m_severityListener = new P_ScoutSeverityListener();
- getPage().addPageLoadedListener(m_pageLoadedListener);
- }
-
- @Override
- protected void cleanup() {
- getPage().removePageLoadedListener(m_pageLoadedListener);
- ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
- super.cleanup();
- }
-
- @Override
- public HandlerNodePage getPage() {
- return (HandlerNodePage) super.getPage();
- }
-
- @Override
- protected void createSections() {
- getForm().setRedraw(true);
- try {
- createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
- createSection(SECTION_ID_PROPERTIES, Texts.get("Properties"));
- if (getPage().getType().isBinary()) {
- getSection(SECTION_ID_PROPERTIES).setText(Texts.get("Properties") + " (" + Texts.get("readOnlyBecauseBinaryFile") + ")");
- }
- // QuickLink 'Open Type'
- TypeOpenAction action = new TypeOpenAction();
- action.init(getPage().getType());
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), action, getFormToolkit());
- applyLayoutData(actionPresenter);
-
- m_transactionalPresenter = new AnnotationPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit(), getPage().getType(), TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction));
- m_transactionalPresenter.setLabel(Texts.get("Transactional"));
- applyLayoutData(m_transactionalPresenter);
-
- // Scout session factory
- m_sessionFactoryPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_sessionFactoryPresenter.setPresenterId(PRESENTER_ID_SESSION_FACTORY);
- m_sessionFactoryPresenter.setLinkAlwaysEnabled(true);
- m_sessionFactoryPresenter.setLabel(Texts.get("SessionFactory"));
- m_sessionFactoryPresenter.setAcceptNullValue(true);
- m_sessionFactoryPresenter.setBundle(m_bundle);
- m_sessionFactoryPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction));
- m_sessionFactoryPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
- m_sessionFactoryPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedSessionPackageName(m_bundle));
- m_sessionFactoryPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)));
- m_sessionFactoryPresenter.setAllowChangeOfInterfaceType(true);
- m_sessionFactoryPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)});
- m_sessionFactoryPresenter.addValueChangedListener(m_presenterListener);
- applyLayoutData(m_sessionFactoryPresenter);
-
- updatePresenterValues();
- }
- finally {
- getForm().setRedraw(true);
- }
- super.createSections();
- }
-
- private void updatePresenterValues() {
- m_transactionalPresenter.updatePresenter();
-
- IAnnotation scoutTransactionAnnotation = m_transactionalPresenter.getValue();
- boolean transactional = (scoutTransactionAnnotation != null);
- GridData gd = (GridData) m_sessionFactoryPresenter.getContainer().getLayoutData();
- gd.exclude = !transactional;
- m_sessionFactoryPresenter.getContainer().setVisible(transactional);
- JaxWsSdkUtility.doLayout(m_sessionFactoryPresenter.getContainer());
- JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_PROPERTIES));
-
- if (scoutTransactionAnnotation != null) {
- AnnotationProperty propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(getPage().getType(), scoutTransactionAnnotation, JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
- m_sessionFactoryPresenter.setInput(propertyValue.getFullyQualifiedName());
- m_sessionFactoryPresenter.setDeclaringType(getPage().getType());
- m_sessionFactoryPresenter.setResetLinkVisible(!propertyValue.isInherited());
- m_sessionFactoryPresenter.setBoldLabelText(!propertyValue.isInherited());
- m_sessionFactoryPresenter.updateInfo();
- }
-
- if (getPage().getType().isBinary()) {
- m_transactionalPresenter.setEnabled(false);
- m_sessionFactoryPresenter.setEnabled(false);
- }
- }
-
- private void applyLayoutData(AbstractPresenter presenter) {
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- presenter.getContainer().setLayoutData(layoutData);
- }
-
- private ISearchJavaSearchScopeFactory createSubClassesSearchScopeFactory(final IType superType) {
- return new ISearchJavaSearchScopeFactory() {
-
- @Override
- public IJavaSearchScope create() {
- // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
- IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
- return SearchEngine.createJavaSearchScope(subTypes);
- }
- };
- }
-
- private final class P_PresenterListener implements IPresenterValueChangedListener {
-
- @Override
- public void propertyChanged(int presenterId, Object value) {
- switch (presenterId) {
- case PRESENTER_ID_SESSION_FACTORY:
- IType type = getPage().getType();
- if (!TypeUtility.exists(type)) {
- return;
- }
- String factoryFullyQualifiedName = (String) value;
- if (!TypeUtility.existsType(factoryFullyQualifiedName)) {
- return;
- }
- IType factoryType = TypeUtility.getType(factoryFullyQualifiedName);
- AnnotationUpdateOperation op = new AnnotationUpdateOperation();
- op.setDeclaringType(type);
- op.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction));
- op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, factoryType);
- new OperationJob(op).schedule();
- break;
- }
- }
- }
-
- private class P_PageLoadedListener implements IPageLoadedListener {
-
- @Override
- public void pageLoaded() {
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (getForm().isDisposed()) {
- return;
- }
- updatePresenterValues();
- }
- });
- }
- }
-
- private class P_ScoutSeverityListener implements IScoutSeverityListener {
-
- @Override
- public void severityChanged(IResource resource) {
- if (getPage().getType() != null && resource == getPage().getType().getResource()) {
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (getForm().isDisposed()) {
- return;
- }
-
- // update marker status of presenters (quality)
- m_sessionFactoryPresenter.updateInfo();
- }
- });
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.util.IScoutSeverityListener;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.TypeOpenAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.HandlerNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.AnnotationPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.AnnotationPropertyTypePresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.TypePresenter.ISearchJavaSearchScopeFactory;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPresenterValueChangedListener;
+import org.eclipse.swt.layout.GridData;
+
+public class HandlerNodePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+
+ public static final String SECTION_ID_LINKS = "section.jaxws.links";
+ public static final String SECTION_ID_PROPERTIES = "section.jaxws.properties";
+
+ public static final int PRESENTER_ID_SESSION_FACTORY = 1 << 1;
+
+ private IPresenterValueChangedListener m_presenterListener;
+
+ private AnnotationPresenter m_transactionalPresenter;
+ private AnnotationPropertyTypePresenter m_sessionFactoryPresenter;
+
+ private P_ScoutSeverityListener m_severityListener;
+ private IPageLoadedListener m_pageLoadedListener;
+
+ private IScoutBundle m_bundle;
+
+ @Override
+ protected void init() {
+ m_bundle = getPage().getScoutResource();
+ m_presenterListener = new P_PresenterListener();
+ m_pageLoadedListener = new P_PageLoadedListener();
+ m_severityListener = new P_ScoutSeverityListener();
+ getPage().addPageLoadedListener(m_pageLoadedListener);
+ }
+
+ @Override
+ protected void cleanup() {
+ getPage().removePageLoadedListener(m_pageLoadedListener);
+ ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
+ super.cleanup();
+ }
+
+ @Override
+ public HandlerNodePage getPage() {
+ return (HandlerNodePage) super.getPage();
+ }
+
+ @Override
+ protected void createSections() {
+ getForm().setRedraw(true);
+ try {
+ createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
+ createSection(SECTION_ID_PROPERTIES, Texts.get("Properties"));
+ if (getPage().getType().isBinary()) {
+ getSection(SECTION_ID_PROPERTIES).setText(Texts.get("Properties") + " (" + Texts.get("readOnlyBecauseBinaryFile") + ")");
+ }
+ // QuickLink 'Open Type'
+ TypeOpenAction action = new TypeOpenAction();
+ action.init(getPage().getType());
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), action, getFormToolkit());
+ applyLayoutData(actionPresenter);
+
+ m_transactionalPresenter = new AnnotationPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit(), getPage().getType(), TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction));
+ m_transactionalPresenter.setLabel(Texts.get("Transactional"));
+ applyLayoutData(m_transactionalPresenter);
+
+ // Scout session factory
+ m_sessionFactoryPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_sessionFactoryPresenter.setPresenterId(PRESENTER_ID_SESSION_FACTORY);
+ m_sessionFactoryPresenter.setLinkAlwaysEnabled(true);
+ m_sessionFactoryPresenter.setLabel(Texts.get("SessionFactory"));
+ m_sessionFactoryPresenter.setAcceptNullValue(true);
+ m_sessionFactoryPresenter.setBundle(m_bundle);
+ m_sessionFactoryPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction));
+ m_sessionFactoryPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
+ m_sessionFactoryPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedSessionPackageName(m_bundle));
+ m_sessionFactoryPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)));
+ m_sessionFactoryPresenter.setAllowChangeOfInterfaceType(true);
+ m_sessionFactoryPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)});
+ m_sessionFactoryPresenter.addValueChangedListener(m_presenterListener);
+ applyLayoutData(m_sessionFactoryPresenter);
+
+ updatePresenterValues();
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ super.createSections();
+ }
+
+ private void updatePresenterValues() {
+ m_transactionalPresenter.updatePresenter();
+
+ IAnnotation scoutTransactionAnnotation = m_transactionalPresenter.getValue();
+ boolean transactional = (scoutTransactionAnnotation != null);
+ GridData gd = (GridData) m_sessionFactoryPresenter.getContainer().getLayoutData();
+ gd.exclude = !transactional;
+ m_sessionFactoryPresenter.getContainer().setVisible(transactional);
+ JaxWsSdkUtility.doLayout(m_sessionFactoryPresenter.getContainer());
+ JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_PROPERTIES));
+
+ if (scoutTransactionAnnotation != null) {
+ AnnotationProperty propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(getPage().getType(), scoutTransactionAnnotation, JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
+ m_sessionFactoryPresenter.setInput(propertyValue.getFullyQualifiedName());
+ m_sessionFactoryPresenter.setDeclaringType(getPage().getType());
+ m_sessionFactoryPresenter.setResetLinkVisible(!propertyValue.isInherited());
+ m_sessionFactoryPresenter.setBoldLabelText(!propertyValue.isInherited());
+ m_sessionFactoryPresenter.updateInfo();
+ }
+
+ if (getPage().getType().isBinary()) {
+ m_transactionalPresenter.setEnabled(false);
+ m_sessionFactoryPresenter.setEnabled(false);
+ }
+ }
+
+ private void applyLayoutData(AbstractPresenter presenter) {
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+
+ private ISearchJavaSearchScopeFactory createSubClassesSearchScopeFactory(final IType superType) {
+ return new ISearchJavaSearchScopeFactory() {
+
+ @Override
+ public IJavaSearchScope create() {
+ // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
+ IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
+ return SearchEngine.createJavaSearchScope(subTypes);
+ }
+ };
+ }
+
+ private final class P_PresenterListener implements IPresenterValueChangedListener {
+
+ @Override
+ public void propertyChanged(int presenterId, Object value) {
+ switch (presenterId) {
+ case PRESENTER_ID_SESSION_FACTORY:
+ IType type = getPage().getType();
+ if (!TypeUtility.exists(type)) {
+ return;
+ }
+ String factoryFullyQualifiedName = (String) value;
+ if (!TypeUtility.existsType(factoryFullyQualifiedName)) {
+ return;
+ }
+ IType factoryType = TypeUtility.getType(factoryFullyQualifiedName);
+ AnnotationUpdateOperation op = new AnnotationUpdateOperation();
+ op.setDeclaringType(type);
+ op.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction));
+ op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, factoryType);
+ new OperationJob(op).schedule();
+ break;
+ }
+ }
+ }
+
+ private class P_PageLoadedListener implements IPageLoadedListener {
+
+ @Override
+ public void pageLoaded() {
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getForm().isDisposed()) {
+ return;
+ }
+ updatePresenterValues();
+ }
+ });
+ }
+ }
+
+ private class P_ScoutSeverityListener implements IScoutSeverityListener {
+
+ @Override
+ public void severityChanged(IResource resource) {
+ if (getPage().getType() != null && resource == getPage().getType().getResource()) {
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getForm().isDisposed()) {
+ return;
+ }
+
+ // update marker status of presenters (quality)
+ m_sessionFactoryPresenter.updateInfo();
+ }
+ });
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/HandlerTablePagePropertyViewPart.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/HandlerTablePagePropertyViewPart.java
index eb1091553..6b3176df5 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/HandlerTablePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/HandlerTablePagePropertyViewPart.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerNewWizardAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.HandlerTablePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
-import org.eclipse.swt.layout.GridData;
-
-public class HandlerTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
-
- public static final String SECTION_ID_FILTER = "section.jaxws.filter";
- public static final String SECTION_ID_LINKS = "section.jaxws.links";
-
- private IScoutBundle m_bundle;
-
- @Override
- protected void init() {
- m_bundle = getPage().getScoutResource();
- }
-
- @Override
- protected void createSections() {
- getForm().setRedraw(false);
- try {
- createSection(SECTION_ID_FILTER, Texts.get("Filter"));
- getSection(SECTION_ID_FILTER).setExpanded(false);
- createSection(SECTION_ID_LINKS, Texts.get("Handlers"), Texts.get("DescriptionHandlers"), true);
-
- // filter section
- PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), getSection(SECTION_ID_FILTER).getSectionClient(), getPage());
- applyLayoutData(filterPresenter);
-
- // QuickLink 'Create new Handler'
- HandlerNewWizardAction action = new HandlerNewWizardAction();
- action.init(m_bundle);
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), action, getFormToolkit());
- applyLayoutData(actionPresenter);
- }
- finally {
- getForm().setRedraw(true);
- }
- }
-
- @Override
- public HandlerTablePage getPage() {
- return (HandlerTablePage) super.getPage();
- }
-
- private void applyLayoutData(AbstractPresenter presenter) {
- GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- presenter.getContainer().setLayoutData(layoutData);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerNewWizardAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.HandlerTablePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
+import org.eclipse.swt.layout.GridData;
+
+public class HandlerTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+
+ public static final String SECTION_ID_FILTER = "section.jaxws.filter";
+ public static final String SECTION_ID_LINKS = "section.jaxws.links";
+
+ private IScoutBundle m_bundle;
+
+ @Override
+ protected void init() {
+ m_bundle = getPage().getScoutResource();
+ }
+
+ @Override
+ protected void createSections() {
+ getForm().setRedraw(false);
+ try {
+ createSection(SECTION_ID_FILTER, Texts.get("Filter"));
+ getSection(SECTION_ID_FILTER).setExpanded(false);
+ createSection(SECTION_ID_LINKS, Texts.get("Handlers"), Texts.get("DescriptionHandlers"), true);
+
+ // filter section
+ PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), getSection(SECTION_ID_FILTER).getSectionClient(), getPage());
+ applyLayoutData(filterPresenter);
+
+ // QuickLink 'Create new Handler'
+ HandlerNewWizardAction action = new HandlerNewWizardAction();
+ action.init(m_bundle);
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), action, getFormToolkit());
+ applyLayoutData(actionPresenter);
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ }
+
+ @Override
+ public HandlerTablePage getPage() {
+ return (HandlerTablePage) super.getPage();
+ }
+
+ private void applyLayoutData(AbstractPresenter presenter) {
+ GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/ProviderTablePagePropertyViewPart.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/ProviderTablePagePropertyViewPart.java
index 13f5892c4..3ecd7d0ba 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/ProviderTablePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/ProviderTablePagePropertyViewPart.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.JaxWsAliasChangeWizardAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.ProviderTablePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
-import org.eclipse.swt.layout.GridData;
-
-public class ProviderTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
-
- public static final String SECTION_ID_GENERAL = "section.jaxws.general";
-
- private IScoutBundle m_bundle;
-
- @Override
- protected void init() {
- m_bundle = getPage().getScoutResource();
- }
-
- @Override
- protected void createSections() {
- getForm().setRedraw(false);
- try {
- createSection(SECTION_ID_GENERAL, Texts.get("General"));
-
- // Change webservice servlet alias
- JaxWsAliasChangeWizardAction e = new JaxWsAliasChangeWizardAction();
- e.init(m_bundle);
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_GENERAL).getSectionClient(), e, getFormToolkit());
- applyLayoutData(actionPresenter);
- }
- finally {
- getForm().setRedraw(true);
- }
- }
-
- @Override
- public ProviderTablePage getPage() {
- return (ProviderTablePage) super.getPage();
- }
-
- private void applyLayoutData(AbstractPresenter presenter) {
- GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- presenter.getContainer().setLayoutData(layoutData);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.JaxWsAliasChangeWizardAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.ProviderTablePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
+import org.eclipse.swt.layout.GridData;
+
+public class ProviderTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+
+ public static final String SECTION_ID_GENERAL = "section.jaxws.general";
+
+ private IScoutBundle m_bundle;
+
+ @Override
+ protected void init() {
+ m_bundle = getPage().getScoutResource();
+ }
+
+ @Override
+ protected void createSections() {
+ getForm().setRedraw(false);
+ try {
+ createSection(SECTION_ID_GENERAL, Texts.get("General"));
+
+ // Change webservice servlet alias
+ JaxWsAliasChangeWizardAction e = new JaxWsAliasChangeWizardAction();
+ e.init(m_bundle);
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_GENERAL).getSectionClient(), e, getFormToolkit());
+ applyLayoutData(actionPresenter);
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ }
+
+ @Override
+ public ProviderTablePage getPage() {
+ return (ProviderTablePage) super.getPage();
+ }
+
+ private void applyLayoutData(AbstractPresenter presenter) {
+ GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/SessionFactoryTablePagePropertyViewPart.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/SessionFactoryTablePagePropertyViewPart.java
index 5b3e8fc37..97f87879a 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/SessionFactoryTablePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/SessionFactoryTablePagePropertyViewPart.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.SessionFactoryNewAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.SessionFactoryTablePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
-import org.eclipse.swt.layout.GridData;
-
-public class SessionFactoryTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
-
- public static final String SECTION_ID_FILTER = "section.jaxws.filter";
- public static final String SECTION_ID_SESSION_FACTORIES = "section.jaxws.links";
-
- private IScoutBundle m_bundle;
-
- @Override
- protected void init() {
- m_bundle = getPage().getScoutResource();
- }
-
- @Override
- protected void createSections() {
- getForm().setRedraw(false);
- try {
- createSection(SECTION_ID_FILTER, Texts.get("Filter"));
- getSection(SECTION_ID_FILTER).setExpanded(false);
- createSection(SECTION_ID_SESSION_FACTORIES, Texts.get("ServerSessionFactories"), Texts.get("DescriptionServerSerssionFactory"), true);
-
- // filter section
- PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), getSection(SECTION_ID_FILTER).getSectionClient(), getPage());
- applyLayoutData(filterPresenter);
-
- // QuickLink 'Create new Session Factory'
- SessionFactoryNewAction action = new SessionFactoryNewAction();
- action.init(m_bundle);
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_SESSION_FACTORIES).getSectionClient(), action, getFormToolkit());
- applyLayoutData(actionPresenter);
- }
- finally {
- getForm().setRedraw(true);
- }
- }
-
- @Override
- public SessionFactoryTablePage getPage() {
- return (SessionFactoryTablePage) super.getPage();
- }
-
- private void applyLayoutData(AbstractPresenter presenter) {
- GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- presenter.getContainer().setLayoutData(layoutData);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.SessionFactoryNewAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.SessionFactoryTablePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
+import org.eclipse.swt.layout.GridData;
+
+public class SessionFactoryTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+
+ public static final String SECTION_ID_FILTER = "section.jaxws.filter";
+ public static final String SECTION_ID_SESSION_FACTORIES = "section.jaxws.links";
+
+ private IScoutBundle m_bundle;
+
+ @Override
+ protected void init() {
+ m_bundle = getPage().getScoutResource();
+ }
+
+ @Override
+ protected void createSections() {
+ getForm().setRedraw(false);
+ try {
+ createSection(SECTION_ID_FILTER, Texts.get("Filter"));
+ getSection(SECTION_ID_FILTER).setExpanded(false);
+ createSection(SECTION_ID_SESSION_FACTORIES, Texts.get("ServerSessionFactories"), Texts.get("DescriptionServerSerssionFactory"), true);
+
+ // filter section
+ PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), getSection(SECTION_ID_FILTER).getSectionClient(), getPage());
+ applyLayoutData(filterPresenter);
+
+ // QuickLink 'Create new Session Factory'
+ SessionFactoryNewAction action = new SessionFactoryNewAction();
+ action.init(m_bundle);
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_SESSION_FACTORIES).getSectionClient(), action, getFormToolkit());
+ applyLayoutData(actionPresenter);
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ }
+
+ @Override
+ public SessionFactoryTablePage getPage() {
+ return (SessionFactoryTablePage) super.getPage();
+ }
+
+ private void applyLayoutData(AbstractPresenter presenter) {
+ GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceConsumerNodePagePropertyViewPart.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceConsumerNodePagePropertyViewPart.java
index 6204feb2c..f9e442fae 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceConsumerNodePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceConsumerNodePagePropertyViewPart.java
@@ -1,691 +1,691 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.jws.WebService;
-import javax.wsdl.Definition;
-import javax.xml.namespace.QName;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.JdtTypePropertyPart;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.util.IScoutSeverityListener;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
-import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.BindingFileNewAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.BuildPropertiesEditAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction.FileExtensionType;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.RepairAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.StubRebuildAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.TypeOpenAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceConsumerNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.AnnotationPropertyTypePresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.BindingFilePresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.FilePresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.FolderPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.SeparatorPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.StringPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.TypePresenter.ISearchJavaSearchScopeFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.WsdlFilePresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.WsdlFolderPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.Artefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaImportArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaIncludeArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPresenterValueChangedListener;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-public class WebServiceConsumerNodePagePropertyViewPart extends JdtTypePropertyPart {
-
- public static final String SECTION_ID_REPAIR = "section.jaxws.repair";
- public static final String SECTION_ID_PROPERTIES = "section.jaxws.properties";
- public static final String SECTION_ID_STUB_PROPERTIES = "section.jaxws.build";
- public static final String SECTION_ID_LINKS = "section.jaxws.links";
- public static final String SECTION_ID_LINKS_REF_WSDLS = "section.jaxws.links.ref.wsdl";
- public static final String SECTION_ID_LINKS_INCLUDED_SCHEMAS = "section.jaxws.links.included.schema";
- public static final String SECTION_ID_LINKS_IMPORTED_SCHEMAS = "section.jaxws.links.imported.schema";
- public static final String SECTION_ID_SCOUT_WEB_SERVICE_CLIENT_ANNOTATION = "section.scoutWebServiceAnnotation";
-
- public static final int PRESENTER_ID_AUTHENTICATION_HANDLER = 1 << 1;
-
- private IPresenterValueChangedListener m_presenterListener;
-
- private StringPresenter m_targetNamespacePresenter;
- private StringPresenter m_servicePresenter;
- private StringPresenter m_portTypePresenter;
- private FolderPresenter m_stubFolderPresenter;
- private FilePresenter m_stubJarFilePresenter;
- private WsdlFolderPresenter m_wsdlFolderPresenter;
- private WsdlFilePresenter m_wsdlFilePresenter;
-
- private Composite m_bindingFilesComposite;
-
- private P_ScoutSeverityListener m_severityListener;
- private IPageLoadedListener m_pageLoadedListener;
-
- private AnnotationPropertyTypePresenter m_authenticationHandlerPresenter;
- private List<BindingFilePresenter> m_bindingFilePresenters;
- private ActionPresenter m_rebuildStubPresenter;
-
- private IScoutBundle m_bundle;
-
- @Override
- protected void init() {
- m_bundle = getPage().getScoutResource();
- m_presenterListener = new P_PresenterListener();
- m_severityListener = new P_ScoutSeverityListener();
- m_pageLoadedListener = new P_PageLoadedListener();
- ScoutSeverityManager.getInstance().addQualityManagerListener(m_severityListener);
- getPage().addPageLoadedListener(m_pageLoadedListener);
- m_bindingFilePresenters = new LinkedList<BindingFilePresenter>();
- }
-
- @Override
- protected void cleanup() {
- ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
- getPage().removePageLoadedListener(m_pageLoadedListener);
- super.cleanup();
- }
-
- @Override
- public WebServiceConsumerNodePage getPage() {
- return (WebServiceConsumerNodePage) super.getPage();
- }
-
- @Override
- protected void createSections() {
- getForm().setRedraw(true);
- try {
- /*
- * repair section
- */
- createSection(SECTION_ID_REPAIR, Texts.get("RepairRequired"), Texts.get("SectionRepairDescription"), false);
- getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
- RepairAction a = new RepairAction();
- a.init(getPage().getMarkerGroupUUID(), m_bundle);
- AbstractPresenter presenter = new ActionPresenter(getSection(SECTION_ID_REPAIR).getSectionClient(), a, getFormToolkit());
- applyLayoutData(presenter);
-
- /*
- * link section
- */
- createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
- createQuickLinkPresenters();
-
- /*
- * link section (referenced WSDL definitions)
- */
- createSection(SECTION_ID_LINKS_REF_WSDLS, Texts.get("ReferencedWsdlDefintions"));
- getSection(SECTION_ID_LINKS_REF_WSDLS).setExpanded(false);
-
- /*
- * link section (imported XSD schemas)
- */
- createSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS, Texts.get("ImportedXsdSchemas"));
- getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).setExpanded(false);
-
- /*
- * link section (included XSD schemas)
- */
- createSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS, Texts.get("IncludedXsdSchemas"));
- getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).setExpanded(false);
-
- createQuickLinkPresentersForReferencedFiles();
-
- if (getPage().getBuildJaxWsBean() == null) {
- return;
- }
-
- /*
- * stub properties section
- */
- createSection(SECTION_ID_STUB_PROPERTIES, Texts.get("StubProperties"));
-
- StubRebuildAction b = new StubRebuildAction();
- b.init(m_bundle, getPage().getBuildJaxWsBean(), getPage().getWsdlResource(), getPage().getMarkerGroupUUID(), WebserviceEnum.Consumer);
- m_rebuildStubPresenter = new ActionPresenter(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), b, getFormToolkit());
- applyLayoutData(m_rebuildStubPresenter);
-
- // edit build properties
- BuildPropertiesEditAction c = new BuildPropertiesEditAction();
- c.init(m_bundle, getPage().getBuildJaxWsBean());
- presenter = new ActionPresenter(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), c, getFormToolkit());
- GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.horizontalAlignment = SWT.RIGHT;
- presenter.getContainer().setLayoutData(gd);
-
- // add binding file
- BindingFileNewAction d = new BindingFileNewAction();
- d.init(m_bundle, getPage().getBuildJaxWsBean(), getPage().getWsdlResource());
- presenter = new ActionPresenter(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), d, getFormToolkit());
- presenter.setEnabled(getPage().getBuildJaxWsBean() != null);
- gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.horizontalAlignment = SWT.RIGHT;
- presenter.getContainer().setLayoutData(gd);
-
- // binding files composite
- m_bindingFilesComposite = new Composite(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), SWT.NONE);
- gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.verticalIndent = 5;
- m_bindingFilesComposite.setLayoutData(gd);
-
- /*
- * Scout webservice annotation section
- */
- createSection(SECTION_ID_SCOUT_WEB_SERVICE_CLIENT_ANNOTATION, Texts.get("Authentication"), null, true);
- getSection(SECTION_ID_SCOUT_WEB_SERVICE_CLIENT_ANNOTATION).setExpanded(false);
-
- // Scout authentication factory
- m_authenticationHandlerPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_SCOUT_WEB_SERVICE_CLIENT_ANNOTATION).getSectionClient(), getFormToolkit());
- m_authenticationHandlerPresenter.setPresenterId(PRESENTER_ID_AUTHENTICATION_HANDLER);
- m_authenticationHandlerPresenter.setLabel(Texts.get("Authentication"));
- m_authenticationHandlerPresenter.setAcceptNullValue(true);
- m_authenticationHandlerPresenter.setBundle(m_bundle);
- m_authenticationHandlerPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebServiceClient));
- m_authenticationHandlerPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER);
- m_authenticationHandlerPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedConsumerSecurityPackageName(m_bundle));
- m_authenticationHandlerPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- m_authenticationHandlerPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer)));
- m_authenticationHandlerPresenter.setAllowChangeOfInterfaceType(true);
- m_authenticationHandlerPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer)});
- m_authenticationHandlerPresenter.addValueChangedListener(m_presenterListener);
- m_authenticationHandlerPresenter.getContainer().setLayoutData(new GridData());
- applyLayoutData(m_authenticationHandlerPresenter);
-
- /*
- * properties section
- */
- createSection(SECTION_ID_PROPERTIES, Texts.get("WebserviceProperties"));
- getSection(SECTION_ID_PROPERTIES).setExpanded(true);
-
- // service
- m_servicePresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_servicePresenter.setLabel(Texts.get("Service"));
- m_servicePresenter.setBundle(m_bundle);
- m_servicePresenter.setMarkerType(MarkerType.Service);
- m_servicePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- m_servicePresenter.setEditable(false);
- applyLayoutData(m_servicePresenter);
-
- // port type
- m_portTypePresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_portTypePresenter.setLabel(Texts.get("PortType"));
- m_portTypePresenter.setBundle(m_bundle);
- m_portTypePresenter.setMarkerType(MarkerType.PortType);
- m_portTypePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- m_portTypePresenter.setEditable(false);
- applyLayoutData(m_portTypePresenter);
-
- // target namespace
- m_targetNamespacePresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_targetNamespacePresenter.setLabel(Texts.get("TargetNamespace"));
- m_targetNamespacePresenter.setBundle(m_bundle);
- m_targetNamespacePresenter.setMarkerType(MarkerType.TargetNamespace);
- m_targetNamespacePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- m_targetNamespacePresenter.setEditable(false);
- applyLayoutData(m_targetNamespacePresenter);
-
- // stub folder
- m_stubFolderPresenter = new FolderPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_stubFolderPresenter.setShowBrowseButton(false);
- m_stubFolderPresenter.setLabel(Texts.get("StubFolder"));
- m_stubFolderPresenter.setBundle(m_bundle);
- m_stubFolderPresenter.setMarkerType(MarkerType.StubFolder);
- m_stubFolderPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- applyLayoutData(m_stubFolderPresenter);
-
- // stub jar
- m_stubJarFilePresenter = new FilePresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_stubJarFilePresenter.setLabel(Texts.get("StubJar"));
- m_stubJarFilePresenter.setShowBrowseButton(false);
- m_stubJarFilePresenter.setBundle(m_bundle);
- m_stubJarFilePresenter.setMarkerType(MarkerType.StubJar);
- m_stubJarFilePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- applyLayoutData(m_stubJarFilePresenter);
-
- // wsdl folder
- m_wsdlFolderPresenter = new WsdlFolderPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit(), WebserviceEnum.Consumer);
- m_wsdlFolderPresenter.setLabel(Texts.get("WsdlFolder"));
- m_wsdlFolderPresenter.setBundle(m_bundle);
- m_wsdlFolderPresenter.setMarkerType(MarkerType.WsdlFolder);
- m_wsdlFolderPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- applyLayoutData(m_wsdlFolderPresenter);
-
- // wsdl file
- m_wsdlFilePresenter = new WsdlFilePresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_wsdlFilePresenter.setLabel(Texts.get("WsdlFile"));
- m_wsdlFilePresenter.setBundle(m_bundle);
- m_wsdlFilePresenter.setMarkerType(MarkerType.Wsdl);
- m_wsdlFilePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- applyLayoutData(m_wsdlFilePresenter);
-
- updatePresenterValues();
- }
- finally {
- getForm().setRedraw(true);
- }
- super.createSections();
-
- ISection propSection = getSection(JdtTypePropertyPart.SECTION_ID_PROPS_ADVANCED);
- if (propSection != null) {
- propSection.setExpanded(false);
- }
- }
-
- private void updatePresenterValues() {
- createQuickLinkPresenters();
- createQuickLinkPresentersForReferencedFiles();
-
- BuildJaxWsBean buildJaxWsBean = getPage().getBuildJaxWsBean();
- Definition wsdlDefinition = getPage().getWsdlDefinition();
-
- String serviceName = null;
- String serviceTooltip = null;
- String portTypeName = null;
- String portTypeTooltip = null;
- IFile stubJarFile = null;
-
- QName serviceQName = JaxWsSdkUtility.extractServiceQNameFromWsClient(getPage().getType());
- if (serviceQName != null) {
- serviceName = serviceQName.getLocalPart();
- serviceTooltip = serviceQName.toString();
- }
- QName portTypeQName = JaxWsSdkUtility.extractPortTypeQNameFromWsClient(getPage().getType());
- if (portTypeQName != null) {
- portTypeName = portTypeQName.getLocalPart();
- portTypeTooltip = portTypeQName.toString();
- }
-
- if (buildJaxWsBean != null) {
- stubJarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, buildJaxWsBean, buildJaxWsBean.getWsdl());
- }
-
- m_targetNamespacePresenter.setInput(wsdlDefinition != null ? wsdlDefinition.getTargetNamespace() : null);
- m_targetNamespacePresenter.setTooltip(m_targetNamespacePresenter.getValue());
- m_servicePresenter.setInput(serviceName);
- m_servicePresenter.setTooltip(serviceTooltip);
- m_portTypePresenter.setInput(portTypeName);
- m_portTypePresenter.setTooltip(portTypeTooltip);
- m_stubJarFilePresenter.setInput(stubJarFile);
- m_stubFolderPresenter.setInput(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.STUB_FOLDER, false));
-
- // WSDL folder
- IFile wsdlFile = getPage().getWsdlResource().getFile();
- if (wsdlFile != null) {
- IPath wsdlFolderPath = wsdlFile.getProjectRelativePath().removeLastSegments(1);
- IFolder folder = JaxWsSdkUtility.getFolder(m_bundle, wsdlFolderPath.toPortableString(), false);
- if (folder == null) {
- folder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_CONSUMER, false);
- }
- m_wsdlFolderPresenter.setInput(folder);
- m_wsdlFilePresenter.setFileDirectory(folder.getProjectRelativePath().toPortableString());
- }
- m_wsdlFolderPresenter.setBuildJaxWsBean(buildJaxWsBean);
-
- // WSDL file
- m_wsdlFilePresenter.setInput(wsdlFile);
- m_wsdlFilePresenter.setBuildJaxWsBean(buildJaxWsBean);
-
- IAnnotation scoutWebServiceClientAnnotation = JaxWsSdkUtility.getAnnotation(getPage().getType(), TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebServiceClient).getFullyQualifiedName(), false);
- getSection(SECTION_ID_SCOUT_WEB_SERVICE_CLIENT_ANNOTATION).setVisible(TypeUtility.exists(scoutWebServiceClientAnnotation));
- if (TypeUtility.exists(scoutWebServiceClientAnnotation)) {
- AnnotationProperty propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(getPage().getType(), scoutWebServiceClientAnnotation, JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER);
- m_authenticationHandlerPresenter.setInput(propertyValue.getFullyQualifiedName());
- m_authenticationHandlerPresenter.setDeclaringType(getPage().getType());
- m_authenticationHandlerPresenter.setResetLinkVisible(!propertyValue.isInherited());
- m_authenticationHandlerPresenter.setBoldLabelText(!propertyValue.isInherited());
- }
-
- createBindingFilePresenters(buildJaxWsBean);
- validateRebuildStubPresenter();
-
- getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
- }
-
- private void createQuickLinkPresenters() {
- getForm().setRedraw(false);
-
- try {
- JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS).getSectionClient());
-
- createQuickLinkForTypesPresenters();
-
- SeparatorPresenter separatorPresenter = new SeparatorPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), getFormToolkit());
- applyLayoutData(separatorPresenter);
-
- // QuickLink 'Open build-jaxws.xml'
- FileOpenAction a = new FileOpenAction();
- a.init(ResourceFactory.getBuildJaxWsResource(m_bundle).getFile(), ResourceFactory.getBuildJaxWsResource(m_bundle).getFile().getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.BuildJaxWsXmlFile), FileExtensionType.Xml);
- a.setToolTip(Texts.get("JaxWsBuildDescriptor"));
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
- applyLayoutData(actionPresenter);
-
- if (getPage().getBuildJaxWsBean() == null) {
- return;
- }
-
- // QuickLink 'Open WSDL file'
- IFile wsdlFile = getPage().getWsdlResource().getFile();
- if (wsdlFile != null) {
- FileOpenAction b = new FileOpenAction();
- b.init(wsdlFile, wsdlFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), FileExtensionType.Auto);
- b.setToolTip("Web Services Description Language");
- actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), b, getFormToolkit());
- actionPresenter.setEnabled(wsdlFile.exists());
- applyLayoutData(actionPresenter);
- }
- }
- finally {
- getForm().setRedraw(true);
- getSection(SECTION_ID_LINKS).setVisible(getSection(SECTION_ID_LINKS).getSectionClient().getChildren().length > 0);
- JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS));
- }
- }
-
- private void createQuickLinkPresentersForReferencedFiles() {
- getForm().setRedraw(false);
- try {
- JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS_REF_WSDLS).getSectionClient());
- JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).getSectionClient());
- JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).getSectionClient());
-
- WsdlResource wsdlResource = getPage().getWsdlResource();
- Artefact[] artefacts = SchemaUtility.getArtefacts(wsdlResource.getFile(), false);
-
- for (Artefact artefact : artefacts) {
- // referenced WSDL definitions
- if (artefact instanceof WsdlArtefact) {
- WsdlArtefact wsdlArtefact = (WsdlArtefact) artefact;
- if (wsdlArtefact.getTypeEnum() == TypeEnum.ReferencedWsdl) {
- IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, wsdlArtefact.getFile());
- FileOpenAction action = new FileOpenAction();
- action.init(referencedWsdlFile, referencedWsdlFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), FileExtensionType.Auto);
-
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS_REF_WSDLS).getSectionClient(), action, getFormToolkit());
- actionPresenter.setEnabled(referencedWsdlFile.exists());
- applyLayoutData(actionPresenter);
- }
- }
- // imported XSD schemas
- if (artefact instanceof SchemaImportArtefact) {
- SchemaImportArtefact schemaArtefact = (SchemaImportArtefact) artefact;
- IFile importedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
-
- FileOpenAction b = new FileOpenAction();
- b.init(importedSchemaFile, importedSchemaFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), FileExtensionType.Auto);
- b.setToolTip("namespace: " + StringUtility.nvl(schemaArtefact.getNamespaceUri(), "?"));
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).getSectionClient(), b, getFormToolkit());
- actionPresenter.setEnabled(importedSchemaFile.exists());
- applyLayoutData(actionPresenter);
- }
-
- // included XSD schemas
- if (artefact instanceof SchemaIncludeArtefact) {
- SchemaIncludeArtefact schemaArtefact = (SchemaIncludeArtefact) artefact;
- IFile includedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
-
- FileOpenAction b = new FileOpenAction();
- b.init(includedSchemaFile, includedSchemaFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), FileExtensionType.Auto);
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).getSectionClient(), b, getFormToolkit());
- actionPresenter.setEnabled(includedSchemaFile.exists());
- applyLayoutData(actionPresenter);
- }
- }
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- }
- finally {
- getForm().setRedraw(true);
-
- getSection(SECTION_ID_LINKS_REF_WSDLS).setVisible(getSection(SECTION_ID_LINKS_REF_WSDLS).getSectionClient().getChildren().length > 0);
- JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS_REF_WSDLS));
-
- getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).setVisible(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).getSectionClient().getChildren().length > 0);
- JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS));
-
- getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).setVisible(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).getSectionClient().getChildren().length > 0);
- JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS));
- }
- }
-
- private void createQuickLinkForTypesPresenters() {
- // QuickLink 'Open PortType'
- TypeOpenAction a = new TypeOpenAction();
- a.init(getPage().getType());
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
- applyLayoutData(actionPresenter);
-
- // QuickLink 'Open PortType Interface'
- IType portTypeInterfaceType = JaxWsSdkUtility.extractGenericSuperType(getPage().getType(), JaxWsConstants.GENERICS_WEBSERVICE_CLIENT_PORT_TYPE_INDEX);
- try {
- if (TypeUtility.exists(portTypeInterfaceType) && portTypeInterfaceType.isInterface()) {
- IAnnotation annotation = JaxWsSdkUtility.getAnnotation(portTypeInterfaceType, WebService.class.getName(), false);
- if (TypeUtility.exists(annotation)) {
- TypeOpenAction action = new TypeOpenAction();
- action.init(portTypeInterfaceType);
- action.setToolTip(Texts.get("JaxWsPortTypeInterface"));
- ActionPresenter presenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), action, getFormToolkit());
- applyLayoutData(presenter);
- }
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("failed to validate port type interface", e);
- }
- }
-
- private void createBindingFilePresenters(BuildJaxWsBean buildJaxWsBean) {
- getForm().setRedraw(false);
- try {
- m_bindingFilePresenters.clear();
- JaxWsSdkUtility.disposeChildControls(m_bindingFilesComposite);
- GridLayout layout = new GridLayout(1, false);
- layout.marginWidth = 0;
- layout.marginHeight = 5;
- m_bindingFilesComposite.setLayout(layout);
-
- if (buildJaxWsBean == null) {
- return;
- }
-
- IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(m_bundle, buildJaxWsBean.getPropertiers());
- for (int index = 0; index < bindingFiles.length; index++) {
- BindingFilePresenter filePresenter = new BindingFilePresenter(m_bindingFilesComposite, getFormToolkit());
- filePresenter.setBundle(m_bundle);
- filePresenter.setMarkerGroupUUID(JaxWsSdkUtility.toMarkerGroupUUID(getPage().getMarkerGroupUUID(), index));
- filePresenter.setInput(bindingFiles[index]);
- filePresenter.setBuildJaxWsBean(buildJaxWsBean);
- applyLayoutData(filePresenter);
-
- m_bindingFilePresenters.add(filePresenter);
- }
- }
- finally {
- getForm().setRedraw(true);
- JaxWsSdkUtility.doLayout(m_bindingFilesComposite);
- JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_STUB_PROPERTIES));
- }
- }
-
- private void applyLayoutData(AbstractPresenter presenter) {
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- presenter.getContainer().setLayoutData(layoutData);
- }
-
- private ISearchJavaSearchScopeFactory createSubClassesSearchScopeFactory(final IType superType) {
- return new ISearchJavaSearchScopeFactory() {
-
- @Override
- public IJavaSearchScope create() {
- // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
- IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
- return SearchEngine.createJavaSearchScope(subTypes);
- }
- };
- }
-
- private void validateRebuildStubPresenter() {
- boolean valid = (getPage().getBuildJaxWsBean() != null &&
- !MarkerUtility.containsMarker(m_bundle, MarkerType.Wsdl, getPage().getMarkerGroupUUID(), IMarker.SEVERITY_ERROR));
- m_rebuildStubPresenter.setEnabled(valid);
-
- if (valid) {
- StubRebuildAction action = new StubRebuildAction();
- action.init(m_bundle, getPage().getBuildJaxWsBean(), getPage().getWsdlResource(), getPage().getMarkerGroupUUID(), WebserviceEnum.Consumer);
- m_rebuildStubPresenter.setAction(action);
- }
- }
-
- private final class P_PresenterListener implements IPresenterValueChangedListener {
-
- @Override
- public void propertyChanged(int presenterId, Object value) {
- switch (presenterId) {
- case PRESENTER_ID_AUTHENTICATION_HANDLER:
- IType type = getPage().getType();
- String factoryFullyQualifiedName = (String) value;
- if (!TypeUtility.existsType(factoryFullyQualifiedName)) {
- return;
- }
- IType factoryType = TypeUtility.getType(factoryFullyQualifiedName);
-
- AnnotationUpdateOperation op = new AnnotationUpdateOperation();
- op.setDeclaringType(type);
- op.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebServiceClient));
- op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER, factoryType);
- new OperationJob(op).schedule();
- break;
- }
- }
- }
-
- private class P_ScoutSeverityListener implements IScoutSeverityListener {
-
- @Override
- public void severityChanged(IResource resource) {
- boolean accept = false;
- if (resource == getPage().getType().getResource()) {
- accept = true;
- }
- if (!accept && resource == ResourceFactory.getSunJaxWsResource(m_bundle).getFile()) {
- accept = true;
- }
- if (!accept && resource == ResourceFactory.getBuildJaxWsResource(m_bundle).getFile()) {
- accept = true;
- }
- if (!accept && resource == getPage().getWsdlResource().getFile()) {
- accept = true;
- }
- if (!accept) {
- for (XmlResource bindingFileResource : getPage().getBindingFileResources()) {
- if (resource == bindingFileResource) {
- accept = true;
- break;
- }
- }
- }
- if (!accept) {
- return;
- }
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (getPage().isPageUnloaded() || getForm().isDisposed()) {
- return;
- }
- getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
-
- if (MarkerUtility.containsMarker(m_bundle, MarkerType.MissingBuildJaxWsEntry, getPage().getMarkerGroupUUID(), IMarker.SEVERITY_ERROR)) {
- return;
- }
-
- // update marker status of presenters (quality)
- m_targetNamespacePresenter.updateInfo();
- m_servicePresenter.updateInfo();
- m_portTypePresenter.updateInfo();
- m_wsdlFilePresenter.updateInfo();
- m_wsdlFolderPresenter.updateInfo();
- m_authenticationHandlerPresenter.updateInfo();
- m_stubJarFilePresenter.updateInfo();
- m_stubFolderPresenter.updateInfo();
-
- for (BindingFilePresenter presenter : m_bindingFilePresenters) {
- presenter.updateInfo();
- }
-
- validateRebuildStubPresenter();
- }
- });
- }
- }
-
- private class P_PageLoadedListener implements IPageLoadedListener {
-
- @Override
- public void pageLoaded() {
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (getPage().isPageUnloaded() || getForm().isDisposed()) {
- return;
- }
-
- if (MarkerUtility.containsMarker(m_bundle, MarkerType.MissingBuildJaxWsEntry, getPage().getMarkerGroupUUID(), IMarker.SEVERITY_ERROR)) {
- return;
- }
- updatePresenterValues();
- }
- });
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.jws.WebService;
+import javax.wsdl.Definition;
+import javax.xml.namespace.QName;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.JdtTypePropertyPart;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.util.IScoutSeverityListener;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
+import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.BindingFileNewAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.BuildPropertiesEditAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction.FileExtensionType;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.RepairAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.StubRebuildAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.TypeOpenAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceConsumerNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.AnnotationPropertyTypePresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.BindingFilePresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.FilePresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.FolderPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.SeparatorPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.StringPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.TypePresenter.ISearchJavaSearchScopeFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.WsdlFilePresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.WsdlFolderPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.Artefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaImportArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaIncludeArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPresenterValueChangedListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+public class WebServiceConsumerNodePagePropertyViewPart extends JdtTypePropertyPart {
+
+ public static final String SECTION_ID_REPAIR = "section.jaxws.repair";
+ public static final String SECTION_ID_PROPERTIES = "section.jaxws.properties";
+ public static final String SECTION_ID_STUB_PROPERTIES = "section.jaxws.build";
+ public static final String SECTION_ID_LINKS = "section.jaxws.links";
+ public static final String SECTION_ID_LINKS_REF_WSDLS = "section.jaxws.links.ref.wsdl";
+ public static final String SECTION_ID_LINKS_INCLUDED_SCHEMAS = "section.jaxws.links.included.schema";
+ public static final String SECTION_ID_LINKS_IMPORTED_SCHEMAS = "section.jaxws.links.imported.schema";
+ public static final String SECTION_ID_SCOUT_WEB_SERVICE_CLIENT_ANNOTATION = "section.scoutWebServiceAnnotation";
+
+ public static final int PRESENTER_ID_AUTHENTICATION_HANDLER = 1 << 1;
+
+ private IPresenterValueChangedListener m_presenterListener;
+
+ private StringPresenter m_targetNamespacePresenter;
+ private StringPresenter m_servicePresenter;
+ private StringPresenter m_portTypePresenter;
+ private FolderPresenter m_stubFolderPresenter;
+ private FilePresenter m_stubJarFilePresenter;
+ private WsdlFolderPresenter m_wsdlFolderPresenter;
+ private WsdlFilePresenter m_wsdlFilePresenter;
+
+ private Composite m_bindingFilesComposite;
+
+ private P_ScoutSeverityListener m_severityListener;
+ private IPageLoadedListener m_pageLoadedListener;
+
+ private AnnotationPropertyTypePresenter m_authenticationHandlerPresenter;
+ private List<BindingFilePresenter> m_bindingFilePresenters;
+ private ActionPresenter m_rebuildStubPresenter;
+
+ private IScoutBundle m_bundle;
+
+ @Override
+ protected void init() {
+ m_bundle = getPage().getScoutResource();
+ m_presenterListener = new P_PresenterListener();
+ m_severityListener = new P_ScoutSeverityListener();
+ m_pageLoadedListener = new P_PageLoadedListener();
+ ScoutSeverityManager.getInstance().addQualityManagerListener(m_severityListener);
+ getPage().addPageLoadedListener(m_pageLoadedListener);
+ m_bindingFilePresenters = new LinkedList<BindingFilePresenter>();
+ }
+
+ @Override
+ protected void cleanup() {
+ ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
+ getPage().removePageLoadedListener(m_pageLoadedListener);
+ super.cleanup();
+ }
+
+ @Override
+ public WebServiceConsumerNodePage getPage() {
+ return (WebServiceConsumerNodePage) super.getPage();
+ }
+
+ @Override
+ protected void createSections() {
+ getForm().setRedraw(true);
+ try {
+ /*
+ * repair section
+ */
+ createSection(SECTION_ID_REPAIR, Texts.get("RepairRequired"), Texts.get("SectionRepairDescription"), false);
+ getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
+ RepairAction a = new RepairAction();
+ a.init(getPage().getMarkerGroupUUID(), m_bundle);
+ AbstractPresenter presenter = new ActionPresenter(getSection(SECTION_ID_REPAIR).getSectionClient(), a, getFormToolkit());
+ applyLayoutData(presenter);
+
+ /*
+ * link section
+ */
+ createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
+ createQuickLinkPresenters();
+
+ /*
+ * link section (referenced WSDL definitions)
+ */
+ createSection(SECTION_ID_LINKS_REF_WSDLS, Texts.get("ReferencedWsdlDefintions"));
+ getSection(SECTION_ID_LINKS_REF_WSDLS).setExpanded(false);
+
+ /*
+ * link section (imported XSD schemas)
+ */
+ createSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS, Texts.get("ImportedXsdSchemas"));
+ getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).setExpanded(false);
+
+ /*
+ * link section (included XSD schemas)
+ */
+ createSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS, Texts.get("IncludedXsdSchemas"));
+ getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).setExpanded(false);
+
+ createQuickLinkPresentersForReferencedFiles();
+
+ if (getPage().getBuildJaxWsBean() == null) {
+ return;
+ }
+
+ /*
+ * stub properties section
+ */
+ createSection(SECTION_ID_STUB_PROPERTIES, Texts.get("StubProperties"));
+
+ StubRebuildAction b = new StubRebuildAction();
+ b.init(m_bundle, getPage().getBuildJaxWsBean(), getPage().getWsdlResource(), getPage().getMarkerGroupUUID(), WebserviceEnum.Consumer);
+ m_rebuildStubPresenter = new ActionPresenter(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), b, getFormToolkit());
+ applyLayoutData(m_rebuildStubPresenter);
+
+ // edit build properties
+ BuildPropertiesEditAction c = new BuildPropertiesEditAction();
+ c.init(m_bundle, getPage().getBuildJaxWsBean());
+ presenter = new ActionPresenter(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), c, getFormToolkit());
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.horizontalAlignment = SWT.RIGHT;
+ presenter.getContainer().setLayoutData(gd);
+
+ // add binding file
+ BindingFileNewAction d = new BindingFileNewAction();
+ d.init(m_bundle, getPage().getBuildJaxWsBean(), getPage().getWsdlResource());
+ presenter = new ActionPresenter(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), d, getFormToolkit());
+ presenter.setEnabled(getPage().getBuildJaxWsBean() != null);
+ gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.horizontalAlignment = SWT.RIGHT;
+ presenter.getContainer().setLayoutData(gd);
+
+ // binding files composite
+ m_bindingFilesComposite = new Composite(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.verticalIndent = 5;
+ m_bindingFilesComposite.setLayoutData(gd);
+
+ /*
+ * Scout webservice annotation section
+ */
+ createSection(SECTION_ID_SCOUT_WEB_SERVICE_CLIENT_ANNOTATION, Texts.get("Authentication"), null, true);
+ getSection(SECTION_ID_SCOUT_WEB_SERVICE_CLIENT_ANNOTATION).setExpanded(false);
+
+ // Scout authentication factory
+ m_authenticationHandlerPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_SCOUT_WEB_SERVICE_CLIENT_ANNOTATION).getSectionClient(), getFormToolkit());
+ m_authenticationHandlerPresenter.setPresenterId(PRESENTER_ID_AUTHENTICATION_HANDLER);
+ m_authenticationHandlerPresenter.setLabel(Texts.get("Authentication"));
+ m_authenticationHandlerPresenter.setAcceptNullValue(true);
+ m_authenticationHandlerPresenter.setBundle(m_bundle);
+ m_authenticationHandlerPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebServiceClient));
+ m_authenticationHandlerPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER);
+ m_authenticationHandlerPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedConsumerSecurityPackageName(m_bundle));
+ m_authenticationHandlerPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ m_authenticationHandlerPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer)));
+ m_authenticationHandlerPresenter.setAllowChangeOfInterfaceType(true);
+ m_authenticationHandlerPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer)});
+ m_authenticationHandlerPresenter.addValueChangedListener(m_presenterListener);
+ m_authenticationHandlerPresenter.getContainer().setLayoutData(new GridData());
+ applyLayoutData(m_authenticationHandlerPresenter);
+
+ /*
+ * properties section
+ */
+ createSection(SECTION_ID_PROPERTIES, Texts.get("WebserviceProperties"));
+ getSection(SECTION_ID_PROPERTIES).setExpanded(true);
+
+ // service
+ m_servicePresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_servicePresenter.setLabel(Texts.get("Service"));
+ m_servicePresenter.setBundle(m_bundle);
+ m_servicePresenter.setMarkerType(MarkerType.Service);
+ m_servicePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ m_servicePresenter.setEditable(false);
+ applyLayoutData(m_servicePresenter);
+
+ // port type
+ m_portTypePresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_portTypePresenter.setLabel(Texts.get("PortType"));
+ m_portTypePresenter.setBundle(m_bundle);
+ m_portTypePresenter.setMarkerType(MarkerType.PortType);
+ m_portTypePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ m_portTypePresenter.setEditable(false);
+ applyLayoutData(m_portTypePresenter);
+
+ // target namespace
+ m_targetNamespacePresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_targetNamespacePresenter.setLabel(Texts.get("TargetNamespace"));
+ m_targetNamespacePresenter.setBundle(m_bundle);
+ m_targetNamespacePresenter.setMarkerType(MarkerType.TargetNamespace);
+ m_targetNamespacePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ m_targetNamespacePresenter.setEditable(false);
+ applyLayoutData(m_targetNamespacePresenter);
+
+ // stub folder
+ m_stubFolderPresenter = new FolderPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_stubFolderPresenter.setShowBrowseButton(false);
+ m_stubFolderPresenter.setLabel(Texts.get("StubFolder"));
+ m_stubFolderPresenter.setBundle(m_bundle);
+ m_stubFolderPresenter.setMarkerType(MarkerType.StubFolder);
+ m_stubFolderPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ applyLayoutData(m_stubFolderPresenter);
+
+ // stub jar
+ m_stubJarFilePresenter = new FilePresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_stubJarFilePresenter.setLabel(Texts.get("StubJar"));
+ m_stubJarFilePresenter.setShowBrowseButton(false);
+ m_stubJarFilePresenter.setBundle(m_bundle);
+ m_stubJarFilePresenter.setMarkerType(MarkerType.StubJar);
+ m_stubJarFilePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ applyLayoutData(m_stubJarFilePresenter);
+
+ // wsdl folder
+ m_wsdlFolderPresenter = new WsdlFolderPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit(), WebserviceEnum.Consumer);
+ m_wsdlFolderPresenter.setLabel(Texts.get("WsdlFolder"));
+ m_wsdlFolderPresenter.setBundle(m_bundle);
+ m_wsdlFolderPresenter.setMarkerType(MarkerType.WsdlFolder);
+ m_wsdlFolderPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ applyLayoutData(m_wsdlFolderPresenter);
+
+ // wsdl file
+ m_wsdlFilePresenter = new WsdlFilePresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_wsdlFilePresenter.setLabel(Texts.get("WsdlFile"));
+ m_wsdlFilePresenter.setBundle(m_bundle);
+ m_wsdlFilePresenter.setMarkerType(MarkerType.Wsdl);
+ m_wsdlFilePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ applyLayoutData(m_wsdlFilePresenter);
+
+ updatePresenterValues();
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ super.createSections();
+
+ ISection propSection = getSection(JdtTypePropertyPart.SECTION_ID_PROPS_ADVANCED);
+ if (propSection != null) {
+ propSection.setExpanded(false);
+ }
+ }
+
+ private void updatePresenterValues() {
+ createQuickLinkPresenters();
+ createQuickLinkPresentersForReferencedFiles();
+
+ BuildJaxWsBean buildJaxWsBean = getPage().getBuildJaxWsBean();
+ Definition wsdlDefinition = getPage().getWsdlDefinition();
+
+ String serviceName = null;
+ String serviceTooltip = null;
+ String portTypeName = null;
+ String portTypeTooltip = null;
+ IFile stubJarFile = null;
+
+ QName serviceQName = JaxWsSdkUtility.extractServiceQNameFromWsClient(getPage().getType());
+ if (serviceQName != null) {
+ serviceName = serviceQName.getLocalPart();
+ serviceTooltip = serviceQName.toString();
+ }
+ QName portTypeQName = JaxWsSdkUtility.extractPortTypeQNameFromWsClient(getPage().getType());
+ if (portTypeQName != null) {
+ portTypeName = portTypeQName.getLocalPart();
+ portTypeTooltip = portTypeQName.toString();
+ }
+
+ if (buildJaxWsBean != null) {
+ stubJarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, buildJaxWsBean, buildJaxWsBean.getWsdl());
+ }
+
+ m_targetNamespacePresenter.setInput(wsdlDefinition != null ? wsdlDefinition.getTargetNamespace() : null);
+ m_targetNamespacePresenter.setTooltip(m_targetNamespacePresenter.getValue());
+ m_servicePresenter.setInput(serviceName);
+ m_servicePresenter.setTooltip(serviceTooltip);
+ m_portTypePresenter.setInput(portTypeName);
+ m_portTypePresenter.setTooltip(portTypeTooltip);
+ m_stubJarFilePresenter.setInput(stubJarFile);
+ m_stubFolderPresenter.setInput(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.STUB_FOLDER, false));
+
+ // WSDL folder
+ IFile wsdlFile = getPage().getWsdlResource().getFile();
+ if (wsdlFile != null) {
+ IPath wsdlFolderPath = wsdlFile.getProjectRelativePath().removeLastSegments(1);
+ IFolder folder = JaxWsSdkUtility.getFolder(m_bundle, wsdlFolderPath.toPortableString(), false);
+ if (folder == null) {
+ folder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_CONSUMER, false);
+ }
+ m_wsdlFolderPresenter.setInput(folder);
+ m_wsdlFilePresenter.setFileDirectory(folder.getProjectRelativePath().toPortableString());
+ }
+ m_wsdlFolderPresenter.setBuildJaxWsBean(buildJaxWsBean);
+
+ // WSDL file
+ m_wsdlFilePresenter.setInput(wsdlFile);
+ m_wsdlFilePresenter.setBuildJaxWsBean(buildJaxWsBean);
+
+ IAnnotation scoutWebServiceClientAnnotation = JaxWsSdkUtility.getAnnotation(getPage().getType(), TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebServiceClient).getFullyQualifiedName(), false);
+ getSection(SECTION_ID_SCOUT_WEB_SERVICE_CLIENT_ANNOTATION).setVisible(TypeUtility.exists(scoutWebServiceClientAnnotation));
+ if (TypeUtility.exists(scoutWebServiceClientAnnotation)) {
+ AnnotationProperty propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(getPage().getType(), scoutWebServiceClientAnnotation, JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER);
+ m_authenticationHandlerPresenter.setInput(propertyValue.getFullyQualifiedName());
+ m_authenticationHandlerPresenter.setDeclaringType(getPage().getType());
+ m_authenticationHandlerPresenter.setResetLinkVisible(!propertyValue.isInherited());
+ m_authenticationHandlerPresenter.setBoldLabelText(!propertyValue.isInherited());
+ }
+
+ createBindingFilePresenters(buildJaxWsBean);
+ validateRebuildStubPresenter();
+
+ getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
+ }
+
+ private void createQuickLinkPresenters() {
+ getForm().setRedraw(false);
+
+ try {
+ JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS).getSectionClient());
+
+ createQuickLinkForTypesPresenters();
+
+ SeparatorPresenter separatorPresenter = new SeparatorPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), getFormToolkit());
+ applyLayoutData(separatorPresenter);
+
+ // QuickLink 'Open build-jaxws.xml'
+ FileOpenAction a = new FileOpenAction();
+ a.init(ResourceFactory.getBuildJaxWsResource(m_bundle).getFile(), ResourceFactory.getBuildJaxWsResource(m_bundle).getFile().getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.BuildJaxWsXmlFile), FileExtensionType.Xml);
+ a.setToolTip(Texts.get("JaxWsBuildDescriptor"));
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
+ applyLayoutData(actionPresenter);
+
+ if (getPage().getBuildJaxWsBean() == null) {
+ return;
+ }
+
+ // QuickLink 'Open WSDL file'
+ IFile wsdlFile = getPage().getWsdlResource().getFile();
+ if (wsdlFile != null) {
+ FileOpenAction b = new FileOpenAction();
+ b.init(wsdlFile, wsdlFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), FileExtensionType.Auto);
+ b.setToolTip("Web Services Description Language");
+ actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), b, getFormToolkit());
+ actionPresenter.setEnabled(wsdlFile.exists());
+ applyLayoutData(actionPresenter);
+ }
+ }
+ finally {
+ getForm().setRedraw(true);
+ getSection(SECTION_ID_LINKS).setVisible(getSection(SECTION_ID_LINKS).getSectionClient().getChildren().length > 0);
+ JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS));
+ }
+ }
+
+ private void createQuickLinkPresentersForReferencedFiles() {
+ getForm().setRedraw(false);
+ try {
+ JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS_REF_WSDLS).getSectionClient());
+ JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).getSectionClient());
+ JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).getSectionClient());
+
+ WsdlResource wsdlResource = getPage().getWsdlResource();
+ Artefact[] artefacts = SchemaUtility.getArtefacts(wsdlResource.getFile(), false);
+
+ for (Artefact artefact : artefacts) {
+ // referenced WSDL definitions
+ if (artefact instanceof WsdlArtefact) {
+ WsdlArtefact wsdlArtefact = (WsdlArtefact) artefact;
+ if (wsdlArtefact.getTypeEnum() == TypeEnum.ReferencedWsdl) {
+ IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, wsdlArtefact.getFile());
+ FileOpenAction action = new FileOpenAction();
+ action.init(referencedWsdlFile, referencedWsdlFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), FileExtensionType.Auto);
+
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS_REF_WSDLS).getSectionClient(), action, getFormToolkit());
+ actionPresenter.setEnabled(referencedWsdlFile.exists());
+ applyLayoutData(actionPresenter);
+ }
+ }
+ // imported XSD schemas
+ if (artefact instanceof SchemaImportArtefact) {
+ SchemaImportArtefact schemaArtefact = (SchemaImportArtefact) artefact;
+ IFile importedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
+
+ FileOpenAction b = new FileOpenAction();
+ b.init(importedSchemaFile, importedSchemaFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), FileExtensionType.Auto);
+ b.setToolTip("namespace: " + StringUtility.nvl(schemaArtefact.getNamespaceUri(), "?"));
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).getSectionClient(), b, getFormToolkit());
+ actionPresenter.setEnabled(importedSchemaFile.exists());
+ applyLayoutData(actionPresenter);
+ }
+
+ // included XSD schemas
+ if (artefact instanceof SchemaIncludeArtefact) {
+ SchemaIncludeArtefact schemaArtefact = (SchemaIncludeArtefact) artefact;
+ IFile includedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
+
+ FileOpenAction b = new FileOpenAction();
+ b.init(includedSchemaFile, includedSchemaFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), FileExtensionType.Auto);
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).getSectionClient(), b, getFormToolkit());
+ actionPresenter.setEnabled(includedSchemaFile.exists());
+ applyLayoutData(actionPresenter);
+ }
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ }
+ finally {
+ getForm().setRedraw(true);
+
+ getSection(SECTION_ID_LINKS_REF_WSDLS).setVisible(getSection(SECTION_ID_LINKS_REF_WSDLS).getSectionClient().getChildren().length > 0);
+ JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS_REF_WSDLS));
+
+ getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).setVisible(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).getSectionClient().getChildren().length > 0);
+ JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS));
+
+ getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).setVisible(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).getSectionClient().getChildren().length > 0);
+ JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS));
+ }
+ }
+
+ private void createQuickLinkForTypesPresenters() {
+ // QuickLink 'Open PortType'
+ TypeOpenAction a = new TypeOpenAction();
+ a.init(getPage().getType());
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
+ applyLayoutData(actionPresenter);
+
+ // QuickLink 'Open PortType Interface'
+ IType portTypeInterfaceType = JaxWsSdkUtility.extractGenericSuperType(getPage().getType(), JaxWsConstants.GENERICS_WEBSERVICE_CLIENT_PORT_TYPE_INDEX);
+ try {
+ if (TypeUtility.exists(portTypeInterfaceType) && portTypeInterfaceType.isInterface()) {
+ IAnnotation annotation = JaxWsSdkUtility.getAnnotation(portTypeInterfaceType, WebService.class.getName(), false);
+ if (TypeUtility.exists(annotation)) {
+ TypeOpenAction action = new TypeOpenAction();
+ action.init(portTypeInterfaceType);
+ action.setToolTip(Texts.get("JaxWsPortTypeInterface"));
+ ActionPresenter presenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), action, getFormToolkit());
+ applyLayoutData(presenter);
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("failed to validate port type interface", e);
+ }
+ }
+
+ private void createBindingFilePresenters(BuildJaxWsBean buildJaxWsBean) {
+ getForm().setRedraw(false);
+ try {
+ m_bindingFilePresenters.clear();
+ JaxWsSdkUtility.disposeChildControls(m_bindingFilesComposite);
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 5;
+ m_bindingFilesComposite.setLayout(layout);
+
+ if (buildJaxWsBean == null) {
+ return;
+ }
+
+ IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(m_bundle, buildJaxWsBean.getPropertiers());
+ for (int index = 0; index < bindingFiles.length; index++) {
+ BindingFilePresenter filePresenter = new BindingFilePresenter(m_bindingFilesComposite, getFormToolkit());
+ filePresenter.setBundle(m_bundle);
+ filePresenter.setMarkerGroupUUID(JaxWsSdkUtility.toMarkerGroupUUID(getPage().getMarkerGroupUUID(), index));
+ filePresenter.setInput(bindingFiles[index]);
+ filePresenter.setBuildJaxWsBean(buildJaxWsBean);
+ applyLayoutData(filePresenter);
+
+ m_bindingFilePresenters.add(filePresenter);
+ }
+ }
+ finally {
+ getForm().setRedraw(true);
+ JaxWsSdkUtility.doLayout(m_bindingFilesComposite);
+ JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_STUB_PROPERTIES));
+ }
+ }
+
+ private void applyLayoutData(AbstractPresenter presenter) {
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+
+ private ISearchJavaSearchScopeFactory createSubClassesSearchScopeFactory(final IType superType) {
+ return new ISearchJavaSearchScopeFactory() {
+
+ @Override
+ public IJavaSearchScope create() {
+ // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
+ IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
+ return SearchEngine.createJavaSearchScope(subTypes);
+ }
+ };
+ }
+
+ private void validateRebuildStubPresenter() {
+ boolean valid = (getPage().getBuildJaxWsBean() != null &&
+ !MarkerUtility.containsMarker(m_bundle, MarkerType.Wsdl, getPage().getMarkerGroupUUID(), IMarker.SEVERITY_ERROR));
+ m_rebuildStubPresenter.setEnabled(valid);
+
+ if (valid) {
+ StubRebuildAction action = new StubRebuildAction();
+ action.init(m_bundle, getPage().getBuildJaxWsBean(), getPage().getWsdlResource(), getPage().getMarkerGroupUUID(), WebserviceEnum.Consumer);
+ m_rebuildStubPresenter.setAction(action);
+ }
+ }
+
+ private final class P_PresenterListener implements IPresenterValueChangedListener {
+
+ @Override
+ public void propertyChanged(int presenterId, Object value) {
+ switch (presenterId) {
+ case PRESENTER_ID_AUTHENTICATION_HANDLER:
+ IType type = getPage().getType();
+ String factoryFullyQualifiedName = (String) value;
+ if (!TypeUtility.existsType(factoryFullyQualifiedName)) {
+ return;
+ }
+ IType factoryType = TypeUtility.getType(factoryFullyQualifiedName);
+
+ AnnotationUpdateOperation op = new AnnotationUpdateOperation();
+ op.setDeclaringType(type);
+ op.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebServiceClient));
+ op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER, factoryType);
+ new OperationJob(op).schedule();
+ break;
+ }
+ }
+ }
+
+ private class P_ScoutSeverityListener implements IScoutSeverityListener {
+
+ @Override
+ public void severityChanged(IResource resource) {
+ boolean accept = false;
+ if (resource == getPage().getType().getResource()) {
+ accept = true;
+ }
+ if (!accept && resource == ResourceFactory.getSunJaxWsResource(m_bundle).getFile()) {
+ accept = true;
+ }
+ if (!accept && resource == ResourceFactory.getBuildJaxWsResource(m_bundle).getFile()) {
+ accept = true;
+ }
+ if (!accept && resource == getPage().getWsdlResource().getFile()) {
+ accept = true;
+ }
+ if (!accept) {
+ for (XmlResource bindingFileResource : getPage().getBindingFileResources()) {
+ if (resource == bindingFileResource) {
+ accept = true;
+ break;
+ }
+ }
+ }
+ if (!accept) {
+ return;
+ }
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getPage().isPageUnloaded() || getForm().isDisposed()) {
+ return;
+ }
+ getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
+
+ if (MarkerUtility.containsMarker(m_bundle, MarkerType.MissingBuildJaxWsEntry, getPage().getMarkerGroupUUID(), IMarker.SEVERITY_ERROR)) {
+ return;
+ }
+
+ // update marker status of presenters (quality)
+ m_targetNamespacePresenter.updateInfo();
+ m_servicePresenter.updateInfo();
+ m_portTypePresenter.updateInfo();
+ m_wsdlFilePresenter.updateInfo();
+ m_wsdlFolderPresenter.updateInfo();
+ m_authenticationHandlerPresenter.updateInfo();
+ m_stubJarFilePresenter.updateInfo();
+ m_stubFolderPresenter.updateInfo();
+
+ for (BindingFilePresenter presenter : m_bindingFilePresenters) {
+ presenter.updateInfo();
+ }
+
+ validateRebuildStubPresenter();
+ }
+ });
+ }
+ }
+
+ private class P_PageLoadedListener implements IPageLoadedListener {
+
+ @Override
+ public void pageLoaded() {
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getPage().isPageUnloaded() || getForm().isDisposed()) {
+ return;
+ }
+
+ if (MarkerUtility.containsMarker(m_bundle, MarkerType.MissingBuildJaxWsEntry, getPage().getMarkerGroupUUID(), IMarker.SEVERITY_ERROR)) {
+ return;
+ }
+ updatePresenterValues();
+ }
+ });
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceConsumerTablePagePropertyViewPart.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceConsumerTablePagePropertyViewPart.java
index 1065e9e6c..c8508f18f 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceConsumerTablePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceConsumerTablePagePropertyViewPart.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.ConsumerNewWizardAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction.FileExtensionType;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceConsumerTablePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.layout.GridData;
-
-public class WebServiceConsumerTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
-
- public static final String SECTION_ID_FILTER = "section.jaxws.filter";
- public static final String SECTION_ID_LINKS = "section.jaxws.links";
- public static final String SECTION_ID_CONSUMER = "section.jaxws.wsconsumer";
-
- private IScoutBundle m_bundle;
-
- @Override
- protected void init() {
- m_bundle = getPage().getScoutResource();
- }
-
- @Override
- protected void createSections() {
- getForm().setRedraw(false);
- try {
- createSection(SECTION_ID_FILTER, Texts.get("Filter"));
- getSection(SECTION_ID_FILTER).setExpanded(false);
- createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
- createSection(SECTION_ID_CONSUMER, Texts.get("WebserviceConsumer"));
- boolean sectionLinksVisible = false;
-
- // filter section
- PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), getSection(SECTION_ID_FILTER).getSectionClient(), getPage());
- applyLayoutData(filterPresenter);
-
- // QuickLink section
- // QuickLink 'Open build-jaxws.xml'
- IFile buildJaxWsFile = ResourceFactory.getBuildJaxWsResource(m_bundle).getFile();
- if (JaxWsSdkUtility.exists(buildJaxWsFile)) {
- FileOpenAction b = new FileOpenAction();
- b.init(buildJaxWsFile, buildJaxWsFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.BuildJaxWsXmlFile), FileExtensionType.Xml);
- b.setToolTip(Texts.get("JaxWsBuildDescriptor"));
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), b, getFormToolkit());
- applyLayoutData(actionPresenter);
- sectionLinksVisible = true;
- }
-
- // QuickLink 'Create new Webservice consumer'
- ConsumerNewWizardAction action = new ConsumerNewWizardAction();
- action.init(m_bundle);
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_CONSUMER).getSectionClient(), action, getFormToolkit());
- applyLayoutData(actionPresenter);
-
- getSection(SECTION_ID_LINKS).setVisible(sectionLinksVisible);
- }
- finally {
- getForm().setRedraw(true);
- }
- }
-
- @Override
- public WebServiceConsumerTablePage getPage() {
- return (WebServiceConsumerTablePage) super.getPage();
- }
-
- private void applyLayoutData(AbstractPresenter presenter) {
- GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- presenter.getContainer().setLayoutData(layoutData);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.ConsumerNewWizardAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction.FileExtensionType;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceConsumerTablePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.layout.GridData;
+
+public class WebServiceConsumerTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+
+ public static final String SECTION_ID_FILTER = "section.jaxws.filter";
+ public static final String SECTION_ID_LINKS = "section.jaxws.links";
+ public static final String SECTION_ID_CONSUMER = "section.jaxws.wsconsumer";
+
+ private IScoutBundle m_bundle;
+
+ @Override
+ protected void init() {
+ m_bundle = getPage().getScoutResource();
+ }
+
+ @Override
+ protected void createSections() {
+ getForm().setRedraw(false);
+ try {
+ createSection(SECTION_ID_FILTER, Texts.get("Filter"));
+ getSection(SECTION_ID_FILTER).setExpanded(false);
+ createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
+ createSection(SECTION_ID_CONSUMER, Texts.get("WebserviceConsumer"));
+ boolean sectionLinksVisible = false;
+
+ // filter section
+ PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), getSection(SECTION_ID_FILTER).getSectionClient(), getPage());
+ applyLayoutData(filterPresenter);
+
+ // QuickLink section
+ // QuickLink 'Open build-jaxws.xml'
+ IFile buildJaxWsFile = ResourceFactory.getBuildJaxWsResource(m_bundle).getFile();
+ if (JaxWsSdkUtility.exists(buildJaxWsFile)) {
+ FileOpenAction b = new FileOpenAction();
+ b.init(buildJaxWsFile, buildJaxWsFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.BuildJaxWsXmlFile), FileExtensionType.Xml);
+ b.setToolTip(Texts.get("JaxWsBuildDescriptor"));
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), b, getFormToolkit());
+ applyLayoutData(actionPresenter);
+ sectionLinksVisible = true;
+ }
+
+ // QuickLink 'Create new Webservice consumer'
+ ConsumerNewWizardAction action = new ConsumerNewWizardAction();
+ action.init(m_bundle);
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_CONSUMER).getSectionClient(), action, getFormToolkit());
+ applyLayoutData(actionPresenter);
+
+ getSection(SECTION_ID_LINKS).setVisible(sectionLinksVisible);
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ }
+
+ @Override
+ public WebServiceConsumerTablePage getPage() {
+ return (WebServiceConsumerTablePage) super.getPage();
+ }
+
+ private void applyLayoutData(AbstractPresenter presenter) {
+ GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderCodeFirstNodePagePropertyViewPart.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderCodeFirstNodePagePropertyViewPart.java
index f9fe5b565..5d34782bc 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderCodeFirstNodePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderCodeFirstNodePagePropertyViewPart.java
@@ -1,417 +1,417 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-import javax.jws.WebService;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.util.IScoutSeverityListener;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction.FileExtensionType;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.RepairAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.TypeOpenAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderCodeFirstNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.AnnotationPropertyTypePresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.SeparatorPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.TypePresenter.ISearchJavaSearchScopeFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.UrlPatternPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPresenterValueChangedListener;
-import org.eclipse.swt.layout.GridData;
-
-public class WebServiceProviderCodeFirstNodePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
-
- public static final String SECTION_ID_REPAIR = "section.jaxws.repair";
- public static final String SECTION_ID_PROPERTIES = "section.jaxws.properties";
- public static final String SECTION_ID_LINKS = "section.jaxws.links";
- public static final String SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION = "section.scoutWebServiceAnnotation";
-
- public static final int PRESENTER_ID_SESSION_FACTORY = 1 << 1;
- public static final int PRESENTER_ID_AUTHENTICATION_HANDLER = 1 << 2;
- public static final int PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY = 1 << 3;
-
- private IPresenterValueChangedListener m_presenterListener;
-
- private UrlPatternPresenter m_urlPatternPresenter;
-
- private P_ScoutSeverityListener m_severityListener;
- private IPageLoadedListener m_pageLoadedListener;
-
- private AnnotationPropertyTypePresenter m_sessionFactoryPresenter;
- private AnnotationPropertyTypePresenter m_authenticationHandlerPresenter;
- private AnnotationPropertyTypePresenter m_credentialValidationStrategyPresenter;
-
- private IScoutBundle m_bundle;
-
- @Override
- protected void init() {
- m_bundle = getPage().getScoutResource();
- m_presenterListener = new P_PresenterListener();
- m_severityListener = new P_ScoutSeverityListener();
- m_pageLoadedListener = new P_PageLoadedListener();
- ScoutSeverityManager.getInstance().addQualityManagerListener(m_severityListener);
- getPage().addPageLoadedListener(m_pageLoadedListener);
- }
-
- @Override
- protected void cleanup() {
- ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
- getPage().removePageLoadedListener(m_pageLoadedListener);
- }
-
- @Override
- public WebServiceProviderCodeFirstNodePage getPage() {
- return (WebServiceProviderCodeFirstNodePage) super.getPage();
- }
-
- @Override
- protected void createSections() {
- getForm().setRedraw(true);
- try {
- /*
- * repair section
- */
- createSection(SECTION_ID_REPAIR, Texts.get("RepairRequired"), Texts.get("SectionRepairDescription"), false);
- getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
- RepairAction a = new RepairAction();
- a.init(getPage().getMarkerGroupUUID(), m_bundle);
- AbstractPresenter presenter = new ActionPresenter(getSection(SECTION_ID_REPAIR).getSectionClient(), a, getFormToolkit());
- applyLayoutData(presenter);
-
- /*
- * link section
- */
- createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
- createQuickLinkPresenters();
-
- /*
- * Scout webservice annotation section
- */
- createSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION, Texts.get("AuthenticationAndSessionContext"), null, true);
- getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).setExpanded(false);
-
- // Scout authentication mechanism
- m_authenticationHandlerPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).getSectionClient(), getFormToolkit());
- m_authenticationHandlerPresenter.setPresenterId(PRESENTER_ID_AUTHENTICATION_HANDLER);
- m_authenticationHandlerPresenter.setLabel(Texts.get("Authentication"));
- m_authenticationHandlerPresenter.setAcceptNullValue(true);
- m_authenticationHandlerPresenter.setBundle(m_bundle);
- m_authenticationHandlerPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
- m_authenticationHandlerPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER);
- m_authenticationHandlerPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
- m_authenticationHandlerPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- m_authenticationHandlerPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider)));
- m_authenticationHandlerPresenter.setAllowChangeOfInterfaceType(true);
- m_authenticationHandlerPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider)});
- m_authenticationHandlerPresenter.addValueChangedListener(m_presenterListener);
- m_authenticationHandlerPresenter.getContainer().setLayoutData(new GridData());
- applyLayoutData(m_authenticationHandlerPresenter);
-
- // Scout credential validation strategy
- m_credentialValidationStrategyPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).getSectionClient(), getFormToolkit());
- m_credentialValidationStrategyPresenter.setPresenterId(PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY);
- m_credentialValidationStrategyPresenter.setLabel(Texts.get("CredentialValidation"));
- m_credentialValidationStrategyPresenter.setAcceptNullValue(true);
- m_credentialValidationStrategyPresenter.setBundle(m_bundle);
- m_credentialValidationStrategyPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
- m_credentialValidationStrategyPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY);
- m_credentialValidationStrategyPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
- m_credentialValidationStrategyPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- m_credentialValidationStrategyPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy)));
- m_credentialValidationStrategyPresenter.setAllowChangeOfInterfaceType(true);
- m_credentialValidationStrategyPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy)});
- m_credentialValidationStrategyPresenter.addValueChangedListener(m_presenterListener);
- m_credentialValidationStrategyPresenter.getContainer().setLayoutData(new GridData());
- applyLayoutData(m_credentialValidationStrategyPresenter);
-
- // Scout session factory
- m_sessionFactoryPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).getSectionClient(), getFormToolkit());
- m_sessionFactoryPresenter.setPresenterId(PRESENTER_ID_SESSION_FACTORY);
- m_sessionFactoryPresenter.setLabel(Texts.get("Session"));
- m_sessionFactoryPresenter.setAcceptNullValue(true);
- m_sessionFactoryPresenter.setBundle(m_bundle);
- m_sessionFactoryPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
- m_sessionFactoryPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
- m_sessionFactoryPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
- m_sessionFactoryPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- m_sessionFactoryPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)));
- m_sessionFactoryPresenter.setAllowChangeOfInterfaceType(true);
- m_sessionFactoryPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)});
- m_sessionFactoryPresenter.addValueChangedListener(m_presenterListener);
- m_sessionFactoryPresenter.getContainer().setLayoutData(new GridData());
- applyLayoutData(m_sessionFactoryPresenter);
-
- /*
- * properties section
- */
- createSection(SECTION_ID_PROPERTIES, Texts.get("WebserviceProperties"));
- getSection(SECTION_ID_PROPERTIES).setExpanded(true);
-
- // URL pattern
- m_urlPatternPresenter = new UrlPatternPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_urlPatternPresenter.setLabel(Texts.get("UrlPattern"));
- m_urlPatternPresenter.setBundle(m_bundle);
- m_urlPatternPresenter.setMarkerType(MarkerType.UrlPattern);
- m_urlPatternPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- applyLayoutData(m_urlPatternPresenter);
-
- updatePresenterValues();
- }
- finally {
- getForm().setRedraw(true);
- }
- }
-
- private void updatePresenterValues() {
- createQuickLinkPresenters();
-
- SunJaxWsBean sunJaxWsBean = getPage().getSunJaxWsBean();
-
- String urlPattern = null;
-
- if (sunJaxWsBean != null) {
- urlPattern = sunJaxWsBean.getUrlPattern();
- }
-
- m_urlPatternPresenter.setInput(urlPattern);
- m_urlPatternPresenter.setSunJaxWsBean(sunJaxWsBean);
- String servletRegistrationBundleName = ServletRegistrationUtility.getBuildJaxServletRegistrationBundleName(m_bundle);
- if (servletRegistrationBundleName != null) {
- m_urlPatternPresenter.setTooltip(Texts.get("JaxWsServletRegistrationInBundleX", servletRegistrationBundleName));
- }
- else {
- m_urlPatternPresenter.setTooltip(null);
- }
-
- IType portType = getPage().getPortType();
- if (portType != null) {
- IAnnotation scoutWebServiceAnnotation = JaxWsSdkUtility.getAnnotation(portType, TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getFullyQualifiedName(), false);
- getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).setVisible(TypeUtility.exists(scoutWebServiceAnnotation));
- if (TypeUtility.exists(scoutWebServiceAnnotation)) {
- AnnotationProperty propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(portType, scoutWebServiceAnnotation, JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
- m_sessionFactoryPresenter.setInput(propertyValue.getFullyQualifiedName());
- m_sessionFactoryPresenter.setDeclaringType(portType);
- m_sessionFactoryPresenter.setResetLinkVisible(!propertyValue.isInherited());
- m_sessionFactoryPresenter.setBoldLabelText(!propertyValue.isInherited());
-
- propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(portType, scoutWebServiceAnnotation, JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER);
- m_authenticationHandlerPresenter.setInput(propertyValue.getFullyQualifiedName());
- m_authenticationHandlerPresenter.setDeclaringType(portType);
- m_authenticationHandlerPresenter.setResetLinkVisible(!propertyValue.isInherited());
- m_authenticationHandlerPresenter.setBoldLabelText(!propertyValue.isInherited());
-
- propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(portType, scoutWebServiceAnnotation, JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY);
- m_credentialValidationStrategyPresenter.setInput(propertyValue.getFullyQualifiedName());
- m_credentialValidationStrategyPresenter.setDeclaringType(portType);
- m_credentialValidationStrategyPresenter.setResetLinkVisible(!propertyValue.isInherited());
- m_credentialValidationStrategyPresenter.setBoldLabelText(!propertyValue.isInherited());
- }
- }
-
- getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
- }
-
- private void createQuickLinkPresenters() {
- getForm().setRedraw(false);
-
- try {
- JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS).getSectionClient());
-
- createQuickLinkForTypesPresenters();
-
- SeparatorPresenter separatorPresenter = new SeparatorPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), getFormToolkit());
- applyLayoutData(separatorPresenter);
-
- // QuickLink 'Open sun-jaxws.xml'
- FileOpenAction a = new FileOpenAction();
- a.init(ResourceFactory.getSunJaxWsResource(m_bundle).getFile(), ResourceFactory.getSunJaxWsResource(m_bundle).getFile().getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.SunJaxWsXmlFile), FileExtensionType.Xml);
- a.setToolTip(Texts.get("JaxWsDeploymentDescriptor"));
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
- applyLayoutData(actionPresenter);
- }
- finally {
- getForm().setRedraw(true);
- getSection(SECTION_ID_LINKS).setVisible(getSection(SECTION_ID_LINKS).getSectionClient().getChildren().length > 0);
- JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS));
- }
- }
-
- private void createQuickLinkForTypesPresenters() {
- SunJaxWsBean sunJaxWsBean = getPage().getSunJaxWsBean();
-
- if (sunJaxWsBean == null || sunJaxWsBean.getImplementation() == null) {
- return;
- }
-
- String fqn = sunJaxWsBean.getImplementation();
- if (!TypeUtility.existsType(fqn)) {
- return;
- }
- IType wsProviderImplType = TypeUtility.getType(fqn);
-
- // QuickLink 'Open PortType'
- TypeOpenAction a = new TypeOpenAction();
- a.init(wsProviderImplType);
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
- applyLayoutData(actionPresenter);
-
- // QuickLink 'Open PortType Interface'
- createQuickLinkForPortTypeInterfaceType();
- }
-
- private void createQuickLinkForPortTypeInterfaceType() {
- IType portType = getPage().getPortType();
- if (!TypeUtility.exists(portType)) {
- return;
- }
- IAnnotation annotation = JaxWsSdkUtility.getAnnotation(portType, WebService.class.getName(), false);
- if (annotation == null) {
- return;
- }
- AnnotationProperty property = JaxWsSdkUtility.parseAnnotationTypeValue(portType, annotation, "endpointInterface");
- IType portTypeInterfaceType = TypeUtility.getType(property.getFullyQualifiedName());
- if (portTypeInterfaceType == null) {
- return;
- }
-
- TypeOpenAction action = new TypeOpenAction();
- action.init(portTypeInterfaceType);
- action.setToolTip(Texts.get("JaxWsPortTypeInterface"));
- ActionPresenter presenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), action, getFormToolkit());
- applyLayoutData(presenter);
- }
-
- private void applyLayoutData(AbstractPresenter presenter) {
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- presenter.getContainer().setLayoutData(layoutData);
- }
-
- private ISearchJavaSearchScopeFactory createSubClassesSearchScopeFactory(final IType superType) {
- return new ISearchJavaSearchScopeFactory() {
-
- @Override
- public IJavaSearchScope create() {
- // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
- IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
- return SearchEngine.createJavaSearchScope(subTypes);
- }
- };
- }
-
- private final class P_PresenterListener implements IPresenterValueChangedListener {
-
- @Override
- public void propertyChanged(int presenterId, Object value) {
- switch (presenterId) {
- case PRESENTER_ID_SESSION_FACTORY:
- case PRESENTER_ID_AUTHENTICATION_HANDLER:
- case PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY: {
- IType portType = getPage().getPortType();
- if (TypeUtility.exists(portType)) {
- String factoryFullyQualifiedName = (String) value;
- if (!TypeUtility.existsType(factoryFullyQualifiedName)) {
- return;
- }
- IType factoryType = TypeUtility.getType(factoryFullyQualifiedName);
- AnnotationUpdateOperation op = new AnnotationUpdateOperation();
- op.setDeclaringType(portType);
- op.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
- switch (presenterId) {
- case PRESENTER_ID_SESSION_FACTORY:
- op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, factoryType);
- break;
- case PRESENTER_ID_AUTHENTICATION_HANDLER:
- op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER, factoryType);
- break;
- case PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY:
- op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY, factoryType);
- break;
- }
- new OperationJob(op).schedule();
- }
- break;
- }
- }
- }
- }
-
- private class P_ScoutSeverityListener implements IScoutSeverityListener {
-
- @Override
- public void severityChanged(IResource resource) {
- boolean accept = false;
- if (resource == ResourceFactory.getSunJaxWsResource(m_bundle).getFile()) {
- accept = true;
- }
- if (!accept && getPage().getPortType() != null && resource == getPage().getPortType().getResource()) {
- accept = true;
- }
- if (!accept) {
- return;
- }
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (getPage().isPageUnloaded() || getForm().isDisposed()) {
- return;
- }
- getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
-
- // update marker status of presenters (quality)
- m_urlPatternPresenter.updateInfo();
- m_sessionFactoryPresenter.updateInfo();
- m_authenticationHandlerPresenter.updateInfo();
- m_credentialValidationStrategyPresenter.updateInfo();
- }
- });
- }
- }
-
- private class P_PageLoadedListener implements IPageLoadedListener {
-
- @Override
- public void pageLoaded() {
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (getPage().isPageUnloaded() || getForm().isDisposed()) {
- return;
- }
- updatePresenterValues();
- }
- });
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+import javax.jws.WebService;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.util.IScoutSeverityListener;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction.FileExtensionType;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.RepairAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.TypeOpenAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderCodeFirstNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.AnnotationPropertyTypePresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.SeparatorPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.TypePresenter.ISearchJavaSearchScopeFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.UrlPatternPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPresenterValueChangedListener;
+import org.eclipse.swt.layout.GridData;
+
+public class WebServiceProviderCodeFirstNodePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+
+ public static final String SECTION_ID_REPAIR = "section.jaxws.repair";
+ public static final String SECTION_ID_PROPERTIES = "section.jaxws.properties";
+ public static final String SECTION_ID_LINKS = "section.jaxws.links";
+ public static final String SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION = "section.scoutWebServiceAnnotation";
+
+ public static final int PRESENTER_ID_SESSION_FACTORY = 1 << 1;
+ public static final int PRESENTER_ID_AUTHENTICATION_HANDLER = 1 << 2;
+ public static final int PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY = 1 << 3;
+
+ private IPresenterValueChangedListener m_presenterListener;
+
+ private UrlPatternPresenter m_urlPatternPresenter;
+
+ private P_ScoutSeverityListener m_severityListener;
+ private IPageLoadedListener m_pageLoadedListener;
+
+ private AnnotationPropertyTypePresenter m_sessionFactoryPresenter;
+ private AnnotationPropertyTypePresenter m_authenticationHandlerPresenter;
+ private AnnotationPropertyTypePresenter m_credentialValidationStrategyPresenter;
+
+ private IScoutBundle m_bundle;
+
+ @Override
+ protected void init() {
+ m_bundle = getPage().getScoutResource();
+ m_presenterListener = new P_PresenterListener();
+ m_severityListener = new P_ScoutSeverityListener();
+ m_pageLoadedListener = new P_PageLoadedListener();
+ ScoutSeverityManager.getInstance().addQualityManagerListener(m_severityListener);
+ getPage().addPageLoadedListener(m_pageLoadedListener);
+ }
+
+ @Override
+ protected void cleanup() {
+ ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
+ getPage().removePageLoadedListener(m_pageLoadedListener);
+ }
+
+ @Override
+ public WebServiceProviderCodeFirstNodePage getPage() {
+ return (WebServiceProviderCodeFirstNodePage) super.getPage();
+ }
+
+ @Override
+ protected void createSections() {
+ getForm().setRedraw(true);
+ try {
+ /*
+ * repair section
+ */
+ createSection(SECTION_ID_REPAIR, Texts.get("RepairRequired"), Texts.get("SectionRepairDescription"), false);
+ getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
+ RepairAction a = new RepairAction();
+ a.init(getPage().getMarkerGroupUUID(), m_bundle);
+ AbstractPresenter presenter = new ActionPresenter(getSection(SECTION_ID_REPAIR).getSectionClient(), a, getFormToolkit());
+ applyLayoutData(presenter);
+
+ /*
+ * link section
+ */
+ createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
+ createQuickLinkPresenters();
+
+ /*
+ * Scout webservice annotation section
+ */
+ createSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION, Texts.get("AuthenticationAndSessionContext"), null, true);
+ getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).setExpanded(false);
+
+ // Scout authentication mechanism
+ m_authenticationHandlerPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).getSectionClient(), getFormToolkit());
+ m_authenticationHandlerPresenter.setPresenterId(PRESENTER_ID_AUTHENTICATION_HANDLER);
+ m_authenticationHandlerPresenter.setLabel(Texts.get("Authentication"));
+ m_authenticationHandlerPresenter.setAcceptNullValue(true);
+ m_authenticationHandlerPresenter.setBundle(m_bundle);
+ m_authenticationHandlerPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
+ m_authenticationHandlerPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER);
+ m_authenticationHandlerPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
+ m_authenticationHandlerPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ m_authenticationHandlerPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider)));
+ m_authenticationHandlerPresenter.setAllowChangeOfInterfaceType(true);
+ m_authenticationHandlerPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider)});
+ m_authenticationHandlerPresenter.addValueChangedListener(m_presenterListener);
+ m_authenticationHandlerPresenter.getContainer().setLayoutData(new GridData());
+ applyLayoutData(m_authenticationHandlerPresenter);
+
+ // Scout credential validation strategy
+ m_credentialValidationStrategyPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).getSectionClient(), getFormToolkit());
+ m_credentialValidationStrategyPresenter.setPresenterId(PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY);
+ m_credentialValidationStrategyPresenter.setLabel(Texts.get("CredentialValidation"));
+ m_credentialValidationStrategyPresenter.setAcceptNullValue(true);
+ m_credentialValidationStrategyPresenter.setBundle(m_bundle);
+ m_credentialValidationStrategyPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
+ m_credentialValidationStrategyPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY);
+ m_credentialValidationStrategyPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
+ m_credentialValidationStrategyPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ m_credentialValidationStrategyPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy)));
+ m_credentialValidationStrategyPresenter.setAllowChangeOfInterfaceType(true);
+ m_credentialValidationStrategyPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy)});
+ m_credentialValidationStrategyPresenter.addValueChangedListener(m_presenterListener);
+ m_credentialValidationStrategyPresenter.getContainer().setLayoutData(new GridData());
+ applyLayoutData(m_credentialValidationStrategyPresenter);
+
+ // Scout session factory
+ m_sessionFactoryPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).getSectionClient(), getFormToolkit());
+ m_sessionFactoryPresenter.setPresenterId(PRESENTER_ID_SESSION_FACTORY);
+ m_sessionFactoryPresenter.setLabel(Texts.get("Session"));
+ m_sessionFactoryPresenter.setAcceptNullValue(true);
+ m_sessionFactoryPresenter.setBundle(m_bundle);
+ m_sessionFactoryPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
+ m_sessionFactoryPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
+ m_sessionFactoryPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
+ m_sessionFactoryPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ m_sessionFactoryPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)));
+ m_sessionFactoryPresenter.setAllowChangeOfInterfaceType(true);
+ m_sessionFactoryPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)});
+ m_sessionFactoryPresenter.addValueChangedListener(m_presenterListener);
+ m_sessionFactoryPresenter.getContainer().setLayoutData(new GridData());
+ applyLayoutData(m_sessionFactoryPresenter);
+
+ /*
+ * properties section
+ */
+ createSection(SECTION_ID_PROPERTIES, Texts.get("WebserviceProperties"));
+ getSection(SECTION_ID_PROPERTIES).setExpanded(true);
+
+ // URL pattern
+ m_urlPatternPresenter = new UrlPatternPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_urlPatternPresenter.setLabel(Texts.get("UrlPattern"));
+ m_urlPatternPresenter.setBundle(m_bundle);
+ m_urlPatternPresenter.setMarkerType(MarkerType.UrlPattern);
+ m_urlPatternPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ applyLayoutData(m_urlPatternPresenter);
+
+ updatePresenterValues();
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ }
+
+ private void updatePresenterValues() {
+ createQuickLinkPresenters();
+
+ SunJaxWsBean sunJaxWsBean = getPage().getSunJaxWsBean();
+
+ String urlPattern = null;
+
+ if (sunJaxWsBean != null) {
+ urlPattern = sunJaxWsBean.getUrlPattern();
+ }
+
+ m_urlPatternPresenter.setInput(urlPattern);
+ m_urlPatternPresenter.setSunJaxWsBean(sunJaxWsBean);
+ String servletRegistrationBundleName = ServletRegistrationUtility.getBuildJaxServletRegistrationBundleName(m_bundle);
+ if (servletRegistrationBundleName != null) {
+ m_urlPatternPresenter.setTooltip(Texts.get("JaxWsServletRegistrationInBundleX", servletRegistrationBundleName));
+ }
+ else {
+ m_urlPatternPresenter.setTooltip(null);
+ }
+
+ IType portType = getPage().getPortType();
+ if (portType != null) {
+ IAnnotation scoutWebServiceAnnotation = JaxWsSdkUtility.getAnnotation(portType, TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getFullyQualifiedName(), false);
+ getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).setVisible(TypeUtility.exists(scoutWebServiceAnnotation));
+ if (TypeUtility.exists(scoutWebServiceAnnotation)) {
+ AnnotationProperty propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(portType, scoutWebServiceAnnotation, JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
+ m_sessionFactoryPresenter.setInput(propertyValue.getFullyQualifiedName());
+ m_sessionFactoryPresenter.setDeclaringType(portType);
+ m_sessionFactoryPresenter.setResetLinkVisible(!propertyValue.isInherited());
+ m_sessionFactoryPresenter.setBoldLabelText(!propertyValue.isInherited());
+
+ propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(portType, scoutWebServiceAnnotation, JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER);
+ m_authenticationHandlerPresenter.setInput(propertyValue.getFullyQualifiedName());
+ m_authenticationHandlerPresenter.setDeclaringType(portType);
+ m_authenticationHandlerPresenter.setResetLinkVisible(!propertyValue.isInherited());
+ m_authenticationHandlerPresenter.setBoldLabelText(!propertyValue.isInherited());
+
+ propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(portType, scoutWebServiceAnnotation, JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY);
+ m_credentialValidationStrategyPresenter.setInput(propertyValue.getFullyQualifiedName());
+ m_credentialValidationStrategyPresenter.setDeclaringType(portType);
+ m_credentialValidationStrategyPresenter.setResetLinkVisible(!propertyValue.isInherited());
+ m_credentialValidationStrategyPresenter.setBoldLabelText(!propertyValue.isInherited());
+ }
+ }
+
+ getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
+ }
+
+ private void createQuickLinkPresenters() {
+ getForm().setRedraw(false);
+
+ try {
+ JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS).getSectionClient());
+
+ createQuickLinkForTypesPresenters();
+
+ SeparatorPresenter separatorPresenter = new SeparatorPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), getFormToolkit());
+ applyLayoutData(separatorPresenter);
+
+ // QuickLink 'Open sun-jaxws.xml'
+ FileOpenAction a = new FileOpenAction();
+ a.init(ResourceFactory.getSunJaxWsResource(m_bundle).getFile(), ResourceFactory.getSunJaxWsResource(m_bundle).getFile().getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.SunJaxWsXmlFile), FileExtensionType.Xml);
+ a.setToolTip(Texts.get("JaxWsDeploymentDescriptor"));
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
+ applyLayoutData(actionPresenter);
+ }
+ finally {
+ getForm().setRedraw(true);
+ getSection(SECTION_ID_LINKS).setVisible(getSection(SECTION_ID_LINKS).getSectionClient().getChildren().length > 0);
+ JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS));
+ }
+ }
+
+ private void createQuickLinkForTypesPresenters() {
+ SunJaxWsBean sunJaxWsBean = getPage().getSunJaxWsBean();
+
+ if (sunJaxWsBean == null || sunJaxWsBean.getImplementation() == null) {
+ return;
+ }
+
+ String fqn = sunJaxWsBean.getImplementation();
+ if (!TypeUtility.existsType(fqn)) {
+ return;
+ }
+ IType wsProviderImplType = TypeUtility.getType(fqn);
+
+ // QuickLink 'Open PortType'
+ TypeOpenAction a = new TypeOpenAction();
+ a.init(wsProviderImplType);
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
+ applyLayoutData(actionPresenter);
+
+ // QuickLink 'Open PortType Interface'
+ createQuickLinkForPortTypeInterfaceType();
+ }
+
+ private void createQuickLinkForPortTypeInterfaceType() {
+ IType portType = getPage().getPortType();
+ if (!TypeUtility.exists(portType)) {
+ return;
+ }
+ IAnnotation annotation = JaxWsSdkUtility.getAnnotation(portType, WebService.class.getName(), false);
+ if (annotation == null) {
+ return;
+ }
+ AnnotationProperty property = JaxWsSdkUtility.parseAnnotationTypeValue(portType, annotation, "endpointInterface");
+ IType portTypeInterfaceType = TypeUtility.getType(property.getFullyQualifiedName());
+ if (portTypeInterfaceType == null) {
+ return;
+ }
+
+ TypeOpenAction action = new TypeOpenAction();
+ action.init(portTypeInterfaceType);
+ action.setToolTip(Texts.get("JaxWsPortTypeInterface"));
+ ActionPresenter presenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), action, getFormToolkit());
+ applyLayoutData(presenter);
+ }
+
+ private void applyLayoutData(AbstractPresenter presenter) {
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+
+ private ISearchJavaSearchScopeFactory createSubClassesSearchScopeFactory(final IType superType) {
+ return new ISearchJavaSearchScopeFactory() {
+
+ @Override
+ public IJavaSearchScope create() {
+ // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
+ IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
+ return SearchEngine.createJavaSearchScope(subTypes);
+ }
+ };
+ }
+
+ private final class P_PresenterListener implements IPresenterValueChangedListener {
+
+ @Override
+ public void propertyChanged(int presenterId, Object value) {
+ switch (presenterId) {
+ case PRESENTER_ID_SESSION_FACTORY:
+ case PRESENTER_ID_AUTHENTICATION_HANDLER:
+ case PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY: {
+ IType portType = getPage().getPortType();
+ if (TypeUtility.exists(portType)) {
+ String factoryFullyQualifiedName = (String) value;
+ if (!TypeUtility.existsType(factoryFullyQualifiedName)) {
+ return;
+ }
+ IType factoryType = TypeUtility.getType(factoryFullyQualifiedName);
+ AnnotationUpdateOperation op = new AnnotationUpdateOperation();
+ op.setDeclaringType(portType);
+ op.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
+ switch (presenterId) {
+ case PRESENTER_ID_SESSION_FACTORY:
+ op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, factoryType);
+ break;
+ case PRESENTER_ID_AUTHENTICATION_HANDLER:
+ op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER, factoryType);
+ break;
+ case PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY:
+ op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY, factoryType);
+ break;
+ }
+ new OperationJob(op).schedule();
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ private class P_ScoutSeverityListener implements IScoutSeverityListener {
+
+ @Override
+ public void severityChanged(IResource resource) {
+ boolean accept = false;
+ if (resource == ResourceFactory.getSunJaxWsResource(m_bundle).getFile()) {
+ accept = true;
+ }
+ if (!accept && getPage().getPortType() != null && resource == getPage().getPortType().getResource()) {
+ accept = true;
+ }
+ if (!accept) {
+ return;
+ }
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getPage().isPageUnloaded() || getForm().isDisposed()) {
+ return;
+ }
+ getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
+
+ // update marker status of presenters (quality)
+ m_urlPatternPresenter.updateInfo();
+ m_sessionFactoryPresenter.updateInfo();
+ m_authenticationHandlerPresenter.updateInfo();
+ m_credentialValidationStrategyPresenter.updateInfo();
+ }
+ });
+ }
+ }
+
+ private class P_PageLoadedListener implements IPageLoadedListener {
+
+ @Override
+ public void pageLoaded() {
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getPage().isPageUnloaded() || getForm().isDisposed()) {
+ return;
+ }
+ updatePresenterValues();
+ }
+ });
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderHandlerNodePagePropertyViewPart.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderHandlerNodePagePropertyViewPart.java
index 1a1cf13e2..ab7f92ac4 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderHandlerNodePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderHandlerNodePagePropertyViewPart.java
@@ -1,274 +1,274 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Random;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.util.IScoutSeverityListener;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction.FileExtensionType;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerAddAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerChainFilterEditAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerChainNewAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerChainRemoveAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean.IHandlerVisitor;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderHandlerNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.HandlerPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.TypePresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.HandlerChainFilterWizardPage.FilterTypeEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-
-public class WebServiceProviderHandlerNodePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
-
- public static final int PRESENTER_ID_HANDLER = 1 << 1;
-
- public static final String SECTION_ID_LINKS = "section.jaxws.links";
- public static final String SECTION_ID_HANDLER_CHAIN_PREFIX = "section.jaxws.handlerchain.";
-
- private P_ScoutSeverityListener m_severityListener;
- private IPageLoadedListener m_pageLoadedListener;
-
- private List<TypePresenter> m_handlerPresenters;
- private Set<String> m_sectionsIdentifiers;
- private IScoutBundle m_bundle;
-
- @Override
- protected void init() {
- m_bundle = getPage().getScoutResource();
- m_sectionsIdentifiers = new HashSet<String>();
- m_handlerPresenters = new ArrayList<TypePresenter>();
-
- m_severityListener = new P_ScoutSeverityListener();
- ScoutSeverityManager.getInstance().addQualityManagerListener(m_severityListener);
-
- m_pageLoadedListener = new P_PageLoadedListener();
- getPage().addPageLoadedListener(m_pageLoadedListener);
- }
-
- @Override
- protected void cleanup() {
- ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
- getPage().removePageLoadedListener(m_pageLoadedListener);
- }
-
- @Override
- public WebServiceProviderHandlerNodePage getPage() {
- return (WebServiceProviderHandlerNodePage) super.getPage();
- }
-
- @Override
- protected void createSections() {
- getForm().setRedraw(true);
- try {
- /*
- * link section
- */
- createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
-
- // QuickLink 'Open sun-jaxws.xml'
- FileOpenAction a = new FileOpenAction();
- a.init(ResourceFactory.getSunJaxWsResource(m_bundle).getFile(), ResourceFactory.getSunJaxWsResource(m_bundle).getFile().getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.SunJaxWsXmlFile), FileExtensionType.Xml);
- a.setToolTip(Texts.get("JaxWsDeploymentDescriptor"));
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
- applyLayoutData(actionPresenter);
-
- if (getPage().getSunJaxWsBean() == null) {
- return;
- }
-
- // Add Handler Chain
- HandlerChainNewAction action = new HandlerChainNewAction();
- action.init(m_bundle, getPage().getSunJaxWsBean());
- ActionPresenter presenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), action, getFormToolkit());
- presenter.setEnabled(getPage().getSunJaxWsBean() != null);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.horizontalAlignment = SWT.RIGHT;
- presenter.getContainer().setLayoutData(gd);
-
- createHandlerChainSections(getPage().getSunJaxWsBean());
- }
- finally {
- getForm().setRedraw(true);
- }
- }
-
- private void applyLayoutData(AbstractPresenter presenter) {
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- presenter.getContainer().setLayoutData(layoutData);
- }
-
- private void createHandlerChainSections(SunJaxWsBean sunJaxWsBean) {
- getForm().setRedraw(false);
- try {
- // reset sections
- for (String sectionId : m_sectionsIdentifiers) {
- removeSection(sectionId);
- }
- m_sectionsIdentifiers.clear();
-
- if (getPage().getSunJaxWsBean() == null) {
- return;
- }
-
- // create handler chain sections
- List<ScoutXmlElement> xmlHandlerChains = sunJaxWsBean.getHandlerChains();
- for (int i = 0; i < xmlHandlerChains.size(); i++) {
- ScoutXmlElement xmlHandlerChain = xmlHandlerChains.get(i);
- final String sectionId = SECTION_ID_HANDLER_CHAIN_PREFIX + Integer.toString(i);
- m_sectionsIdentifiers.add(sectionId);
- ISection section = createSection(sectionId, "", null, false);
-
- // set title of section
- String handlerChainName = null;
- if (xmlHandlerChain.hasAttribute("name")) {
- handlerChainName = xmlHandlerChain.getAttribute("name");
- }
- if (StringUtility.hasText(handlerChainName)) {
- section.setText(Texts.get("HandlerChainX", handlerChainName));
- }
- else {
- section.setText(Texts.get("HandlerChain"));
- }
-
- // Edit Filter
- HandlerChainFilterEditAction filterAction = new HandlerChainFilterEditAction();
- FilterTypeEnum filterType = getFilterType(sunJaxWsBean, xmlHandlerChain);
- if (filterType != FilterTypeEnum.NoFilter) {
- filterAction.setLinkText(Texts.get("EditFilterXActive", filterType.getLabel()));
- }
- filterAction.init(m_bundle, getPage().getSunJaxWsBean(), xmlHandlerChain);
- ActionPresenter presenter = new ActionPresenter(section.getSectionClient(), filterAction, getFormToolkit());
- GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.horizontalAlignment = SWT.RIGHT;
- presenter.getContainer().setLayoutData(gd);
-
- // Remove Handler Chain
- HandlerChainRemoveAction removeChainAction = new HandlerChainRemoveAction();
- removeChainAction.init(m_bundle, getPage().getSunJaxWsBean(), xmlHandlerChain);
- presenter = new ActionPresenter(section.getSectionClient(), removeChainAction, getFormToolkit());
- gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.horizontalAlignment = SWT.RIGHT;
- presenter.getContainer().setLayoutData(gd);
-
- // Add Handler
- HandlerAddAction newHandlerAction = new HandlerAddAction();
- newHandlerAction.init(m_bundle, getPage().getSunJaxWsBean(), xmlHandlerChain);
- presenter = new ActionPresenter(section.getSectionClient(), newHandlerAction, getFormToolkit());
- gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.verticalIndent = 20;
- gd.horizontalAlignment = SWT.RIGHT;
- presenter.getContainer().setLayoutData(gd);
-
- // handler presenters
- sunJaxWsBean.visitHandlers(xmlHandlerChain, new IHandlerVisitor() {
-
- @Override
- public boolean visit(ScoutXmlElement xmlHandlerElement, String fullyQualifiedName, int handlerIndex, int handlerCount) {
- String handlerClassElementName = getPage().getSunJaxWsBean().toQualifiedName(SunJaxWsBean.XML_HANDLER_CLASS);
- ScoutXmlElement xmlHandlerClassElement = xmlHandlerElement.getChild(handlerClassElementName);
- String handlerClass = null;
- if (xmlHandlerClassElement != null) {
- handlerClass = xmlHandlerClassElement.getText();
- }
-
- HandlerPresenter p = new HandlerPresenter(m_bundle, getSection(sectionId).getSectionClient(), handlerIndex, handlerCount, getFormToolkit());
- p.setPresenterId(PRESENTER_ID_HANDLER + new Random().nextInt());
- p.setMarkerGroupUUID(JaxWsSdkUtility.toMarkerGroupUUID(getPage().getMarkerGroupUUID(), handlerIndex));
- p.setXmlHandlerElement(xmlHandlerElement);
- p.setSunJaxWsBean(getPage().getSunJaxWsBean());
- p.setInput(handlerClass);
-
- m_handlerPresenters.add(p);
- applyLayoutData(p);
- return true;
- }
- });
- JaxWsSdkUtility.doLayoutSection(section);
- }
- }
- finally {
- getForm().setRedraw(true);
- }
- }
-
- private FilterTypeEnum getFilterType(SunJaxWsBean sunJaxWsBean, ScoutXmlElement xmlHandlerChain) {
- if (xmlHandlerChain.hasChild(sunJaxWsBean.toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PROTOCOL))) {
- return FilterTypeEnum.ProtocolFilter;
- }
- else if (xmlHandlerChain.hasChild(sunJaxWsBean.toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_SERVICE))) {
- return FilterTypeEnum.ServiceFilter;
- }
- else if (xmlHandlerChain.hasChild(sunJaxWsBean.toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PORT))) {
- return FilterTypeEnum.PortFilter;
- }
- return FilterTypeEnum.NoFilter;
- }
-
- private class P_ScoutSeverityListener implements IScoutSeverityListener {
-
- @Override
- public void severityChanged(IResource resource) {
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (getPage().isPageUnloaded() || getForm().isDisposed()) {
- return;
- }
-
- // update marker status of presenters (quality)
- for (TypePresenter presenter : m_handlerPresenters) {
- presenter.updateInfo();
- }
- }
- });
- }
- }
-
- private class P_PageLoadedListener implements IPageLoadedListener {
-
- @Override
- public void pageLoaded() {
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (getPage().isPageUnloaded() || getForm().isDisposed()) {
- return;
- }
- createHandlerChainSections(getPage().getSunJaxWsBean());
- }
- });
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Random;
+import java.util.Set;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.util.IScoutSeverityListener;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction.FileExtensionType;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerAddAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerChainFilterEditAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerChainNewAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.HandlerChainRemoveAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean.IHandlerVisitor;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderHandlerNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.HandlerPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.TypePresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.HandlerChainFilterWizardPage.FilterTypeEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+
+public class WebServiceProviderHandlerNodePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+
+ public static final int PRESENTER_ID_HANDLER = 1 << 1;
+
+ public static final String SECTION_ID_LINKS = "section.jaxws.links";
+ public static final String SECTION_ID_HANDLER_CHAIN_PREFIX = "section.jaxws.handlerchain.";
+
+ private P_ScoutSeverityListener m_severityListener;
+ private IPageLoadedListener m_pageLoadedListener;
+
+ private List<TypePresenter> m_handlerPresenters;
+ private Set<String> m_sectionsIdentifiers;
+ private IScoutBundle m_bundle;
+
+ @Override
+ protected void init() {
+ m_bundle = getPage().getScoutResource();
+ m_sectionsIdentifiers = new HashSet<String>();
+ m_handlerPresenters = new ArrayList<TypePresenter>();
+
+ m_severityListener = new P_ScoutSeverityListener();
+ ScoutSeverityManager.getInstance().addQualityManagerListener(m_severityListener);
+
+ m_pageLoadedListener = new P_PageLoadedListener();
+ getPage().addPageLoadedListener(m_pageLoadedListener);
+ }
+
+ @Override
+ protected void cleanup() {
+ ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
+ getPage().removePageLoadedListener(m_pageLoadedListener);
+ }
+
+ @Override
+ public WebServiceProviderHandlerNodePage getPage() {
+ return (WebServiceProviderHandlerNodePage) super.getPage();
+ }
+
+ @Override
+ protected void createSections() {
+ getForm().setRedraw(true);
+ try {
+ /*
+ * link section
+ */
+ createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
+
+ // QuickLink 'Open sun-jaxws.xml'
+ FileOpenAction a = new FileOpenAction();
+ a.init(ResourceFactory.getSunJaxWsResource(m_bundle).getFile(), ResourceFactory.getSunJaxWsResource(m_bundle).getFile().getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.SunJaxWsXmlFile), FileExtensionType.Xml);
+ a.setToolTip(Texts.get("JaxWsDeploymentDescriptor"));
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
+ applyLayoutData(actionPresenter);
+
+ if (getPage().getSunJaxWsBean() == null) {
+ return;
+ }
+
+ // Add Handler Chain
+ HandlerChainNewAction action = new HandlerChainNewAction();
+ action.init(m_bundle, getPage().getSunJaxWsBean());
+ ActionPresenter presenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), action, getFormToolkit());
+ presenter.setEnabled(getPage().getSunJaxWsBean() != null);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.horizontalAlignment = SWT.RIGHT;
+ presenter.getContainer().setLayoutData(gd);
+
+ createHandlerChainSections(getPage().getSunJaxWsBean());
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ }
+
+ private void applyLayoutData(AbstractPresenter presenter) {
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+
+ private void createHandlerChainSections(SunJaxWsBean sunJaxWsBean) {
+ getForm().setRedraw(false);
+ try {
+ // reset sections
+ for (String sectionId : m_sectionsIdentifiers) {
+ removeSection(sectionId);
+ }
+ m_sectionsIdentifiers.clear();
+
+ if (getPage().getSunJaxWsBean() == null) {
+ return;
+ }
+
+ // create handler chain sections
+ List<ScoutXmlElement> xmlHandlerChains = sunJaxWsBean.getHandlerChains();
+ for (int i = 0; i < xmlHandlerChains.size(); i++) {
+ ScoutXmlElement xmlHandlerChain = xmlHandlerChains.get(i);
+ final String sectionId = SECTION_ID_HANDLER_CHAIN_PREFIX + Integer.toString(i);
+ m_sectionsIdentifiers.add(sectionId);
+ ISection section = createSection(sectionId, "", null, false);
+
+ // set title of section
+ String handlerChainName = null;
+ if (xmlHandlerChain.hasAttribute("name")) {
+ handlerChainName = xmlHandlerChain.getAttribute("name");
+ }
+ if (StringUtility.hasText(handlerChainName)) {
+ section.setText(Texts.get("HandlerChainX", handlerChainName));
+ }
+ else {
+ section.setText(Texts.get("HandlerChain"));
+ }
+
+ // Edit Filter
+ HandlerChainFilterEditAction filterAction = new HandlerChainFilterEditAction();
+ FilterTypeEnum filterType = getFilterType(sunJaxWsBean, xmlHandlerChain);
+ if (filterType != FilterTypeEnum.NoFilter) {
+ filterAction.setLinkText(Texts.get("EditFilterXActive", filterType.getLabel()));
+ }
+ filterAction.init(m_bundle, getPage().getSunJaxWsBean(), xmlHandlerChain);
+ ActionPresenter presenter = new ActionPresenter(section.getSectionClient(), filterAction, getFormToolkit());
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.horizontalAlignment = SWT.RIGHT;
+ presenter.getContainer().setLayoutData(gd);
+
+ // Remove Handler Chain
+ HandlerChainRemoveAction removeChainAction = new HandlerChainRemoveAction();
+ removeChainAction.init(m_bundle, getPage().getSunJaxWsBean(), xmlHandlerChain);
+ presenter = new ActionPresenter(section.getSectionClient(), removeChainAction, getFormToolkit());
+ gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.horizontalAlignment = SWT.RIGHT;
+ presenter.getContainer().setLayoutData(gd);
+
+ // Add Handler
+ HandlerAddAction newHandlerAction = new HandlerAddAction();
+ newHandlerAction.init(m_bundle, getPage().getSunJaxWsBean(), xmlHandlerChain);
+ presenter = new ActionPresenter(section.getSectionClient(), newHandlerAction, getFormToolkit());
+ gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.verticalIndent = 20;
+ gd.horizontalAlignment = SWT.RIGHT;
+ presenter.getContainer().setLayoutData(gd);
+
+ // handler presenters
+ sunJaxWsBean.visitHandlers(xmlHandlerChain, new IHandlerVisitor() {
+
+ @Override
+ public boolean visit(ScoutXmlElement xmlHandlerElement, String fullyQualifiedName, int handlerIndex, int handlerCount) {
+ String handlerClassElementName = getPage().getSunJaxWsBean().toQualifiedName(SunJaxWsBean.XML_HANDLER_CLASS);
+ ScoutXmlElement xmlHandlerClassElement = xmlHandlerElement.getChild(handlerClassElementName);
+ String handlerClass = null;
+ if (xmlHandlerClassElement != null) {
+ handlerClass = xmlHandlerClassElement.getText();
+ }
+
+ HandlerPresenter p = new HandlerPresenter(m_bundle, getSection(sectionId).getSectionClient(), handlerIndex, handlerCount, getFormToolkit());
+ p.setPresenterId(PRESENTER_ID_HANDLER + new Random().nextInt());
+ p.setMarkerGroupUUID(JaxWsSdkUtility.toMarkerGroupUUID(getPage().getMarkerGroupUUID(), handlerIndex));
+ p.setXmlHandlerElement(xmlHandlerElement);
+ p.setSunJaxWsBean(getPage().getSunJaxWsBean());
+ p.setInput(handlerClass);
+
+ m_handlerPresenters.add(p);
+ applyLayoutData(p);
+ return true;
+ }
+ });
+ JaxWsSdkUtility.doLayoutSection(section);
+ }
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ }
+
+ private FilterTypeEnum getFilterType(SunJaxWsBean sunJaxWsBean, ScoutXmlElement xmlHandlerChain) {
+ if (xmlHandlerChain.hasChild(sunJaxWsBean.toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PROTOCOL))) {
+ return FilterTypeEnum.ProtocolFilter;
+ }
+ else if (xmlHandlerChain.hasChild(sunJaxWsBean.toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_SERVICE))) {
+ return FilterTypeEnum.ServiceFilter;
+ }
+ else if (xmlHandlerChain.hasChild(sunJaxWsBean.toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PORT))) {
+ return FilterTypeEnum.PortFilter;
+ }
+ return FilterTypeEnum.NoFilter;
+ }
+
+ private class P_ScoutSeverityListener implements IScoutSeverityListener {
+
+ @Override
+ public void severityChanged(IResource resource) {
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getPage().isPageUnloaded() || getForm().isDisposed()) {
+ return;
+ }
+
+ // update marker status of presenters (quality)
+ for (TypePresenter presenter : m_handlerPresenters) {
+ presenter.updateInfo();
+ }
+ }
+ });
+ }
+ }
+
+ private class P_PageLoadedListener implements IPageLoadedListener {
+
+ @Override
+ public void pageLoaded() {
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getPage().isPageUnloaded() || getForm().isDisposed()) {
+ return;
+ }
+ createHandlerChainSections(getPage().getSunJaxWsBean());
+ }
+ });
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderNodePagePropertyViewPart.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderNodePagePropertyViewPart.java
index ec5bd8871..ce6ae221e 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderNodePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderNodePagePropertyViewPart.java
@@ -1,868 +1,868 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.wsdl.Binding;
-import javax.wsdl.Definition;
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.util.IScoutSeverityListener;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
-import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.BindingFileNewAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.BuildPropertiesEditAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction.FileExtensionType;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.RepairAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.StubRebuildAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.TypeOpenAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.AnnotationPropertyTypePresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.BindingFilePresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.FilePresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.FolderPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.SeparatorPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.StringPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.TypePresenter.ISearchJavaSearchScopeFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.UrlPatternPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.WsdlFilePresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.WsdlFolderPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.Artefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaImportArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaIncludeArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPresenterValueChangedListener;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-public class WebServiceProviderNodePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
-
- public static final String SECTION_ID_REPAIR = "section.jaxws.repair";
- public static final String SECTION_ID_PROPERTIES = "section.jaxws.properties";
- public static final String SECTION_ID_STUB_PROPERTIES = "section.jaxws.build";
- public static final String SECTION_ID_LINKS = "section.jaxws.links";
- public static final String SECTION_ID_LINKS_REF_WSDLS = "section.jaxws.links.ref.wsdl";
- public static final String SECTION_ID_LINKS_INCLUDED_SCHEMAS = "section.jaxws.links.included.schema";
- public static final String SECTION_ID_LINKS_IMPORTED_SCHEMAS = "section.jaxws.links.imported.schema";
- public static final String SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION = "section.scoutWebServiceAnnotation";
-
- public static final int PRESENTER_ID_SESSION_FACTORY = 1 << 1;
- public static final int PRESENTER_ID_AUTHENTICATION_HANDLER = 1 << 2;
- public static final int PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY = 1 << 3;
-
- private IPresenterValueChangedListener m_presenterListener;
-
- private StringPresenter m_targetNamespacePresenter;
- private StringPresenter m_servicePresenter;
- private StringPresenter m_portPresenter;
- private StringPresenter m_bindingPresenter;
- private StringPresenter m_portTypePresenter;
- private UrlPatternPresenter m_urlPatternPresenter;
- private FolderPresenter m_stubFolderPresenter;
- private FilePresenter m_stubJarFilePresenter;
- private WsdlFolderPresenter m_wsdlFolderPresenter;
- private WsdlFilePresenter m_wsdlFilePresenter;
-
- private Composite m_bindingFilesComposite;
-
- private P_ScoutSeverityListener m_severityListener;
- private IPageLoadedListener m_pageLoadedListener;
-
- private AnnotationPropertyTypePresenter m_sessionFactoryPresenter;
- private AnnotationPropertyTypePresenter m_authenticationHandlerPresenter;
- private AnnotationPropertyTypePresenter m_credentialValidationStrategyPresenter;
- private List<BindingFilePresenter> m_bindingFilePresenters;
- private ActionPresenter m_rebuildStubPresenter;
-
- private IScoutBundle m_bundle;
-
- @Override
- protected void init() {
- m_bundle = getPage().getScoutResource();
- m_presenterListener = new P_PresenterListener();
- m_severityListener = new P_ScoutSeverityListener();
- m_pageLoadedListener = new P_PageLoadedListener();
- ScoutSeverityManager.getInstance().addQualityManagerListener(m_severityListener);
- getPage().addPageLoadedListener(m_pageLoadedListener);
- m_bindingFilePresenters = new LinkedList<BindingFilePresenter>();
- }
-
- @Override
- protected void cleanup() {
- ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
- getPage().removePageLoadedListener(m_pageLoadedListener);
- }
-
- @Override
- public WebServiceProviderNodePage getPage() {
- return (WebServiceProviderNodePage) super.getPage();
- }
-
- @Override
- protected void createSections() {
- getForm().setRedraw(true);
- try {
- /*
- * repair section
- */
- createSection(SECTION_ID_REPAIR, Texts.get("RepairRequired"), Texts.get("SectionRepairDescription"), false);
- getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
- RepairAction a = new RepairAction();
- a.init(getPage().getMarkerGroupUUID(), m_bundle);
- AbstractPresenter presenter = new ActionPresenter(getSection(SECTION_ID_REPAIR).getSectionClient(), a, getFormToolkit());
- applyLayoutData(presenter);
-
- /*
- * link section
- */
- createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
- createQuickLinkPresenters();
-
- /*
- * link section (referenced WSDL definitions)
- */
- createSection(SECTION_ID_LINKS_REF_WSDLS, Texts.get("ReferencedWsdlDefintions"));
- getSection(SECTION_ID_LINKS_REF_WSDLS).setExpanded(false);
-
- /*
- * link section (imported XSD schemas)
- */
- createSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS, Texts.get("ImportedXsdSchemas"));
- getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).setExpanded(false);
-
- /*
- * link section (included XSD schemas)
- */
- createSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS, Texts.get("IncludedXsdSchemas"));
- getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).setExpanded(false);
-
- createQuickLinkPresentersForReferencedFiles();
-
- if (getPage().getBuildJaxWsBean() == null) {
- return;
- }
-
- /*
- * stub properties section
- */
- createSection(SECTION_ID_STUB_PROPERTIES, Texts.get("StubProperties"));
-
- StubRebuildAction b = new StubRebuildAction();
- b.init(m_bundle, getPage().getBuildJaxWsBean(), getPage().getWsdlResource(), getPage().getMarkerGroupUUID(), WebserviceEnum.Provider);
- m_rebuildStubPresenter = new ActionPresenter(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), b, getFormToolkit());
- applyLayoutData(m_rebuildStubPresenter);
-
- // edit build properties
- BuildPropertiesEditAction c = new BuildPropertiesEditAction();
- c.init(m_bundle, getPage().getBuildJaxWsBean());
- presenter = new ActionPresenter(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), c, getFormToolkit());
- GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.horizontalAlignment = SWT.RIGHT;
- presenter.getContainer().setLayoutData(gd);
-
- // add binding file
- BindingFileNewAction d = new BindingFileNewAction();
- d.init(m_bundle, getPage().getBuildJaxWsBean(), getPage().getWsdlResource());
- presenter = new ActionPresenter(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), d, getFormToolkit());
- presenter.setEnabled(getPage().getBuildJaxWsBean() != null);
- gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.horizontalAlignment = SWT.RIGHT;
- presenter.getContainer().setLayoutData(gd);
-
- // binding files composite
- m_bindingFilesComposite = new Composite(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), SWT.NONE);
- gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.verticalIndent = 5;
- m_bindingFilesComposite.setLayoutData(gd);
-
- /*
- * Scout webservice annotation section
- */
- createSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION, Texts.get("AuthenticationAndSessionContext"), null, true);
- getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).setExpanded(false);
-
- // Scout authentication mechanism
- m_authenticationHandlerPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).getSectionClient(), getFormToolkit());
- m_authenticationHandlerPresenter.setPresenterId(PRESENTER_ID_AUTHENTICATION_HANDLER);
- m_authenticationHandlerPresenter.setLabel(Texts.get("Authentication"));
- m_authenticationHandlerPresenter.setAcceptNullValue(true);
- m_authenticationHandlerPresenter.setBundle(m_bundle);
- m_authenticationHandlerPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
- m_authenticationHandlerPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER);
- m_authenticationHandlerPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
- m_authenticationHandlerPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- m_authenticationHandlerPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider)));
- m_authenticationHandlerPresenter.setAllowChangeOfInterfaceType(true);
- m_authenticationHandlerPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider)});
- m_authenticationHandlerPresenter.addValueChangedListener(m_presenterListener);
- m_authenticationHandlerPresenter.getContainer().setLayoutData(new GridData());
- applyLayoutData(m_authenticationHandlerPresenter);
-
- // Scout credential validation strategy
- m_credentialValidationStrategyPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).getSectionClient(), getFormToolkit());
- m_credentialValidationStrategyPresenter.setPresenterId(PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY);
- m_credentialValidationStrategyPresenter.setLabel(Texts.get("CredentialValidation"));
- m_credentialValidationStrategyPresenter.setAcceptNullValue(true);
- m_credentialValidationStrategyPresenter.setBundle(m_bundle);
- m_credentialValidationStrategyPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
- m_credentialValidationStrategyPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY);
- m_credentialValidationStrategyPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
- m_credentialValidationStrategyPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- m_credentialValidationStrategyPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy)));
- m_credentialValidationStrategyPresenter.setAllowChangeOfInterfaceType(true);
- m_credentialValidationStrategyPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy)});
- m_credentialValidationStrategyPresenter.addValueChangedListener(m_presenterListener);
- m_credentialValidationStrategyPresenter.getContainer().setLayoutData(new GridData());
- applyLayoutData(m_credentialValidationStrategyPresenter);
-
- // Scout session factory
- m_sessionFactoryPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).getSectionClient(), getFormToolkit());
- m_sessionFactoryPresenter.setPresenterId(PRESENTER_ID_SESSION_FACTORY);
- m_sessionFactoryPresenter.setLabel(Texts.get("Session"));
- m_sessionFactoryPresenter.setAcceptNullValue(true);
- m_sessionFactoryPresenter.setBundle(m_bundle);
- m_sessionFactoryPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
- m_sessionFactoryPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
- m_sessionFactoryPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
- m_sessionFactoryPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- m_sessionFactoryPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)));
- m_sessionFactoryPresenter.setAllowChangeOfInterfaceType(true);
- m_sessionFactoryPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)});
- m_sessionFactoryPresenter.addValueChangedListener(m_presenterListener);
- m_sessionFactoryPresenter.getContainer().setLayoutData(new GridData());
- applyLayoutData(m_sessionFactoryPresenter);
-
- /*
- * properties section
- */
- createSection(SECTION_ID_PROPERTIES, Texts.get("WebserviceProperties"));
- getSection(SECTION_ID_PROPERTIES).setExpanded(true);
-
- // service
- m_servicePresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_servicePresenter.setLabel(Texts.get("Service"));
- m_servicePresenter.setBundle(m_bundle);
- m_servicePresenter.setMarkerType(MarkerType.Service);
- m_servicePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- m_servicePresenter.setEditable(false);
- applyLayoutData(m_servicePresenter);
-
- // port
- m_portPresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_portPresenter.setLabel(Texts.get("Port"));
- m_portPresenter.setBundle(m_bundle);
- m_portPresenter.setMarkerType(MarkerType.Port);
- m_portPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- m_portPresenter.setEditable(false);
- applyLayoutData(m_portPresenter);
-
- // port type
- m_portTypePresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_portTypePresenter.setLabel(Texts.get("PortType"));
- m_portTypePresenter.setBundle(m_bundle);
- m_portTypePresenter.setMarkerType(MarkerType.PortType);
- m_portTypePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- m_portTypePresenter.setEditable(false);
- applyLayoutData(m_portTypePresenter);
-
- // binding
- m_bindingPresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_bindingPresenter.setLabel(Texts.get("Binding"));
- m_bindingPresenter.setEditable(false);
- applyLayoutData(m_bindingPresenter);
-
- // URL pattern
- m_urlPatternPresenter = new UrlPatternPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_urlPatternPresenter.setLabel(Texts.get("UrlPattern"));
- m_urlPatternPresenter.setBundle(m_bundle);
- m_urlPatternPresenter.setMarkerType(MarkerType.UrlPattern);
- m_urlPatternPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- applyLayoutData(m_urlPatternPresenter);
-
- // target namespace
- m_targetNamespacePresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_targetNamespacePresenter.setLabel(Texts.get("TargetNamespace"));
- m_targetNamespacePresenter.setBundle(m_bundle);
- m_targetNamespacePresenter.setMarkerType(MarkerType.TargetNamespace);
- m_targetNamespacePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- m_targetNamespacePresenter.setEditable(false);
- applyLayoutData(m_targetNamespacePresenter);
-
- // stub folder
- m_stubFolderPresenter = new FolderPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_stubFolderPresenter.setShowBrowseButton(false);
- m_stubFolderPresenter.setLabel(Texts.get("StubFolder"));
- m_stubFolderPresenter.setBundle(m_bundle);
- m_stubFolderPresenter.setMarkerType(MarkerType.StubFolder);
- m_stubFolderPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- applyLayoutData(m_stubFolderPresenter);
-
- // stub jar
- m_stubJarFilePresenter = new FilePresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_stubJarFilePresenter.setShowBrowseButton(false);
- m_stubJarFilePresenter.setLabel(Texts.get("StubJar"));
- m_stubJarFilePresenter.setBundle(m_bundle);
- m_stubJarFilePresenter.setMarkerType(MarkerType.StubJar);
- m_stubJarFilePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- applyLayoutData(m_stubJarFilePresenter);
-
- // wsdl folder
- m_wsdlFolderPresenter = new WsdlFolderPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit(), WebserviceEnum.Provider);
- m_wsdlFolderPresenter.setLabel(Texts.get("WsdlFolder"));
- m_wsdlFolderPresenter.setBundle(m_bundle);
- m_wsdlFolderPresenter.setMarkerType(MarkerType.WsdlFolder);
- m_wsdlFolderPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- applyLayoutData(m_wsdlFolderPresenter);
-
- // wsdl file
- m_wsdlFilePresenter = new WsdlFilePresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
- m_wsdlFilePresenter.setLabel(Texts.get("WsdlFile"));
- m_wsdlFilePresenter.setBundle(m_bundle);
- m_wsdlFilePresenter.setMarkerType(MarkerType.Wsdl);
- m_wsdlFilePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
- applyLayoutData(m_wsdlFilePresenter);
-
- updatePresenterValues();
- }
- finally {
- getForm().setRedraw(true);
- }
- }
-
- private void updatePresenterValues() {
- createQuickLinkPresenters();
- createQuickLinkPresentersForReferencedFiles();
-
- SunJaxWsBean sunJaxWsBean = getPage().getSunJaxWsBean();
- BuildJaxWsBean buildJaxWsBean = getPage().getBuildJaxWsBean();
- Definition wsdlDefinition = getPage().getWsdlDefinition();
-
- String serviceName = null;
- String serviceTooltip = null;
- String portName = null;
- String portTooltip = null;
- String bindingName = null;
- String bindingTooltip = null;
- String portTypeName = null;
- String portTypeTooltip = null;
- String urlPattern = null;
- IFile stubJarFile = null;
-
- if (sunJaxWsBean != null) {
- urlPattern = sunJaxWsBean.getUrlPattern();
-
- QName serviceQName = sunJaxWsBean.getServiceQNameSafe();
- if (serviceQName != null) {
- serviceName = serviceQName.getLocalPart();
- serviceTooltip = serviceQName.toString();
- }
- QName portTypeQName = sunJaxWsBean.getPortQNameSafe();
- if (portTypeQName != null) {
- portName = portTypeQName.getLocalPart();
- portTooltip = portTypeQName.toString();
- }
-
- if (wsdlDefinition != null) {
- PortType portType = JaxWsSdkUtility.getPortType(wsdlDefinition, sunJaxWsBean.getServiceQNameSafe(), sunJaxWsBean.getPort());
- if (portType != null) {
- portTypeName = portType.getQName().getLocalPart();
- portTypeTooltip = portType.getQName().toString();
- }
-
- Binding binding = JaxWsSdkUtility.getBinding(wsdlDefinition, sunJaxWsBean.getServiceQNameSafe(), sunJaxWsBean.getPort());
- if (binding != null) {
- bindingName = binding.getQName().getLocalPart();
- bindingTooltip = binding.getQName().toString();
- }
- }
- }
-
- if (buildJaxWsBean != null) {
- String wsdlFileName = null;
- if (sunJaxWsBean != null) {
- wsdlFileName = sunJaxWsBean.getWsdl();
- }
- stubJarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, buildJaxWsBean, wsdlFileName);
- }
-
- m_targetNamespacePresenter.setInput(wsdlDefinition != null ? wsdlDefinition.getTargetNamespace() : null);
- m_targetNamespacePresenter.setTooltip(m_targetNamespacePresenter.getValue());
- m_servicePresenter.setInput(serviceName);
- m_servicePresenter.setTooltip(serviceTooltip);
- m_portPresenter.setInput(portName);
- m_portPresenter.setTooltip(portTooltip);
- m_bindingPresenter.setInput(bindingName);
- m_bindingPresenter.setTooltip(bindingTooltip);
- m_portTypePresenter.setInput(portTypeName);
- m_portTypePresenter.setTooltip(portTypeTooltip);
- m_urlPatternPresenter.setInput(urlPattern);
- m_urlPatternPresenter.setSunJaxWsBean(sunJaxWsBean);
- String servletRegistrationBundleName = ServletRegistrationUtility.getBuildJaxServletRegistrationBundleName(m_bundle);
- if (servletRegistrationBundleName != null) {
- m_urlPatternPresenter.setTooltip(Texts.get("JaxWsServletRegistrationInBundleX", servletRegistrationBundleName));
- }
- else {
- m_urlPatternPresenter.setTooltip(null);
- }
- // WSDL folder
- IFile wsdlFile = getPage().getWsdlResource().getFile();
- if (wsdlFile != null) {
- IPath wsdlFolderPath = wsdlFile.getProjectRelativePath().removeLastSegments(1);
- IFolder folder = JaxWsSdkUtility.getFolder(m_bundle, wsdlFolderPath.toPortableString(), false);
- if (folder == null) {
- folder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false);
- }
- m_wsdlFolderPresenter.setInput(folder);
- m_wsdlFilePresenter.setFileDirectory(folder.getProjectRelativePath().toPortableString());
- }
- m_wsdlFolderPresenter.setBuildJaxWsBean(buildJaxWsBean);
- m_wsdlFolderPresenter.setSunJaxWsBean(sunJaxWsBean);
-
- // WSDL file
- m_wsdlFilePresenter.setInput(wsdlFile);
- m_wsdlFilePresenter.setBuildJaxWsBean(buildJaxWsBean);
- m_wsdlFilePresenter.setSunJaxWsBean(sunJaxWsBean);
-
- m_stubJarFilePresenter.setInput(stubJarFile);
- m_stubFolderPresenter.setInput(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.STUB_FOLDER, false));
-
- IType portType = getPage().getPortType();
- if (portType != null) {
- IAnnotation scoutWebServiceAnnotation = JaxWsSdkUtility.getAnnotation(portType, TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getFullyQualifiedName(), false);
- getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).setVisible(TypeUtility.exists(scoutWebServiceAnnotation));
- if (TypeUtility.exists(scoutWebServiceAnnotation)) {
- AnnotationProperty propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(portType, scoutWebServiceAnnotation, JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
- m_sessionFactoryPresenter.setInput(propertyValue.getFullyQualifiedName());
- m_sessionFactoryPresenter.setDeclaringType(portType);
- m_sessionFactoryPresenter.setResetLinkVisible(!propertyValue.isInherited());
- m_sessionFactoryPresenter.setBoldLabelText(!propertyValue.isInherited());
-
- propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(portType, scoutWebServiceAnnotation, JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER);
- m_authenticationHandlerPresenter.setInput(propertyValue.getFullyQualifiedName());
- m_authenticationHandlerPresenter.setDeclaringType(portType);
- m_authenticationHandlerPresenter.setResetLinkVisible(!propertyValue.isInherited());
- m_authenticationHandlerPresenter.setBoldLabelText(!propertyValue.isInherited());
-
- propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(portType, scoutWebServiceAnnotation, JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY);
- m_credentialValidationStrategyPresenter.setInput(propertyValue.getFullyQualifiedName());
- m_credentialValidationStrategyPresenter.setDeclaringType(portType);
- m_credentialValidationStrategyPresenter.setResetLinkVisible(!propertyValue.isInherited());
- m_credentialValidationStrategyPresenter.setBoldLabelText(!propertyValue.isInherited());
- }
- }
-
- createBindingFilePresenters(buildJaxWsBean);
- validateRebuildStubPresenter();
-
- getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
-
- controlView();
- }
-
- private void createQuickLinkPresenters() {
- getForm().setRedraw(false);
-
- try {
- JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS).getSectionClient());
-
- createQuickLinkForTypesPresenters();
-
- SeparatorPresenter separatorPresenter = new SeparatorPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), getFormToolkit());
- applyLayoutData(separatorPresenter);
-
- // QuickLink 'Open sun-jaxws.xml'
- FileOpenAction a = new FileOpenAction();
- a.init(ResourceFactory.getSunJaxWsResource(m_bundle).getFile(), ResourceFactory.getSunJaxWsResource(m_bundle).getFile().getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.SunJaxWsXmlFile), FileExtensionType.Xml);
- a.setToolTip(Texts.get("JaxWsDeploymentDescriptor"));
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
- applyLayoutData(actionPresenter);
-
- // QuickLink 'Open build-jaxws.xml'
- FileOpenAction b = new FileOpenAction();
- b.init(ResourceFactory.getBuildJaxWsResource(m_bundle).getFile(), ResourceFactory.getBuildJaxWsResource(m_bundle).getFile().getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.BuildJaxWsXmlFile), FileExtensionType.Xml);
- actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), b, getFormToolkit());
- b.setToolTip(Texts.get("JaxWsBuildDescriptor"));
- applyLayoutData(actionPresenter);
-
- if (getPage().getBuildJaxWsBean() == null) {
- return;
- }
-
- // QuickLink 'Open WSDL file'
- IFile wsdlFile = getPage().getWsdlResource().getFile();
- if (wsdlFile != null) {
- FileOpenAction c = new FileOpenAction();
- c.init(wsdlFile, wsdlFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), FileExtensionType.Auto);
- c.setToolTip("Web Services Description Language");
- actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), c, getFormToolkit());
- actionPresenter.setEnabled(wsdlFile.exists());
- applyLayoutData(actionPresenter);
- }
- }
- finally {
- getForm().setRedraw(true);
- getSection(SECTION_ID_LINKS).setVisible(getSection(SECTION_ID_LINKS).getSectionClient().getChildren().length > 0);
- JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS));
- }
- }
-
- private void createQuickLinkPresentersForReferencedFiles() {
- getForm().setRedraw(false);
- try {
- JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS_REF_WSDLS).getSectionClient());
- JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).getSectionClient());
- JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).getSectionClient());
-
- WsdlResource wsdlResource = getPage().getWsdlResource();
- Artefact[] artefacts = SchemaUtility.getArtefacts(wsdlResource.getFile(), false);
-
- for (Artefact artefact : artefacts) {
- // referenced WSDL definitions
- if (artefact instanceof WsdlArtefact) {
- WsdlArtefact wsdlArtefact = (WsdlArtefact) artefact;
- if (wsdlArtefact.getTypeEnum() == TypeEnum.ReferencedWsdl) {
- IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, wsdlArtefact.getFile());
- FileOpenAction action = new FileOpenAction();
- action.init(referencedWsdlFile, referencedWsdlFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), FileExtensionType.Auto);
-
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS_REF_WSDLS).getSectionClient(), action, getFormToolkit());
- actionPresenter.setEnabled(referencedWsdlFile.exists());
- applyLayoutData(actionPresenter);
- }
- }
- // imported XSD schemas
- if (artefact instanceof SchemaImportArtefact) {
- SchemaImportArtefact schemaArtefact = (SchemaImportArtefact) artefact;
- IFile importedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
-
- FileOpenAction b = new FileOpenAction();
- b.init(importedSchemaFile, importedSchemaFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), FileExtensionType.Auto);
- b.setToolTip("namespace: " + StringUtility.nvl(schemaArtefact.getNamespaceUri(), "?"));
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).getSectionClient(), b, getFormToolkit());
- actionPresenter.setEnabled(importedSchemaFile.exists());
- applyLayoutData(actionPresenter);
- }
-
- // included XSD schemas
- if (artefact instanceof SchemaIncludeArtefact) {
- SchemaIncludeArtefact schemaArtefact = (SchemaIncludeArtefact) artefact;
- IFile includedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
-
- FileOpenAction b = new FileOpenAction();
- b.init(includedSchemaFile, includedSchemaFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), FileExtensionType.Auto);
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).getSectionClient(), b, getFormToolkit());
- actionPresenter.setEnabled(includedSchemaFile.exists());
- applyLayoutData(actionPresenter);
- }
- }
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- }
- finally {
- getForm().setRedraw(true);
-
- getSection(SECTION_ID_LINKS_REF_WSDLS).setVisible(getSection(SECTION_ID_LINKS_REF_WSDLS).getSectionClient().getChildren().length > 0);
- JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS_REF_WSDLS));
-
- getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).setVisible(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).getSectionClient().getChildren().length > 0);
- JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS));
-
- getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).setVisible(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).getSectionClient().getChildren().length > 0);
- JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS));
- }
- }
-
- private void createQuickLinkForTypesPresenters() {
- SunJaxWsBean sunJaxWsBean = getPage().getSunJaxWsBean();
-
- if (sunJaxWsBean == null || sunJaxWsBean.getImplementation() == null) {
- return;
- }
-
- String fqn = sunJaxWsBean.getImplementation();
- if (!TypeUtility.existsType(fqn)) {
- return;
- }
- IType wsProviderImplType = TypeUtility.getType(fqn);
-
- // QuickLink 'Open PortType'
- TypeOpenAction a = new TypeOpenAction();
- a.init(wsProviderImplType);
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
- applyLayoutData(actionPresenter);
-
- // QuickLink 'Open PortType Interface'
- createQuickLinkForPortTypeInterfaceType();
- }
-
- private void createQuickLinkForPortTypeInterfaceType() {
- BuildJaxWsBean buildJaxWsBean = getPage().getBuildJaxWsBean();
- SunJaxWsBean sunJaxWsBean = getPage().getSunJaxWsBean();
- if (sunJaxWsBean == null) {
- return;
- }
- PortType portType = JaxWsSdkUtility.getPortType(getPage().getWsdlDefinition(), sunJaxWsBean.getServiceQNameSafe(), sunJaxWsBean.getPort());
- if (portType == null || portType.getQName() == null) {
- return;
- }
- IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, buildJaxWsBean, sunJaxWsBean.getWsdl());
- if (stubJarFile == null) {
- return;
- }
- IType portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(portType.getQName(), stubJarFile);
- if (!TypeUtility.exists(portTypeInterfaceType)) {
- return;
- }
-
- TypeOpenAction action = new TypeOpenAction();
- action.init(portTypeInterfaceType);
- action.setToolTip(Texts.get("JaxWsPortTypeInterface"));
- ActionPresenter presenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), action, getFormToolkit());
- applyLayoutData(presenter);
- }
-
- private void createBindingFilePresenters(BuildJaxWsBean buildJaxWsBean) {
- getForm().setRedraw(false);
- try {
- m_bindingFilePresenters.clear();
- JaxWsSdkUtility.disposeChildControls(m_bindingFilesComposite);
- GridLayout layout = new GridLayout(1, false);
- layout.marginWidth = 0;
- layout.marginHeight = 5;
- m_bindingFilesComposite.setLayout(layout);
-
- if (buildJaxWsBean == null) {
- return;
- }
-
- IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(m_bundle, buildJaxWsBean.getPropertiers());
- for (int index = 0; index < bindingFiles.length; index++) {
- BindingFilePresenter filePresenter = new BindingFilePresenter(m_bindingFilesComposite, getFormToolkit());
- filePresenter.setBundle(m_bundle);
- filePresenter.setMarkerGroupUUID(JaxWsSdkUtility.toMarkerGroupUUID(getPage().getMarkerGroupUUID(), index));
- filePresenter.setInput(bindingFiles[index]);
- filePresenter.setBuildJaxWsBean(buildJaxWsBean);
- applyLayoutData(filePresenter);
-
- m_bindingFilePresenters.add(filePresenter);
- }
- }
- finally {
- getForm().setRedraw(true);
- JaxWsSdkUtility.doLayout(m_bindingFilesComposite);
- JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_STUB_PROPERTIES));
- }
- }
-
- private void applyLayoutData(AbstractPresenter presenter) {
- GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- presenter.getContainer().setLayoutData(layoutData);
- }
-
- private ISearchJavaSearchScopeFactory createSubClassesSearchScopeFactory(final IType superType) {
- return new ISearchJavaSearchScopeFactory() {
-
- @Override
- public IJavaSearchScope create() {
- // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
- IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
- return SearchEngine.createJavaSearchScope(subTypes);
- }
- };
- }
-
- private void validateRebuildStubPresenter() {
- boolean valid = (getPage().getBuildJaxWsBean() != null &&
- getPage().getSunJaxWsBean() != null &&
- !MarkerUtility.containsMarker(m_bundle, MarkerType.Wsdl, getPage().getMarkerGroupUUID(), IMarker.SEVERITY_ERROR));
- m_rebuildStubPresenter.setEnabled(valid);
-
- if (valid) {
- StubRebuildAction action = new StubRebuildAction();
- action.init(m_bundle, getPage().getBuildJaxWsBean(), getPage().getWsdlResource(), getPage().getMarkerGroupUUID(), WebserviceEnum.Provider);
- m_rebuildStubPresenter.setAction(action);
- }
- }
-
- private void controlView() {
- // enable / disable credential validation strategy presenter
- m_credentialValidationStrategyPresenter.setEnabled(JaxWsSdkUtility.isProviderAuthenticationSet(m_authenticationHandlerPresenter.getValue()));
- }
-
- private final class P_PresenterListener implements IPresenterValueChangedListener {
-
- @Override
- public void propertyChanged(int presenterId, Object value) {
- switch (presenterId) {
- case PRESENTER_ID_SESSION_FACTORY:
- case PRESENTER_ID_AUTHENTICATION_HANDLER:
- case PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY: {
- IType portType = getPage().getPortType();
- if (TypeUtility.exists(portType)) {
- String factoryFullyQualifiedName = (String) value;
- if (!TypeUtility.existsType(factoryFullyQualifiedName)) {
- return;
- }
- IType factoryType = TypeUtility.getType(factoryFullyQualifiedName);
- AnnotationUpdateOperation op = new AnnotationUpdateOperation();
- op.setDeclaringType(portType);
- op.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
- switch (presenterId) {
- case PRESENTER_ID_SESSION_FACTORY:
- op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, factoryType);
- break;
- case PRESENTER_ID_AUTHENTICATION_HANDLER:
- op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER, factoryType);
- if (!JaxWsSdkUtility.isProviderAuthenticationSet(factoryFullyQualifiedName)) {
- op.removeProperty(JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY);
- }
- break;
- case PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY:
- op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY, factoryType);
- break;
- }
- new OperationJob(op).schedule();
- }
- break;
- }
- }
- }
- }
-
- private class P_ScoutSeverityListener implements IScoutSeverityListener {
-
- @Override
- public void severityChanged(IResource resource) {
- boolean accept = false;
- if (resource == ResourceFactory.getSunJaxWsResource(m_bundle).getFile()) {
- accept = true;
- }
- if (!accept && resource == ResourceFactory.getBuildJaxWsResource(m_bundle).getFile()) {
- accept = true;
- }
- if (!accept && resource == getPage().getWsdlResource().getFile()) {
- accept = true;
- }
- if (!accept && getPage().getPortType() != null && resource == getPage().getPortType().getResource()) {
- accept = true;
- }
- if (!accept) {
- for (XmlResource bindingFileResource : getPage().getBindingFileResources()) {
- if (resource == bindingFileResource) {
- accept = true;
- break;
- }
- }
- }
- if (!accept) {
- return;
- }
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (getPage().isPageUnloaded() || getForm().isDisposed()) {
- return;
- }
- getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
-
- if (MarkerUtility.containsMarker(m_bundle, MarkerType.MissingBuildJaxWsEntry, getPage().getMarkerGroupUUID(), IMarker.SEVERITY_ERROR)) {
- return;
- }
-
- // update marker status of presenters (quality)
- m_targetNamespacePresenter.updateInfo();
- m_servicePresenter.updateInfo();
- m_portPresenter.updateInfo();
- m_bindingPresenter.updateInfo();
- m_portTypePresenter.updateInfo();
- m_urlPatternPresenter.updateInfo();
- m_wsdlFilePresenter.updateInfo();
- m_wsdlFolderPresenter.updateInfo();
- m_sessionFactoryPresenter.updateInfo();
- m_authenticationHandlerPresenter.updateInfo();
- m_credentialValidationStrategyPresenter.updateInfo();
- m_stubJarFilePresenter.updateInfo();
- m_stubFolderPresenter.updateInfo();
-
- for (BindingFilePresenter presenter : m_bindingFilePresenters) {
- presenter.updateInfo();
- }
-
- validateRebuildStubPresenter();
- controlView();
- }
- });
- }
- }
-
- private class P_PageLoadedListener implements IPageLoadedListener {
-
- @Override
- public void pageLoaded() {
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (getPage().isPageUnloaded() || getForm().isDisposed()) {
- return;
- }
- if (MarkerUtility.containsMarker(m_bundle, MarkerType.MissingBuildJaxWsEntry, getPage().getMarkerGroupUUID(), IMarker.SEVERITY_ERROR)) {
- return;
- }
- updatePresenterValues();
- }
- });
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.util.IScoutSeverityListener;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
+import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.BindingFileNewAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.BuildPropertiesEditAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction.FileExtensionType;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.RepairAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.StubRebuildAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.TypeOpenAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.AnnotationPropertyTypePresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.BindingFilePresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.FilePresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.FolderPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.SeparatorPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.StringPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.TypePresenter.ISearchJavaSearchScopeFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.UrlPatternPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.WsdlFilePresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.WsdlFolderPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.Artefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaImportArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaIncludeArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPageLoadedListener;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPresenterValueChangedListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+public class WebServiceProviderNodePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+
+ public static final String SECTION_ID_REPAIR = "section.jaxws.repair";
+ public static final String SECTION_ID_PROPERTIES = "section.jaxws.properties";
+ public static final String SECTION_ID_STUB_PROPERTIES = "section.jaxws.build";
+ public static final String SECTION_ID_LINKS = "section.jaxws.links";
+ public static final String SECTION_ID_LINKS_REF_WSDLS = "section.jaxws.links.ref.wsdl";
+ public static final String SECTION_ID_LINKS_INCLUDED_SCHEMAS = "section.jaxws.links.included.schema";
+ public static final String SECTION_ID_LINKS_IMPORTED_SCHEMAS = "section.jaxws.links.imported.schema";
+ public static final String SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION = "section.scoutWebServiceAnnotation";
+
+ public static final int PRESENTER_ID_SESSION_FACTORY = 1 << 1;
+ public static final int PRESENTER_ID_AUTHENTICATION_HANDLER = 1 << 2;
+ public static final int PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY = 1 << 3;
+
+ private IPresenterValueChangedListener m_presenterListener;
+
+ private StringPresenter m_targetNamespacePresenter;
+ private StringPresenter m_servicePresenter;
+ private StringPresenter m_portPresenter;
+ private StringPresenter m_bindingPresenter;
+ private StringPresenter m_portTypePresenter;
+ private UrlPatternPresenter m_urlPatternPresenter;
+ private FolderPresenter m_stubFolderPresenter;
+ private FilePresenter m_stubJarFilePresenter;
+ private WsdlFolderPresenter m_wsdlFolderPresenter;
+ private WsdlFilePresenter m_wsdlFilePresenter;
+
+ private Composite m_bindingFilesComposite;
+
+ private P_ScoutSeverityListener m_severityListener;
+ private IPageLoadedListener m_pageLoadedListener;
+
+ private AnnotationPropertyTypePresenter m_sessionFactoryPresenter;
+ private AnnotationPropertyTypePresenter m_authenticationHandlerPresenter;
+ private AnnotationPropertyTypePresenter m_credentialValidationStrategyPresenter;
+ private List<BindingFilePresenter> m_bindingFilePresenters;
+ private ActionPresenter m_rebuildStubPresenter;
+
+ private IScoutBundle m_bundle;
+
+ @Override
+ protected void init() {
+ m_bundle = getPage().getScoutResource();
+ m_presenterListener = new P_PresenterListener();
+ m_severityListener = new P_ScoutSeverityListener();
+ m_pageLoadedListener = new P_PageLoadedListener();
+ ScoutSeverityManager.getInstance().addQualityManagerListener(m_severityListener);
+ getPage().addPageLoadedListener(m_pageLoadedListener);
+ m_bindingFilePresenters = new LinkedList<BindingFilePresenter>();
+ }
+
+ @Override
+ protected void cleanup() {
+ ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
+ getPage().removePageLoadedListener(m_pageLoadedListener);
+ }
+
+ @Override
+ public WebServiceProviderNodePage getPage() {
+ return (WebServiceProviderNodePage) super.getPage();
+ }
+
+ @Override
+ protected void createSections() {
+ getForm().setRedraw(true);
+ try {
+ /*
+ * repair section
+ */
+ createSection(SECTION_ID_REPAIR, Texts.get("RepairRequired"), Texts.get("SectionRepairDescription"), false);
+ getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
+ RepairAction a = new RepairAction();
+ a.init(getPage().getMarkerGroupUUID(), m_bundle);
+ AbstractPresenter presenter = new ActionPresenter(getSection(SECTION_ID_REPAIR).getSectionClient(), a, getFormToolkit());
+ applyLayoutData(presenter);
+
+ /*
+ * link section
+ */
+ createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
+ createQuickLinkPresenters();
+
+ /*
+ * link section (referenced WSDL definitions)
+ */
+ createSection(SECTION_ID_LINKS_REF_WSDLS, Texts.get("ReferencedWsdlDefintions"));
+ getSection(SECTION_ID_LINKS_REF_WSDLS).setExpanded(false);
+
+ /*
+ * link section (imported XSD schemas)
+ */
+ createSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS, Texts.get("ImportedXsdSchemas"));
+ getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).setExpanded(false);
+
+ /*
+ * link section (included XSD schemas)
+ */
+ createSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS, Texts.get("IncludedXsdSchemas"));
+ getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).setExpanded(false);
+
+ createQuickLinkPresentersForReferencedFiles();
+
+ if (getPage().getBuildJaxWsBean() == null) {
+ return;
+ }
+
+ /*
+ * stub properties section
+ */
+ createSection(SECTION_ID_STUB_PROPERTIES, Texts.get("StubProperties"));
+
+ StubRebuildAction b = new StubRebuildAction();
+ b.init(m_bundle, getPage().getBuildJaxWsBean(), getPage().getWsdlResource(), getPage().getMarkerGroupUUID(), WebserviceEnum.Provider);
+ m_rebuildStubPresenter = new ActionPresenter(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), b, getFormToolkit());
+ applyLayoutData(m_rebuildStubPresenter);
+
+ // edit build properties
+ BuildPropertiesEditAction c = new BuildPropertiesEditAction();
+ c.init(m_bundle, getPage().getBuildJaxWsBean());
+ presenter = new ActionPresenter(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), c, getFormToolkit());
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.horizontalAlignment = SWT.RIGHT;
+ presenter.getContainer().setLayoutData(gd);
+
+ // add binding file
+ BindingFileNewAction d = new BindingFileNewAction();
+ d.init(m_bundle, getPage().getBuildJaxWsBean(), getPage().getWsdlResource());
+ presenter = new ActionPresenter(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), d, getFormToolkit());
+ presenter.setEnabled(getPage().getBuildJaxWsBean() != null);
+ gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.horizontalAlignment = SWT.RIGHT;
+ presenter.getContainer().setLayoutData(gd);
+
+ // binding files composite
+ m_bindingFilesComposite = new Composite(getSection(SECTION_ID_STUB_PROPERTIES).getSectionClient(), SWT.NONE);
+ gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.verticalIndent = 5;
+ m_bindingFilesComposite.setLayoutData(gd);
+
+ /*
+ * Scout webservice annotation section
+ */
+ createSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION, Texts.get("AuthenticationAndSessionContext"), null, true);
+ getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).setExpanded(false);
+
+ // Scout authentication mechanism
+ m_authenticationHandlerPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).getSectionClient(), getFormToolkit());
+ m_authenticationHandlerPresenter.setPresenterId(PRESENTER_ID_AUTHENTICATION_HANDLER);
+ m_authenticationHandlerPresenter.setLabel(Texts.get("Authentication"));
+ m_authenticationHandlerPresenter.setAcceptNullValue(true);
+ m_authenticationHandlerPresenter.setBundle(m_bundle);
+ m_authenticationHandlerPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
+ m_authenticationHandlerPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER);
+ m_authenticationHandlerPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
+ m_authenticationHandlerPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ m_authenticationHandlerPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider)));
+ m_authenticationHandlerPresenter.setAllowChangeOfInterfaceType(true);
+ m_authenticationHandlerPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider)});
+ m_authenticationHandlerPresenter.addValueChangedListener(m_presenterListener);
+ m_authenticationHandlerPresenter.getContainer().setLayoutData(new GridData());
+ applyLayoutData(m_authenticationHandlerPresenter);
+
+ // Scout credential validation strategy
+ m_credentialValidationStrategyPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).getSectionClient(), getFormToolkit());
+ m_credentialValidationStrategyPresenter.setPresenterId(PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY);
+ m_credentialValidationStrategyPresenter.setLabel(Texts.get("CredentialValidation"));
+ m_credentialValidationStrategyPresenter.setAcceptNullValue(true);
+ m_credentialValidationStrategyPresenter.setBundle(m_bundle);
+ m_credentialValidationStrategyPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
+ m_credentialValidationStrategyPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY);
+ m_credentialValidationStrategyPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
+ m_credentialValidationStrategyPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ m_credentialValidationStrategyPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy)));
+ m_credentialValidationStrategyPresenter.setAllowChangeOfInterfaceType(true);
+ m_credentialValidationStrategyPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy)});
+ m_credentialValidationStrategyPresenter.addValueChangedListener(m_presenterListener);
+ m_credentialValidationStrategyPresenter.getContainer().setLayoutData(new GridData());
+ applyLayoutData(m_credentialValidationStrategyPresenter);
+
+ // Scout session factory
+ m_sessionFactoryPresenter = new AnnotationPropertyTypePresenter(getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).getSectionClient(), getFormToolkit());
+ m_sessionFactoryPresenter.setPresenterId(PRESENTER_ID_SESSION_FACTORY);
+ m_sessionFactoryPresenter.setLabel(Texts.get("Session"));
+ m_sessionFactoryPresenter.setAcceptNullValue(true);
+ m_sessionFactoryPresenter.setBundle(m_bundle);
+ m_sessionFactoryPresenter.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
+ m_sessionFactoryPresenter.setProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
+ m_sessionFactoryPresenter.setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
+ m_sessionFactoryPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ m_sessionFactoryPresenter.setSearchScopeFactory(createSubClassesSearchScopeFactory(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)));
+ m_sessionFactoryPresenter.setAllowChangeOfInterfaceType(true);
+ m_sessionFactoryPresenter.setInterfaceTypes(new IType[]{TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory)});
+ m_sessionFactoryPresenter.addValueChangedListener(m_presenterListener);
+ m_sessionFactoryPresenter.getContainer().setLayoutData(new GridData());
+ applyLayoutData(m_sessionFactoryPresenter);
+
+ /*
+ * properties section
+ */
+ createSection(SECTION_ID_PROPERTIES, Texts.get("WebserviceProperties"));
+ getSection(SECTION_ID_PROPERTIES).setExpanded(true);
+
+ // service
+ m_servicePresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_servicePresenter.setLabel(Texts.get("Service"));
+ m_servicePresenter.setBundle(m_bundle);
+ m_servicePresenter.setMarkerType(MarkerType.Service);
+ m_servicePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ m_servicePresenter.setEditable(false);
+ applyLayoutData(m_servicePresenter);
+
+ // port
+ m_portPresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_portPresenter.setLabel(Texts.get("Port"));
+ m_portPresenter.setBundle(m_bundle);
+ m_portPresenter.setMarkerType(MarkerType.Port);
+ m_portPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ m_portPresenter.setEditable(false);
+ applyLayoutData(m_portPresenter);
+
+ // port type
+ m_portTypePresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_portTypePresenter.setLabel(Texts.get("PortType"));
+ m_portTypePresenter.setBundle(m_bundle);
+ m_portTypePresenter.setMarkerType(MarkerType.PortType);
+ m_portTypePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ m_portTypePresenter.setEditable(false);
+ applyLayoutData(m_portTypePresenter);
+
+ // binding
+ m_bindingPresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_bindingPresenter.setLabel(Texts.get("Binding"));
+ m_bindingPresenter.setEditable(false);
+ applyLayoutData(m_bindingPresenter);
+
+ // URL pattern
+ m_urlPatternPresenter = new UrlPatternPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_urlPatternPresenter.setLabel(Texts.get("UrlPattern"));
+ m_urlPatternPresenter.setBundle(m_bundle);
+ m_urlPatternPresenter.setMarkerType(MarkerType.UrlPattern);
+ m_urlPatternPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ applyLayoutData(m_urlPatternPresenter);
+
+ // target namespace
+ m_targetNamespacePresenter = new StringPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_targetNamespacePresenter.setLabel(Texts.get("TargetNamespace"));
+ m_targetNamespacePresenter.setBundle(m_bundle);
+ m_targetNamespacePresenter.setMarkerType(MarkerType.TargetNamespace);
+ m_targetNamespacePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ m_targetNamespacePresenter.setEditable(false);
+ applyLayoutData(m_targetNamespacePresenter);
+
+ // stub folder
+ m_stubFolderPresenter = new FolderPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_stubFolderPresenter.setShowBrowseButton(false);
+ m_stubFolderPresenter.setLabel(Texts.get("StubFolder"));
+ m_stubFolderPresenter.setBundle(m_bundle);
+ m_stubFolderPresenter.setMarkerType(MarkerType.StubFolder);
+ m_stubFolderPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ applyLayoutData(m_stubFolderPresenter);
+
+ // stub jar
+ m_stubJarFilePresenter = new FilePresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_stubJarFilePresenter.setShowBrowseButton(false);
+ m_stubJarFilePresenter.setLabel(Texts.get("StubJar"));
+ m_stubJarFilePresenter.setBundle(m_bundle);
+ m_stubJarFilePresenter.setMarkerType(MarkerType.StubJar);
+ m_stubJarFilePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ applyLayoutData(m_stubJarFilePresenter);
+
+ // wsdl folder
+ m_wsdlFolderPresenter = new WsdlFolderPresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit(), WebserviceEnum.Provider);
+ m_wsdlFolderPresenter.setLabel(Texts.get("WsdlFolder"));
+ m_wsdlFolderPresenter.setBundle(m_bundle);
+ m_wsdlFolderPresenter.setMarkerType(MarkerType.WsdlFolder);
+ m_wsdlFolderPresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ applyLayoutData(m_wsdlFolderPresenter);
+
+ // wsdl file
+ m_wsdlFilePresenter = new WsdlFilePresenter(getSection(SECTION_ID_PROPERTIES).getSectionClient(), getFormToolkit());
+ m_wsdlFilePresenter.setLabel(Texts.get("WsdlFile"));
+ m_wsdlFilePresenter.setBundle(m_bundle);
+ m_wsdlFilePresenter.setMarkerType(MarkerType.Wsdl);
+ m_wsdlFilePresenter.setMarkerGroupUUID(getPage().getMarkerGroupUUID());
+ applyLayoutData(m_wsdlFilePresenter);
+
+ updatePresenterValues();
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ }
+
+ private void updatePresenterValues() {
+ createQuickLinkPresenters();
+ createQuickLinkPresentersForReferencedFiles();
+
+ SunJaxWsBean sunJaxWsBean = getPage().getSunJaxWsBean();
+ BuildJaxWsBean buildJaxWsBean = getPage().getBuildJaxWsBean();
+ Definition wsdlDefinition = getPage().getWsdlDefinition();
+
+ String serviceName = null;
+ String serviceTooltip = null;
+ String portName = null;
+ String portTooltip = null;
+ String bindingName = null;
+ String bindingTooltip = null;
+ String portTypeName = null;
+ String portTypeTooltip = null;
+ String urlPattern = null;
+ IFile stubJarFile = null;
+
+ if (sunJaxWsBean != null) {
+ urlPattern = sunJaxWsBean.getUrlPattern();
+
+ QName serviceQName = sunJaxWsBean.getServiceQNameSafe();
+ if (serviceQName != null) {
+ serviceName = serviceQName.getLocalPart();
+ serviceTooltip = serviceQName.toString();
+ }
+ QName portTypeQName = sunJaxWsBean.getPortQNameSafe();
+ if (portTypeQName != null) {
+ portName = portTypeQName.getLocalPart();
+ portTooltip = portTypeQName.toString();
+ }
+
+ if (wsdlDefinition != null) {
+ PortType portType = JaxWsSdkUtility.getPortType(wsdlDefinition, sunJaxWsBean.getServiceQNameSafe(), sunJaxWsBean.getPort());
+ if (portType != null) {
+ portTypeName = portType.getQName().getLocalPart();
+ portTypeTooltip = portType.getQName().toString();
+ }
+
+ Binding binding = JaxWsSdkUtility.getBinding(wsdlDefinition, sunJaxWsBean.getServiceQNameSafe(), sunJaxWsBean.getPort());
+ if (binding != null) {
+ bindingName = binding.getQName().getLocalPart();
+ bindingTooltip = binding.getQName().toString();
+ }
+ }
+ }
+
+ if (buildJaxWsBean != null) {
+ String wsdlFileName = null;
+ if (sunJaxWsBean != null) {
+ wsdlFileName = sunJaxWsBean.getWsdl();
+ }
+ stubJarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, buildJaxWsBean, wsdlFileName);
+ }
+
+ m_targetNamespacePresenter.setInput(wsdlDefinition != null ? wsdlDefinition.getTargetNamespace() : null);
+ m_targetNamespacePresenter.setTooltip(m_targetNamespacePresenter.getValue());
+ m_servicePresenter.setInput(serviceName);
+ m_servicePresenter.setTooltip(serviceTooltip);
+ m_portPresenter.setInput(portName);
+ m_portPresenter.setTooltip(portTooltip);
+ m_bindingPresenter.setInput(bindingName);
+ m_bindingPresenter.setTooltip(bindingTooltip);
+ m_portTypePresenter.setInput(portTypeName);
+ m_portTypePresenter.setTooltip(portTypeTooltip);
+ m_urlPatternPresenter.setInput(urlPattern);
+ m_urlPatternPresenter.setSunJaxWsBean(sunJaxWsBean);
+ String servletRegistrationBundleName = ServletRegistrationUtility.getBuildJaxServletRegistrationBundleName(m_bundle);
+ if (servletRegistrationBundleName != null) {
+ m_urlPatternPresenter.setTooltip(Texts.get("JaxWsServletRegistrationInBundleX", servletRegistrationBundleName));
+ }
+ else {
+ m_urlPatternPresenter.setTooltip(null);
+ }
+ // WSDL folder
+ IFile wsdlFile = getPage().getWsdlResource().getFile();
+ if (wsdlFile != null) {
+ IPath wsdlFolderPath = wsdlFile.getProjectRelativePath().removeLastSegments(1);
+ IFolder folder = JaxWsSdkUtility.getFolder(m_bundle, wsdlFolderPath.toPortableString(), false);
+ if (folder == null) {
+ folder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false);
+ }
+ m_wsdlFolderPresenter.setInput(folder);
+ m_wsdlFilePresenter.setFileDirectory(folder.getProjectRelativePath().toPortableString());
+ }
+ m_wsdlFolderPresenter.setBuildJaxWsBean(buildJaxWsBean);
+ m_wsdlFolderPresenter.setSunJaxWsBean(sunJaxWsBean);
+
+ // WSDL file
+ m_wsdlFilePresenter.setInput(wsdlFile);
+ m_wsdlFilePresenter.setBuildJaxWsBean(buildJaxWsBean);
+ m_wsdlFilePresenter.setSunJaxWsBean(sunJaxWsBean);
+
+ m_stubJarFilePresenter.setInput(stubJarFile);
+ m_stubFolderPresenter.setInput(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.STUB_FOLDER, false));
+
+ IType portType = getPage().getPortType();
+ if (portType != null) {
+ IAnnotation scoutWebServiceAnnotation = JaxWsSdkUtility.getAnnotation(portType, TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getFullyQualifiedName(), false);
+ getSection(SECTION_ID_SCOUT_WEB_SERVICE_ANNOTATION).setVisible(TypeUtility.exists(scoutWebServiceAnnotation));
+ if (TypeUtility.exists(scoutWebServiceAnnotation)) {
+ AnnotationProperty propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(portType, scoutWebServiceAnnotation, JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
+ m_sessionFactoryPresenter.setInput(propertyValue.getFullyQualifiedName());
+ m_sessionFactoryPresenter.setDeclaringType(portType);
+ m_sessionFactoryPresenter.setResetLinkVisible(!propertyValue.isInherited());
+ m_sessionFactoryPresenter.setBoldLabelText(!propertyValue.isInherited());
+
+ propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(portType, scoutWebServiceAnnotation, JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER);
+ m_authenticationHandlerPresenter.setInput(propertyValue.getFullyQualifiedName());
+ m_authenticationHandlerPresenter.setDeclaringType(portType);
+ m_authenticationHandlerPresenter.setResetLinkVisible(!propertyValue.isInherited());
+ m_authenticationHandlerPresenter.setBoldLabelText(!propertyValue.isInherited());
+
+ propertyValue = JaxWsSdkUtility.parseAnnotationTypeValue(portType, scoutWebServiceAnnotation, JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY);
+ m_credentialValidationStrategyPresenter.setInput(propertyValue.getFullyQualifiedName());
+ m_credentialValidationStrategyPresenter.setDeclaringType(portType);
+ m_credentialValidationStrategyPresenter.setResetLinkVisible(!propertyValue.isInherited());
+ m_credentialValidationStrategyPresenter.setBoldLabelText(!propertyValue.isInherited());
+ }
+ }
+
+ createBindingFilePresenters(buildJaxWsBean);
+ validateRebuildStubPresenter();
+
+ getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
+
+ controlView();
+ }
+
+ private void createQuickLinkPresenters() {
+ getForm().setRedraw(false);
+
+ try {
+ JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS).getSectionClient());
+
+ createQuickLinkForTypesPresenters();
+
+ SeparatorPresenter separatorPresenter = new SeparatorPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), getFormToolkit());
+ applyLayoutData(separatorPresenter);
+
+ // QuickLink 'Open sun-jaxws.xml'
+ FileOpenAction a = new FileOpenAction();
+ a.init(ResourceFactory.getSunJaxWsResource(m_bundle).getFile(), ResourceFactory.getSunJaxWsResource(m_bundle).getFile().getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.SunJaxWsXmlFile), FileExtensionType.Xml);
+ a.setToolTip(Texts.get("JaxWsDeploymentDescriptor"));
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
+ applyLayoutData(actionPresenter);
+
+ // QuickLink 'Open build-jaxws.xml'
+ FileOpenAction b = new FileOpenAction();
+ b.init(ResourceFactory.getBuildJaxWsResource(m_bundle).getFile(), ResourceFactory.getBuildJaxWsResource(m_bundle).getFile().getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.BuildJaxWsXmlFile), FileExtensionType.Xml);
+ actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), b, getFormToolkit());
+ b.setToolTip(Texts.get("JaxWsBuildDescriptor"));
+ applyLayoutData(actionPresenter);
+
+ if (getPage().getBuildJaxWsBean() == null) {
+ return;
+ }
+
+ // QuickLink 'Open WSDL file'
+ IFile wsdlFile = getPage().getWsdlResource().getFile();
+ if (wsdlFile != null) {
+ FileOpenAction c = new FileOpenAction();
+ c.init(wsdlFile, wsdlFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), FileExtensionType.Auto);
+ c.setToolTip("Web Services Description Language");
+ actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), c, getFormToolkit());
+ actionPresenter.setEnabled(wsdlFile.exists());
+ applyLayoutData(actionPresenter);
+ }
+ }
+ finally {
+ getForm().setRedraw(true);
+ getSection(SECTION_ID_LINKS).setVisible(getSection(SECTION_ID_LINKS).getSectionClient().getChildren().length > 0);
+ JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS));
+ }
+ }
+
+ private void createQuickLinkPresentersForReferencedFiles() {
+ getForm().setRedraw(false);
+ try {
+ JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS_REF_WSDLS).getSectionClient());
+ JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).getSectionClient());
+ JaxWsSdkUtility.disposeChildControls(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).getSectionClient());
+
+ WsdlResource wsdlResource = getPage().getWsdlResource();
+ Artefact[] artefacts = SchemaUtility.getArtefacts(wsdlResource.getFile(), false);
+
+ for (Artefact artefact : artefacts) {
+ // referenced WSDL definitions
+ if (artefact instanceof WsdlArtefact) {
+ WsdlArtefact wsdlArtefact = (WsdlArtefact) artefact;
+ if (wsdlArtefact.getTypeEnum() == TypeEnum.ReferencedWsdl) {
+ IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, wsdlArtefact.getFile());
+ FileOpenAction action = new FileOpenAction();
+ action.init(referencedWsdlFile, referencedWsdlFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), FileExtensionType.Auto);
+
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS_REF_WSDLS).getSectionClient(), action, getFormToolkit());
+ actionPresenter.setEnabled(referencedWsdlFile.exists());
+ applyLayoutData(actionPresenter);
+ }
+ }
+ // imported XSD schemas
+ if (artefact instanceof SchemaImportArtefact) {
+ SchemaImportArtefact schemaArtefact = (SchemaImportArtefact) artefact;
+ IFile importedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
+
+ FileOpenAction b = new FileOpenAction();
+ b.init(importedSchemaFile, importedSchemaFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), FileExtensionType.Auto);
+ b.setToolTip("namespace: " + StringUtility.nvl(schemaArtefact.getNamespaceUri(), "?"));
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).getSectionClient(), b, getFormToolkit());
+ actionPresenter.setEnabled(importedSchemaFile.exists());
+ applyLayoutData(actionPresenter);
+ }
+
+ // included XSD schemas
+ if (artefact instanceof SchemaIncludeArtefact) {
+ SchemaIncludeArtefact schemaArtefact = (SchemaIncludeArtefact) artefact;
+ IFile includedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
+
+ FileOpenAction b = new FileOpenAction();
+ b.init(includedSchemaFile, includedSchemaFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), FileExtensionType.Auto);
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).getSectionClient(), b, getFormToolkit());
+ actionPresenter.setEnabled(includedSchemaFile.exists());
+ applyLayoutData(actionPresenter);
+ }
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ }
+ finally {
+ getForm().setRedraw(true);
+
+ getSection(SECTION_ID_LINKS_REF_WSDLS).setVisible(getSection(SECTION_ID_LINKS_REF_WSDLS).getSectionClient().getChildren().length > 0);
+ JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS_REF_WSDLS));
+
+ getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).setVisible(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS).getSectionClient().getChildren().length > 0);
+ JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS_IMPORTED_SCHEMAS));
+
+ getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).setVisible(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS).getSectionClient().getChildren().length > 0);
+ JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_LINKS_INCLUDED_SCHEMAS));
+ }
+ }
+
+ private void createQuickLinkForTypesPresenters() {
+ SunJaxWsBean sunJaxWsBean = getPage().getSunJaxWsBean();
+
+ if (sunJaxWsBean == null || sunJaxWsBean.getImplementation() == null) {
+ return;
+ }
+
+ String fqn = sunJaxWsBean.getImplementation();
+ if (!TypeUtility.existsType(fqn)) {
+ return;
+ }
+ IType wsProviderImplType = TypeUtility.getType(fqn);
+
+ // QuickLink 'Open PortType'
+ TypeOpenAction a = new TypeOpenAction();
+ a.init(wsProviderImplType);
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
+ applyLayoutData(actionPresenter);
+
+ // QuickLink 'Open PortType Interface'
+ createQuickLinkForPortTypeInterfaceType();
+ }
+
+ private void createQuickLinkForPortTypeInterfaceType() {
+ BuildJaxWsBean buildJaxWsBean = getPage().getBuildJaxWsBean();
+ SunJaxWsBean sunJaxWsBean = getPage().getSunJaxWsBean();
+ if (sunJaxWsBean == null) {
+ return;
+ }
+ PortType portType = JaxWsSdkUtility.getPortType(getPage().getWsdlDefinition(), sunJaxWsBean.getServiceQNameSafe(), sunJaxWsBean.getPort());
+ if (portType == null || portType.getQName() == null) {
+ return;
+ }
+ IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, buildJaxWsBean, sunJaxWsBean.getWsdl());
+ if (stubJarFile == null) {
+ return;
+ }
+ IType portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(portType.getQName(), stubJarFile);
+ if (!TypeUtility.exists(portTypeInterfaceType)) {
+ return;
+ }
+
+ TypeOpenAction action = new TypeOpenAction();
+ action.init(portTypeInterfaceType);
+ action.setToolTip(Texts.get("JaxWsPortTypeInterface"));
+ ActionPresenter presenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), action, getFormToolkit());
+ applyLayoutData(presenter);
+ }
+
+ private void createBindingFilePresenters(BuildJaxWsBean buildJaxWsBean) {
+ getForm().setRedraw(false);
+ try {
+ m_bindingFilePresenters.clear();
+ JaxWsSdkUtility.disposeChildControls(m_bindingFilesComposite);
+ GridLayout layout = new GridLayout(1, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 5;
+ m_bindingFilesComposite.setLayout(layout);
+
+ if (buildJaxWsBean == null) {
+ return;
+ }
+
+ IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(m_bundle, buildJaxWsBean.getPropertiers());
+ for (int index = 0; index < bindingFiles.length; index++) {
+ BindingFilePresenter filePresenter = new BindingFilePresenter(m_bindingFilesComposite, getFormToolkit());
+ filePresenter.setBundle(m_bundle);
+ filePresenter.setMarkerGroupUUID(JaxWsSdkUtility.toMarkerGroupUUID(getPage().getMarkerGroupUUID(), index));
+ filePresenter.setInput(bindingFiles[index]);
+ filePresenter.setBuildJaxWsBean(buildJaxWsBean);
+ applyLayoutData(filePresenter);
+
+ m_bindingFilePresenters.add(filePresenter);
+ }
+ }
+ finally {
+ getForm().setRedraw(true);
+ JaxWsSdkUtility.doLayout(m_bindingFilesComposite);
+ JaxWsSdkUtility.doLayoutSection(getSection(SECTION_ID_STUB_PROPERTIES));
+ }
+ }
+
+ private void applyLayoutData(AbstractPresenter presenter) {
+ GridData layoutData = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+
+ private ISearchJavaSearchScopeFactory createSubClassesSearchScopeFactory(final IType superType) {
+ return new ISearchJavaSearchScopeFactory() {
+
+ @Override
+ public IJavaSearchScope create() {
+ // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
+ IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
+ return SearchEngine.createJavaSearchScope(subTypes);
+ }
+ };
+ }
+
+ private void validateRebuildStubPresenter() {
+ boolean valid = (getPage().getBuildJaxWsBean() != null &&
+ getPage().getSunJaxWsBean() != null &&
+ !MarkerUtility.containsMarker(m_bundle, MarkerType.Wsdl, getPage().getMarkerGroupUUID(), IMarker.SEVERITY_ERROR));
+ m_rebuildStubPresenter.setEnabled(valid);
+
+ if (valid) {
+ StubRebuildAction action = new StubRebuildAction();
+ action.init(m_bundle, getPage().getBuildJaxWsBean(), getPage().getWsdlResource(), getPage().getMarkerGroupUUID(), WebserviceEnum.Provider);
+ m_rebuildStubPresenter.setAction(action);
+ }
+ }
+
+ private void controlView() {
+ // enable / disable credential validation strategy presenter
+ m_credentialValidationStrategyPresenter.setEnabled(JaxWsSdkUtility.isProviderAuthenticationSet(m_authenticationHandlerPresenter.getValue()));
+ }
+
+ private final class P_PresenterListener implements IPresenterValueChangedListener {
+
+ @Override
+ public void propertyChanged(int presenterId, Object value) {
+ switch (presenterId) {
+ case PRESENTER_ID_SESSION_FACTORY:
+ case PRESENTER_ID_AUTHENTICATION_HANDLER:
+ case PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY: {
+ IType portType = getPage().getPortType();
+ if (TypeUtility.exists(portType)) {
+ String factoryFullyQualifiedName = (String) value;
+ if (!TypeUtility.existsType(factoryFullyQualifiedName)) {
+ return;
+ }
+ IType factoryType = TypeUtility.getType(factoryFullyQualifiedName);
+ AnnotationUpdateOperation op = new AnnotationUpdateOperation();
+ op.setDeclaringType(portType);
+ op.setAnnotationType(TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService));
+ switch (presenterId) {
+ case PRESENTER_ID_SESSION_FACTORY:
+ op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, factoryType);
+ break;
+ case PRESENTER_ID_AUTHENTICATION_HANDLER:
+ op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_AUTH_HANDLER, factoryType);
+ if (!JaxWsSdkUtility.isProviderAuthenticationSet(factoryFullyQualifiedName)) {
+ op.removeProperty(JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY);
+ }
+ break;
+ case PRESENTER_ID_CREDENTIAL_VALIDATION_STRATEGY:
+ op.addTypeProperty(JaxWsRuntimeClasses.PROP_SWS_CREDENTIAL_STRATEGY, factoryType);
+ break;
+ }
+ new OperationJob(op).schedule();
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ private class P_ScoutSeverityListener implements IScoutSeverityListener {
+
+ @Override
+ public void severityChanged(IResource resource) {
+ boolean accept = false;
+ if (resource == ResourceFactory.getSunJaxWsResource(m_bundle).getFile()) {
+ accept = true;
+ }
+ if (!accept && resource == ResourceFactory.getBuildJaxWsResource(m_bundle).getFile()) {
+ accept = true;
+ }
+ if (!accept && resource == getPage().getWsdlResource().getFile()) {
+ accept = true;
+ }
+ if (!accept && getPage().getPortType() != null && resource == getPage().getPortType().getResource()) {
+ accept = true;
+ }
+ if (!accept) {
+ for (XmlResource bindingFileResource : getPage().getBindingFileResources()) {
+ if (resource == bindingFileResource) {
+ accept = true;
+ break;
+ }
+ }
+ }
+ if (!accept) {
+ return;
+ }
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getPage().isPageUnloaded() || getForm().isDisposed()) {
+ return;
+ }
+ getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
+
+ if (MarkerUtility.containsMarker(m_bundle, MarkerType.MissingBuildJaxWsEntry, getPage().getMarkerGroupUUID(), IMarker.SEVERITY_ERROR)) {
+ return;
+ }
+
+ // update marker status of presenters (quality)
+ m_targetNamespacePresenter.updateInfo();
+ m_servicePresenter.updateInfo();
+ m_portPresenter.updateInfo();
+ m_bindingPresenter.updateInfo();
+ m_portTypePresenter.updateInfo();
+ m_urlPatternPresenter.updateInfo();
+ m_wsdlFilePresenter.updateInfo();
+ m_wsdlFolderPresenter.updateInfo();
+ m_sessionFactoryPresenter.updateInfo();
+ m_authenticationHandlerPresenter.updateInfo();
+ m_credentialValidationStrategyPresenter.updateInfo();
+ m_stubJarFilePresenter.updateInfo();
+ m_stubFolderPresenter.updateInfo();
+
+ for (BindingFilePresenter presenter : m_bindingFilePresenters) {
+ presenter.updateInfo();
+ }
+
+ validateRebuildStubPresenter();
+ controlView();
+ }
+ });
+ }
+ }
+
+ private class P_PageLoadedListener implements IPageLoadedListener {
+
+ @Override
+ public void pageLoaded() {
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getPage().isPageUnloaded() || getForm().isDisposed()) {
+ return;
+ }
+ if (MarkerUtility.containsMarker(m_bundle, MarkerType.MissingBuildJaxWsEntry, getPage().getMarkerGroupUUID(), IMarker.SEVERITY_ERROR)) {
+ return;
+ }
+ updatePresenterValues();
+ }
+ });
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderTablePagePropertyViewPart.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderTablePagePropertyViewPart.java
index fa89f04cf..213cfbaaf 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderTablePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServiceProviderTablePagePropertyViewPart.java
@@ -1,142 +1,142 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.util.IScoutSeverityListener;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction.FileExtensionType;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.ProviderNewWizardAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.RepairAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderTablePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.layout.GridData;
-
-public class WebServiceProviderTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
-
- public static final String SECTION_ID_FILTER = "section.jaxws.filter";
- public static final String SECTION_ID_REPAIR = "section.jaxws.repair";
- public static final String SECTION_ID_LINKS = "section.jaxws.links";
- public static final String SECTION_ID_PROVIDER = "section.jaxws.wsprovider";
-
- private P_ScoutSeverityListener m_severityListener;
- private IScoutBundle m_bundle;
-
- @Override
- protected void init() {
- m_bundle = getPage().getScoutResource();
- m_severityListener = new P_ScoutSeverityListener();
- ScoutSeverityManager.getInstance().addQualityManagerListener(m_severityListener);
- }
-
- @Override
- protected void cleanup() {
- ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
- }
-
- @Override
- protected void createSections() {
- getForm().setRedraw(false);
- try {
- createSection(SECTION_ID_FILTER, Texts.get("Filter"));
- getSection(SECTION_ID_FILTER).setExpanded(false);
- createSection(SECTION_ID_REPAIR, Texts.get("RepairRequired"), Texts.get("SectionRepairDescription"), false);
- createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
- createSection(SECTION_ID_PROVIDER, Texts.get("WebserviceProvider"));
- boolean sectionLinksVisible = false;
-
- // repair action
- getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
-
- RepairAction a = new RepairAction();
- a.init(getPage().getMarkerGroupUUID(), getPage().getScoutResource());
- AbstractPresenter presenter = new ActionPresenter(getSection(SECTION_ID_REPAIR).getSectionClient(), a, getFormToolkit());
- applyLayoutData(presenter);
-
- // filter section
- PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), getSection(SECTION_ID_FILTER).getSectionClient(), getPage());
- applyLayoutData(filterPresenter);
-
- // QuickLink 'Open sun-jaxws.xml'
- IFile sunJaxWsFile = ResourceFactory.getSunJaxWsResource(m_bundle).getFile();
- if (JaxWsSdkUtility.exists(sunJaxWsFile)) {
- FileOpenAction b = new FileOpenAction();
- b.init(sunJaxWsFile, sunJaxWsFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.SunJaxWsXmlFile), FileExtensionType.Xml);
- b.setToolTip(Texts.get("JaxWsDeploymentDescriptor"));
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), b, getFormToolkit());
- applyLayoutData(actionPresenter);
- sectionLinksVisible = true;
- }
-
- // QuickLink 'Open build-jaxws.xml'
- IFile buildJaxWsFile = ResourceFactory.getBuildJaxWsResource(m_bundle).getFile();
- if (JaxWsSdkUtility.exists(buildJaxWsFile)) {
- FileOpenAction c = new FileOpenAction();
- c.init(buildJaxWsFile, buildJaxWsFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.BuildJaxWsXmlFile), FileExtensionType.Xml);
- c.setToolTip(Texts.get("JaxWsBuildDescriptor"));
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), c, getFormToolkit());
- applyLayoutData(actionPresenter);
- sectionLinksVisible = true;
- }
- getSection(SECTION_ID_LINKS).setVisible(sectionLinksVisible);
-
- // QuickLink 'Create new Provider'
- ProviderNewWizardAction d = new ProviderNewWizardAction();
- d.init(m_bundle);
- ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_PROVIDER).getSectionClient(), d, getFormToolkit());
- applyLayoutData(actionPresenter);
- }
- finally {
- getForm().setRedraw(true);
- }
- }
-
- @Override
- public WebServiceProviderTablePage getPage() {
- return (WebServiceProviderTablePage) super.getPage();
- }
-
- private void applyLayoutData(AbstractPresenter presenter) {
- GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- presenter.getContainer().setLayoutData(layoutData);
- }
-
- private class P_ScoutSeverityListener implements IScoutSeverityListener {
-
- @Override
- public void severityChanged(IResource resource) {
- if (resource == ResourceFactory.getSunJaxWsResource(m_bundle).getFile()) {
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (getPage().isPageUnloaded() || getForm().isDisposed()) {
- return;
- }
- getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
- }
- });
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.internal.view.properties.presenter.PageFilterPresenter;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.util.IScoutSeverityListener;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction.FileExtensionType;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.ProviderNewWizardAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.RepairAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderTablePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.layout.GridData;
+
+public class WebServiceProviderTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+
+ public static final String SECTION_ID_FILTER = "section.jaxws.filter";
+ public static final String SECTION_ID_REPAIR = "section.jaxws.repair";
+ public static final String SECTION_ID_LINKS = "section.jaxws.links";
+ public static final String SECTION_ID_PROVIDER = "section.jaxws.wsprovider";
+
+ private P_ScoutSeverityListener m_severityListener;
+ private IScoutBundle m_bundle;
+
+ @Override
+ protected void init() {
+ m_bundle = getPage().getScoutResource();
+ m_severityListener = new P_ScoutSeverityListener();
+ ScoutSeverityManager.getInstance().addQualityManagerListener(m_severityListener);
+ }
+
+ @Override
+ protected void cleanup() {
+ ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
+ }
+
+ @Override
+ protected void createSections() {
+ getForm().setRedraw(false);
+ try {
+ createSection(SECTION_ID_FILTER, Texts.get("Filter"));
+ getSection(SECTION_ID_FILTER).setExpanded(false);
+ createSection(SECTION_ID_REPAIR, Texts.get("RepairRequired"), Texts.get("SectionRepairDescription"), false);
+ createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
+ createSection(SECTION_ID_PROVIDER, Texts.get("WebserviceProvider"));
+ boolean sectionLinksVisible = false;
+
+ // repair action
+ getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
+
+ RepairAction a = new RepairAction();
+ a.init(getPage().getMarkerGroupUUID(), getPage().getScoutResource());
+ AbstractPresenter presenter = new ActionPresenter(getSection(SECTION_ID_REPAIR).getSectionClient(), a, getFormToolkit());
+ applyLayoutData(presenter);
+
+ // filter section
+ PageFilterPresenter filterPresenter = new PageFilterPresenter(getFormToolkit(), getSection(SECTION_ID_FILTER).getSectionClient(), getPage());
+ applyLayoutData(filterPresenter);
+
+ // QuickLink 'Open sun-jaxws.xml'
+ IFile sunJaxWsFile = ResourceFactory.getSunJaxWsResource(m_bundle).getFile();
+ if (JaxWsSdkUtility.exists(sunJaxWsFile)) {
+ FileOpenAction b = new FileOpenAction();
+ b.init(sunJaxWsFile, sunJaxWsFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.SunJaxWsXmlFile), FileExtensionType.Xml);
+ b.setToolTip(Texts.get("JaxWsDeploymentDescriptor"));
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), b, getFormToolkit());
+ applyLayoutData(actionPresenter);
+ sectionLinksVisible = true;
+ }
+
+ // QuickLink 'Open build-jaxws.xml'
+ IFile buildJaxWsFile = ResourceFactory.getBuildJaxWsResource(m_bundle).getFile();
+ if (JaxWsSdkUtility.exists(buildJaxWsFile)) {
+ FileOpenAction c = new FileOpenAction();
+ c.init(buildJaxWsFile, buildJaxWsFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsIcons.BuildJaxWsXmlFile), FileExtensionType.Xml);
+ c.setToolTip(Texts.get("JaxWsBuildDescriptor"));
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), c, getFormToolkit());
+ applyLayoutData(actionPresenter);
+ sectionLinksVisible = true;
+ }
+ getSection(SECTION_ID_LINKS).setVisible(sectionLinksVisible);
+
+ // QuickLink 'Create new Provider'
+ ProviderNewWizardAction d = new ProviderNewWizardAction();
+ d.init(m_bundle);
+ ActionPresenter actionPresenter = new ActionPresenter(getSection(SECTION_ID_PROVIDER).getSectionClient(), d, getFormToolkit());
+ applyLayoutData(actionPresenter);
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ }
+
+ @Override
+ public WebServiceProviderTablePage getPage() {
+ return (WebServiceProviderTablePage) super.getPage();
+ }
+
+ private void applyLayoutData(AbstractPresenter presenter) {
+ GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+
+ private class P_ScoutSeverityListener implements IScoutSeverityListener {
+
+ @Override
+ public void severityChanged(IResource resource) {
+ if (resource == ResourceFactory.getSunJaxWsResource(m_bundle).getFile()) {
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (getPage().isPageUnloaded() || getForm().isDisposed()) {
+ return;
+ }
+ getSection(SECTION_ID_REPAIR).setVisible(JaxWsSdk.getDefault().containsMarkerCommands(getPage().getMarkerGroupUUID()));
+ }
+ });
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServicesTablePagePropertyViewPart.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServicesTablePagePropertyViewPart.java
index 32674615b..74a4d6cc4 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServicesTablePagePropertyViewPart.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/part/WebServicesTablePagePropertyViewPart.java
@@ -1,88 +1,88 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
-import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.CleanupPhantomJarFileAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction.FileExtensionType;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServicesTablePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.InformationPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-
-public class WebServicesTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
-
- public static final String SECTION_ID_LINKS = "section.jaxws.links";
- public static final String SECTION_ID_INFORMATION = "section.jaxws.information";
-
- private IScoutBundle m_bundle;
-
- @Override
- protected void init() {
- m_bundle = getPage().getScoutResource();
- }
-
- @Override
- protected void createSections() {
- getForm().setRedraw(false);
- try {
- createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
-
- // QuickLink 'Open build-jaxws.xml'
- IFile buildJaxWsFile = ResourceFactory.getBuildJaxWsResource(m_bundle).getFile();
- if (JaxWsSdkUtility.exists(buildJaxWsFile)) {
- FileOpenAction a = new FileOpenAction();
- a.init(buildJaxWsFile, buildJaxWsFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsSdk.BuildJaxWsXmlFile), FileExtensionType.Xml);
- a.setToolTip(Texts.get("JaxWsBuildDescriptor"));
- ActionPresenter presenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
- applyLayoutData(presenter);
- }
-
- // cleanup phantom JAR-Files
- CleanupPhantomJarFileAction b = new CleanupPhantomJarFileAction();
- b.init(m_bundle);
- AbstractPresenter presenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), b, getFormToolkit());
- applyLayoutData(presenter);
-
- // JAX-WS library conflict
- if (TypeUtility.getTypes(javax.xml.ws.Service.class.getName()).length > 1) {
- ISection section = createSection(SECTION_ID_INFORMATION, Texts.get("Information"), null, false);
- presenter = new InformationPresenter(section.getSectionClient(), "Multiple JAX-WS RI implementations detected which might cause problems at design and runtime. Please consider that the installed Scout JAX-WS integration supports JAX-WS RI 2.1.6 bundled with Java SE 6.", JaxWsSdk.getImageDescriptor(JaxWsIcons.LibraryConflict), new Point(48, 100), getFormToolkit());
- applyLayoutData(presenter);
- }
- }
- finally {
- getForm().setRedraw(true);
- }
- }
-
- @Override
- public WebServicesTablePage getPage() {
- return (WebServicesTablePage) super.getPage();
- }
-
- private void applyLayoutData(AbstractPresenter presenter) {
- GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
- presenter.getContainer().setLayoutData(layoutData);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.part;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
+import org.eclipse.scout.sdk.ui.view.properties.part.singlepage.AbstractSinglePageSectionBasedViewPart;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.CleanupPhantomJarFileAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.FileOpenAction.FileExtensionType;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServicesTablePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.ActionPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter.InformationPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+
+public class WebServicesTablePagePropertyViewPart extends AbstractSinglePageSectionBasedViewPart {
+
+ public static final String SECTION_ID_LINKS = "section.jaxws.links";
+ public static final String SECTION_ID_INFORMATION = "section.jaxws.information";
+
+ private IScoutBundle m_bundle;
+
+ @Override
+ protected void init() {
+ m_bundle = getPage().getScoutResource();
+ }
+
+ @Override
+ protected void createSections() {
+ getForm().setRedraw(false);
+ try {
+ createSection(SECTION_ID_LINKS, Texts.get("ConsiderLinks"));
+
+ // QuickLink 'Open build-jaxws.xml'
+ IFile buildJaxWsFile = ResourceFactory.getBuildJaxWsResource(m_bundle).getFile();
+ if (JaxWsSdkUtility.exists(buildJaxWsFile)) {
+ FileOpenAction a = new FileOpenAction();
+ a.init(buildJaxWsFile, buildJaxWsFile.getName(), JaxWsSdk.getImageDescriptor(JaxWsSdk.BuildJaxWsXmlFile), FileExtensionType.Xml);
+ a.setToolTip(Texts.get("JaxWsBuildDescriptor"));
+ ActionPresenter presenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), a, getFormToolkit());
+ applyLayoutData(presenter);
+ }
+
+ // cleanup phantom JAR-Files
+ CleanupPhantomJarFileAction b = new CleanupPhantomJarFileAction();
+ b.init(m_bundle);
+ AbstractPresenter presenter = new ActionPresenter(getSection(SECTION_ID_LINKS).getSectionClient(), b, getFormToolkit());
+ applyLayoutData(presenter);
+
+ // JAX-WS library conflict
+ if (TypeUtility.getTypes(javax.xml.ws.Service.class.getName()).length > 1) {
+ ISection section = createSection(SECTION_ID_INFORMATION, Texts.get("Information"), null, false);
+ presenter = new InformationPresenter(section.getSectionClient(), "Multiple JAX-WS RI implementations detected which might cause problems at design and runtime. Please consider that the installed Scout JAX-WS integration supports JAX-WS RI 2.1.6 bundled with Java SE 6.", JaxWsSdk.getImageDescriptor(JaxWsIcons.LibraryConflict), new Point(48, 100), getFormToolkit());
+ applyLayoutData(presenter);
+ }
+ }
+ finally {
+ getForm().setRedraw(true);
+ }
+ }
+
+ @Override
+ public WebServicesTablePage getPage() {
+ return (WebServicesTablePage) super.getPage();
+ }
+
+ private void applyLayoutData(AbstractPresenter presenter) {
+ GridData layoutData = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
+ presenter.getContainer().setLayoutData(layoutData);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AbstractPropertyPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AbstractPropertyPresenter.java
index 2cc5a8752..c524466a0 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AbstractPropertyPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AbstractPropertyPresenter.java
@@ -1,591 +1,591 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.NumberUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPresenterValueChangedListener;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-
-public abstract class AbstractPropertyPresenter<T> extends AbstractPresenter {
-
- public static final int DEFAULT_LABEL_WIDTH = 120;
-
- private T m_value;
- protected int m_presenterId;
- private Composite m_container;
- private String m_labelText;
- private ImageDescriptor m_iconImageDescriptor;
- private String m_iconTooltip;
- private String m_tooltip;
- private String m_resetTooltip;
- private List<IPresenterValueChangedListener> m_valueChangedListeners;
- private boolean m_acceptNullValue;
- private boolean m_boldLabelText;
- private boolean m_useLinkAsLabel;
- private boolean m_resetLinkVisible;
- private boolean m_linkAlwaysEnabled;
-
- private int m_labelWidth;
- private Label m_label;
- private Hyperlink m_link;
- protected Control m_content;
- private Label m_statusIcon;
- private Label m_icon;
- protected ImageHyperlink m_resetLink;
-
- private MarkerType m_markerType;
- protected IScoutBundle m_bundle;
- private String m_markerGroupUUID;
-
- private String m_customInfo;
- private int m_customSeverity;
-
- private int m_stateChanging;
-
- public AbstractPropertyPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- this(parent, toolkit, DEFAULT_LABEL_WIDTH, true);
- }
-
- public AbstractPropertyPresenter(Composite parent, PropertyViewFormToolkit toolkit, boolean initialize) {
- this(parent, toolkit, DEFAULT_LABEL_WIDTH, initialize);
- }
-
- public AbstractPropertyPresenter(Composite parent, PropertyViewFormToolkit toolkit, int labelWidth, boolean initialize) {
- super(toolkit, parent);
- m_labelWidth = labelWidth;
- m_valueChangedListeners = new LinkedList<IPresenterValueChangedListener>();
- m_resetTooltip = Texts.get("Remove");
- if (initialize) {
- callInitializer();
- }
- }
-
- protected void callInitializer() {
- createPresenter();
- }
-
- private Control createPresenter() {
- m_container = getContainer();
-
- m_label = new Label(m_container, SWT.NONE);
- m_label.setText(StringUtility.join("", m_labelText, ":"));
- m_label.setToolTipText(m_tooltip);
-
- m_link = getToolkit().createHyperlink(m_container, StringUtility.join("", m_labelText, ":"), SWT.NONE);
- m_link.setToolTipText(m_tooltip);
- m_link.setUnderlined(true);
- m_link.addHyperlinkListener(new HyperlinkAdapter() {
-
- @Override
- public void linkActivated(HyperlinkEvent event) {
- try {
- execLinkAction();
- }
- catch (CoreException e) {
- JaxWsSdk.logError(e);
- }
- }
- });
-
- m_icon = new Label(m_container, SWT.NONE);
- if (getIconImageDescriptor() != null) {
- m_icon.setImage(getIconImageDescriptor().createImage());
- }
- m_icon.setToolTipText(StringUtility.nvl(getIconTooltip(), ""));
-
- // content
- m_content = createContent(m_container);
-
- m_statusIcon = new Label(m_container, SWT.NONE);
- m_statusIcon.setImage(ScoutSdkUi.getImage(ScoutSdkUi.StatusError));
-
- m_resetLink = getToolkit().createImageHyperlink(m_container, SWT.NONE);
- m_resetLink.setToolTipText(StringUtility.nvl(m_resetTooltip, ""));
- m_resetLink.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolRemove));
- m_resetLink.addHyperlinkListener(new HyperlinkAdapter() {
-
- @Override
- public void linkActivated(HyperlinkEvent event) {
- try {
- execResetAction();
- }
- catch (CoreException e) {
- JaxWsSdk.logError(e);
- }
- }
- });
-
- // layout
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = 0;
- layout.marginWidth = 0;
- layout.numColumns = 5;
- layout.marginBottom = 0;
- layout.marginTop = 0;
- layout.verticalSpacing = 0;
- layout.marginHeight = 2;
- layout.makeColumnsEqualWidth = false;
- m_container.setLayout(layout);
-
- boolean labelVisible = !m_useLinkAsLabel;
- GridData gd = new GridData();
- gd.widthHint = m_labelWidth;
- gd.horizontalAlignment = SWT.LEFT;
- gd.grabExcessHorizontalSpace = false;
- gd.exclude = !labelVisible;
- gd.horizontalIndent = 1; // as link takes more place on the left side
- m_label.setLayoutData(gd);
- m_label.setVisible(labelVisible);
-
- boolean linkVisible = m_useLinkAsLabel;
- gd = new GridData();
- gd.widthHint = m_labelWidth;
- gd.horizontalAlignment = SWT.LEFT;
- gd.grabExcessHorizontalSpace = false;
- gd.exclude = !linkVisible;
- m_link.setLayoutData(gd);
- m_link.setVisible(linkVisible);
-
- gd = new GridData();
- gd.widthHint = 16;
- gd.horizontalAlignment = SWT.RIGHT;
- m_icon.setLayoutData(gd);
- m_icon.setVisible(getIconImageDescriptor() != null);
-
- gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.horizontalIndent = 5;
- gd.grabExcessHorizontalSpace = true;
- m_content.setLayoutData(gd);
-
- gd = new GridData();
- gd.grabExcessHorizontalSpace = false;
- m_statusIcon.setLayoutData(gd);
-
- gd = new GridData();
- gd.grabExcessHorizontalSpace = false;
- gd.exclude = !m_resetLinkVisible;
- gd.horizontalIndent = 5;
- m_resetLink.setLayoutData(gd);
- m_resetLink.setVisible(m_resetLinkVisible);
-
- setUseLinkAsLabel(m_useLinkAsLabel);
- setBoldLabelText(m_boldLabelText);
-
- return m_container;
- }
-
- public void setPresenterId(int presenterId) {
- m_presenterId = presenterId;
- }
-
- public void setLabel(String label) {
- m_labelText = label;
- if (isControlCreated()) {
- m_label.setText(StringUtility.nvl(m_labelText, ""));
- m_link.setText(StringUtility.nvl(m_labelText, ""));
- }
- }
-
- public String getLabel() {
- return m_labelText;
- }
-
- public ImageDescriptor getIconImageDescriptor() {
- return m_iconImageDescriptor;
- }
-
- public void setIconImageDescriptor(ImageDescriptor iconImageDescriptor) {
- m_iconImageDescriptor = iconImageDescriptor;
- if (isControlCreated()) {
- if (iconImageDescriptor != null) {
- m_icon.setImage(iconImageDescriptor.createImage());
- }
- else {
- m_icon.setImage(null);
- }
- m_icon.setToolTipText(StringUtility.nvl(m_iconTooltip, ""));
- m_icon.setVisible(iconImageDescriptor != null);
- m_icon.getParent().layout(true);
- }
- }
-
- public String getIconTooltip() {
- return m_iconTooltip;
- }
-
- public void setIconTooltip(String iconTooltip) {
- m_iconTooltip = iconTooltip;
- if (isControlCreated()) {
- m_icon.setToolTipText(StringUtility.nvl(iconTooltip, ""));
- }
- }
-
- public void setTooltip(String tooltip) {
- m_tooltip = tooltip;
- if (isControlCreated()) {
- m_label.setToolTipText(StringUtility.nvl(tooltip, ""));
- m_link.setToolTipText(StringUtility.nvl(tooltip, ""));
- }
- }
-
- public void setResetTooltip(String resetTooltip) {
- m_resetTooltip = resetTooltip;
- if (isControlCreated()) {
- m_resetLink.setToolTipText(StringUtility.nvl(resetTooltip, ""));
- }
- }
-
- public boolean isUseLinkAsLabel() {
- return m_useLinkAsLabel;
- }
-
- public void setUseLinkAsLabel(boolean useLinkAsLabel) {
- if (m_useLinkAsLabel == useLinkAsLabel) {
- return;
- }
-
- m_useLinkAsLabel = useLinkAsLabel;
- if (isControlCreated()) {
- ((GridData) m_label.getLayoutData()).exclude = m_useLinkAsLabel;
- m_label.setVisible(!m_useLinkAsLabel); // required as exclude does not hide the control properly (bug)
- ((GridData) m_link.getLayoutData()).exclude = !m_useLinkAsLabel;
- m_link.setVisible(m_useLinkAsLabel); // required as exclude does not hide the control properly (bug)
- m_container.layout();
- }
- }
-
- public boolean isLinkAlwaysEnabled() {
- return m_linkAlwaysEnabled;
- }
-
- public void setLinkAlwaysEnabled(boolean linkAlwaysEnabled) {
- m_linkAlwaysEnabled = linkAlwaysEnabled;
- if (linkAlwaysEnabled) {
- if (isControlCreated()) {
- m_link.setEnabled(true);
- }
- }
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- if (!isLinkAlwaysEnabled()) {
- super.setEnabled(enabled);
- }
- else {
- m_content.setEnabled(enabled);
- m_label.setEnabled(enabled);
- m_icon.setEnabled(enabled);
- m_statusIcon.setEnabled(enabled);
- }
- }
-
- public boolean isResetLinkVisible() {
- return m_resetLinkVisible;
- }
-
- public void setResetLinkVisible(boolean resetLinkVisible) {
- if (m_resetLinkVisible == resetLinkVisible) {
- return;
- }
- m_resetLinkVisible = resetLinkVisible;
- if (isControlCreated()) {
- ((GridData) m_resetLink.getLayoutData()).exclude = !m_resetLinkVisible;
- m_resetLink.setVisible(m_resetLinkVisible);
- m_container.layout();
- }
- }
-
- public void setMarkerType(MarkerType markerType) {
- m_markerType = markerType;
- }
-
- public MarkerType getMarkerType() {
- return m_markerType;
- }
-
- public void setMarkerGroupUUID(String markerGroupUUID) {
- m_markerGroupUUID = markerGroupUUID;
- }
-
- public String getMarkerGroupUUID() {
- return m_markerGroupUUID;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public void addValueChangedListener(IPresenterValueChangedListener listener) {
- m_valueChangedListeners.add(listener);
- }
-
- public void removeValueChangedListener(IPresenterValueChangedListener listener) {
- m_valueChangedListeners.remove(listener);
- }
-
- public void setInput(final T value) {
- if (m_container == null) {
- createPresenter();
- }
- if (m_container.isDisposed()) {
- return;
- }
-
- clearInfo();
- try {
- m_value = value;
- setInputInternal(value);
- }
- finally {
- updateInfo();
- }
- }
-
- public void setInfo(int severity, String info) {
- m_customSeverity = severity;
- m_customInfo = info;
- updateInfo();
- }
-
- public void clearInfo() {
- clearInfo(true);
- }
-
- public void clearInfo(boolean updateUi) {
- m_customInfo = null;
- m_customSeverity = IMarker.SEVERITY_INFO;
-
- if (updateUi) {
- updateInfo();
- }
- }
-
- public void updateInfo() {
- if (isDisposed()) {
- return;
- }
- String info = null;
- int severity = IMarker.SEVERITY_INFO;
-
- List<SeverityEntry> statusList = new ArrayList<SeverityEntry>();
- statusList.add(new SeverityEntry(NumberUtility.nvl(m_customSeverity, IMarker.SEVERITY_INFO), m_customInfo));
-
- // marker status
- if (m_markerType != null && m_bundle != null) {
- IMarker[] markers = MarkerUtility.getMarkers(m_bundle, m_markerType, m_markerGroupUUID);
-
- for (IMarker marker : markers) {
- statusList.add(new SeverityEntry(marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO), marker.getAttribute(IMarker.MESSAGE, null)));
- }
- }
-
- try {
- updateSeverity(statusList);
- }
- catch (CoreException e) {
- JaxWsSdk.logError(e);
- }
-
- for (SeverityEntry severityEntry : statusList) {
- severity = Math.max(severity, severityEntry.getSeverity());
- if (StringUtility.hasText(severityEntry.getMessage())) {
- info = StringUtility.join("\n" + info, severityEntry.getMessage());
- }
- }
-
- // visualize status
- Image image;
- switch (severity) {
- case IMarker.SEVERITY_WARNING:
- image = ScoutSdkUi.getImage(ScoutSdkUi.StatusWarning);
- break;
- case IMarker.SEVERITY_ERROR:
- image = ScoutSdkUi.getImage(ScoutSdkUi.StatusError);
- break;
- default:
- image = ScoutSdkUi.getImage(ScoutSdkUi.StatusInfo);
- }
-
- if (!StringUtility.hasText(info)) {
- info = null;
- }
-
- GridData gridDataIcon = (GridData) m_statusIcon.getLayoutData();
-
- if (severity == IMarker.SEVERITY_INFO && info == null) {
- // clear info
- if (!gridDataIcon.exclude) {
- gridDataIcon.exclude = true;
- m_statusIcon.setVisible(false);
- m_container.layout();
- }
- }
- else {
- m_statusIcon.setImage(image);
- m_statusIcon.setToolTipText(StringUtility.nvl(info, ""));
-
- if (gridDataIcon.exclude) {
- gridDataIcon.exclude = false;
- m_statusIcon.setVisible(true);
- m_container.layout();
- }
- }
- }
-
- public T getValue() {
- return m_value;
- }
-
- public boolean isAcceptNullValue() {
- return m_acceptNullValue;
- }
-
- public void setAcceptNullValue(boolean acceptNullValue) {
- m_acceptNullValue = acceptNullValue;
- }
-
- public boolean isBoldLabelText() {
- return m_boldLabelText;
- }
-
- public void setBoldLabelText(boolean boldLabelText) {
- if (m_boldLabelText == boldLabelText) {
- return;
- }
- m_boldLabelText = boldLabelText;
- if (isControlCreated()) {
- m_link.setFont(getFont(JFaceResources.DIALOG_FONT, boldLabelText));
- m_label.setFont(getFont(JFaceResources.DIALOG_FONT, boldLabelText));
- }
- }
-
- /**
- * Sets the value in the presenter's model and notifies attached listeners
- *
- * @param newValue
- */
- protected void setValueFromUI(T newValue) {
- setValueFromUI(newValue, false);
- }
-
- /**
- * Sets the value in the presenter's model and notifies attached listeners
- *
- * @param newValue
- * @param force
- * to force set the value without equality check of new and old value
- */
- protected void setValueFromUI(T newValue, boolean force) {
- if (!isStateChanging() && (force || !CompareUtility.equals(getValue(), newValue)) && (newValue != null || isAcceptNullValue())) {
- m_value = newValue;
- for (IPresenterValueChangedListener listener : m_valueChangedListeners.toArray(new IPresenterValueChangedListener[m_valueChangedListeners.size()])) {
- try {
- listener.propertyChanged(m_presenterId, newValue);
- }
- catch (Throwable t) {
- // nop
- }
- }
- }
- clearInfo();
- }
-
- /**
- * is called to update the presenter's UI representation
- *
- * @param input
- * @return
- */
- protected abstract void setInputInternal(T input);
-
- protected abstract Control createContent(Composite parent);
-
- protected boolean isControlCreated() {
- return m_container != null && !m_container.isDisposed();
- }
-
- protected boolean isStateChanging() {
- return m_stateChanging > 0;
- }
-
- public void setStateChanging(boolean b) {
- if (b) {
- m_stateChanging++;
- }
- else {
- m_stateChanging--;
- }
- }
-
- protected void execLinkAction() throws CoreException {
- }
-
- protected void execResetAction() throws CoreException {
- }
-
- protected void updateSeverity(List<SeverityEntry> statusList) throws CoreException {
- }
-
- public static class SeverityEntry {
- private int m_severity;
- private String m_message;
-
- public SeverityEntry(int severity, String message) {
- m_severity = severity;
- m_message = message;
- }
-
- public int getSeverity() {
- return m_severity;
- }
-
- public void setSeverity(int severity) {
- m_severity = severity;
- }
-
- public String getMessage() {
- return m_message;
- }
-
- public void setMessage(String message) {
- m_message = message;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.NumberUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.marker.MarkerUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPresenterValueChangedListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
+
+public abstract class AbstractPropertyPresenter<T> extends AbstractPresenter {
+
+ public static final int DEFAULT_LABEL_WIDTH = 120;
+
+ private T m_value;
+ protected int m_presenterId;
+ private Composite m_container;
+ private String m_labelText;
+ private ImageDescriptor m_iconImageDescriptor;
+ private String m_iconTooltip;
+ private String m_tooltip;
+ private String m_resetTooltip;
+ private List<IPresenterValueChangedListener> m_valueChangedListeners;
+ private boolean m_acceptNullValue;
+ private boolean m_boldLabelText;
+ private boolean m_useLinkAsLabel;
+ private boolean m_resetLinkVisible;
+ private boolean m_linkAlwaysEnabled;
+
+ private int m_labelWidth;
+ private Label m_label;
+ private Hyperlink m_link;
+ protected Control m_content;
+ private Label m_statusIcon;
+ private Label m_icon;
+ protected ImageHyperlink m_resetLink;
+
+ private MarkerType m_markerType;
+ protected IScoutBundle m_bundle;
+ private String m_markerGroupUUID;
+
+ private String m_customInfo;
+ private int m_customSeverity;
+
+ private int m_stateChanging;
+
+ public AbstractPropertyPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ this(parent, toolkit, DEFAULT_LABEL_WIDTH, true);
+ }
+
+ public AbstractPropertyPresenter(Composite parent, PropertyViewFormToolkit toolkit, boolean initialize) {
+ this(parent, toolkit, DEFAULT_LABEL_WIDTH, initialize);
+ }
+
+ public AbstractPropertyPresenter(Composite parent, PropertyViewFormToolkit toolkit, int labelWidth, boolean initialize) {
+ super(toolkit, parent);
+ m_labelWidth = labelWidth;
+ m_valueChangedListeners = new LinkedList<IPresenterValueChangedListener>();
+ m_resetTooltip = Texts.get("Remove");
+ if (initialize) {
+ callInitializer();
+ }
+ }
+
+ protected void callInitializer() {
+ createPresenter();
+ }
+
+ private Control createPresenter() {
+ m_container = getContainer();
+
+ m_label = new Label(m_container, SWT.NONE);
+ m_label.setText(StringUtility.join("", m_labelText, ":"));
+ m_label.setToolTipText(m_tooltip);
+
+ m_link = getToolkit().createHyperlink(m_container, StringUtility.join("", m_labelText, ":"), SWT.NONE);
+ m_link.setToolTipText(m_tooltip);
+ m_link.setUnderlined(true);
+ m_link.addHyperlinkListener(new HyperlinkAdapter() {
+
+ @Override
+ public void linkActivated(HyperlinkEvent event) {
+ try {
+ execLinkAction();
+ }
+ catch (CoreException e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+ });
+
+ m_icon = new Label(m_container, SWT.NONE);
+ if (getIconImageDescriptor() != null) {
+ m_icon.setImage(getIconImageDescriptor().createImage());
+ }
+ m_icon.setToolTipText(StringUtility.nvl(getIconTooltip(), ""));
+
+ // content
+ m_content = createContent(m_container);
+
+ m_statusIcon = new Label(m_container, SWT.NONE);
+ m_statusIcon.setImage(ScoutSdkUi.getImage(ScoutSdkUi.StatusError));
+
+ m_resetLink = getToolkit().createImageHyperlink(m_container, SWT.NONE);
+ m_resetLink.setToolTipText(StringUtility.nvl(m_resetTooltip, ""));
+ m_resetLink.setImage(ScoutSdkUi.getImage(ScoutSdkUi.ToolRemove));
+ m_resetLink.addHyperlinkListener(new HyperlinkAdapter() {
+
+ @Override
+ public void linkActivated(HyperlinkEvent event) {
+ try {
+ execResetAction();
+ }
+ catch (CoreException e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+ });
+
+ // layout
+ GridLayout layout = new GridLayout();
+ layout.horizontalSpacing = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 5;
+ layout.marginBottom = 0;
+ layout.marginTop = 0;
+ layout.verticalSpacing = 0;
+ layout.marginHeight = 2;
+ layout.makeColumnsEqualWidth = false;
+ m_container.setLayout(layout);
+
+ boolean labelVisible = !m_useLinkAsLabel;
+ GridData gd = new GridData();
+ gd.widthHint = m_labelWidth;
+ gd.horizontalAlignment = SWT.LEFT;
+ gd.grabExcessHorizontalSpace = false;
+ gd.exclude = !labelVisible;
+ gd.horizontalIndent = 1; // as link takes more place on the left side
+ m_label.setLayoutData(gd);
+ m_label.setVisible(labelVisible);
+
+ boolean linkVisible = m_useLinkAsLabel;
+ gd = new GridData();
+ gd.widthHint = m_labelWidth;
+ gd.horizontalAlignment = SWT.LEFT;
+ gd.grabExcessHorizontalSpace = false;
+ gd.exclude = !linkVisible;
+ m_link.setLayoutData(gd);
+ m_link.setVisible(linkVisible);
+
+ gd = new GridData();
+ gd.widthHint = 16;
+ gd.horizontalAlignment = SWT.RIGHT;
+ m_icon.setLayoutData(gd);
+ m_icon.setVisible(getIconImageDescriptor() != null);
+
+ gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.horizontalIndent = 5;
+ gd.grabExcessHorizontalSpace = true;
+ m_content.setLayoutData(gd);
+
+ gd = new GridData();
+ gd.grabExcessHorizontalSpace = false;
+ m_statusIcon.setLayoutData(gd);
+
+ gd = new GridData();
+ gd.grabExcessHorizontalSpace = false;
+ gd.exclude = !m_resetLinkVisible;
+ gd.horizontalIndent = 5;
+ m_resetLink.setLayoutData(gd);
+ m_resetLink.setVisible(m_resetLinkVisible);
+
+ setUseLinkAsLabel(m_useLinkAsLabel);
+ setBoldLabelText(m_boldLabelText);
+
+ return m_container;
+ }
+
+ public void setPresenterId(int presenterId) {
+ m_presenterId = presenterId;
+ }
+
+ public void setLabel(String label) {
+ m_labelText = label;
+ if (isControlCreated()) {
+ m_label.setText(StringUtility.nvl(m_labelText, ""));
+ m_link.setText(StringUtility.nvl(m_labelText, ""));
+ }
+ }
+
+ public String getLabel() {
+ return m_labelText;
+ }
+
+ public ImageDescriptor getIconImageDescriptor() {
+ return m_iconImageDescriptor;
+ }
+
+ public void setIconImageDescriptor(ImageDescriptor iconImageDescriptor) {
+ m_iconImageDescriptor = iconImageDescriptor;
+ if (isControlCreated()) {
+ if (iconImageDescriptor != null) {
+ m_icon.setImage(iconImageDescriptor.createImage());
+ }
+ else {
+ m_icon.setImage(null);
+ }
+ m_icon.setToolTipText(StringUtility.nvl(m_iconTooltip, ""));
+ m_icon.setVisible(iconImageDescriptor != null);
+ m_icon.getParent().layout(true);
+ }
+ }
+
+ public String getIconTooltip() {
+ return m_iconTooltip;
+ }
+
+ public void setIconTooltip(String iconTooltip) {
+ m_iconTooltip = iconTooltip;
+ if (isControlCreated()) {
+ m_icon.setToolTipText(StringUtility.nvl(iconTooltip, ""));
+ }
+ }
+
+ public void setTooltip(String tooltip) {
+ m_tooltip = tooltip;
+ if (isControlCreated()) {
+ m_label.setToolTipText(StringUtility.nvl(tooltip, ""));
+ m_link.setToolTipText(StringUtility.nvl(tooltip, ""));
+ }
+ }
+
+ public void setResetTooltip(String resetTooltip) {
+ m_resetTooltip = resetTooltip;
+ if (isControlCreated()) {
+ m_resetLink.setToolTipText(StringUtility.nvl(resetTooltip, ""));
+ }
+ }
+
+ public boolean isUseLinkAsLabel() {
+ return m_useLinkAsLabel;
+ }
+
+ public void setUseLinkAsLabel(boolean useLinkAsLabel) {
+ if (m_useLinkAsLabel == useLinkAsLabel) {
+ return;
+ }
+
+ m_useLinkAsLabel = useLinkAsLabel;
+ if (isControlCreated()) {
+ ((GridData) m_label.getLayoutData()).exclude = m_useLinkAsLabel;
+ m_label.setVisible(!m_useLinkAsLabel); // required as exclude does not hide the control properly (bug)
+ ((GridData) m_link.getLayoutData()).exclude = !m_useLinkAsLabel;
+ m_link.setVisible(m_useLinkAsLabel); // required as exclude does not hide the control properly (bug)
+ m_container.layout();
+ }
+ }
+
+ public boolean isLinkAlwaysEnabled() {
+ return m_linkAlwaysEnabled;
+ }
+
+ public void setLinkAlwaysEnabled(boolean linkAlwaysEnabled) {
+ m_linkAlwaysEnabled = linkAlwaysEnabled;
+ if (linkAlwaysEnabled) {
+ if (isControlCreated()) {
+ m_link.setEnabled(true);
+ }
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ if (!isLinkAlwaysEnabled()) {
+ super.setEnabled(enabled);
+ }
+ else {
+ m_content.setEnabled(enabled);
+ m_label.setEnabled(enabled);
+ m_icon.setEnabled(enabled);
+ m_statusIcon.setEnabled(enabled);
+ }
+ }
+
+ public boolean isResetLinkVisible() {
+ return m_resetLinkVisible;
+ }
+
+ public void setResetLinkVisible(boolean resetLinkVisible) {
+ if (m_resetLinkVisible == resetLinkVisible) {
+ return;
+ }
+ m_resetLinkVisible = resetLinkVisible;
+ if (isControlCreated()) {
+ ((GridData) m_resetLink.getLayoutData()).exclude = !m_resetLinkVisible;
+ m_resetLink.setVisible(m_resetLinkVisible);
+ m_container.layout();
+ }
+ }
+
+ public void setMarkerType(MarkerType markerType) {
+ m_markerType = markerType;
+ }
+
+ public MarkerType getMarkerType() {
+ return m_markerType;
+ }
+
+ public void setMarkerGroupUUID(String markerGroupUUID) {
+ m_markerGroupUUID = markerGroupUUID;
+ }
+
+ public String getMarkerGroupUUID() {
+ return m_markerGroupUUID;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public void addValueChangedListener(IPresenterValueChangedListener listener) {
+ m_valueChangedListeners.add(listener);
+ }
+
+ public void removeValueChangedListener(IPresenterValueChangedListener listener) {
+ m_valueChangedListeners.remove(listener);
+ }
+
+ public void setInput(final T value) {
+ if (m_container == null) {
+ createPresenter();
+ }
+ if (m_container.isDisposed()) {
+ return;
+ }
+
+ clearInfo();
+ try {
+ m_value = value;
+ setInputInternal(value);
+ }
+ finally {
+ updateInfo();
+ }
+ }
+
+ public void setInfo(int severity, String info) {
+ m_customSeverity = severity;
+ m_customInfo = info;
+ updateInfo();
+ }
+
+ public void clearInfo() {
+ clearInfo(true);
+ }
+
+ public void clearInfo(boolean updateUi) {
+ m_customInfo = null;
+ m_customSeverity = IMarker.SEVERITY_INFO;
+
+ if (updateUi) {
+ updateInfo();
+ }
+ }
+
+ public void updateInfo() {
+ if (isDisposed()) {
+ return;
+ }
+ String info = null;
+ int severity = IMarker.SEVERITY_INFO;
+
+ List<SeverityEntry> statusList = new ArrayList<SeverityEntry>();
+ statusList.add(new SeverityEntry(NumberUtility.nvl(m_customSeverity, IMarker.SEVERITY_INFO), m_customInfo));
+
+ // marker status
+ if (m_markerType != null && m_bundle != null) {
+ IMarker[] markers = MarkerUtility.getMarkers(m_bundle, m_markerType, m_markerGroupUUID);
+
+ for (IMarker marker : markers) {
+ statusList.add(new SeverityEntry(marker.getAttribute(IMarker.SEVERITY, IMarker.SEVERITY_INFO), marker.getAttribute(IMarker.MESSAGE, null)));
+ }
+ }
+
+ try {
+ updateSeverity(statusList);
+ }
+ catch (CoreException e) {
+ JaxWsSdk.logError(e);
+ }
+
+ for (SeverityEntry severityEntry : statusList) {
+ severity = Math.max(severity, severityEntry.getSeverity());
+ if (StringUtility.hasText(severityEntry.getMessage())) {
+ info = StringUtility.join("\n" + info, severityEntry.getMessage());
+ }
+ }
+
+ // visualize status
+ Image image;
+ switch (severity) {
+ case IMarker.SEVERITY_WARNING:
+ image = ScoutSdkUi.getImage(ScoutSdkUi.StatusWarning);
+ break;
+ case IMarker.SEVERITY_ERROR:
+ image = ScoutSdkUi.getImage(ScoutSdkUi.StatusError);
+ break;
+ default:
+ image = ScoutSdkUi.getImage(ScoutSdkUi.StatusInfo);
+ }
+
+ if (!StringUtility.hasText(info)) {
+ info = null;
+ }
+
+ GridData gridDataIcon = (GridData) m_statusIcon.getLayoutData();
+
+ if (severity == IMarker.SEVERITY_INFO && info == null) {
+ // clear info
+ if (!gridDataIcon.exclude) {
+ gridDataIcon.exclude = true;
+ m_statusIcon.setVisible(false);
+ m_container.layout();
+ }
+ }
+ else {
+ m_statusIcon.setImage(image);
+ m_statusIcon.setToolTipText(StringUtility.nvl(info, ""));
+
+ if (gridDataIcon.exclude) {
+ gridDataIcon.exclude = false;
+ m_statusIcon.setVisible(true);
+ m_container.layout();
+ }
+ }
+ }
+
+ public T getValue() {
+ return m_value;
+ }
+
+ public boolean isAcceptNullValue() {
+ return m_acceptNullValue;
+ }
+
+ public void setAcceptNullValue(boolean acceptNullValue) {
+ m_acceptNullValue = acceptNullValue;
+ }
+
+ public boolean isBoldLabelText() {
+ return m_boldLabelText;
+ }
+
+ public void setBoldLabelText(boolean boldLabelText) {
+ if (m_boldLabelText == boldLabelText) {
+ return;
+ }
+ m_boldLabelText = boldLabelText;
+ if (isControlCreated()) {
+ m_link.setFont(getFont(JFaceResources.DIALOG_FONT, boldLabelText));
+ m_label.setFont(getFont(JFaceResources.DIALOG_FONT, boldLabelText));
+ }
+ }
+
+ /**
+ * Sets the value in the presenter's model and notifies attached listeners
+ *
+ * @param newValue
+ */
+ protected void setValueFromUI(T newValue) {
+ setValueFromUI(newValue, false);
+ }
+
+ /**
+ * Sets the value in the presenter's model and notifies attached listeners
+ *
+ * @param newValue
+ * @param force
+ * to force set the value without equality check of new and old value
+ */
+ protected void setValueFromUI(T newValue, boolean force) {
+ if (!isStateChanging() && (force || !CompareUtility.equals(getValue(), newValue)) && (newValue != null || isAcceptNullValue())) {
+ m_value = newValue;
+ for (IPresenterValueChangedListener listener : m_valueChangedListeners.toArray(new IPresenterValueChangedListener[m_valueChangedListeners.size()])) {
+ try {
+ listener.propertyChanged(m_presenterId, newValue);
+ }
+ catch (Throwable t) {
+ // nop
+ }
+ }
+ }
+ clearInfo();
+ }
+
+ /**
+ * is called to update the presenter's UI representation
+ *
+ * @param input
+ * @return
+ */
+ protected abstract void setInputInternal(T input);
+
+ protected abstract Control createContent(Composite parent);
+
+ protected boolean isControlCreated() {
+ return m_container != null && !m_container.isDisposed();
+ }
+
+ protected boolean isStateChanging() {
+ return m_stateChanging > 0;
+ }
+
+ public void setStateChanging(boolean b) {
+ if (b) {
+ m_stateChanging++;
+ }
+ else {
+ m_stateChanging--;
+ }
+ }
+
+ protected void execLinkAction() throws CoreException {
+ }
+
+ protected void execResetAction() throws CoreException {
+ }
+
+ protected void updateSeverity(List<SeverityEntry> statusList) throws CoreException {
+ }
+
+ public static class SeverityEntry {
+ private int m_severity;
+ private String m_message;
+
+ public SeverityEntry(int severity, String message) {
+ m_severity = severity;
+ m_message = message;
+ }
+
+ public int getSeverity() {
+ return m_severity;
+ }
+
+ public void setSeverity(int severity) {
+ m_severity = severity;
+ }
+
+ public String getMessage() {
+ return m_message;
+ }
+
+ public void setMessage(String message) {
+ m_message = message;
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AbstractStringActionPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AbstractStringActionPresenter.java
index 5243a7df7..8d7a38989 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AbstractStringActionPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AbstractStringActionPresenter.java
@@ -1,131 +1,131 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-
-public abstract class AbstractStringActionPresenter extends AbstractPropertyPresenter<String> {
-
- protected StyledText m_styledText;
- private String m_tooltip;
- protected ImageHyperlink m_actionLink;
- private String m_actionLinkTooltip;
- private boolean m_actionLinkEnabled;
-
- public AbstractStringActionPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- super(parent, toolkit, false);
- setAcceptNullValue(true);
- setUseLinkAsLabel(false);
- setResetLinkVisible(false);
- setActionLinkEnabled(true);
- callInitializer();
- }
-
- public String getTooltip() {
- return m_tooltip;
- }
-
- @Override
- public void setTooltip(String tooltip) {
- m_tooltip = tooltip;
- if (isControlCreated()) {
- m_styledText.setToolTipText(StringUtility.nvl(m_tooltip, ""));
- }
- }
-
- public String getActionLinkTooltip() {
- return m_actionLinkTooltip;
- }
-
- public void setActionLinkTooltip(String actionTooltip) {
- m_actionLinkTooltip = actionTooltip;
- if (isControlCreated()) {
- m_actionLink.setToolTipText(StringUtility.nvl(actionTooltip, ""));
- }
- }
-
- public void setActionLinkEnabled(boolean actionLinkEnabled) {
- m_actionLinkEnabled = actionLinkEnabled;
- if (isControlCreated()) {
- m_actionLink.setEnabled(actionLinkEnabled);
- }
- }
-
- @Override
- protected Control createContent(Composite parent) {
- Composite composite = new Composite(parent, SWT.NONE);
-
- m_styledText = new StyledText(composite, SWT.SINGLE | SWT.BORDER);
- m_styledText.setEditable(false);
- m_styledText.setBackground(JaxWsSdkUtility.getColorLightGray());
- m_styledText.setToolTipText(StringUtility.nvl(m_tooltip, ""));
-
- m_actionLink = getToolkit().createImageHyperlink(composite, SWT.NONE);
- m_actionLink.setToolTipText(StringUtility.nvl(m_actionLinkTooltip, ""));
- m_actionLink.setImage(JaxWsSdk.getImage(JaxWsIcons.UrlPattern));
- m_actionLink.setEnabled(m_actionLinkEnabled);
- m_actionLink.addHyperlinkListener(new HyperlinkAdapter() {
-
- @Override
- public void linkActivated(HyperlinkEvent event) {
- try {
- execAction();
- }
- catch (CoreException e) {
- JaxWsSdk.logError(e);
- }
- }
- });
-
- // layout
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = 0;
- layout.marginWidth = 0;
- layout.numColumns = 5;
- layout.marginBottom = 0;
- layout.marginTop = 0;
- layout.verticalSpacing = 0;
- layout.makeColumnsEqualWidth = false;
- composite.setLayout(layout);
-
- GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.grabExcessHorizontalSpace = true;
- m_styledText.setLayoutData(gd);
-
- gd = new GridData();
- gd.grabExcessHorizontalSpace = false;
- gd.horizontalIndent = 5;
- m_actionLink.setLayoutData(gd);
-
- return composite;
- }
-
- @Override
- protected void setInputInternal(String input) {
- m_styledText.setText(StringUtility.nvl(input, ""));
- }
-
- protected abstract void execAction() throws CoreException;
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
+
+public abstract class AbstractStringActionPresenter extends AbstractPropertyPresenter<String> {
+
+ protected StyledText m_styledText;
+ private String m_tooltip;
+ protected ImageHyperlink m_actionLink;
+ private String m_actionLinkTooltip;
+ private boolean m_actionLinkEnabled;
+
+ public AbstractStringActionPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ super(parent, toolkit, false);
+ setAcceptNullValue(true);
+ setUseLinkAsLabel(false);
+ setResetLinkVisible(false);
+ setActionLinkEnabled(true);
+ callInitializer();
+ }
+
+ public String getTooltip() {
+ return m_tooltip;
+ }
+
+ @Override
+ public void setTooltip(String tooltip) {
+ m_tooltip = tooltip;
+ if (isControlCreated()) {
+ m_styledText.setToolTipText(StringUtility.nvl(m_tooltip, ""));
+ }
+ }
+
+ public String getActionLinkTooltip() {
+ return m_actionLinkTooltip;
+ }
+
+ public void setActionLinkTooltip(String actionTooltip) {
+ m_actionLinkTooltip = actionTooltip;
+ if (isControlCreated()) {
+ m_actionLink.setToolTipText(StringUtility.nvl(actionTooltip, ""));
+ }
+ }
+
+ public void setActionLinkEnabled(boolean actionLinkEnabled) {
+ m_actionLinkEnabled = actionLinkEnabled;
+ if (isControlCreated()) {
+ m_actionLink.setEnabled(actionLinkEnabled);
+ }
+ }
+
+ @Override
+ protected Control createContent(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+
+ m_styledText = new StyledText(composite, SWT.SINGLE | SWT.BORDER);
+ m_styledText.setEditable(false);
+ m_styledText.setBackground(JaxWsSdkUtility.getColorLightGray());
+ m_styledText.setToolTipText(StringUtility.nvl(m_tooltip, ""));
+
+ m_actionLink = getToolkit().createImageHyperlink(composite, SWT.NONE);
+ m_actionLink.setToolTipText(StringUtility.nvl(m_actionLinkTooltip, ""));
+ m_actionLink.setImage(JaxWsSdk.getImage(JaxWsIcons.UrlPattern));
+ m_actionLink.setEnabled(m_actionLinkEnabled);
+ m_actionLink.addHyperlinkListener(new HyperlinkAdapter() {
+
+ @Override
+ public void linkActivated(HyperlinkEvent event) {
+ try {
+ execAction();
+ }
+ catch (CoreException e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+ });
+
+ // layout
+ GridLayout layout = new GridLayout();
+ layout.horizontalSpacing = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 5;
+ layout.marginBottom = 0;
+ layout.marginTop = 0;
+ layout.verticalSpacing = 0;
+ layout.makeColumnsEqualWidth = false;
+ composite.setLayout(layout);
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.grabExcessHorizontalSpace = true;
+ m_styledText.setLayoutData(gd);
+
+ gd = new GridData();
+ gd.grabExcessHorizontalSpace = false;
+ gd.horizontalIndent = 5;
+ m_actionLink.setLayoutData(gd);
+
+ return composite;
+ }
+
+ @Override
+ protected void setInputInternal(String input) {
+ m_styledText.setText(StringUtility.nvl(input, ""));
+ }
+
+ protected abstract void execAction() throws CoreException;
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/ActionPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/ActionPresenter.java
index c5988d7fc..6eb55b57f 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/ActionPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/ActionPresenter.java
@@ -1,144 +1,144 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jdt.ui.JavaElementImageDescriptor;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.swt.action.IPresenterAction;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-
-public class ActionPresenter extends AbstractPresenter {
-
- private IPresenterAction m_presenterAction;
-
- private Label m_icon;
- private Text m_text;
- private ImageHyperlink m_link;
-
- public ActionPresenter(Composite parent, IPresenterAction presenterAction, PropertyViewFormToolkit toolkit) {
- super(toolkit, parent);
- m_presenterAction = presenterAction;
- createPresenter();
- }
-
- /**
- * To reset the action
- *
- * @param action
- */
- public void setAction(IPresenterAction action) {
- m_presenterAction = action;
-
- if (!getContainer().isDisposed()) {
- for (Control child : getContainer().getChildren()) {
- child.dispose();
- }
- }
-
- createPresenter();
- getContainer().layout();
- }
-
- public Control createPresenter() {
- Composite presenter = getContainer();
- if (m_presenterAction == null) {
- return presenter; // not initialized yet
- }
-
- // icon
- m_icon = new Label(presenter, SWT.NONE);
- m_icon.setToolTipText(m_presenterAction.getToolTip());
- if (m_presenterAction.getImage() != null) {
- m_icon.setImage(ScoutSdkUi.getImage(new JavaElementImageDescriptor(m_presenterAction.getImage(), SWT.NONE, new Point(16, 16))));
- }
-
- // text
- m_text = new Text(presenter, SWT.READ_ONLY | SWT.MULTI);
- if (StringUtility.hasText(m_presenterAction.getLeadingText())) {
- m_text.setText(m_presenterAction.getLeadingText());
- }
- m_text.setToolTipText(m_presenterAction.getToolTip());
-
- // link
- m_link = getToolkit().createImageHyperlink(presenter, SWT.NONE);
- if (StringUtility.hasText(m_presenterAction.getLinkText())) {
- m_link.setText(m_presenterAction.getLinkText());
- }
- m_link.setToolTipText(m_presenterAction.getToolTip());
- m_link.addHyperlinkListener(new HyperlinkAdapter() {
-
- @Override
- public void linkActivated(HyperlinkEvent e) {
- try {
- m_presenterAction.execute(null, null, null);
- }
- catch (ExecutionException e1) {
- JaxWsSdk.logError(e1);
- }
- }
- });
-
- // layout
- GridLayout layout = new GridLayout(3, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- presenter.setLayout(layout);
-
- // icon
- GridData gd = new GridData();
- gd.exclude = (m_icon.getImage() == null);
- gd.widthHint = 20;
- m_icon.setLayoutData(gd);
-
- // text
- gd = new GridData();
- gd.exclude = !StringUtility.hasText(m_presenterAction.getLeadingText());
- m_text.setLayoutData(gd);
-
- // link
- gd = new GridData();
- gd.exclude = !StringUtility.hasText(m_presenterAction.getLinkText());
- m_link.setLayoutData(gd);
-
- return presenter;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- if (!isDisposed()) {
- m_link.setEnabled(enabled);
- m_icon.setEnabled(enabled);
- m_text.setEnabled(enabled);
- }
- }
-
- @Override
- public boolean isMultiLine() {
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.jdt.ui.JavaElementImageDescriptor;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.swt.action.IPresenterAction;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
+
+public class ActionPresenter extends AbstractPresenter {
+
+ private IPresenterAction m_presenterAction;
+
+ private Label m_icon;
+ private Text m_text;
+ private ImageHyperlink m_link;
+
+ public ActionPresenter(Composite parent, IPresenterAction presenterAction, PropertyViewFormToolkit toolkit) {
+ super(toolkit, parent);
+ m_presenterAction = presenterAction;
+ createPresenter();
+ }
+
+ /**
+ * To reset the action
+ *
+ * @param action
+ */
+ public void setAction(IPresenterAction action) {
+ m_presenterAction = action;
+
+ if (!getContainer().isDisposed()) {
+ for (Control child : getContainer().getChildren()) {
+ child.dispose();
+ }
+ }
+
+ createPresenter();
+ getContainer().layout();
+ }
+
+ public Control createPresenter() {
+ Composite presenter = getContainer();
+ if (m_presenterAction == null) {
+ return presenter; // not initialized yet
+ }
+
+ // icon
+ m_icon = new Label(presenter, SWT.NONE);
+ m_icon.setToolTipText(m_presenterAction.getToolTip());
+ if (m_presenterAction.getImage() != null) {
+ m_icon.setImage(ScoutSdkUi.getImage(new JavaElementImageDescriptor(m_presenterAction.getImage(), SWT.NONE, new Point(16, 16))));
+ }
+
+ // text
+ m_text = new Text(presenter, SWT.READ_ONLY | SWT.MULTI);
+ if (StringUtility.hasText(m_presenterAction.getLeadingText())) {
+ m_text.setText(m_presenterAction.getLeadingText());
+ }
+ m_text.setToolTipText(m_presenterAction.getToolTip());
+
+ // link
+ m_link = getToolkit().createImageHyperlink(presenter, SWT.NONE);
+ if (StringUtility.hasText(m_presenterAction.getLinkText())) {
+ m_link.setText(m_presenterAction.getLinkText());
+ }
+ m_link.setToolTipText(m_presenterAction.getToolTip());
+ m_link.addHyperlinkListener(new HyperlinkAdapter() {
+
+ @Override
+ public void linkActivated(HyperlinkEvent e) {
+ try {
+ m_presenterAction.execute(null, null, null);
+ }
+ catch (ExecutionException e1) {
+ JaxWsSdk.logError(e1);
+ }
+ }
+ });
+
+ // layout
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ presenter.setLayout(layout);
+
+ // icon
+ GridData gd = new GridData();
+ gd.exclude = (m_icon.getImage() == null);
+ gd.widthHint = 20;
+ m_icon.setLayoutData(gd);
+
+ // text
+ gd = new GridData();
+ gd.exclude = !StringUtility.hasText(m_presenterAction.getLeadingText());
+ m_text.setLayoutData(gd);
+
+ // link
+ gd = new GridData();
+ gd.exclude = !StringUtility.hasText(m_presenterAction.getLinkText());
+ m_link.setLayoutData(gd);
+
+ return presenter;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ if (!isDisposed()) {
+ m_link.setEnabled(enabled);
+ m_icon.setEnabled(enabled);
+ m_text.setEnabled(enabled);
+ }
+ }
+
+ @Override
+ public boolean isMultiLine() {
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AnnotationPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AnnotationPresenter.java
index 60ecd9544..775cad155 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AnnotationPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AnnotationPresenter.java
@@ -1,209 +1,209 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.operation.IOperation;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.operation.SourceRangeRemoveOperation;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.ui.PlatformUI;
-
-public class AnnotationPresenter extends AbstractPropertyPresenter<IAnnotation> {
-
- private IType m_type;
- private IType m_annotationType;
- protected Button m_checkbox;
- protected Label m_label;
- private SelectionListener m_selectionListener;
-
- public AnnotationPresenter(Composite parent, PropertyViewFormToolkit toolkit, IType type, IType annotationType) {
- super(parent, toolkit, false);
- m_selectionListener = new P_SelectionListener();
- m_type = type;
- m_annotationType = annotationType;
- setLinkAlwaysEnabled(true);
- callInitializer();
- }
-
- @Override
- protected Control createContent(Composite parent) {
- m_checkbox = new Button(parent, SWT.CHECK);
- m_label = new Label(parent, SWT.NONE);
-
- // layout
- GridLayout layout = new GridLayout(2, false);
- layout.marginLeft = 0;
- layout.marginRight = 0;
- layout.marginTop = 0;
- layout.marginBottom = 0;
- layout.marginHeight = 0;
- layout.marginWidth = 0;
- parent.setLayout(layout);
- m_checkbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
-
- GridData gd = new GridData();
- gd.horizontalAlignment = SWT.RIGHT;
- m_label.setLayoutData(gd);
- m_label.setFont(PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry().getItalic(JFaceResources.DIALOG_FONT));
- m_label.setText(Texts.get("inherited"));
- return m_checkbox;
- }
-
- @Override
- protected void setInputInternal(IAnnotation input) {
- m_checkbox.removeSelectionListener(m_selectionListener);
- try {
- m_checkbox.setSelection(input != null);
- }
- finally {
- m_checkbox.addSelectionListener(m_selectionListener);
- }
-
- updateStyle(input);
- }
-
- private void updateStyle(IAnnotation annotation) {
- m_label.setVisible(false);
- if (annotation != null) {
- setUseLinkAsLabel(true);
- if (JaxWsSdkUtility.isAnnotationOnDeclaringType(m_type, annotation)) {
- // annotation on declaring type.
- setBoldLabelText(true);
- setEnabled(true);
- }
- else {
- setTooltip(Texts.get("XisInheritedFromY", annotation.getElementName(), annotation.getParent().getElementName()));
- m_label.setVisible(true);
- setBoldLabelText(false);
- setEnabled(false); // cannot be changed as annotation is configured in super type
- }
- }
- else {
- setUseLinkAsLabel(false);
- setBoldLabelText(false);
- setEnabled(true);
- }
- }
-
- private final class P_SelectionListener extends SelectionAdapter {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (m_checkbox.getSelection()) {
- P_AnnotationCreateOperation op = new P_AnnotationCreateOperation();
- new OperationJob(op).schedule();
- }
- else {
- IAnnotation annotation = JaxWsSdkUtility.getAnnotation(m_type, TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction).getFullyQualifiedName(), false);
- if (annotation != null) {
- SourceRangeRemoveOperation op = new SourceRangeRemoveOperation();
- op.setAnnotation(annotation);
- op.setDeclaringType(m_type);
- new OperationJob(op).schedule();
- setValueFromUI(null);
- }
- }
- }
- }
-
- /**
- * No supported. Use {@link AnnotationPresenter#updatePresenter()} instead.
- */
- @Override
- public void setInput(IAnnotation value) {
- throw new UnsupportedOperationException();
- }
-
- public void updatePresenter() {
- IAnnotation annotation = JaxWsSdkUtility.getAnnotation(m_type, m_annotationType.getFullyQualifiedName(), true);
- super.setInput(annotation);
- }
-
- @Override
- protected void setValueFromUI(IAnnotation newValue) {
- updateStyle(newValue);
- super.setValueFromUI(newValue);
- }
-
- @Override
- protected void execLinkAction() throws CoreException {
- if (getValue() == null) {
- return;
- }
- try {
- JavaUI.openInEditor(getValue());
- }
- catch (Exception e) {
- JaxWsSdk.logWarning(e);
- }
- }
-
- public IType getType() {
- return m_type;
- }
-
- public void setType(IType type) {
- m_type = type;
- }
-
- private class P_AnnotationCreateOperation implements IOperation {
-
- @Override
- public void validate() throws IllegalArgumentException {
- }
-
- @Override
- public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- AnnotationUpdateOperation op = new AnnotationUpdateOperation();
- op.setAnnotationType(m_annotationType);
- op.setDeclaringType(m_type);
- op.run(monitor, workingCopyManager);
-
- final IAnnotation annotation = JaxWsSdkUtility.getAnnotation(m_type, m_annotationType.getFullyQualifiedName(), false);
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- setValueFromUI(annotation);
- }
- });
- }
-
- @Override
- public String getOperationName() {
- return P_AnnotationCreateOperation.class.getName();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.operation.IOperation;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.operation.SourceRangeRemoveOperation;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.PlatformUI;
+
+public class AnnotationPresenter extends AbstractPropertyPresenter<IAnnotation> {
+
+ private IType m_type;
+ private IType m_annotationType;
+ protected Button m_checkbox;
+ protected Label m_label;
+ private SelectionListener m_selectionListener;
+
+ public AnnotationPresenter(Composite parent, PropertyViewFormToolkit toolkit, IType type, IType annotationType) {
+ super(parent, toolkit, false);
+ m_selectionListener = new P_SelectionListener();
+ m_type = type;
+ m_annotationType = annotationType;
+ setLinkAlwaysEnabled(true);
+ callInitializer();
+ }
+
+ @Override
+ protected Control createContent(Composite parent) {
+ m_checkbox = new Button(parent, SWT.CHECK);
+ m_label = new Label(parent, SWT.NONE);
+
+ // layout
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginLeft = 0;
+ layout.marginRight = 0;
+ layout.marginTop = 0;
+ layout.marginBottom = 0;
+ layout.marginHeight = 0;
+ layout.marginWidth = 0;
+ parent.setLayout(layout);
+ m_checkbox.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+
+ GridData gd = new GridData();
+ gd.horizontalAlignment = SWT.RIGHT;
+ m_label.setLayoutData(gd);
+ m_label.setFont(PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getFontRegistry().getItalic(JFaceResources.DIALOG_FONT));
+ m_label.setText(Texts.get("inherited"));
+ return m_checkbox;
+ }
+
+ @Override
+ protected void setInputInternal(IAnnotation input) {
+ m_checkbox.removeSelectionListener(m_selectionListener);
+ try {
+ m_checkbox.setSelection(input != null);
+ }
+ finally {
+ m_checkbox.addSelectionListener(m_selectionListener);
+ }
+
+ updateStyle(input);
+ }
+
+ private void updateStyle(IAnnotation annotation) {
+ m_label.setVisible(false);
+ if (annotation != null) {
+ setUseLinkAsLabel(true);
+ if (JaxWsSdkUtility.isAnnotationOnDeclaringType(m_type, annotation)) {
+ // annotation on declaring type.
+ setBoldLabelText(true);
+ setEnabled(true);
+ }
+ else {
+ setTooltip(Texts.get("XisInheritedFromY", annotation.getElementName(), annotation.getParent().getElementName()));
+ m_label.setVisible(true);
+ setBoldLabelText(false);
+ setEnabled(false); // cannot be changed as annotation is configured in super type
+ }
+ }
+ else {
+ setUseLinkAsLabel(false);
+ setBoldLabelText(false);
+ setEnabled(true);
+ }
+ }
+
+ private final class P_SelectionListener extends SelectionAdapter {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (m_checkbox.getSelection()) {
+ P_AnnotationCreateOperation op = new P_AnnotationCreateOperation();
+ new OperationJob(op).schedule();
+ }
+ else {
+ IAnnotation annotation = JaxWsSdkUtility.getAnnotation(m_type, TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction).getFullyQualifiedName(), false);
+ if (annotation != null) {
+ SourceRangeRemoveOperation op = new SourceRangeRemoveOperation();
+ op.setAnnotation(annotation);
+ op.setDeclaringType(m_type);
+ new OperationJob(op).schedule();
+ setValueFromUI(null);
+ }
+ }
+ }
+ }
+
+ /**
+ * No supported. Use {@link AnnotationPresenter#updatePresenter()} instead.
+ */
+ @Override
+ public void setInput(IAnnotation value) {
+ throw new UnsupportedOperationException();
+ }
+
+ public void updatePresenter() {
+ IAnnotation annotation = JaxWsSdkUtility.getAnnotation(m_type, m_annotationType.getFullyQualifiedName(), true);
+ super.setInput(annotation);
+ }
+
+ @Override
+ protected void setValueFromUI(IAnnotation newValue) {
+ updateStyle(newValue);
+ super.setValueFromUI(newValue);
+ }
+
+ @Override
+ protected void execLinkAction() throws CoreException {
+ if (getValue() == null) {
+ return;
+ }
+ try {
+ JavaUI.openInEditor(getValue());
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning(e);
+ }
+ }
+
+ public IType getType() {
+ return m_type;
+ }
+
+ public void setType(IType type) {
+ m_type = type;
+ }
+
+ private class P_AnnotationCreateOperation implements IOperation {
+
+ @Override
+ public void validate() throws IllegalArgumentException {
+ }
+
+ @Override
+ public void run(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ AnnotationUpdateOperation op = new AnnotationUpdateOperation();
+ op.setAnnotationType(m_annotationType);
+ op.setDeclaringType(m_type);
+ op.run(monitor, workingCopyManager);
+
+ final IAnnotation annotation = JaxWsSdkUtility.getAnnotation(m_type, m_annotationType.getFullyQualifiedName(), false);
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ setValueFromUI(annotation);
+ }
+ });
+ }
+
+ @Override
+ public String getOperationName() {
+ return P_AnnotationCreateOperation.class.getName();
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AnnotationPropertyTypePresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AnnotationPropertyTypePresenter.java
index 8394592b8..4c648bde5 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AnnotationPropertyTypePresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/AnnotationPropertyTypePresenter.java
@@ -1,65 +1,65 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
-import org.eclipse.swt.widgets.Composite;
-
-public class AnnotationPropertyTypePresenter extends TypePresenter {
-
- private String m_property;
- private IType m_declaringType;
- private IType m_annotationType;
-
- public AnnotationPropertyTypePresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- super(parent, toolkit);
- }
-
- @Override
- protected void execResetAction() throws CoreException {
- if (TypeUtility.exists(m_declaringType)) {
- AnnotationUpdateOperation op = new AnnotationUpdateOperation();
- op.setAnnotationType(m_annotationType);
- op.setDeclaringType(m_declaringType);
- op.removeProperty(m_property);
- new OperationJob(op).schedule();
- }
- }
-
- public IType getDeclaringType() {
- return m_declaringType;
- }
-
- public void setDeclaringType(IType declaringType) {
- m_declaringType = declaringType;
- }
-
- public String getProperty() {
- return m_property;
- }
-
- public void setProperty(String property) {
- m_property = property;
- }
-
- public IType getAnnotationType() {
- return m_annotationType;
- }
-
- public void setAnnotationType(IType annotationType) {
- m_annotationType = annotationType;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.ws.jaxws.operation.AnnotationUpdateOperation;
+import org.eclipse.swt.widgets.Composite;
+
+public class AnnotationPropertyTypePresenter extends TypePresenter {
+
+ private String m_property;
+ private IType m_declaringType;
+ private IType m_annotationType;
+
+ public AnnotationPropertyTypePresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ super(parent, toolkit);
+ }
+
+ @Override
+ protected void execResetAction() throws CoreException {
+ if (TypeUtility.exists(m_declaringType)) {
+ AnnotationUpdateOperation op = new AnnotationUpdateOperation();
+ op.setAnnotationType(m_annotationType);
+ op.setDeclaringType(m_declaringType);
+ op.removeProperty(m_property);
+ new OperationJob(op).schedule();
+ }
+ }
+
+ public IType getDeclaringType() {
+ return m_declaringType;
+ }
+
+ public void setDeclaringType(IType declaringType) {
+ m_declaringType = declaringType;
+ }
+
+ public String getProperty() {
+ return m_property;
+ }
+
+ public void setProperty(String property) {
+ m_property = property;
+ }
+
+ public IType getAnnotationType() {
+ return m_annotationType;
+ }
+
+ public void setAnnotationType(IType annotationType) {
+ m_annotationType = annotationType;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/BindingFilePresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/BindingFilePresenter.java
index e79dc39d7..e71ac333f 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/BindingFilePresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/BindingFilePresenter.java
@@ -1,129 +1,129 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.FileDeleteOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.MessageBox;
-
-public class BindingFilePresenter extends FilePresenter {
-
- private BuildJaxWsBean m_buildJaxWsBean;
-
- public BindingFilePresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- super(parent, toolkit);
- setResetLinkVisible(true);
- setFileDirectory(JaxWsConstants.PATH_BUILD);
- setFileExtension("xml");
- setLabel(Texts.get("BindingFile"));
- setMarkerType(MarkerType.BindingFile);
- setResetTooltip(Texts.get("TooltipRemoveBindingFile"));
- }
-
- @Override
- protected IFile execBrowseAction() {
- IFile oldFile = getValue();
- IFile newFile = super.execBrowseAction();
- if (newFile == null || CompareUtility.equals(oldFile, newFile)) {
- return null;
- }
-
- Map<String, List<String>> propertiers = m_buildJaxWsBean.getPropertiers();
- String path = null;
- if (oldFile != null) {
- path = oldFile.getProjectRelativePath().toPortableString();
- }
- if (!removeBindingFileEntry(propertiers, path)) {
- return null;
- }
- JaxWsSdkUtility.addBuildProperty(propertiers, JaxWsConstants.OPTION_BINDING_FILE, newFile.getProjectRelativePath().toPortableString());
- m_buildJaxWsBean.setProperties(propertiers);
-
- // store property map
- ResourceFactory.getBuildJaxWsResource(m_bundle).storeXmlAsync(m_buildJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_PROPERTIES_CHANGED, m_buildJaxWsBean.getAlias());
- return newFile;
- }
-
- @Override
- protected void execResetAction() throws CoreException {
- IFile file = getValue();
-
- String bindingFileRaw = null;
- if (file != null) {
- bindingFileRaw = file.getProjectRelativePath().toPortableString();
- }
-
- Map<String, List<String>> propertiers = m_buildJaxWsBean.getPropertiers();
- if (!removeBindingFileEntry(propertiers, bindingFileRaw)) {
- return; // used canceled operation
- }
-
- // store property map
- m_buildJaxWsBean.setProperties(propertiers);
- ResourceFactory.getBuildJaxWsResource(m_bundle).storeXmlAsync(m_buildJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_PROPERTIES_CHANGED, m_buildJaxWsBean.getAlias());
- }
-
- private boolean removeBindingFileEntry(Map<String, List<String>> properties, String bindingFileRaw) {
- IFile bindingFile = JaxWsSdkUtility.getFile(m_bundle, bindingFileRaw, false);
- if (bindingFile != null && bindingFile.exists()) {
- MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.CANCEL);
- messageBox.setMessage(Texts.get("QuestionShouldFileXAlsoBeDeletedFromDisk", bindingFileRaw));
- int status = messageBox.open();
- if (status == SWT.YES) {
- FileDeleteOperation op = new FileDeleteOperation();
- op.setFile(bindingFile);
- new OperationJob(op).schedule();
- }
- else if (status == SWT.CANCEL) {
- return false;
- }
- }
-
- List<String> bindingFiles = properties.get(JaxWsConstants.OPTION_BINDING_FILE);
-
- if (bindingFiles != null && bindingFiles.size() > 0) {
- while (bindingFiles.remove(bindingFileRaw)) {
- // nop -> in case multiple entries have null as their value <property name="b" />
- }
-
- if (bindingFiles.size() == 0) {
- properties.remove(JaxWsConstants.OPTION_BINDING_FILE);
- }
- }
-
- return true;
- }
-
- public BuildJaxWsBean getBuildJaxWsBean() {
- return m_buildJaxWsBean;
- }
-
- public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
- m_buildJaxWsBean = buildJaxWsBean;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.FileDeleteOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.MessageBox;
+
+public class BindingFilePresenter extends FilePresenter {
+
+ private BuildJaxWsBean m_buildJaxWsBean;
+
+ public BindingFilePresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ super(parent, toolkit);
+ setResetLinkVisible(true);
+ setFileDirectory(JaxWsConstants.PATH_BUILD);
+ setFileExtension("xml");
+ setLabel(Texts.get("BindingFile"));
+ setMarkerType(MarkerType.BindingFile);
+ setResetTooltip(Texts.get("TooltipRemoveBindingFile"));
+ }
+
+ @Override
+ protected IFile execBrowseAction() {
+ IFile oldFile = getValue();
+ IFile newFile = super.execBrowseAction();
+ if (newFile == null || CompareUtility.equals(oldFile, newFile)) {
+ return null;
+ }
+
+ Map<String, List<String>> propertiers = m_buildJaxWsBean.getPropertiers();
+ String path = null;
+ if (oldFile != null) {
+ path = oldFile.getProjectRelativePath().toPortableString();
+ }
+ if (!removeBindingFileEntry(propertiers, path)) {
+ return null;
+ }
+ JaxWsSdkUtility.addBuildProperty(propertiers, JaxWsConstants.OPTION_BINDING_FILE, newFile.getProjectRelativePath().toPortableString());
+ m_buildJaxWsBean.setProperties(propertiers);
+
+ // store property map
+ ResourceFactory.getBuildJaxWsResource(m_bundle).storeXmlAsync(m_buildJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_PROPERTIES_CHANGED, m_buildJaxWsBean.getAlias());
+ return newFile;
+ }
+
+ @Override
+ protected void execResetAction() throws CoreException {
+ IFile file = getValue();
+
+ String bindingFileRaw = null;
+ if (file != null) {
+ bindingFileRaw = file.getProjectRelativePath().toPortableString();
+ }
+
+ Map<String, List<String>> propertiers = m_buildJaxWsBean.getPropertiers();
+ if (!removeBindingFileEntry(propertiers, bindingFileRaw)) {
+ return; // used canceled operation
+ }
+
+ // store property map
+ m_buildJaxWsBean.setProperties(propertiers);
+ ResourceFactory.getBuildJaxWsResource(m_bundle).storeXmlAsync(m_buildJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_PROPERTIES_CHANGED, m_buildJaxWsBean.getAlias());
+ }
+
+ private boolean removeBindingFileEntry(Map<String, List<String>> properties, String bindingFileRaw) {
+ IFile bindingFile = JaxWsSdkUtility.getFile(m_bundle, bindingFileRaw, false);
+ if (bindingFile != null && bindingFile.exists()) {
+ MessageBox messageBox = new MessageBox(ScoutSdkUi.getShell(), SWT.ICON_QUESTION | SWT.YES | SWT.NO | SWT.CANCEL);
+ messageBox.setMessage(Texts.get("QuestionShouldFileXAlsoBeDeletedFromDisk", bindingFileRaw));
+ int status = messageBox.open();
+ if (status == SWT.YES) {
+ FileDeleteOperation op = new FileDeleteOperation();
+ op.setFile(bindingFile);
+ new OperationJob(op).schedule();
+ }
+ else if (status == SWT.CANCEL) {
+ return false;
+ }
+ }
+
+ List<String> bindingFiles = properties.get(JaxWsConstants.OPTION_BINDING_FILE);
+
+ if (bindingFiles != null && bindingFiles.size() > 0) {
+ while (bindingFiles.remove(bindingFileRaw)) {
+ // nop -> in case multiple entries have null as their value <property name="b" />
+ }
+
+ if (bindingFiles.size() == 0) {
+ properties.remove(JaxWsConstants.OPTION_BINDING_FILE);
+ }
+ }
+
+ return true;
+ }
+
+ public BuildJaxWsBean getBuildJaxWsBean() {
+ return m_buildJaxWsBean;
+ }
+
+ public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
+ m_buildJaxWsBean = buildJaxWsBean;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/BooleanPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/BooleanPresenter.java
index 0cb21b39a..3f4c186d8 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/BooleanPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/BooleanPresenter.java
@@ -1,58 +1,58 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import org.eclipse.scout.commons.BooleanUtility;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-public class BooleanPresenter extends AbstractPropertyPresenter<Boolean> {
-
- protected Button m_checkbox;
- private SelectionListener m_selectionListener;
-
- public BooleanPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- super(parent, toolkit, false);
- m_selectionListener = new P_SelectionListener();
- callInitializer();
- }
-
- @Override
- protected Control createContent(Composite parent) {
- m_checkbox = new Button(parent, SWT.CHECK);
- return m_checkbox;
- }
-
- @Override
- protected void setInputInternal(Boolean input) {
- m_checkbox.removeSelectionListener(m_selectionListener);
- try {
- m_checkbox.setSelection(BooleanUtility.nvl(input, false));
- }
- finally {
- m_checkbox.addSelectionListener(m_selectionListener);
- }
- }
-
- private final class P_SelectionListener extends SelectionAdapter {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- setValueFromUI(m_checkbox.getSelection());
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import org.eclipse.scout.commons.BooleanUtility;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public class BooleanPresenter extends AbstractPropertyPresenter<Boolean> {
+
+ protected Button m_checkbox;
+ private SelectionListener m_selectionListener;
+
+ public BooleanPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ super(parent, toolkit, false);
+ m_selectionListener = new P_SelectionListener();
+ callInitializer();
+ }
+
+ @Override
+ protected Control createContent(Composite parent) {
+ m_checkbox = new Button(parent, SWT.CHECK);
+ return m_checkbox;
+ }
+
+ @Override
+ protected void setInputInternal(Boolean input) {
+ m_checkbox.removeSelectionListener(m_selectionListener);
+ try {
+ m_checkbox.setSelection(BooleanUtility.nvl(input, false));
+ }
+ finally {
+ m_checkbox.addSelectionListener(m_selectionListener);
+ }
+ }
+
+ private final class P_SelectionListener extends SelectionAdapter {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setValueFromUI(m_checkbox.getSelection());
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/FilePresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/FilePresenter.java
index 9b9fbd61c..281b4a34b 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/FilePresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/FilePresenter.java
@@ -1,214 +1,214 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.ExternalFileCopyOperation;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.ide.IDE;
-
-public class FilePresenter extends AbstractPropertyPresenter<IFile> {
-
- private Composite m_composite;
- private Text m_textField;
- private Button m_button;
- private String m_fileExtension;
- private String m_fileDirectory;
- private boolean m_showBrowseButton;
-
- public FilePresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- super(parent, toolkit, false);
- setLabel(Texts.get("File"));
- setUseLinkAsLabel(true);
- setShowBrowseButton(true);
- callInitializer();
- }
-
- @Override
- protected final Control createContent(Composite parent) {
- m_composite = getToolkit().createComposite(parent, SWT.NONE);
- m_textField = getToolkit().createText(m_composite, "", SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL);
- m_textField.setEditable(false);
- m_textField.setBackground(JaxWsSdkUtility.getColorLightGray());
-
- m_button = new Button(m_composite, SWT.PUSH | SWT.FLAT);
- m_button.setText(getConfiguredBrowseButtonLabel());
- m_button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IFile file = execBrowseAction();
- if (file != null) {
- setInputInternal(file);
- setValueFromUI(file);
- }
- }
- });
-
- // layout
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = 0;
- layout.marginWidth = 0;
- layout.numColumns = 2;
- layout.marginBottom = 0;
- layout.marginRight = 0;
- layout.marginLeft = 0;
- layout.marginTop = 0;
- layout.verticalSpacing = 0;
- layout.marginHeight = 0;
- layout.makeColumnsEqualWidth = false;
- m_composite.setLayout(layout);
-
- GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.grabExcessHorizontalSpace = true;
- m_textField.setLayoutData(gd);
-
- gd = new GridData();
- gd.grabExcessHorizontalSpace = false;
- gd.widthHint = 50;
- gd.horizontalIndent = 5;
- gd.exclude = !isShowBrowseButton();
- m_button.setLayoutData(gd);
-
- return m_composite;
- }
-
- protected String getConfiguredBrowseButtonLabel() {
- return Texts.get("Browse");
- }
-
- @Override
- protected void setInputInternal(IFile input) {
- if (input != null) {
- m_textField.setText(input.getName());
- m_textField.setToolTipText(input.getName());
- }
- else {
- m_textField.setText("");
- m_textField.setToolTipText(null);
- }
-
- setUseLinkAsLabel(input != null && input.exists());
- }
-
- @Override
- protected void execLinkAction() throws CoreException {
- IFile file = getValue();
- if (file != null && file.exists()) {
- IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file, true);
- }
- }
-
- protected IFile execBrowseAction() {
- FileDialog dialog = new FileDialog(ScoutSdkUi.getShell(), SWT.OPEN);
- if (StringUtility.hasText(m_fileExtension)) {
- dialog.setFilterNames(new String[]{m_fileExtension});
- dialog.setFilterExtensions(new String[]{"*." + m_fileExtension});
- }
- String path = dialog.open();
- if (path == null) {
- return null;
- }
- File file = IOUtility.toFile(path);
-
- // check whether to copy external file into workspace
- if (isCopyRequired(file)) {
- ExternalFileCopyOperation op = new ExternalFileCopyOperation();
- op.setBundle(m_bundle);
- op.setOverwrite(true);
- op.setExternalFile(file);
- op.setWorkspacePath(new Path(m_fileDirectory));
- OperationJob job = new OperationJob(op);
- job.schedule();
- try {
- job.join();
- }
- catch (InterruptedException e) {
- JaxWsSdk.logError("unexpected error occured while waiting for operation to complete", e);
- return null;
- }
- }
-
- return JaxWsSdkUtility.getFile(m_bundle, JaxWsSdkUtility.normalizePath(m_fileDirectory, SeparatorType.BothType) + file.getName(), false);
- }
-
- public String getFileExtension() {
- return m_fileExtension;
- }
-
- public void setFileExtension(String fileExtension) {
- m_fileExtension = fileExtension;
- }
-
- public String getFileDirectory() {
- return m_fileDirectory;
- }
-
- public void setFileDirectory(String fileDirectory) {
- m_fileDirectory = fileDirectory;
- }
-
- public boolean isShowBrowseButton() {
- return m_showBrowseButton;
- }
-
- public void setShowBrowseButton(boolean showBrowseButton) {
- if (m_showBrowseButton == showBrowseButton) {
- return;
- }
- m_showBrowseButton = showBrowseButton;
-
- m_showBrowseButton = showBrowseButton;
- if (isControlCreated()) {
- ((GridData) m_button.getLayoutData()).exclude = !showBrowseButton;
- m_composite.layout();
- }
- }
-
- private boolean isCopyRequired(File file) {
- IFile potentialSameFile = JaxWsSdkUtility.getFile(m_bundle, JaxWsSdkUtility.normalizePath(m_fileDirectory, SeparatorType.BothType) + file.getName(), false);
-
- if (potentialSameFile != null && potentialSameFile.exists()) {
- IPath potentialSameFilePath = new Path(potentialSameFile.getLocationURI().getRawPath());
- IPath filePath = new Path(file.getAbsolutePath());
-
- if (potentialSameFilePath.equals(filePath)) {
- return false;
- }
- }
-
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.ExternalFileCopyOperation;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.ide.IDE;
+
+public class FilePresenter extends AbstractPropertyPresenter<IFile> {
+
+ private Composite m_composite;
+ private Text m_textField;
+ private Button m_button;
+ private String m_fileExtension;
+ private String m_fileDirectory;
+ private boolean m_showBrowseButton;
+
+ public FilePresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ super(parent, toolkit, false);
+ setLabel(Texts.get("File"));
+ setUseLinkAsLabel(true);
+ setShowBrowseButton(true);
+ callInitializer();
+ }
+
+ @Override
+ protected final Control createContent(Composite parent) {
+ m_composite = getToolkit().createComposite(parent, SWT.NONE);
+ m_textField = getToolkit().createText(m_composite, "", SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL);
+ m_textField.setEditable(false);
+ m_textField.setBackground(JaxWsSdkUtility.getColorLightGray());
+
+ m_button = new Button(m_composite, SWT.PUSH | SWT.FLAT);
+ m_button.setText(getConfiguredBrowseButtonLabel());
+ m_button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IFile file = execBrowseAction();
+ if (file != null) {
+ setInputInternal(file);
+ setValueFromUI(file);
+ }
+ }
+ });
+
+ // layout
+ GridLayout layout = new GridLayout();
+ layout.horizontalSpacing = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ layout.marginBottom = 0;
+ layout.marginRight = 0;
+ layout.marginLeft = 0;
+ layout.marginTop = 0;
+ layout.verticalSpacing = 0;
+ layout.marginHeight = 0;
+ layout.makeColumnsEqualWidth = false;
+ m_composite.setLayout(layout);
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.grabExcessHorizontalSpace = true;
+ m_textField.setLayoutData(gd);
+
+ gd = new GridData();
+ gd.grabExcessHorizontalSpace = false;
+ gd.widthHint = 50;
+ gd.horizontalIndent = 5;
+ gd.exclude = !isShowBrowseButton();
+ m_button.setLayoutData(gd);
+
+ return m_composite;
+ }
+
+ protected String getConfiguredBrowseButtonLabel() {
+ return Texts.get("Browse");
+ }
+
+ @Override
+ protected void setInputInternal(IFile input) {
+ if (input != null) {
+ m_textField.setText(input.getName());
+ m_textField.setToolTipText(input.getName());
+ }
+ else {
+ m_textField.setText("");
+ m_textField.setToolTipText(null);
+ }
+
+ setUseLinkAsLabel(input != null && input.exists());
+ }
+
+ @Override
+ protected void execLinkAction() throws CoreException {
+ IFile file = getValue();
+ if (file != null && file.exists()) {
+ IDE.openEditor(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(), file, true);
+ }
+ }
+
+ protected IFile execBrowseAction() {
+ FileDialog dialog = new FileDialog(ScoutSdkUi.getShell(), SWT.OPEN);
+ if (StringUtility.hasText(m_fileExtension)) {
+ dialog.setFilterNames(new String[]{m_fileExtension});
+ dialog.setFilterExtensions(new String[]{"*." + m_fileExtension});
+ }
+ String path = dialog.open();
+ if (path == null) {
+ return null;
+ }
+ File file = IOUtility.toFile(path);
+
+ // check whether to copy external file into workspace
+ if (isCopyRequired(file)) {
+ ExternalFileCopyOperation op = new ExternalFileCopyOperation();
+ op.setBundle(m_bundle);
+ op.setOverwrite(true);
+ op.setExternalFile(file);
+ op.setWorkspacePath(new Path(m_fileDirectory));
+ OperationJob job = new OperationJob(op);
+ job.schedule();
+ try {
+ job.join();
+ }
+ catch (InterruptedException e) {
+ JaxWsSdk.logError("unexpected error occured while waiting for operation to complete", e);
+ return null;
+ }
+ }
+
+ return JaxWsSdkUtility.getFile(m_bundle, JaxWsSdkUtility.normalizePath(m_fileDirectory, SeparatorType.BothType) + file.getName(), false);
+ }
+
+ public String getFileExtension() {
+ return m_fileExtension;
+ }
+
+ public void setFileExtension(String fileExtension) {
+ m_fileExtension = fileExtension;
+ }
+
+ public String getFileDirectory() {
+ return m_fileDirectory;
+ }
+
+ public void setFileDirectory(String fileDirectory) {
+ m_fileDirectory = fileDirectory;
+ }
+
+ public boolean isShowBrowseButton() {
+ return m_showBrowseButton;
+ }
+
+ public void setShowBrowseButton(boolean showBrowseButton) {
+ if (m_showBrowseButton == showBrowseButton) {
+ return;
+ }
+ m_showBrowseButton = showBrowseButton;
+
+ m_showBrowseButton = showBrowseButton;
+ if (isControlCreated()) {
+ ((GridData) m_button.getLayoutData()).exclude = !showBrowseButton;
+ m_composite.layout();
+ }
+ }
+
+ private boolean isCopyRequired(File file) {
+ IFile potentialSameFile = JaxWsSdkUtility.getFile(m_bundle, JaxWsSdkUtility.normalizePath(m_fileDirectory, SeparatorType.BothType) + file.getName(), false);
+
+ if (potentialSameFile != null && potentialSameFile.exists()) {
+ IPath potentialSameFilePath = new Path(potentialSameFile.getLocationURI().getRawPath());
+ IPath filePath = new Path(file.getAbsolutePath());
+
+ if (potentialSameFilePath.equals(filePath)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/FolderPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/FolderPresenter.java
index d2e1aaf21..23cce4b0f 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/FolderPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/FolderPresenter.java
@@ -1,279 +1,279 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.internal.ui.wizards.buildpaths.FolderSelectionDialog;
-import org.eclipse.jdt.ui.IPackagesViewPart;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbenchPage;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.views.navigator.ResourceComparator;
-
-@SuppressWarnings("restriction")
-public class FolderPresenter extends AbstractPropertyPresenter<IFolder> {
-
- private Composite m_composite;
- private Text m_textField;
- private Button m_button;
- private boolean m_showBrowseButton;
- private String m_messageFolderDialog;
- private String m_titleFolderDialog;
-
- public FolderPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- this(parent, toolkit, DEFAULT_LABEL_WIDTH, true);
- }
-
- public FolderPresenter(Composite parent, PropertyViewFormToolkit toolkit, int labelWidth, boolean initialize) {
- super(parent, toolkit, labelWidth, false);
- setLabel(Texts.get("Folder"));
- setMessageFolderDialog(Texts.get("ChooseFolder"));
- setTitleFolderDialog(Texts.get("ChooseFolder"));
- setUseLinkAsLabel(true);
- setShowBrowseButton(true);
- if (initialize) {
- callInitializer();
- }
- }
-
- @Override
- protected final Control createContent(Composite parent) {
- m_composite = getToolkit().createComposite(parent, SWT.NONE);
- m_textField = getToolkit().createText(m_composite, "", SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL);
- m_textField.setEditable(false);
- m_textField.setBackground(JaxWsSdkUtility.getColorLightGray());
-
- m_button = new Button(m_composite, SWT.PUSH | SWT.FLAT);
- m_button.setText(getConfiguredBrowseButtonLabel());
- m_button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IFolder folder = execBrowseAction();
- if (folder != null) {
- setInputInternal(folder);
- setValueFromUI(folder);
- }
- }
- });
-
- // layout
- GridLayout layout = new GridLayout();
- layout.horizontalSpacing = 0;
- layout.marginWidth = 0;
- layout.numColumns = 2;
- layout.marginBottom = 0;
- layout.marginRight = 0;
- layout.marginLeft = 0;
- layout.marginTop = 0;
- layout.verticalSpacing = 0;
- layout.marginHeight = 0;
- layout.makeColumnsEqualWidth = false;
- m_composite.setLayout(layout);
-
- GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.grabExcessHorizontalSpace = true;
- m_textField.setLayoutData(gd);
-
- gd = new GridData();
- gd.grabExcessHorizontalSpace = false;
- gd.widthHint = 50;
- gd.horizontalIndent = 5;
- gd.exclude = !isShowBrowseButton();
- m_button.setLayoutData(gd);
-
- return m_composite;
- }
-
- @Override
- protected void setInputInternal(IFolder input) {
- if (input != null) {
- m_textField.setText(input.getProjectRelativePath().toPortableString());
- m_textField.setToolTipText(input.getProjectRelativePath().toPortableString());
- }
- else {
- m_textField.setText("");
- m_textField.setToolTipText(null);
- }
-
- setUseLinkAsLabel(input != null && input.exists());
- }
-
- @Override
- protected void execLinkAction() throws CoreException {
- IFolder folder = getValue();
- if (folder != null && folder.exists()) {
- IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
- IPackagesViewPart viewPart;
- viewPart = (IPackagesViewPart) page.showView(JavaUI.ID_PACKAGES);
- viewPart.selectAndReveal(folder);
- }
- else {
- JaxWsSdk.logInfo("Could not find folder");
- }
- }
-
- protected IFolder execBrowseAction() {
- ILabelProvider labelProvider = new WorkbenchLabelProvider();
- ITreeContentProvider contentProvider = new WorkbenchContentProvider();
- FolderSelectionDialog dialog = new FolderSelectionDialog(ScoutSdkUi.getShell(), labelProvider, contentProvider);
- dialog.setTitle(getTitleFolderDialog());
- dialog.setMessage(getMessageFolderDialog());
- dialog.addFilter(createFilter());
- dialog.setHelpAvailable(false);
- dialog.setAllowMultiple(false);
- dialog.setInput(m_bundle.getProject());
- dialog.setInitialSelection(getValue());
- dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
-
- if (dialog.open() == Window.OK) {
- return (IFolder) dialog.getFirstResult();
- }
- return null;
- }
-
- public boolean isShowBrowseButton() {
- return m_showBrowseButton;
- }
-
- public void setShowBrowseButton(boolean showBrowseButton) {
- if (m_showBrowseButton == showBrowseButton) {
- return;
- }
- m_showBrowseButton = showBrowseButton;
-
- m_showBrowseButton = showBrowseButton;
- if (isControlCreated()) {
- ((GridData) m_button.getLayoutData()).exclude = !showBrowseButton;
- m_composite.layout();
- }
- }
-
- protected ViewerFilter createFilter() {
- return new FolderFilter(m_bundle);
- }
-
- protected String getConfiguredBrowseButtonLabel() {
- return Texts.get("Browse");
- }
-
- public String getMessageFolderDialog() {
- return m_messageFolderDialog;
- }
-
- public void setMessageFolderDialog(String messageFolderDialog) {
- m_messageFolderDialog = messageFolderDialog;
- }
-
- public String getTitleFolderDialog() {
- return m_titleFolderDialog;
- }
-
- public void setTitleFolderDialog(String titleFolderDialog) {
- m_titleFolderDialog = titleFolderDialog;
- }
-
- public static class FolderFilter extends ViewerFilter {
-
- private IScoutBundle m_bundle;
- private Set<IPath> m_unsupportedFolders;
-
- public FolderFilter(IScoutBundle bundle) {
- m_unsupportedFolders = new HashSet<IPath>();
- m_bundle = bundle;
-
- try {
- for (IClasspathEntry classpathEntry : m_bundle.getJavaProject().getRawClasspath()) {
- IPath outputLocation = classpathEntry.getOutputLocation();
- // skip output directories of classpath entry
- if (outputLocation != null) {
- m_unsupportedFolders.add(toProjectRelativePath(outputLocation));
- }
-
- // skip source folders
- if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
- m_unsupportedFolders.add(toProjectRelativePath(classpathEntry.getPath()));
- }
- }
-
- // skip default output directory
- IPath defaultOutputLocation = m_bundle.getJavaProject().getOutputLocation();
- if (defaultOutputLocation != null) {
- m_unsupportedFolders.add(toProjectRelativePath(defaultOutputLocation));
- }
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- }
-
- }
-
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (!(element instanceof IFolder)) {
- return false;
- }
- IFolder folder = (IFolder) element;
- // exclude hidden folders
- if (folder.getName().startsWith(".")) {
- return false;
- }
-
- // exclude source folders
- if (m_unsupportedFolders.contains(folder.getProjectRelativePath())) {
- return false;
- }
-
- return true;
- }
-
- private IPath toProjectRelativePath(IPath path) {
- IFolder folder = m_bundle.getProject().getFolder(path);
- if (folder != null && folder.exists()) {
- return folder.getProjectRelativePath();
- }
-
- folder = m_bundle.getProject().getWorkspace().getRoot().getFolder(path);
- if (folder != null && folder.exists()) {
- return folder.getProjectRelativePath();
- }
- return path;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.internal.ui.wizards.buildpaths.FolderSelectionDialog;
+import org.eclipse.jdt.ui.IPackagesViewPart;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.views.navigator.ResourceComparator;
+
+@SuppressWarnings("restriction")
+public class FolderPresenter extends AbstractPropertyPresenter<IFolder> {
+
+ private Composite m_composite;
+ private Text m_textField;
+ private Button m_button;
+ private boolean m_showBrowseButton;
+ private String m_messageFolderDialog;
+ private String m_titleFolderDialog;
+
+ public FolderPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ this(parent, toolkit, DEFAULT_LABEL_WIDTH, true);
+ }
+
+ public FolderPresenter(Composite parent, PropertyViewFormToolkit toolkit, int labelWidth, boolean initialize) {
+ super(parent, toolkit, labelWidth, false);
+ setLabel(Texts.get("Folder"));
+ setMessageFolderDialog(Texts.get("ChooseFolder"));
+ setTitleFolderDialog(Texts.get("ChooseFolder"));
+ setUseLinkAsLabel(true);
+ setShowBrowseButton(true);
+ if (initialize) {
+ callInitializer();
+ }
+ }
+
+ @Override
+ protected final Control createContent(Composite parent) {
+ m_composite = getToolkit().createComposite(parent, SWT.NONE);
+ m_textField = getToolkit().createText(m_composite, "", SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL);
+ m_textField.setEditable(false);
+ m_textField.setBackground(JaxWsSdkUtility.getColorLightGray());
+
+ m_button = new Button(m_composite, SWT.PUSH | SWT.FLAT);
+ m_button.setText(getConfiguredBrowseButtonLabel());
+ m_button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IFolder folder = execBrowseAction();
+ if (folder != null) {
+ setInputInternal(folder);
+ setValueFromUI(folder);
+ }
+ }
+ });
+
+ // layout
+ GridLayout layout = new GridLayout();
+ layout.horizontalSpacing = 0;
+ layout.marginWidth = 0;
+ layout.numColumns = 2;
+ layout.marginBottom = 0;
+ layout.marginRight = 0;
+ layout.marginLeft = 0;
+ layout.marginTop = 0;
+ layout.verticalSpacing = 0;
+ layout.marginHeight = 0;
+ layout.makeColumnsEqualWidth = false;
+ m_composite.setLayout(layout);
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.grabExcessHorizontalSpace = true;
+ m_textField.setLayoutData(gd);
+
+ gd = new GridData();
+ gd.grabExcessHorizontalSpace = false;
+ gd.widthHint = 50;
+ gd.horizontalIndent = 5;
+ gd.exclude = !isShowBrowseButton();
+ m_button.setLayoutData(gd);
+
+ return m_composite;
+ }
+
+ @Override
+ protected void setInputInternal(IFolder input) {
+ if (input != null) {
+ m_textField.setText(input.getProjectRelativePath().toPortableString());
+ m_textField.setToolTipText(input.getProjectRelativePath().toPortableString());
+ }
+ else {
+ m_textField.setText("");
+ m_textField.setToolTipText(null);
+ }
+
+ setUseLinkAsLabel(input != null && input.exists());
+ }
+
+ @Override
+ protected void execLinkAction() throws CoreException {
+ IFolder folder = getValue();
+ if (folder != null && folder.exists()) {
+ IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+ IPackagesViewPart viewPart;
+ viewPart = (IPackagesViewPart) page.showView(JavaUI.ID_PACKAGES);
+ viewPart.selectAndReveal(folder);
+ }
+ else {
+ JaxWsSdk.logInfo("Could not find folder");
+ }
+ }
+
+ protected IFolder execBrowseAction() {
+ ILabelProvider labelProvider = new WorkbenchLabelProvider();
+ ITreeContentProvider contentProvider = new WorkbenchContentProvider();
+ FolderSelectionDialog dialog = new FolderSelectionDialog(ScoutSdkUi.getShell(), labelProvider, contentProvider);
+ dialog.setTitle(getTitleFolderDialog());
+ dialog.setMessage(getMessageFolderDialog());
+ dialog.addFilter(createFilter());
+ dialog.setHelpAvailable(false);
+ dialog.setAllowMultiple(false);
+ dialog.setInput(m_bundle.getProject());
+ dialog.setInitialSelection(getValue());
+ dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+
+ if (dialog.open() == Window.OK) {
+ return (IFolder) dialog.getFirstResult();
+ }
+ return null;
+ }
+
+ public boolean isShowBrowseButton() {
+ return m_showBrowseButton;
+ }
+
+ public void setShowBrowseButton(boolean showBrowseButton) {
+ if (m_showBrowseButton == showBrowseButton) {
+ return;
+ }
+ m_showBrowseButton = showBrowseButton;
+
+ m_showBrowseButton = showBrowseButton;
+ if (isControlCreated()) {
+ ((GridData) m_button.getLayoutData()).exclude = !showBrowseButton;
+ m_composite.layout();
+ }
+ }
+
+ protected ViewerFilter createFilter() {
+ return new FolderFilter(m_bundle);
+ }
+
+ protected String getConfiguredBrowseButtonLabel() {
+ return Texts.get("Browse");
+ }
+
+ public String getMessageFolderDialog() {
+ return m_messageFolderDialog;
+ }
+
+ public void setMessageFolderDialog(String messageFolderDialog) {
+ m_messageFolderDialog = messageFolderDialog;
+ }
+
+ public String getTitleFolderDialog() {
+ return m_titleFolderDialog;
+ }
+
+ public void setTitleFolderDialog(String titleFolderDialog) {
+ m_titleFolderDialog = titleFolderDialog;
+ }
+
+ public static class FolderFilter extends ViewerFilter {
+
+ private IScoutBundle m_bundle;
+ private Set<IPath> m_unsupportedFolders;
+
+ public FolderFilter(IScoutBundle bundle) {
+ m_unsupportedFolders = new HashSet<IPath>();
+ m_bundle = bundle;
+
+ try {
+ for (IClasspathEntry classpathEntry : m_bundle.getJavaProject().getRawClasspath()) {
+ IPath outputLocation = classpathEntry.getOutputLocation();
+ // skip output directories of classpath entry
+ if (outputLocation != null) {
+ m_unsupportedFolders.add(toProjectRelativePath(outputLocation));
+ }
+
+ // skip source folders
+ if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ m_unsupportedFolders.add(toProjectRelativePath(classpathEntry.getPath()));
+ }
+ }
+
+ // skip default output directory
+ IPath defaultOutputLocation = m_bundle.getJavaProject().getOutputLocation();
+ if (defaultOutputLocation != null) {
+ m_unsupportedFolders.add(toProjectRelativePath(defaultOutputLocation));
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ }
+
+ }
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (!(element instanceof IFolder)) {
+ return false;
+ }
+ IFolder folder = (IFolder) element;
+ // exclude hidden folders
+ if (folder.getName().startsWith(".")) {
+ return false;
+ }
+
+ // exclude source folders
+ if (m_unsupportedFolders.contains(folder.getProjectRelativePath())) {
+ return false;
+ }
+
+ return true;
+ }
+
+ private IPath toProjectRelativePath(IPath path) {
+ IFolder folder = m_bundle.getProject().getFolder(path);
+ if (folder != null && folder.exists()) {
+ return folder.getProjectRelativePath();
+ }
+
+ folder = m_bundle.getProject().getWorkspace().getRoot().getFolder(path);
+ if (folder != null && folder.exists()) {
+ return folder.getProjectRelativePath();
+ }
+ return path;
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/HandlerPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/HandlerPresenter.java
index 956c2809b..a64afaa99 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/HandlerPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/HandlerPresenter.java
@@ -1,224 +1,224 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import javax.xml.ws.handler.soap.SOAPHandler;
-import javax.xml.ws.handler.soap.SOAPMessageContext;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.part.AnnotationProperty;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPresenterValueChangedListener;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.widgets.ImageHyperlink;
-
-public class HandlerPresenter extends TypePresenter {
-
- private SunJaxWsBean m_sunJaxWsBean;
- private ScoutXmlElement m_xmlHandlerElement;
- private IPresenterValueChangedListener m_valueChangedListener;
- private int m_handlerIndex;
- private int m_handlerCount;
-
- public HandlerPresenter(IScoutBundle bundle, Composite parent, int handlerIndex, int handlerCount, PropertyViewFormToolkit toolkit) {
- super(parent, toolkit, 70, false);
- m_handlerIndex = handlerIndex;
- m_handlerCount = handlerCount;
- setMarkerType(MarkerType.HandlerClass);
- setBundle(bundle);
- setAcceptNullValue(false);
- setUseLinkAsLabel(true);
- setAllowChangeOfInterfaceType(false);
- setAllowChangeOfSourceFolder(false);
- setResetLinkVisible(true);
- setResetTooltip(Texts.get("TooltipRemoveHandlerRegistration"));
- setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedHandlerPackageName(m_bundle));
- m_valueChangedListener = new P_ValueChangedListener();
- addValueChangedListener(m_valueChangedListener);
-
- String interfaceSignature = Signature.createTypeSignature(SOAPHandler.class.getName() + "<" + SOAPMessageContext.class.getName() + ">", false);
- IType interfaceType = TypeUtility.getTypeBySignature(interfaceSignature);
- setInterfaceSignatures(new String[]{interfaceSignature});
- setSearchScopeFactory(createSubClassesSearchScopeFactory(interfaceType));
-
- callInitializer();
- }
-
- @Override
- protected Control createContent(Composite parent) {
- Composite composite = getToolkit().createComposite(parent, SWT.NONE);
-
- Control content = super.createContent(composite);
-
- ImageHyperlink upButton = getToolkit().createImageHyperlink(composite, SWT.NONE);
- upButton.setImage(JaxWsSdk.getImage(JaxWsIcons.Up));
- upButton.setToolTipText(Texts.get("ClickToIncreasePrecendence"));
- upButton.setEnabled(m_handlerIndex > 0);
- upButton.addHyperlinkListener(new HyperlinkAdapter() {
-
- @Override
- public void linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent e) {
- ScoutXmlElement xmlChain = m_xmlHandlerElement.getParent();
- if (m_sunJaxWsBean.swapHandler(xmlChain, m_handlerIndex, m_handlerIndex - 1)) {
- // persist
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
- }
- }
- });
-
- ImageHyperlink downButton = getToolkit().createImageHyperlink(composite, SWT.NONE);
- downButton.setImage(JaxWsSdk.getImage(JaxWsIcons.Down));
- downButton.setToolTipText(Texts.get("ClickToLowerPrecendence"));
- downButton.setEnabled(m_handlerIndex < m_handlerCount - 1);
- downButton.addHyperlinkListener(new HyperlinkAdapter() {
-
- @Override
- public void linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent e) {
- ScoutXmlElement xmlChain = m_xmlHandlerElement.getParent();
- if (m_sunJaxWsBean.swapHandler(xmlChain, m_handlerIndex, m_handlerIndex + 1)) {
- // persist
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
- }
- }
- });
- composite.setLayout(new FormLayout());
-
- FormData formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(upButton, -2, SWT.LEFT);
- content.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(2, 0);
- formData.right = new FormAttachment(100, 0);
- upButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(0, 12);
- formData.right = new FormAttachment(100, 0);
- downButton.setLayoutData(formData);
-
- return composite;
- }
-
- @Override
- public void dispose() {
- if (m_valueChangedListener != null) {
- removeValueChangedListener(m_valueChangedListener);
- m_valueChangedListener = null;
- }
- super.dispose();
- }
-
- @Override
- protected void execResetAction() throws CoreException {
- // remove itself
- m_xmlHandlerElement.getParent().removeChild(m_xmlHandlerElement);
-
- // persist
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
- }
-
- public SunJaxWsBean getSunJaxWsBean() {
- return m_sunJaxWsBean;
- }
-
- public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
- m_sunJaxWsBean = sunJaxWsBean;
- }
-
- public ScoutXmlElement getXmlHandlerElement() {
- return m_xmlHandlerElement;
- }
-
- public void setXmlHandlerElement(ScoutXmlElement xmlHandlerElement) {
- m_xmlHandlerElement = xmlHandlerElement;
- }
-
- private ISearchJavaSearchScopeFactory createSubClassesSearchScopeFactory(final IType superType) {
- return new ISearchJavaSearchScopeFactory() {
-
- @Override
- public IJavaSearchScope create() {
- // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
- IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
- return SearchEngine.createJavaSearchScope(subTypes);
- }
- };
- }
-
- private class P_ValueChangedListener implements IPresenterValueChangedListener {
-
- @Override
- public void propertyChanged(int presenterId, Object value) {
- String fqn = (String) value;
- String handlerClassElementName = m_sunJaxWsBean.toQualifiedName(SunJaxWsBean.XML_HANDLER_CLASS);
-
- m_xmlHandlerElement.removeChild(handlerClassElementName);
- ScoutXmlElement child = m_xmlHandlerElement.addChild();
- child.setName(handlerClassElementName);
- child.addText(fqn);
-
- updateTransactionalIcon(fqn);
-
- // persist
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
- }
- }
-
- private void updateTransactionalIcon(String fqn) {
- IType type = TypeUtility.getType(fqn);
- ImageDescriptor icon = null;
- String tooltip = null;
- if (TypeUtility.exists(type)) {
- IAnnotation annotation = JaxWsSdkUtility.getAnnotation(type, TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction).getFullyQualifiedName(), false);
- if (annotation != null) {
- icon = JaxWsSdk.getImageDescriptor(JaxWsIcons.Transactional);
- AnnotationProperty prop = JaxWsSdkUtility.parseAnnotationTypeValue(type, annotation, JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
- tooltip = "This is a transactional handler\nServer session factory: " + Signature.getSimpleName(prop.getFullyQualifiedName());
- }
- }
-
- setIconImageDescriptor(icon);
- setIconTooltip(tooltip);
- }
-
- @Override
- public void updateInfo() {
- updateTransactionalIcon(getValue());
- super.updateInfo();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants.MarkerType;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.part.AnnotationProperty;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IPresenterValueChangedListener;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.widgets.ImageHyperlink;
+
+public class HandlerPresenter extends TypePresenter {
+
+ private SunJaxWsBean m_sunJaxWsBean;
+ private ScoutXmlElement m_xmlHandlerElement;
+ private IPresenterValueChangedListener m_valueChangedListener;
+ private int m_handlerIndex;
+ private int m_handlerCount;
+
+ public HandlerPresenter(IScoutBundle bundle, Composite parent, int handlerIndex, int handlerCount, PropertyViewFormToolkit toolkit) {
+ super(parent, toolkit, 70, false);
+ m_handlerIndex = handlerIndex;
+ m_handlerCount = handlerCount;
+ setMarkerType(MarkerType.HandlerClass);
+ setBundle(bundle);
+ setAcceptNullValue(false);
+ setUseLinkAsLabel(true);
+ setAllowChangeOfInterfaceType(false);
+ setAllowChangeOfSourceFolder(false);
+ setResetLinkVisible(true);
+ setResetTooltip(Texts.get("TooltipRemoveHandlerRegistration"));
+ setDefaultPackageNameNewType(JaxWsSdkUtility.getRecommendedHandlerPackageName(m_bundle));
+ m_valueChangedListener = new P_ValueChangedListener();
+ addValueChangedListener(m_valueChangedListener);
+
+ String interfaceSignature = Signature.createTypeSignature(SOAPHandler.class.getName() + "<" + SOAPMessageContext.class.getName() + ">", false);
+ IType interfaceType = TypeUtility.getTypeBySignature(interfaceSignature);
+ setInterfaceSignatures(new String[]{interfaceSignature});
+ setSearchScopeFactory(createSubClassesSearchScopeFactory(interfaceType));
+
+ callInitializer();
+ }
+
+ @Override
+ protected Control createContent(Composite parent) {
+ Composite composite = getToolkit().createComposite(parent, SWT.NONE);
+
+ Control content = super.createContent(composite);
+
+ ImageHyperlink upButton = getToolkit().createImageHyperlink(composite, SWT.NONE);
+ upButton.setImage(JaxWsSdk.getImage(JaxWsIcons.Up));
+ upButton.setToolTipText(Texts.get("ClickToIncreasePrecendence"));
+ upButton.setEnabled(m_handlerIndex > 0);
+ upButton.addHyperlinkListener(new HyperlinkAdapter() {
+
+ @Override
+ public void linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent e) {
+ ScoutXmlElement xmlChain = m_xmlHandlerElement.getParent();
+ if (m_sunJaxWsBean.swapHandler(xmlChain, m_handlerIndex, m_handlerIndex - 1)) {
+ // persist
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
+ }
+ }
+ });
+
+ ImageHyperlink downButton = getToolkit().createImageHyperlink(composite, SWT.NONE);
+ downButton.setImage(JaxWsSdk.getImage(JaxWsIcons.Down));
+ downButton.setToolTipText(Texts.get("ClickToLowerPrecendence"));
+ downButton.setEnabled(m_handlerIndex < m_handlerCount - 1);
+ downButton.addHyperlinkListener(new HyperlinkAdapter() {
+
+ @Override
+ public void linkActivated(org.eclipse.ui.forms.events.HyperlinkEvent e) {
+ ScoutXmlElement xmlChain = m_xmlHandlerElement.getParent();
+ if (m_sunJaxWsBean.swapHandler(xmlChain, m_handlerIndex, m_handlerIndex + 1)) {
+ // persist
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
+ }
+ }
+ });
+ composite.setLayout(new FormLayout());
+
+ FormData formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(upButton, -2, SWT.LEFT);
+ content.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(2, 0);
+ formData.right = new FormAttachment(100, 0);
+ upButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(0, 12);
+ formData.right = new FormAttachment(100, 0);
+ downButton.setLayoutData(formData);
+
+ return composite;
+ }
+
+ @Override
+ public void dispose() {
+ if (m_valueChangedListener != null) {
+ removeValueChangedListener(m_valueChangedListener);
+ m_valueChangedListener = null;
+ }
+ super.dispose();
+ }
+
+ @Override
+ protected void execResetAction() throws CoreException {
+ // remove itself
+ m_xmlHandlerElement.getParent().removeChild(m_xmlHandlerElement);
+
+ // persist
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
+ }
+
+ public SunJaxWsBean getSunJaxWsBean() {
+ return m_sunJaxWsBean;
+ }
+
+ public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
+ m_sunJaxWsBean = sunJaxWsBean;
+ }
+
+ public ScoutXmlElement getXmlHandlerElement() {
+ return m_xmlHandlerElement;
+ }
+
+ public void setXmlHandlerElement(ScoutXmlElement xmlHandlerElement) {
+ m_xmlHandlerElement = xmlHandlerElement;
+ }
+
+ private ISearchJavaSearchScopeFactory createSubClassesSearchScopeFactory(final IType superType) {
+ return new ISearchJavaSearchScopeFactory() {
+
+ @Override
+ public IJavaSearchScope create() {
+ // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
+ IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
+ return SearchEngine.createJavaSearchScope(subTypes);
+ }
+ };
+ }
+
+ private class P_ValueChangedListener implements IPresenterValueChangedListener {
+
+ @Override
+ public void propertyChanged(int presenterId, Object value) {
+ String fqn = (String) value;
+ String handlerClassElementName = m_sunJaxWsBean.toQualifiedName(SunJaxWsBean.XML_HANDLER_CLASS);
+
+ m_xmlHandlerElement.removeChild(handlerClassElementName);
+ ScoutXmlElement child = m_xmlHandlerElement.addChild();
+ child.setName(handlerClassElementName);
+ child.addText(fqn);
+
+ updateTransactionalIcon(fqn);
+
+ // persist
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
+ }
+ }
+
+ private void updateTransactionalIcon(String fqn) {
+ IType type = TypeUtility.getType(fqn);
+ ImageDescriptor icon = null;
+ String tooltip = null;
+ if (TypeUtility.exists(type)) {
+ IAnnotation annotation = JaxWsSdkUtility.getAnnotation(type, TypeUtility.getType(JaxWsRuntimeClasses.ScoutTransaction).getFullyQualifiedName(), false);
+ if (annotation != null) {
+ icon = JaxWsSdk.getImageDescriptor(JaxWsIcons.Transactional);
+ AnnotationProperty prop = JaxWsSdkUtility.parseAnnotationTypeValue(type, annotation, JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY);
+ tooltip = "This is a transactional handler\nServer session factory: " + Signature.getSimpleName(prop.getFullyQualifiedName());
+ }
+ }
+
+ setIconImageDescriptor(icon);
+ setIconTooltip(tooltip);
+ }
+
+ @Override
+ public void updateInfo() {
+ updateTransactionalIcon(getValue());
+ super.updateInfo();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/InformationPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/InformationPresenter.java
index d454320d7..502655335 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/InformationPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/InformationPresenter.java
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import org.eclipse.jdt.ui.JavaElementImageDescriptor;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-public class InformationPresenter extends AbstractPresenter {
-
- private String m_text;
- private ImageDescriptor m_imageDescriptor;
- private Point m_iconDimension;
-
- public InformationPresenter(Composite parent, String text, PropertyViewFormToolkit toolkit) {
- this(parent, text, null, null, toolkit);
- }
-
- public InformationPresenter(Composite parent, String text, ImageDescriptor imageDescriptor, PropertyViewFormToolkit toolkit) {
- this(parent, text, imageDescriptor, new Point(16, 16), toolkit);
- }
-
- public InformationPresenter(Composite parent, String text, ImageDescriptor imageDescriptor, Point iconDimension, PropertyViewFormToolkit toolkit) {
- super(toolkit, parent);
- m_text = text;
- m_imageDescriptor = imageDescriptor;
- m_iconDimension = iconDimension;
- createPresenter();
- }
-
- public Control createPresenter() {
- Composite presenter = getContainer();
-
- // icon
- Label icon = new Label(presenter, SWT.NONE);
- if (m_imageDescriptor != null) {
- icon.setImage(ScoutSdkUi.getImage(new JavaElementImageDescriptor(m_imageDescriptor, SWT.NONE, m_iconDimension)));
- }
-
- // text
- Label text = new Label(presenter, SWT.WRAP);
- text.setText(m_text);
-
- // layout
- GridLayout layout = new GridLayout(3, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- presenter.setLayout(layout);
-
- GridData gd = new GridData();
- gd.exclude = (icon.getImage() == null);
- if (icon.getImage() != null) {
- gd.widthHint = m_iconDimension.x + 5;
- }
- icon.setLayoutData(gd);
-
- gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
- text.setLayoutData(gd);
-
- return presenter;
- }
-
- @Override
- public boolean isMultiLine() {
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import org.eclipse.jdt.ui.JavaElementImageDescriptor;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+public class InformationPresenter extends AbstractPresenter {
+
+ private String m_text;
+ private ImageDescriptor m_imageDescriptor;
+ private Point m_iconDimension;
+
+ public InformationPresenter(Composite parent, String text, PropertyViewFormToolkit toolkit) {
+ this(parent, text, null, null, toolkit);
+ }
+
+ public InformationPresenter(Composite parent, String text, ImageDescriptor imageDescriptor, PropertyViewFormToolkit toolkit) {
+ this(parent, text, imageDescriptor, new Point(16, 16), toolkit);
+ }
+
+ public InformationPresenter(Composite parent, String text, ImageDescriptor imageDescriptor, Point iconDimension, PropertyViewFormToolkit toolkit) {
+ super(toolkit, parent);
+ m_text = text;
+ m_imageDescriptor = imageDescriptor;
+ m_iconDimension = iconDimension;
+ createPresenter();
+ }
+
+ public Control createPresenter() {
+ Composite presenter = getContainer();
+
+ // icon
+ Label icon = new Label(presenter, SWT.NONE);
+ if (m_imageDescriptor != null) {
+ icon.setImage(ScoutSdkUi.getImage(new JavaElementImageDescriptor(m_imageDescriptor, SWT.NONE, m_iconDimension)));
+ }
+
+ // text
+ Label text = new Label(presenter, SWT.WRAP);
+ text.setText(m_text);
+
+ // layout
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ presenter.setLayout(layout);
+
+ GridData gd = new GridData();
+ gd.exclude = (icon.getImage() == null);
+ if (icon.getImage() != null) {
+ gd.widthHint = m_iconDimension.x + 5;
+ }
+ icon.setLayoutData(gd);
+
+ gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
+ text.setLayoutData(gd);
+
+ return presenter;
+ }
+
+ @Override
+ public boolean isMultiLine() {
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/JaxWsLibraryConflictPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/JaxWsLibraryConflictPresenter.java
index 6f26343f7..bba4e6e58 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/JaxWsLibraryConflictPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/JaxWsLibraryConflictPresenter.java
@@ -1,73 +1,73 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.PaintEvent;
-import org.eclipse.swt.events.PaintListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-public class JaxWsLibraryConflictPresenter extends AbstractPresenter {
-
- public JaxWsLibraryConflictPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- super(toolkit, parent);
- createPresenter();
- }
-
- public Control createPresenter() {
- Composite presenter = getContainer();
-
- // text
- final Label text = new Label(presenter, SWT.WRAP | SWT.LEFT);
- text.setBackground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- text.addPaintListener(new PaintListener() {
- @Override
- public void paintControl(PaintEvent e) {
- GC gc = e.gc;
- gc.setBackground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- Rectangle rect = text.getBounds();
- Rectangle border = new Rectangle(rect.x, rect.y, rect.width - 12, rect.height);
- gc.drawRectangle(border);
- }
- });
-
- text.setBackground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- text.setText("Conflicasdfasdfas\nfas dfasdf asf \nasdf asf asf asdf asdf asdfdfasdf");
-
- // layout
- GridLayout layout = new GridLayout(1, true);
- layout.marginWidth = 20;
- layout.marginHeight = 0;
- layout.horizontalSpacing = 0;
- layout.verticalSpacing = 0;
- presenter.setLayout(layout);
-
- // icon
- GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
- text.setLayoutData(gd);
-
- return presenter;
- }
-
- @Override
- public boolean isMultiLine() {
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.PaintEvent;
+import org.eclipse.swt.events.PaintListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+public class JaxWsLibraryConflictPresenter extends AbstractPresenter {
+
+ public JaxWsLibraryConflictPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ super(toolkit, parent);
+ createPresenter();
+ }
+
+ public Control createPresenter() {
+ Composite presenter = getContainer();
+
+ // text
+ final Label text = new Label(presenter, SWT.WRAP | SWT.LEFT);
+ text.setBackground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ text.addPaintListener(new PaintListener() {
+ @Override
+ public void paintControl(PaintEvent e) {
+ GC gc = e.gc;
+ gc.setBackground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
+ Rectangle rect = text.getBounds();
+ Rectangle border = new Rectangle(rect.x, rect.y, rect.width - 12, rect.height);
+ gc.drawRectangle(border);
+ }
+ });
+
+ text.setBackground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ text.setText("Conflicasdfasdfas\nfas dfasdf asf \nasdf asf asf asdf asdf asdfdfasdf");
+
+ // layout
+ GridLayout layout = new GridLayout(1, true);
+ layout.marginWidth = 20;
+ layout.marginHeight = 0;
+ layout.horizontalSpacing = 0;
+ layout.verticalSpacing = 0;
+ presenter.setLayout(layout);
+
+ // icon
+ GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
+ text.setLayoutData(gd);
+
+ return presenter;
+ }
+
+ @Override
+ public boolean isMultiLine() {
+ return false;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/PackagePresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/PackagePresenter.java
index 01d51577d..4f4778ce7 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/PackagePresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/PackagePresenter.java
@@ -1,287 +1,287 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jdt.ui.actions.OpenNewPackageWizardAction;
-import org.eclipse.jdt.ui.wizards.NewPackageWizardPage;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-@SuppressWarnings("restriction")
-public class PackagePresenter extends AbstractPropertyPresenter<String> {
-
- private Text m_textField;
- private Button m_button;
-
- private ModifyListener m_modifyListener;
- private String m_sourceFolder;
- private boolean m_allowChangeOfSourceFolder;
-
- public PackagePresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- super(parent, toolkit, false);
- setLabel(Texts.get("package"));
- setUseLinkAsLabel(true);
- m_modifyListener = new P_ModifyListener();
- callInitializer();
- }
-
- @Override
- protected Control createContent(Composite parent) {
- Composite composite = getToolkit().createComposite(parent, SWT.NONE);
- m_textField = getToolkit().createText(composite, "", SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL);
- m_textField.setEditable(true);
- m_textField.addModifyListener(m_modifyListener);
- m_textField.addFocusListener(new FocusAdapter() {
-
- @Override
- public void focusLost(FocusEvent e) {
- String packageName = m_textField.getText();
- if (validate(packageName)) {
- setValueFromUI(packageName);
- }
- }
- });
-
- m_button = new Button(composite, SWT.PUSH | SWT.FLAT);
- m_button.setText(Texts.get("Browse") + "...");
- m_button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- String packageName = openPackageBrowserDialog();
- if (packageName == null) {
- return; // dialog canceled
- }
- if (validate(packageName)) {
- setInputInternal(packageName);
- setValueFromUI(packageName);
- }
- }
- });
-
- // layout
- composite.setLayout(new FormLayout());
-
- FormData formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(m_button, -3, SWT.LEFT);
- formData.bottom = new FormAttachment(100, 0);
- m_textField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- formData.bottom = new FormAttachment(100, 0);
- m_button.setLayoutData(formData);
-
- return composite;
- }
-
- @Override
- protected void execLinkAction() throws CoreException {
- IPackageFragment packageFragment = getPackageFragment(m_textField.getText());
- if (packageFragment != null) {
- try {
- JavaUI.openInEditor(packageFragment);
- }
- catch (Exception e) {
- JaxWsSdk.logWarning(e);
- }
- }
- else {
- String packageName = openPackageNewDialog();
- if (packageName != null) {
- setInputInternal(packageName);
- setValueFromUI(packageName, true);
- }
- }
- }
-
- @Override
- protected void setInputInternal(String input) {
- m_textField.removeModifyListener(m_modifyListener);
- try {
- m_textField.setText(StringUtility.nvl(input, ""));
- }
- finally {
- m_textField.addModifyListener(m_modifyListener);
- }
- validate(input);
- }
-
- private String openPackageNewDialog() throws JavaModelException {
- NewPackageWizardPage page = new NewPackageWizardPage();
- page.setDescription(Texts.get("CreateNewPackage"));
- page.setPackageText(m_textField.getText(), true);
-
- if (!isAllowChangeOfSourceFolder() && !JaxWsSdkUtility.isValidSourceFolder(m_bundle, m_sourceFolder)) {
- return null;
- }
-
- if (m_sourceFolder != null) {
- IPath sourceFolder = m_bundle.getProject().getFullPath().append(m_sourceFolder);
- IPackageFragmentRoot root = m_bundle.getJavaProject().findPackageFragmentRoot(sourceFolder);
- page.setPackageFragmentRoot(root, isAllowChangeOfSourceFolder());
- }
-
- OpenNewPackageWizardAction action = new OpenNewPackageWizardAction();
- action.setConfiguredWizardPage(page);
- action.run();
-
- IPackageFragment packageFragment = page.getNewPackageFragment();
- if (packageFragment != null && packageFragment.exists() && validate(packageFragment.getElementName())) {
- m_sourceFolder = page.getPackageFragmentRoot().getPath().lastSegment();
- return packageFragment.getElementName();
- }
- return null;
- }
-
- private String openPackageBrowserDialog() {
- IRunnableContext context = new BusyIndicatorRunnableContext();
- SelectionDialog dialog = JavaUI.createPackageDialog(ScoutSdkUi.getShell(), context, createSearchScopeForSourceFolder(), false, true, null);
- dialog.setTitle(Texts.get("CreateNewPackage"));
-
- if (dialog.open() == Window.OK && dialog.getResult() != null && dialog.getResult().length > 0) {
- IPackageFragment packageFragment = (IPackageFragment) dialog.getResult()[0];
-
- if (TypeUtility.exists(packageFragment)) {
- m_sourceFolder = packageFragment.getParent().getPath().lastSegment();
- return packageFragment.getElementName();
- }
- }
- return null;
- }
-
- private boolean validate(String packageName) {
- setUseLinkAsLabel(false);
-
- if (!JaxWsSdkUtility.isValidSourceFolder(m_bundle, m_sourceFolder)) {
- setInfo(IMarker.SEVERITY_ERROR, "Source folder not set set or does not exist");
- return false;
- }
- if (packageName == null) {
- clearInfo();
- return isAcceptNullValue();
- }
- try {
- IPath sourceFolder = m_bundle.getProject().getFullPath().append(m_sourceFolder);
- IPackageFragmentRoot root = m_bundle.getJavaProject().findPackageFragmentRoot(sourceFolder);
- if (!TypeUtility.exists(root)) {
- setInfo(IMarker.SEVERITY_ERROR, "Source folder could not be found");
- return false;
- }
- IPackageFragment packageFragment = root.getPackageFragment(packageName);
- if ((packageFragment != null && !packageFragment.exists()) || (packageFragment == null && !isAcceptNullValue())) {
- setUseLinkAsLabel(true);
- setInfo(IMarker.SEVERITY_WARNING, Texts.get("PackageDoesNotExistClickOnLinkToCreate"));
- return false;
- }
- clearInfo();
- return true;
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("failed to validate package name", e);
- }
- clearInfo();
- return false;
- }
-
- private IPackageFragment getPackageFragment(String packageName) {
- if (validate(packageName)) {
- IPath sourceFolder = m_bundle.getProject().getFullPath().append(m_sourceFolder);
- try {
- IPackageFragmentRoot root = m_bundle.getJavaProject().findPackageFragmentRoot(sourceFolder);
- return root.getPackageFragment(packageName);
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("failed to get package fragment", e);
- }
- }
- return null;
- }
-
- public String getSourceFolder() {
- return m_sourceFolder;
- }
-
- public void setSourceFolder(String sourceFolder) {
- m_sourceFolder = sourceFolder;
- if (isControlCreated()) {
- validate(m_textField.getText());
- }
- }
-
- public boolean isAllowChangeOfSourceFolder() {
- return m_allowChangeOfSourceFolder;
- }
-
- public void setAllowChangeOfSourceFolder(boolean allowChangeOfSourceFolder) {
- m_allowChangeOfSourceFolder = allowChangeOfSourceFolder;
- }
-
- private IJavaSearchScope createSearchScopeForSourceFolder() {
- if (JaxWsSdkUtility.isValidSourceFolder(m_bundle, m_sourceFolder)) {
- try {
- IPath sourceFolder = m_bundle.getProject().getFullPath().append(m_sourceFolder);
- IPackageFragmentRoot root = m_bundle.getJavaProject().findPackageFragmentRoot(sourceFolder);
- return SearchEngine.createJavaSearchScope(new IJavaElement[]{root});
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("failed to create Java search scope for package elements", e);
- }
- }
- return SearchEngine.createJavaSearchScope(new IJavaElement[0]); // empty search scope
- }
-
- private class P_ModifyListener implements ModifyListener {
-
- @Override
- public void modifyText(ModifyEvent e) {
- if (validate(m_textField.getText())) {
- setValueFromUI(m_textField.getText());
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jdt.ui.actions.OpenNewPackageWizardAction;
+import org.eclipse.jdt.ui.wizards.NewPackageWizardPage;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+@SuppressWarnings("restriction")
+public class PackagePresenter extends AbstractPropertyPresenter<String> {
+
+ private Text m_textField;
+ private Button m_button;
+
+ private ModifyListener m_modifyListener;
+ private String m_sourceFolder;
+ private boolean m_allowChangeOfSourceFolder;
+
+ public PackagePresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ super(parent, toolkit, false);
+ setLabel(Texts.get("package"));
+ setUseLinkAsLabel(true);
+ m_modifyListener = new P_ModifyListener();
+ callInitializer();
+ }
+
+ @Override
+ protected Control createContent(Composite parent) {
+ Composite composite = getToolkit().createComposite(parent, SWT.NONE);
+ m_textField = getToolkit().createText(composite, "", SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL);
+ m_textField.setEditable(true);
+ m_textField.addModifyListener(m_modifyListener);
+ m_textField.addFocusListener(new FocusAdapter() {
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ String packageName = m_textField.getText();
+ if (validate(packageName)) {
+ setValueFromUI(packageName);
+ }
+ }
+ });
+
+ m_button = new Button(composite, SWT.PUSH | SWT.FLAT);
+ m_button.setText(Texts.get("Browse") + "...");
+ m_button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String packageName = openPackageBrowserDialog();
+ if (packageName == null) {
+ return; // dialog canceled
+ }
+ if (validate(packageName)) {
+ setInputInternal(packageName);
+ setValueFromUI(packageName);
+ }
+ }
+ });
+
+ // layout
+ composite.setLayout(new FormLayout());
+
+ FormData formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(m_button, -3, SWT.LEFT);
+ formData.bottom = new FormAttachment(100, 0);
+ m_textField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ formData.bottom = new FormAttachment(100, 0);
+ m_button.setLayoutData(formData);
+
+ return composite;
+ }
+
+ @Override
+ protected void execLinkAction() throws CoreException {
+ IPackageFragment packageFragment = getPackageFragment(m_textField.getText());
+ if (packageFragment != null) {
+ try {
+ JavaUI.openInEditor(packageFragment);
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning(e);
+ }
+ }
+ else {
+ String packageName = openPackageNewDialog();
+ if (packageName != null) {
+ setInputInternal(packageName);
+ setValueFromUI(packageName, true);
+ }
+ }
+ }
+
+ @Override
+ protected void setInputInternal(String input) {
+ m_textField.removeModifyListener(m_modifyListener);
+ try {
+ m_textField.setText(StringUtility.nvl(input, ""));
+ }
+ finally {
+ m_textField.addModifyListener(m_modifyListener);
+ }
+ validate(input);
+ }
+
+ private String openPackageNewDialog() throws JavaModelException {
+ NewPackageWizardPage page = new NewPackageWizardPage();
+ page.setDescription(Texts.get("CreateNewPackage"));
+ page.setPackageText(m_textField.getText(), true);
+
+ if (!isAllowChangeOfSourceFolder() && !JaxWsSdkUtility.isValidSourceFolder(m_bundle, m_sourceFolder)) {
+ return null;
+ }
+
+ if (m_sourceFolder != null) {
+ IPath sourceFolder = m_bundle.getProject().getFullPath().append(m_sourceFolder);
+ IPackageFragmentRoot root = m_bundle.getJavaProject().findPackageFragmentRoot(sourceFolder);
+ page.setPackageFragmentRoot(root, isAllowChangeOfSourceFolder());
+ }
+
+ OpenNewPackageWizardAction action = new OpenNewPackageWizardAction();
+ action.setConfiguredWizardPage(page);
+ action.run();
+
+ IPackageFragment packageFragment = page.getNewPackageFragment();
+ if (packageFragment != null && packageFragment.exists() && validate(packageFragment.getElementName())) {
+ m_sourceFolder = page.getPackageFragmentRoot().getPath().lastSegment();
+ return packageFragment.getElementName();
+ }
+ return null;
+ }
+
+ private String openPackageBrowserDialog() {
+ IRunnableContext context = new BusyIndicatorRunnableContext();
+ SelectionDialog dialog = JavaUI.createPackageDialog(ScoutSdkUi.getShell(), context, createSearchScopeForSourceFolder(), false, true, null);
+ dialog.setTitle(Texts.get("CreateNewPackage"));
+
+ if (dialog.open() == Window.OK && dialog.getResult() != null && dialog.getResult().length > 0) {
+ IPackageFragment packageFragment = (IPackageFragment) dialog.getResult()[0];
+
+ if (TypeUtility.exists(packageFragment)) {
+ m_sourceFolder = packageFragment.getParent().getPath().lastSegment();
+ return packageFragment.getElementName();
+ }
+ }
+ return null;
+ }
+
+ private boolean validate(String packageName) {
+ setUseLinkAsLabel(false);
+
+ if (!JaxWsSdkUtility.isValidSourceFolder(m_bundle, m_sourceFolder)) {
+ setInfo(IMarker.SEVERITY_ERROR, "Source folder not set set or does not exist");
+ return false;
+ }
+ if (packageName == null) {
+ clearInfo();
+ return isAcceptNullValue();
+ }
+ try {
+ IPath sourceFolder = m_bundle.getProject().getFullPath().append(m_sourceFolder);
+ IPackageFragmentRoot root = m_bundle.getJavaProject().findPackageFragmentRoot(sourceFolder);
+ if (!TypeUtility.exists(root)) {
+ setInfo(IMarker.SEVERITY_ERROR, "Source folder could not be found");
+ return false;
+ }
+ IPackageFragment packageFragment = root.getPackageFragment(packageName);
+ if ((packageFragment != null && !packageFragment.exists()) || (packageFragment == null && !isAcceptNullValue())) {
+ setUseLinkAsLabel(true);
+ setInfo(IMarker.SEVERITY_WARNING, Texts.get("PackageDoesNotExistClickOnLinkToCreate"));
+ return false;
+ }
+ clearInfo();
+ return true;
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("failed to validate package name", e);
+ }
+ clearInfo();
+ return false;
+ }
+
+ private IPackageFragment getPackageFragment(String packageName) {
+ if (validate(packageName)) {
+ IPath sourceFolder = m_bundle.getProject().getFullPath().append(m_sourceFolder);
+ try {
+ IPackageFragmentRoot root = m_bundle.getJavaProject().findPackageFragmentRoot(sourceFolder);
+ return root.getPackageFragment(packageName);
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("failed to get package fragment", e);
+ }
+ }
+ return null;
+ }
+
+ public String getSourceFolder() {
+ return m_sourceFolder;
+ }
+
+ public void setSourceFolder(String sourceFolder) {
+ m_sourceFolder = sourceFolder;
+ if (isControlCreated()) {
+ validate(m_textField.getText());
+ }
+ }
+
+ public boolean isAllowChangeOfSourceFolder() {
+ return m_allowChangeOfSourceFolder;
+ }
+
+ public void setAllowChangeOfSourceFolder(boolean allowChangeOfSourceFolder) {
+ m_allowChangeOfSourceFolder = allowChangeOfSourceFolder;
+ }
+
+ private IJavaSearchScope createSearchScopeForSourceFolder() {
+ if (JaxWsSdkUtility.isValidSourceFolder(m_bundle, m_sourceFolder)) {
+ try {
+ IPath sourceFolder = m_bundle.getProject().getFullPath().append(m_sourceFolder);
+ IPackageFragmentRoot root = m_bundle.getJavaProject().findPackageFragmentRoot(sourceFolder);
+ return SearchEngine.createJavaSearchScope(new IJavaElement[]{root});
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("failed to create Java search scope for package elements", e);
+ }
+ }
+ return SearchEngine.createJavaSearchScope(new IJavaElement[0]); // empty search scope
+ }
+
+ private class P_ModifyListener implements ModifyListener {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ if (validate(m_textField.getText())) {
+ setValueFromUI(m_textField.getText());
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/ProposalPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/ProposalPresenter.java
index 7d528cdd4..d4c861a69 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/ProposalPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/ProposalPresenter.java
@@ -1,112 +1,112 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import java.util.Arrays;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.SimpleLabelProvider;
-import org.eclipse.scout.sdk.ui.fields.proposal.SimpleProposal;
-import org.eclipse.scout.sdk.ui.fields.proposal.StaticContentProvider;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-public class ProposalPresenter<T extends SimpleProposal> extends AbstractPropertyPresenter<T> {
-
- protected ProposalTextField m_proposalField;
- protected SimpleProposal[] m_proposals;
-
- private IProposalAdapterListener m_proposalListener;
-
- public ProposalPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- super(parent, toolkit, true);
- }
-
- public ProposalPresenter(Composite parent, PropertyViewFormToolkit toolkit, boolean initialize) {
- super(parent, toolkit, initialize);
- }
-
- @Override
- protected Control createContent(Composite parent) {
- m_proposalField = getToolkit().createProposalField(parent, "", ProposalTextField.STYLE_NO_LABEL);
- initializeProposalField(getProposals());
- m_proposalListener = new P_ProposalListener();
- m_proposalField.addProposalAdapterListener(m_proposalListener);
- return m_proposalField;
- }
-
- public void setProposals(SimpleProposal[] proposals) {
- m_proposals = proposals;
- initializeProposalField(proposals);
- }
-
- private void initializeProposalField(SimpleProposal[] proposals) {
- setStateChanging(true);
- try {
- if (isControlCreated()) {
- StaticContentProvider provider = new StaticContentProvider(m_proposals, new SimpleLabelProvider());
- m_proposalField.setContentProvider(provider);
- if (!isStateChanging()) {
- setInput(getValue());
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public SimpleProposal[] getProposals() {
- return m_proposals;
- }
-
- @Override
- protected void setInputInternal(T input) {
- m_proposalField.removeProposalAdapterListener(m_proposalListener);
- try {
- if (input != null && m_proposals != null && Arrays.asList(m_proposals).contains(input)) {
- m_proposalField.acceptProposal(input);
- }
- else {
- m_proposalField.acceptProposal(null);
- }
- }
- finally {
- m_proposalField.addProposalAdapterListener(m_proposalListener);
- }
- }
-
- private final class P_ProposalListener implements IProposalAdapterListener {
-
- @SuppressWarnings("unchecked")
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- T proposal = (T) event.proposal;
- if (proposal != null || isAcceptNullValue()) {
- setValueFromUI(proposal);
- }
- else {
- setInfo(IMarker.SEVERITY_ERROR, Texts.get("InvalidValue"));
- }
- }
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- // to change background color in disabled state
- m_proposalField.setEnabled(enabled);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import java.util.Arrays;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.SimpleLabelProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.SimpleProposal;
+import org.eclipse.scout.sdk.ui.fields.proposal.StaticContentProvider;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public class ProposalPresenter<T extends SimpleProposal> extends AbstractPropertyPresenter<T> {
+
+ protected ProposalTextField m_proposalField;
+ protected SimpleProposal[] m_proposals;
+
+ private IProposalAdapterListener m_proposalListener;
+
+ public ProposalPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ super(parent, toolkit, true);
+ }
+
+ public ProposalPresenter(Composite parent, PropertyViewFormToolkit toolkit, boolean initialize) {
+ super(parent, toolkit, initialize);
+ }
+
+ @Override
+ protected Control createContent(Composite parent) {
+ m_proposalField = getToolkit().createProposalField(parent, "", ProposalTextField.STYLE_NO_LABEL);
+ initializeProposalField(getProposals());
+ m_proposalListener = new P_ProposalListener();
+ m_proposalField.addProposalAdapterListener(m_proposalListener);
+ return m_proposalField;
+ }
+
+ public void setProposals(SimpleProposal[] proposals) {
+ m_proposals = proposals;
+ initializeProposalField(proposals);
+ }
+
+ private void initializeProposalField(SimpleProposal[] proposals) {
+ setStateChanging(true);
+ try {
+ if (isControlCreated()) {
+ StaticContentProvider provider = new StaticContentProvider(m_proposals, new SimpleLabelProvider());
+ m_proposalField.setContentProvider(provider);
+ if (!isStateChanging()) {
+ setInput(getValue());
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public SimpleProposal[] getProposals() {
+ return m_proposals;
+ }
+
+ @Override
+ protected void setInputInternal(T input) {
+ m_proposalField.removeProposalAdapterListener(m_proposalListener);
+ try {
+ if (input != null && m_proposals != null && Arrays.asList(m_proposals).contains(input)) {
+ m_proposalField.acceptProposal(input);
+ }
+ else {
+ m_proposalField.acceptProposal(null);
+ }
+ }
+ finally {
+ m_proposalField.addProposalAdapterListener(m_proposalListener);
+ }
+ }
+
+ private final class P_ProposalListener implements IProposalAdapterListener {
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ T proposal = (T) event.proposal;
+ if (proposal != null || isAcceptNullValue()) {
+ setValueFromUI(proposal);
+ }
+ else {
+ setInfo(IMarker.SEVERITY_ERROR, Texts.get("InvalidValue"));
+ }
+ }
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ // to change background color in disabled state
+ m_proposalField.setEnabled(enabled);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/SeparatorPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/SeparatorPresenter.java
index ff482d495..2efaa3b91 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/SeparatorPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/SeparatorPresenter.java
@@ -1,36 +1,36 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-public class SeparatorPresenter extends AbstractPresenter {
-
- public SeparatorPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- super(toolkit, parent);
- createPresenter();
- }
-
- public Control createPresenter() {
- Composite presenter = getContainer();
- presenter.setLayout(new GridLayout(1, false));
- Label separator = new Label(presenter, SWT.HORIZONTAL | SWT.SEPARATOR);
- separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- return presenter;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ui.view.properties.presenter.AbstractPresenter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+public class SeparatorPresenter extends AbstractPresenter {
+
+ public SeparatorPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ super(toolkit, parent);
+ createPresenter();
+ }
+
+ public Control createPresenter() {
+ Composite presenter = getContainer();
+ presenter.setLayout(new GridLayout(1, false));
+ Label separator = new Label(presenter, SWT.HORIZONTAL | SWT.SEPARATOR);
+ separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ return presenter;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/SourceFolderPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/SourceFolderPresenter.java
index 3f8a1c6d9..f1dae1b08 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/SourceFolderPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/SourceFolderPresenter.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.resources.ResourcesContentProvider;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.SourceFolderCreateOrUpdateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.proposal.PathProposal;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.SourceFolderNewWizard;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @deprecated use {@link ProposalTextField} with {@link ResourcesContentProvider}
- */
-@Deprecated
-public class SourceFolderPresenter extends ProposalPresenter<PathProposal> {
-
- public SourceFolderPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- super(parent, toolkit, false);
- setLabel(Texts.get("SourceFolder"));
- setTooltip(Texts.get("ClickToCreateNewSourceFolder"));
- setUseLinkAsLabel(true);
- callInitializer();
- }
-
- @Override
- protected void execLinkAction() throws CoreException {
- SourceFolderNewWizard wizard = new SourceFolderNewWizard(m_bundle);
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- if (wizardDialog.open() == Window.OK) {
- SourceFolderCreateOrUpdateOperation op = new SourceFolderCreateOrUpdateOperation();
- op.setBundle(m_bundle);
- op.setSourceFolder(wizard.getSourceFolder());
- op.run(new NullProgressMonitor(), null);
-
- IPath sourceFolder = new Path(wizard.getSourceFolder().lastSegment());
- setInputInternal(new PathProposal(sourceFolder));
- setValueFromUI(new PathProposal(sourceFolder));
- }
- }
-
- @Override
- protected void setInputInternal(PathProposal input) {
- setStateChanging(true);
- try {
- setProposals(createSourceFolderProposals());
- }
- finally {
- setStateChanging(false);
- }
- super.setInputInternal(input);
- }
-
- private PathProposal[] createSourceFolderProposals() {
- List<PathProposal> proposals = new LinkedList<PathProposal>();
- try {
- for (IClasspathEntry classpathEntry : m_bundle.getJavaProject().getRawClasspath()) {
- if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
- proposals.add(new PathProposal(new Path(classpathEntry.getPath().lastSegment())));
- }
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("Error occured while fetching source folders.", e);
- }
-
- return proposals.toArray(new PathProposal[proposals.size()]);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.resources.ResourcesContentProvider;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.SourceFolderCreateOrUpdateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.proposal.PathProposal;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.SourceFolderNewWizard;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @deprecated use {@link ProposalTextField} with {@link ResourcesContentProvider}
+ */
+@Deprecated
+public class SourceFolderPresenter extends ProposalPresenter<PathProposal> {
+
+ public SourceFolderPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ super(parent, toolkit, false);
+ setLabel(Texts.get("SourceFolder"));
+ setTooltip(Texts.get("ClickToCreateNewSourceFolder"));
+ setUseLinkAsLabel(true);
+ callInitializer();
+ }
+
+ @Override
+ protected void execLinkAction() throws CoreException {
+ SourceFolderNewWizard wizard = new SourceFolderNewWizard(m_bundle);
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ if (wizardDialog.open() == Window.OK) {
+ SourceFolderCreateOrUpdateOperation op = new SourceFolderCreateOrUpdateOperation();
+ op.setBundle(m_bundle);
+ op.setSourceFolder(wizard.getSourceFolder());
+ op.run(new NullProgressMonitor(), null);
+
+ IPath sourceFolder = new Path(wizard.getSourceFolder().lastSegment());
+ setInputInternal(new PathProposal(sourceFolder));
+ setValueFromUI(new PathProposal(sourceFolder));
+ }
+ }
+
+ @Override
+ protected void setInputInternal(PathProposal input) {
+ setStateChanging(true);
+ try {
+ setProposals(createSourceFolderProposals());
+ }
+ finally {
+ setStateChanging(false);
+ }
+ super.setInputInternal(input);
+ }
+
+ private PathProposal[] createSourceFolderProposals() {
+ List<PathProposal> proposals = new LinkedList<PathProposal>();
+ try {
+ for (IClasspathEntry classpathEntry : m_bundle.getJavaProject().getRawClasspath()) {
+ if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ proposals.add(new PathProposal(new Path(classpathEntry.getPath().lastSegment())));
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("Error occured while fetching source folders.", e);
+ }
+
+ return proposals.toArray(new PathProposal[proposals.size()]);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/StringPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/StringPresenter.java
index e4d6e951d..43ace217b 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/StringPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/StringPresenter.java
@@ -1,280 +1,280 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.LineStyleEvent;
-import org.eclipse.swt.custom.LineStyleListener;
-import org.eclipse.swt.custom.StyleRange;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.VerifyEvent;
-import org.eclipse.swt.events.VerifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-public class StringPresenter extends AbstractPropertyPresenter<String> {
-
- protected StyledText m_styledText;
- protected String m_prefix;
- protected String m_suffix;
- private VerifyListener m_verifyListener;
- private ModifyListener m_modifyListener;
- private boolean m_editable;
- private String m_tooltip;
-
- public StringPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- super(parent, toolkit, false);
- m_verifyListener = new P_VerifyListener();
- m_modifyListener = new P_ModifyListener();
- setAcceptNullValue(true);
- callInitializer();
- }
-
- public void setPrefix(String prefix) {
- m_prefix = prefix;
- }
-
- public void setSuffix(String suffix) {
- m_suffix = suffix;
- }
-
- public boolean isEditable() {
- return m_editable;
- }
-
- public void setEditable(boolean editable) {
- m_editable = editable;
- if (isControlCreated()) {
- if (editable) {
- m_styledText.setBackground(null);
- }
- else {
- m_styledText.setBackground(JaxWsSdkUtility.getColorLightGray());
- }
- }
- }
-
- public String getTooltip() {
- return m_tooltip;
- }
-
- @Override
- public void setTooltip(String tooltip) {
- m_tooltip = tooltip;
- if (isControlCreated()) {
- m_styledText.setToolTipText(StringUtility.nvl(m_tooltip, ""));
- }
- }
-
- @Override
- protected Control createContent(Composite parent) {
- m_styledText = new StyledText(parent, SWT.SINGLE | SWT.BORDER);
- m_styledText.addLineStyleListener(new P_LineStyleListener());
- m_styledText.addSelectionListener(new P_SelectionListener());
- m_styledText.addKeyListener(new P_KeyListener());
- m_styledText.addFocusListener(new P_FocusListener());
- m_styledText.addModifyListener(m_modifyListener);
- m_styledText.addVerifyListener(m_verifyListener);
- m_styledText.setEditable(false);
- m_styledText.setToolTipText(StringUtility.nvl(m_tooltip, ""));
- setEditable(m_editable);
- return m_styledText;
- }
-
- @Override
- protected void setInputInternal(String input) {
- m_styledText.removeVerifyListener(m_verifyListener);
- m_styledText.removeModifyListener(m_modifyListener);
- try {
- m_styledText.setText(StringUtility.nvl(input, StringUtility.join("", m_prefix, m_suffix)));
- }
- finally {
- m_styledText.addVerifyListener(m_verifyListener);
- m_styledText.addModifyListener(m_modifyListener);
- }
- }
-
- private final class P_LineStyleListener implements LineStyleListener {
-
- @Override
- public void lineGetStyle(LineStyleEvent event) {
- List<StyleRange> styleRanges = new LinkedList<StyleRange>();
-
- // color prefix
- if (m_prefix != null && m_styledText.getText().startsWith(m_prefix)) {
- StyleRange styleRange = new StyleRange();
- styleRange.start = 0;
- styleRange.length = m_prefix.length();
- styleRange.foreground = ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_BLUE);
- styleRanges.add(styleRange);
- }
-
- // color suffix
- if (m_suffix != null && m_styledText.getText().endsWith(m_suffix)) {
- StyleRange styleRange = new StyleRange();
- styleRange.start = m_styledText.getText().length() - m_suffix.length();
- styleRange.length = m_styledText.getText().length();
- styleRange.foreground = ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_BLUE);
- styleRanges.add(styleRange);
- }
-
- // Set the styles for the line
- event.styles = (styleRanges.toArray(new StyleRange[styleRanges.size()]));
- }
- }
-
- private final class P_SelectionListener extends SelectionAdapter {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- int start = Math.min(e.x, e.y);
- int end = Math.max(e.x, e.y);
-
- e.x = start;
- e.y = end;
-
- if (m_prefix != null && m_styledText.getText().startsWith(m_prefix) && e.x < m_prefix.length()) {
- e.x = m_prefix.length();
- e.doit = false;
- }
- if (m_suffix != null && m_styledText.getText().endsWith(m_suffix) && e.y > (m_styledText.getText().length() - m_suffix.length())) {
- e.y = m_styledText.getText().length() - m_suffix.length();
- e.doit = false;
- }
- if (e.y < e.x) {
- e.y = e.x;
- }
-
- // adjust selection
- if (!e.doit) {
- m_styledText.removeSelectionListener(this);
- try {
- m_styledText.setSelection(e.x, e.y);
- }
- finally {
- m_styledText.addSelectionListener(this);
- }
- }
- }
- }
-
- private final class P_KeyListener extends KeyAdapter {
-
- @Override
- public void keyReleased(KeyEvent e) {
- int key = e.character;
- if (key > 0 && key <= 26) {
- key += 'a' - 1;
- }
-
- e.doit = true;
- if (e.stateMask == SWT.MOD1 && key == 'a') { // CTRL-A
- selectAll();
- }
- }
-
- private void selectAll() {
- int start = 0;
- int end = m_styledText.getText().length();
-
- if (m_prefix != null && m_styledText.getText().startsWith(m_prefix)) {
- start = m_prefix.length();
- }
- if (m_suffix != null && m_styledText.getText().endsWith(m_suffix)) {
- end = m_styledText.getText().length() - m_suffix.length();
- }
-
- // adjust selection
- m_styledText.setSelection(start, end);
- }
- }
-
- private final class P_VerifyListener implements VerifyListener {
-
- @Override
- public void verifyText(VerifyEvent e) {
- // check prefix
- if (m_prefix != null && m_styledText.getText().startsWith(m_prefix) && e.start < m_prefix.length()) {
- e.doit = false;
- return;
- }
-
- // check suffix
- if (m_suffix != null && m_styledText.getText().endsWith(m_suffix) && e.end > m_styledText.getText().length() - m_suffix.length()) {
- e.doit = false;
- return;
- }
- e.doit = true;
- }
- }
-
- private final class P_FocusListener extends FocusAdapter {
-
- @Override
- public void focusLost(FocusEvent e) {
- String newValue = m_styledText.getText();
- if (isValid(newValue)) {
- setValueFromUI(newValue);
- }
- else {
- setInfo(IMarker.SEVERITY_ERROR, Texts.get("InvalidValue"));
- }
- }
- }
-
- private final class P_ModifyListener implements ModifyListener {
-
- @Override
- public void modifyText(ModifyEvent e) {
- String newValue = m_styledText.getText();
- if (isValid(newValue)) {
- clearInfo();
- }
- else {
- setInfo(IMarker.SEVERITY_ERROR, Texts.get("InvalidValue"));
- }
- }
- }
-
- private boolean isValid(String value) {
- if (!StringUtility.hasText(value) && !isAcceptNullValue()) {
- return false;
- }
- if (m_prefix != null && (!value.startsWith(m_prefix) || value.equals(m_prefix))) {
- return false;
- }
- if (m_suffix != null && (!value.endsWith(m_suffix) || value.equals(m_suffix))) {
- return false;
- }
-
- if (m_prefix != null && m_suffix != null && value.equals(m_prefix + m_suffix)) {
- return false;
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.LineStyleEvent;
+import org.eclipse.swt.custom.LineStyleListener;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public class StringPresenter extends AbstractPropertyPresenter<String> {
+
+ protected StyledText m_styledText;
+ protected String m_prefix;
+ protected String m_suffix;
+ private VerifyListener m_verifyListener;
+ private ModifyListener m_modifyListener;
+ private boolean m_editable;
+ private String m_tooltip;
+
+ public StringPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ super(parent, toolkit, false);
+ m_verifyListener = new P_VerifyListener();
+ m_modifyListener = new P_ModifyListener();
+ setAcceptNullValue(true);
+ callInitializer();
+ }
+
+ public void setPrefix(String prefix) {
+ m_prefix = prefix;
+ }
+
+ public void setSuffix(String suffix) {
+ m_suffix = suffix;
+ }
+
+ public boolean isEditable() {
+ return m_editable;
+ }
+
+ public void setEditable(boolean editable) {
+ m_editable = editable;
+ if (isControlCreated()) {
+ if (editable) {
+ m_styledText.setBackground(null);
+ }
+ else {
+ m_styledText.setBackground(JaxWsSdkUtility.getColorLightGray());
+ }
+ }
+ }
+
+ public String getTooltip() {
+ return m_tooltip;
+ }
+
+ @Override
+ public void setTooltip(String tooltip) {
+ m_tooltip = tooltip;
+ if (isControlCreated()) {
+ m_styledText.setToolTipText(StringUtility.nvl(m_tooltip, ""));
+ }
+ }
+
+ @Override
+ protected Control createContent(Composite parent) {
+ m_styledText = new StyledText(parent, SWT.SINGLE | SWT.BORDER);
+ m_styledText.addLineStyleListener(new P_LineStyleListener());
+ m_styledText.addSelectionListener(new P_SelectionListener());
+ m_styledText.addKeyListener(new P_KeyListener());
+ m_styledText.addFocusListener(new P_FocusListener());
+ m_styledText.addModifyListener(m_modifyListener);
+ m_styledText.addVerifyListener(m_verifyListener);
+ m_styledText.setEditable(false);
+ m_styledText.setToolTipText(StringUtility.nvl(m_tooltip, ""));
+ setEditable(m_editable);
+ return m_styledText;
+ }
+
+ @Override
+ protected void setInputInternal(String input) {
+ m_styledText.removeVerifyListener(m_verifyListener);
+ m_styledText.removeModifyListener(m_modifyListener);
+ try {
+ m_styledText.setText(StringUtility.nvl(input, StringUtility.join("", m_prefix, m_suffix)));
+ }
+ finally {
+ m_styledText.addVerifyListener(m_verifyListener);
+ m_styledText.addModifyListener(m_modifyListener);
+ }
+ }
+
+ private final class P_LineStyleListener implements LineStyleListener {
+
+ @Override
+ public void lineGetStyle(LineStyleEvent event) {
+ List<StyleRange> styleRanges = new LinkedList<StyleRange>();
+
+ // color prefix
+ if (m_prefix != null && m_styledText.getText().startsWith(m_prefix)) {
+ StyleRange styleRange = new StyleRange();
+ styleRange.start = 0;
+ styleRange.length = m_prefix.length();
+ styleRange.foreground = ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_BLUE);
+ styleRanges.add(styleRange);
+ }
+
+ // color suffix
+ if (m_suffix != null && m_styledText.getText().endsWith(m_suffix)) {
+ StyleRange styleRange = new StyleRange();
+ styleRange.start = m_styledText.getText().length() - m_suffix.length();
+ styleRange.length = m_styledText.getText().length();
+ styleRange.foreground = ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_BLUE);
+ styleRanges.add(styleRange);
+ }
+
+ // Set the styles for the line
+ event.styles = (styleRanges.toArray(new StyleRange[styleRanges.size()]));
+ }
+ }
+
+ private final class P_SelectionListener extends SelectionAdapter {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ int start = Math.min(e.x, e.y);
+ int end = Math.max(e.x, e.y);
+
+ e.x = start;
+ e.y = end;
+
+ if (m_prefix != null && m_styledText.getText().startsWith(m_prefix) && e.x < m_prefix.length()) {
+ e.x = m_prefix.length();
+ e.doit = false;
+ }
+ if (m_suffix != null && m_styledText.getText().endsWith(m_suffix) && e.y > (m_styledText.getText().length() - m_suffix.length())) {
+ e.y = m_styledText.getText().length() - m_suffix.length();
+ e.doit = false;
+ }
+ if (e.y < e.x) {
+ e.y = e.x;
+ }
+
+ // adjust selection
+ if (!e.doit) {
+ m_styledText.removeSelectionListener(this);
+ try {
+ m_styledText.setSelection(e.x, e.y);
+ }
+ finally {
+ m_styledText.addSelectionListener(this);
+ }
+ }
+ }
+ }
+
+ private final class P_KeyListener extends KeyAdapter {
+
+ @Override
+ public void keyReleased(KeyEvent e) {
+ int key = e.character;
+ if (key > 0 && key <= 26) {
+ key += 'a' - 1;
+ }
+
+ e.doit = true;
+ if (e.stateMask == SWT.MOD1 && key == 'a') { // CTRL-A
+ selectAll();
+ }
+ }
+
+ private void selectAll() {
+ int start = 0;
+ int end = m_styledText.getText().length();
+
+ if (m_prefix != null && m_styledText.getText().startsWith(m_prefix)) {
+ start = m_prefix.length();
+ }
+ if (m_suffix != null && m_styledText.getText().endsWith(m_suffix)) {
+ end = m_styledText.getText().length() - m_suffix.length();
+ }
+
+ // adjust selection
+ m_styledText.setSelection(start, end);
+ }
+ }
+
+ private final class P_VerifyListener implements VerifyListener {
+
+ @Override
+ public void verifyText(VerifyEvent e) {
+ // check prefix
+ if (m_prefix != null && m_styledText.getText().startsWith(m_prefix) && e.start < m_prefix.length()) {
+ e.doit = false;
+ return;
+ }
+
+ // check suffix
+ if (m_suffix != null && m_styledText.getText().endsWith(m_suffix) && e.end > m_styledText.getText().length() - m_suffix.length()) {
+ e.doit = false;
+ return;
+ }
+ e.doit = true;
+ }
+ }
+
+ private final class P_FocusListener extends FocusAdapter {
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ String newValue = m_styledText.getText();
+ if (isValid(newValue)) {
+ setValueFromUI(newValue);
+ }
+ else {
+ setInfo(IMarker.SEVERITY_ERROR, Texts.get("InvalidValue"));
+ }
+ }
+ }
+
+ private final class P_ModifyListener implements ModifyListener {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ String newValue = m_styledText.getText();
+ if (isValid(newValue)) {
+ clearInfo();
+ }
+ else {
+ setInfo(IMarker.SEVERITY_ERROR, Texts.get("InvalidValue"));
+ }
+ }
+ }
+
+ private boolean isValid(String value) {
+ if (!StringUtility.hasText(value) && !isAcceptNullValue()) {
+ return false;
+ }
+ if (m_prefix != null && (!value.startsWith(m_prefix) || value.equals(m_prefix))) {
+ return false;
+ }
+ if (m_suffix != null && (!value.endsWith(m_suffix) || value.equals(m_suffix))) {
+ return false;
+ }
+
+ if (m_prefix != null && m_suffix != null && value.equals(m_prefix + m_suffix)) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/TypePresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/TypePresenter.java
index aad518955..659a6144c 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/TypePresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/TypePresenter.java
@@ -1,464 +1,464 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.internal.corext.template.java.SignatureUtil;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jdt.ui.actions.OpenNewClassWizardAction;
-import org.eclipse.jdt.ui.wizards.NewClassWizardPage;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.fields.tooltip.JavadocTooltip;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.util.IScoutSeverityListener;
-import org.eclipse.scout.sdk.util.ScoutSeverityManager;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.custom.StyledText;
-import org.eclipse.swt.events.FocusAdapter;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-@SuppressWarnings("restriction")
-public class TypePresenter extends AbstractPropertyPresenter<String> {
-
- protected StyledText m_textField;
- protected Button m_button;
-
- private IType m_superType;
- private String[] m_interfaceSignatures;
- private boolean m_allowChangeOfInterfaceType;
- private ISearchJavaSearchScopeFactory m_searchScopeFactory;
- private String m_defaultPackageNameNewType;
- private ModifyListener m_modifyListener;
- private boolean m_allowChangeOfSourceFolder;
- private JavadocTooltip m_javaDocTooltip;
-
- private P_ScoutSeverityListener m_severityListener;
-
- public TypePresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- this(parent, toolkit, AbstractPropertyPresenter.DEFAULT_LABEL_WIDTH, true);
- }
-
- public TypePresenter(Composite parent, PropertyViewFormToolkit toolkit, int labelWidth, boolean initialize) {
- super(parent, toolkit, labelWidth, false);
- setLabel(Texts.get("class"));
- setUseLinkAsLabel(true);
- m_modifyListener = new P_ModifyListener();
- m_severityListener = new P_ScoutSeverityListener();
- ScoutSeverityManager.getInstance().addQualityManagerListener(m_severityListener);
- if (initialize) {
- callInitializer();
- }
- }
-
- @Override
- protected Control createContent(Composite parent) {
- Composite composite = getToolkit().createComposite(parent, SWT.NONE);
- m_textField = new StyledText(composite, SWT.SINGLE | SWT.BORDER);
- m_textField.setEditable(true);
- m_textField.addModifyListener(m_modifyListener);
- m_textField.addFocusListener(new FocusAdapter() {
-
- @Override
- public void focusLost(FocusEvent e) {
- IType type = validateType(m_textField.getText());
- if (type != null) {
- setValueFromUI(type.getFullyQualifiedName());
- }
- }
- });
- m_javaDocTooltip = new JavadocTooltip(m_textField);
-
- m_button = new Button(composite, SWT.PUSH | SWT.FLAT);
- m_button.setText(Texts.get("Browse"));
- m_button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IType newType = openBrowseTypesDialog();
- if (TypeUtility.exists(newType)) {
- setInputInternal(newType.getFullyQualifiedName());
- setValueFromUI(newType.getFullyQualifiedName(), true);
- }
- }
- });
- m_button.setEnabled(m_searchScopeFactory != null);
-
- // layout
- GridLayout layout = new GridLayout(2, false);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- composite.setLayout(layout);
-
- GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- m_textField.setLayoutData(gd);
-
- gd = new GridData();
- m_button.setLayoutData(gd);
-
- return composite;
- }
-
- @Override
- public void dispose() {
- if (m_severityListener != null) {
- ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
- }
- }
-
- @Override
- protected void execLinkAction() throws CoreException {
- String fqn = m_textField.getText();
- if (TypeUtility.existsType(fqn)) {
- try {
- JavaUI.openInEditor(TypeUtility.getType(fqn));
- }
- catch (Exception e) {
- JaxWsSdk.logWarning(e);
- }
- }
- else {
- IType newType = openNewTypeDialog();
- if (TypeUtility.exists(newType)) {
- setInputInternal(newType.getFullyQualifiedName());
- setValueFromUI(newType.getFullyQualifiedName());
- }
- }
- }
-
- @Override
- protected void setInputInternal(String input) {
- m_textField.removeModifyListener(m_modifyListener);
- try {
- m_textField.setText(StringUtility.nvl(input, ""));
- }
- finally {
- m_textField.addModifyListener(m_modifyListener);
- }
-
- String fqn = StringUtility.nvl(input, "");
- if (TypeUtility.existsType(fqn)) {
- setTooltip(Signature.getSimpleName(fqn));
- m_javaDocTooltip.setMember(TypeUtility.getType(fqn));
- }
- else {
- setTooltip(null);
- m_javaDocTooltip.setMember(null);
- }
-
- validateType(fqn);
- }
-
- public ISearchJavaSearchScopeFactory getSearchScopeFactory() {
- return m_searchScopeFactory;
- }
-
- public void setSearchScopeFactory(ISearchJavaSearchScopeFactory searchScopeFactory) {
- m_searchScopeFactory = searchScopeFactory;
-
- if (isControlCreated()) {
- m_button.setEnabled(m_searchScopeFactory != null);
- }
- }
-
- public void setSuperType(IType superType) {
- m_superType = superType;
- }
-
- /**
- * To set the super interface types. Fore interface signatures, use
- * {@link TypePresenter#setInterfaceSignatures(String[])}
- *
- * @param interfaceTypes
- */
- public void setInterfaceTypes(IType[] interfaceTypes) {
- List<String> signatures = new ArrayList<String>();
- for (IType type : interfaceTypes) {
- signatures.add(Signature.createTypeSignature(type.getFullyQualifiedName(), true));
- }
- setInterfaceSignatures(signatures.toArray(new String[signatures.size()]));
- }
-
- public void setInterfaceSignatures(String[] interfaceSignatures) {
- m_interfaceSignatures = interfaceSignatures;
- }
-
- public void setAllowChangeOfInterfaceType(boolean allowChangeOfInterfaceType) {
- m_allowChangeOfInterfaceType = allowChangeOfInterfaceType;
- }
-
- public String getDefaultPackageNameNewType() {
- return m_defaultPackageNameNewType;
- }
-
- public void setDefaultPackageNameNewType(String defaultPackageNameNewType) {
- m_defaultPackageNameNewType = defaultPackageNameNewType;
- }
-
- protected IType openNewTypeDialog() {
- NewClassWizardPage page = new NewClassWizardPage();
- page.setDescription(Texts.get("CreateNewType"));
- page.setEnclosingTypeSelection(false, false);
- page.setMethodStubSelection(false, true, true, true);
- String qualifier = Signature.getQualifier(m_textField.getText());
- IPackageFragment packageFragment = null;
- if (qualifier != null && qualifier.length() > 0) {
- packageFragment = m_bundle.getPackageFragment(qualifier);
- }
- else if (m_defaultPackageNameNewType != null) {
- packageFragment = m_bundle.getPackageFragment(m_defaultPackageNameNewType);
- }
-
- if (packageFragment != null) {
- page.setPackageFragmentRoot((IPackageFragmentRoot) packageFragment.getParent(), isAllowChangeOfSourceFolder());
- page.setPackageFragment(packageFragment, true);
- }
- else {
- String rootPackageName = m_bundle.getRootPackageName();
- page.setPackageFragmentRoot((IPackageFragmentRoot) m_bundle.getPackageFragment(rootPackageName).getParent(), true);
- }
- if (m_superType != null) {
- page.setSuperClass(m_superType.getFullyQualifiedName(), false);
- }
- if (m_interfaceSignatures != null && m_interfaceSignatures.length > 0) {
- List<String> interfaceTypeNames = new LinkedList<String>();
- for (String signature : m_interfaceSignatures) {
- interfaceTypeNames.add(stripSignatureToFQN(signature, false));
- }
- page.setSuperInterfaces(interfaceTypeNames, m_allowChangeOfInterfaceType);
- }
- page.setTypeName(Signature.getSimpleName(m_textField.getText()), true);
- OpenNewClassWizardAction action = new OpenNewClassWizardAction();
- action.setConfiguredWizardPage(page);
- action.run();
-
- IType type = page.getCreatedType();
- if (TypeUtility.exists(type)) {
- return type;
- }
- return null;
- }
-
- private IType openBrowseTypesDialog() {
- String fqn = m_textField.getText();
- IType type = null;
- if (TypeUtility.existsType(fqn)) {
- type = TypeUtility.getType(fqn);
- }
-
- try {
- SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, m_searchScopeFactory.create(), IJavaElementSearchConstants.CONSIDER_ALL_TYPES, false, "*.*");
- dialog.setTitle(Texts.get("BrowseForType"));
- if (TypeUtility.exists(type)) {
- dialog.setInitialSelections(new IType[]{type});
- }
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- type = (IType) dialog.getResult()[0];
- if (TypeUtility.exists(type)) {
- return type;
- }
- }
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- return null;
- }
-
- public boolean isAllowChangeOfSourceFolder() {
- return m_allowChangeOfSourceFolder;
- }
-
- public boolean isAllowChangeOfInterfaceType() {
- return m_allowChangeOfInterfaceType;
- }
-
- public void setAllowChangeOfSourceFolder(boolean allowChangeOfSourceFolder) {
- m_allowChangeOfSourceFolder = allowChangeOfSourceFolder;
- }
-
- private IType validateType(String fullyQualifiedName) {
- if (!TypeUtility.existsType(fullyQualifiedName)) {
- setInfo(IMarker.SEVERITY_ERROR, Texts.get("TypeDoesNotExistClickOnXToCreate", Texts.get("class")));
- return null;
- }
-
- IType type = TypeUtility.getType(fullyQualifiedName);
-
- // check validity of type
- if (m_interfaceSignatures != null) {
- for (String signature : m_interfaceSignatures) {
- IType interfaceType = TypeUtility.getType(stripSignatureToFQN(signature, true));
- if (!JaxWsSdkUtility.isJdtSubType(interfaceType.getFullyQualifiedName(), type)) {
- setInfo(IMarker.SEVERITY_ERROR, Texts.get("XMustBeSubtypeOfY", type.getElementName(), interfaceType.getFullyQualifiedName()));
- return null;
- }
- }
- }
- if (m_superType != null && !JaxWsSdkUtility.isJdtSubType(m_superType.getFullyQualifiedName(), type)) {
- setInfo(IMarker.SEVERITY_ERROR, Texts.get("XMustBeSubtypeOfY", type.getElementName(), m_superType.getFullyQualifiedName()));
- return null;
- }
-
- clearInfo();
- return type;
- }
-
- @Override
- protected void updateSeverity(List<SeverityEntry> statusList) throws CoreException {
- if (StringUtility.hasText(getValue()) && (TypeUtility.existsType(getValue()))) {
- int quality = ScoutSeverityManager.getInstance().getSeverityOf(TypeUtility.getType(getValue()));
- if (quality > IMarker.SEVERITY_INFO) {
- statusList.add(new SeverityEntry(quality, "Unresolved compilation errors"));
- }
- }
- }
-
- private class P_ModifyListener implements ModifyListener {
-
- @Override
- public void modifyText(ModifyEvent e) {
- validateType(m_textField.getText());
- }
- }
-
- private String stripSignatureToFQN(String signature, boolean eraseGenericTypes) {
- if (signature == null) {
- return null;
- }
-
- String typeSignature = SignatureUtil.stripSignatureToFQN(signature);
- if (!eraseGenericTypes) {
- // support for generic type parameters
- String typeArguments = null;
- for (String typeArgument : Signature.getTypeArguments(signature)) {
- typeArguments = StringUtility.join(",", typeArguments, SignatureUtil.stripSignatureToFQN(typeArgument));
- }
- if (typeArguments != null) {
- typeSignature = typeSignature + "<" + typeArguments + ">";
- }
- }
-
- return typeSignature;
- }
-
- @Override
- public void setEnabled(boolean enabled) {
- m_button.setEnabled(enabled);
- m_textField.setEnabled(enabled);
-
- if (enabled) {
- m_textField.setBackground(null);
- }
- else {
- m_textField.setBackground(JaxWsSdkUtility.getColorLightGray());
- }
-
- super.setEnabled(enabled);
- }
-
- public static interface ISearchJavaSearchScopeFactory {
-
- /**
- * For default search scope, use {@link SearchEngine#createWorkspaceScope()}
- *
- * @return
- */
- public IJavaSearchScope create();
- }
-
- private class P_ScoutSeverityListener implements IScoutSeverityListener {
-
- @Override
- public void severityChanged(final IResource resource) {
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (isDisposed()) {
- return;
- }
-
- String value = getValue();
- if (!StringUtility.hasText(value)) {
- return;
- }
- String simpleName = Signature.getSimpleName(value);
- if (TypeUtility.existsType(value) &&
- resource.getType() == IResource.FILE &&
- resource.getFileExtension() != null &&
- resource.getFileExtension().equalsIgnoreCase("java") &&
- (resource.getName().endsWith(simpleName + ".java") ||
- resource.getName().endsWith(simpleName + ".class"))) {
- IType type = TypeUtility.getType(getValue());
- ICompilationUnit cu = JavaCore.createCompilationUnitFrom((IFile) resource);
-
- if (cu == null) {
- return;
- }
-
- try {
- for (IType typeChanged : cu.getTypes()) {
- if (TypeUtility.exists(typeChanged)) {
- typeChanged = TypeUtility.getToplevelType(typeChanged);
-
- if ((CompareUtility.equals(typeChanged, type))) {
- updateInfo();
- return;
- }
- }
- }
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- }
- }
- }
- });
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.internal.corext.template.java.SignatureUtil;
+import org.eclipse.jdt.ui.IJavaElementSearchConstants;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jdt.ui.actions.OpenNewClassWizardAction;
+import org.eclipse.jdt.ui.wizards.NewClassWizardPage;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.fields.tooltip.JavadocTooltip;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.util.IScoutSeverityListener;
+import org.eclipse.scout.sdk.util.ScoutSeverityManager;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyledText;
+import org.eclipse.swt.events.FocusAdapter;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+@SuppressWarnings("restriction")
+public class TypePresenter extends AbstractPropertyPresenter<String> {
+
+ protected StyledText m_textField;
+ protected Button m_button;
+
+ private IType m_superType;
+ private String[] m_interfaceSignatures;
+ private boolean m_allowChangeOfInterfaceType;
+ private ISearchJavaSearchScopeFactory m_searchScopeFactory;
+ private String m_defaultPackageNameNewType;
+ private ModifyListener m_modifyListener;
+ private boolean m_allowChangeOfSourceFolder;
+ private JavadocTooltip m_javaDocTooltip;
+
+ private P_ScoutSeverityListener m_severityListener;
+
+ public TypePresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ this(parent, toolkit, AbstractPropertyPresenter.DEFAULT_LABEL_WIDTH, true);
+ }
+
+ public TypePresenter(Composite parent, PropertyViewFormToolkit toolkit, int labelWidth, boolean initialize) {
+ super(parent, toolkit, labelWidth, false);
+ setLabel(Texts.get("class"));
+ setUseLinkAsLabel(true);
+ m_modifyListener = new P_ModifyListener();
+ m_severityListener = new P_ScoutSeverityListener();
+ ScoutSeverityManager.getInstance().addQualityManagerListener(m_severityListener);
+ if (initialize) {
+ callInitializer();
+ }
+ }
+
+ @Override
+ protected Control createContent(Composite parent) {
+ Composite composite = getToolkit().createComposite(parent, SWT.NONE);
+ m_textField = new StyledText(composite, SWT.SINGLE | SWT.BORDER);
+ m_textField.setEditable(true);
+ m_textField.addModifyListener(m_modifyListener);
+ m_textField.addFocusListener(new FocusAdapter() {
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ IType type = validateType(m_textField.getText());
+ if (type != null) {
+ setValueFromUI(type.getFullyQualifiedName());
+ }
+ }
+ });
+ m_javaDocTooltip = new JavadocTooltip(m_textField);
+
+ m_button = new Button(composite, SWT.PUSH | SWT.FLAT);
+ m_button.setText(Texts.get("Browse"));
+ m_button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IType newType = openBrowseTypesDialog();
+ if (TypeUtility.exists(newType)) {
+ setInputInternal(newType.getFullyQualifiedName());
+ setValueFromUI(newType.getFullyQualifiedName(), true);
+ }
+ }
+ });
+ m_button.setEnabled(m_searchScopeFactory != null);
+
+ // layout
+ GridLayout layout = new GridLayout(2, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ composite.setLayout(layout);
+
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ m_textField.setLayoutData(gd);
+
+ gd = new GridData();
+ m_button.setLayoutData(gd);
+
+ return composite;
+ }
+
+ @Override
+ public void dispose() {
+ if (m_severityListener != null) {
+ ScoutSeverityManager.getInstance().removeQualityManagerListener(m_severityListener);
+ }
+ }
+
+ @Override
+ protected void execLinkAction() throws CoreException {
+ String fqn = m_textField.getText();
+ if (TypeUtility.existsType(fqn)) {
+ try {
+ JavaUI.openInEditor(TypeUtility.getType(fqn));
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning(e);
+ }
+ }
+ else {
+ IType newType = openNewTypeDialog();
+ if (TypeUtility.exists(newType)) {
+ setInputInternal(newType.getFullyQualifiedName());
+ setValueFromUI(newType.getFullyQualifiedName());
+ }
+ }
+ }
+
+ @Override
+ protected void setInputInternal(String input) {
+ m_textField.removeModifyListener(m_modifyListener);
+ try {
+ m_textField.setText(StringUtility.nvl(input, ""));
+ }
+ finally {
+ m_textField.addModifyListener(m_modifyListener);
+ }
+
+ String fqn = StringUtility.nvl(input, "");
+ if (TypeUtility.existsType(fqn)) {
+ setTooltip(Signature.getSimpleName(fqn));
+ m_javaDocTooltip.setMember(TypeUtility.getType(fqn));
+ }
+ else {
+ setTooltip(null);
+ m_javaDocTooltip.setMember(null);
+ }
+
+ validateType(fqn);
+ }
+
+ public ISearchJavaSearchScopeFactory getSearchScopeFactory() {
+ return m_searchScopeFactory;
+ }
+
+ public void setSearchScopeFactory(ISearchJavaSearchScopeFactory searchScopeFactory) {
+ m_searchScopeFactory = searchScopeFactory;
+
+ if (isControlCreated()) {
+ m_button.setEnabled(m_searchScopeFactory != null);
+ }
+ }
+
+ public void setSuperType(IType superType) {
+ m_superType = superType;
+ }
+
+ /**
+ * To set the super interface types. Fore interface signatures, use
+ * {@link TypePresenter#setInterfaceSignatures(String[])}
+ *
+ * @param interfaceTypes
+ */
+ public void setInterfaceTypes(IType[] interfaceTypes) {
+ List<String> signatures = new ArrayList<String>();
+ for (IType type : interfaceTypes) {
+ signatures.add(Signature.createTypeSignature(type.getFullyQualifiedName(), true));
+ }
+ setInterfaceSignatures(signatures.toArray(new String[signatures.size()]));
+ }
+
+ public void setInterfaceSignatures(String[] interfaceSignatures) {
+ m_interfaceSignatures = interfaceSignatures;
+ }
+
+ public void setAllowChangeOfInterfaceType(boolean allowChangeOfInterfaceType) {
+ m_allowChangeOfInterfaceType = allowChangeOfInterfaceType;
+ }
+
+ public String getDefaultPackageNameNewType() {
+ return m_defaultPackageNameNewType;
+ }
+
+ public void setDefaultPackageNameNewType(String defaultPackageNameNewType) {
+ m_defaultPackageNameNewType = defaultPackageNameNewType;
+ }
+
+ protected IType openNewTypeDialog() {
+ NewClassWizardPage page = new NewClassWizardPage();
+ page.setDescription(Texts.get("CreateNewType"));
+ page.setEnclosingTypeSelection(false, false);
+ page.setMethodStubSelection(false, true, true, true);
+ String qualifier = Signature.getQualifier(m_textField.getText());
+ IPackageFragment packageFragment = null;
+ if (qualifier != null && qualifier.length() > 0) {
+ packageFragment = m_bundle.getPackageFragment(qualifier);
+ }
+ else if (m_defaultPackageNameNewType != null) {
+ packageFragment = m_bundle.getPackageFragment(m_defaultPackageNameNewType);
+ }
+
+ if (packageFragment != null) {
+ page.setPackageFragmentRoot((IPackageFragmentRoot) packageFragment.getParent(), isAllowChangeOfSourceFolder());
+ page.setPackageFragment(packageFragment, true);
+ }
+ else {
+ String rootPackageName = m_bundle.getRootPackageName();
+ page.setPackageFragmentRoot((IPackageFragmentRoot) m_bundle.getPackageFragment(rootPackageName).getParent(), true);
+ }
+ if (m_superType != null) {
+ page.setSuperClass(m_superType.getFullyQualifiedName(), false);
+ }
+ if (m_interfaceSignatures != null && m_interfaceSignatures.length > 0) {
+ List<String> interfaceTypeNames = new LinkedList<String>();
+ for (String signature : m_interfaceSignatures) {
+ interfaceTypeNames.add(stripSignatureToFQN(signature, false));
+ }
+ page.setSuperInterfaces(interfaceTypeNames, m_allowChangeOfInterfaceType);
+ }
+ page.setTypeName(Signature.getSimpleName(m_textField.getText()), true);
+ OpenNewClassWizardAction action = new OpenNewClassWizardAction();
+ action.setConfiguredWizardPage(page);
+ action.run();
+
+ IType type = page.getCreatedType();
+ if (TypeUtility.exists(type)) {
+ return type;
+ }
+ return null;
+ }
+
+ private IType openBrowseTypesDialog() {
+ String fqn = m_textField.getText();
+ IType type = null;
+ if (TypeUtility.existsType(fqn)) {
+ type = TypeUtility.getType(fqn);
+ }
+
+ try {
+ SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, m_searchScopeFactory.create(), IJavaElementSearchConstants.CONSIDER_ALL_TYPES, false, "*.*");
+ dialog.setTitle(Texts.get("BrowseForType"));
+ if (TypeUtility.exists(type)) {
+ dialog.setInitialSelections(new IType[]{type});
+ }
+ dialog.setBlockOnOpen(true);
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ type = (IType) dialog.getResult()[0];
+ if (TypeUtility.exists(type)) {
+ return type;
+ }
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ return null;
+ }
+
+ public boolean isAllowChangeOfSourceFolder() {
+ return m_allowChangeOfSourceFolder;
+ }
+
+ public boolean isAllowChangeOfInterfaceType() {
+ return m_allowChangeOfInterfaceType;
+ }
+
+ public void setAllowChangeOfSourceFolder(boolean allowChangeOfSourceFolder) {
+ m_allowChangeOfSourceFolder = allowChangeOfSourceFolder;
+ }
+
+ private IType validateType(String fullyQualifiedName) {
+ if (!TypeUtility.existsType(fullyQualifiedName)) {
+ setInfo(IMarker.SEVERITY_ERROR, Texts.get("TypeDoesNotExistClickOnXToCreate", Texts.get("class")));
+ return null;
+ }
+
+ IType type = TypeUtility.getType(fullyQualifiedName);
+
+ // check validity of type
+ if (m_interfaceSignatures != null) {
+ for (String signature : m_interfaceSignatures) {
+ IType interfaceType = TypeUtility.getType(stripSignatureToFQN(signature, true));
+ if (!JaxWsSdkUtility.isJdtSubType(interfaceType.getFullyQualifiedName(), type)) {
+ setInfo(IMarker.SEVERITY_ERROR, Texts.get("XMustBeSubtypeOfY", type.getElementName(), interfaceType.getFullyQualifiedName()));
+ return null;
+ }
+ }
+ }
+ if (m_superType != null && !JaxWsSdkUtility.isJdtSubType(m_superType.getFullyQualifiedName(), type)) {
+ setInfo(IMarker.SEVERITY_ERROR, Texts.get("XMustBeSubtypeOfY", type.getElementName(), m_superType.getFullyQualifiedName()));
+ return null;
+ }
+
+ clearInfo();
+ return type;
+ }
+
+ @Override
+ protected void updateSeverity(List<SeverityEntry> statusList) throws CoreException {
+ if (StringUtility.hasText(getValue()) && (TypeUtility.existsType(getValue()))) {
+ int quality = ScoutSeverityManager.getInstance().getSeverityOf(TypeUtility.getType(getValue()));
+ if (quality > IMarker.SEVERITY_INFO) {
+ statusList.add(new SeverityEntry(quality, "Unresolved compilation errors"));
+ }
+ }
+ }
+
+ private class P_ModifyListener implements ModifyListener {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ validateType(m_textField.getText());
+ }
+ }
+
+ private String stripSignatureToFQN(String signature, boolean eraseGenericTypes) {
+ if (signature == null) {
+ return null;
+ }
+
+ String typeSignature = SignatureUtil.stripSignatureToFQN(signature);
+ if (!eraseGenericTypes) {
+ // support for generic type parameters
+ String typeArguments = null;
+ for (String typeArgument : Signature.getTypeArguments(signature)) {
+ typeArguments = StringUtility.join(",", typeArguments, SignatureUtil.stripSignatureToFQN(typeArgument));
+ }
+ if (typeArguments != null) {
+ typeSignature = typeSignature + "<" + typeArguments + ">";
+ }
+ }
+
+ return typeSignature;
+ }
+
+ @Override
+ public void setEnabled(boolean enabled) {
+ m_button.setEnabled(enabled);
+ m_textField.setEnabled(enabled);
+
+ if (enabled) {
+ m_textField.setBackground(null);
+ }
+ else {
+ m_textField.setBackground(JaxWsSdkUtility.getColorLightGray());
+ }
+
+ super.setEnabled(enabled);
+ }
+
+ public static interface ISearchJavaSearchScopeFactory {
+
+ /**
+ * For default search scope, use {@link SearchEngine#createWorkspaceScope()}
+ *
+ * @return
+ */
+ public IJavaSearchScope create();
+ }
+
+ private class P_ScoutSeverityListener implements IScoutSeverityListener {
+
+ @Override
+ public void severityChanged(final IResource resource) {
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (isDisposed()) {
+ return;
+ }
+
+ String value = getValue();
+ if (!StringUtility.hasText(value)) {
+ return;
+ }
+ String simpleName = Signature.getSimpleName(value);
+ if (TypeUtility.existsType(value) &&
+ resource.getType() == IResource.FILE &&
+ resource.getFileExtension() != null &&
+ resource.getFileExtension().equalsIgnoreCase("java") &&
+ (resource.getName().endsWith(simpleName + ".java") ||
+ resource.getName().endsWith(simpleName + ".class"))) {
+ IType type = TypeUtility.getType(getValue());
+ ICompilationUnit cu = JavaCore.createCompilationUnitFrom((IFile) resource);
+
+ if (cu == null) {
+ return;
+ }
+
+ try {
+ for (IType typeChanged : cu.getTypes()) {
+ if (TypeUtility.exists(typeChanged)) {
+ typeChanged = TypeUtility.getToplevelType(typeChanged);
+
+ if ((CompareUtility.equals(typeChanged, type))) {
+ updateInfo();
+ return;
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+ }
+ });
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/UrlPatternPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/UrlPatternPresenter.java
index 08ed76ac3..f14d19628 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/UrlPatternPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/UrlPatternPresenter.java
@@ -1,94 +1,94 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.JaxWsServletRegistrationOperation;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.JaxWsServletRegistrationWizardPage;
-import org.eclipse.swt.widgets.Composite;
-
-public class UrlPatternPresenter extends AbstractStringActionPresenter {
-
- private SunJaxWsBean m_sunJaxWsBean;
-
- public UrlPatternPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- super(parent, toolkit);
- setActionLinkTooltip(Texts.get("ChangeUrlOfWsdl"));
- setActionLinkEnabled(false);
- }
-
- @Override
- protected void execAction() throws CoreException {
- P_Wizard wizard = new P_Wizard(m_bundle);
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.setPageSize(650, 410);
- wizardDialog.open();
- }
-
- public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
- m_sunJaxWsBean = sunJaxWsBean;
- setActionLinkEnabled(m_sunJaxWsBean != null);
- }
-
- private class P_Wizard extends AbstractWorkspaceWizard {
-
- private IScoutBundle m_bundle;
- private JaxWsServletRegistrationWizardPage m_wizardPage;
- private JaxWsServletRegistrationOperation m_operation;
-
- public P_Wizard(IScoutBundle bundle) {
- m_bundle = bundle;
- m_operation = new JaxWsServletRegistrationOperation();
- setWindowTitle(Texts.get("EndpointPublishConfiguration"));
- }
-
- @Override
- public void addPages() {
- m_wizardPage = new JaxWsServletRegistrationWizardPage(m_bundle, true);
- m_wizardPage.setTitle(Texts.get("SpecifyUrlOfWsdl"));
- m_wizardPage.setUrlPattern(getValue());
- m_wizardPage.initializeDefaultValues(m_bundle);
- addPage(m_wizardPage);
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_operation.setBundle(m_bundle);
- m_operation.setRegistrationBundle(m_wizardPage.getRegistrationBundle());
- m_operation.setJaxWsAlias(m_wizardPage.getAlias());
- m_operation.setSunJaxWsBean(m_sunJaxWsBean);
- m_operation.setUrlPattern(m_wizardPage.getUrlPattern());
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- JaxWsSdk.getDefault().getMarkerQueueManager().suspend();
- try {
- m_operation.run(monitor, workingCopyManager);
- }
- finally {
- JaxWsSdk.getDefault().getMarkerQueueManager().resume();
- }
- return true;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.JaxWsServletRegistrationOperation;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.JaxWsServletRegistrationWizardPage;
+import org.eclipse.swt.widgets.Composite;
+
+public class UrlPatternPresenter extends AbstractStringActionPresenter {
+
+ private SunJaxWsBean m_sunJaxWsBean;
+
+ public UrlPatternPresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ super(parent, toolkit);
+ setActionLinkTooltip(Texts.get("ChangeUrlOfWsdl"));
+ setActionLinkEnabled(false);
+ }
+
+ @Override
+ protected void execAction() throws CoreException {
+ P_Wizard wizard = new P_Wizard(m_bundle);
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.setPageSize(650, 410);
+ wizardDialog.open();
+ }
+
+ public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
+ m_sunJaxWsBean = sunJaxWsBean;
+ setActionLinkEnabled(m_sunJaxWsBean != null);
+ }
+
+ private class P_Wizard extends AbstractWorkspaceWizard {
+
+ private IScoutBundle m_bundle;
+ private JaxWsServletRegistrationWizardPage m_wizardPage;
+ private JaxWsServletRegistrationOperation m_operation;
+
+ public P_Wizard(IScoutBundle bundle) {
+ m_bundle = bundle;
+ m_operation = new JaxWsServletRegistrationOperation();
+ setWindowTitle(Texts.get("EndpointPublishConfiguration"));
+ }
+
+ @Override
+ public void addPages() {
+ m_wizardPage = new JaxWsServletRegistrationWizardPage(m_bundle, true);
+ m_wizardPage.setTitle(Texts.get("SpecifyUrlOfWsdl"));
+ m_wizardPage.setUrlPattern(getValue());
+ m_wizardPage.initializeDefaultValues(m_bundle);
+ addPage(m_wizardPage);
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_operation.setBundle(m_bundle);
+ m_operation.setRegistrationBundle(m_wizardPage.getRegistrationBundle());
+ m_operation.setJaxWsAlias(m_wizardPage.getAlias());
+ m_operation.setSunJaxWsBean(m_sunJaxWsBean);
+ m_operation.setUrlPattern(m_wizardPage.getUrlPattern());
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ JaxWsSdk.getDefault().getMarkerQueueManager().suspend();
+ try {
+ m_operation.run(monitor, workingCopyManager);
+ }
+ finally {
+ JaxWsSdk.getDefault().getMarkerQueueManager().resume();
+ }
+ return true;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/WsdlFilePresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/WsdlFilePresenter.java
index 691bd88b9..588ce7606 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/WsdlFilePresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/WsdlFilePresenter.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsdlLocationWizard;
-import org.eclipse.swt.widgets.Composite;
-
-public class WsdlFilePresenter extends FilePresenter {
-
- private BuildJaxWsBean m_buildJaxWsBean;
- private SunJaxWsBean m_sunJaxWsBean;
-
- public WsdlFilePresenter(Composite parent, PropertyViewFormToolkit toolkit) {
- super(parent, toolkit);
- setLabel(Texts.get("WsdlFile"));
- setUseLinkAsLabel(true);
- setFileExtension("wsdl");
- if (m_sunJaxWsBean != null) {
- setFileDirectory(JaxWsConstants.PATH_WSDL_PROVIDER);
- }
- else {
- setFileDirectory(JaxWsConstants.PATH_WSDL_CONSUMER);
- }
- }
-
- @Override
- protected IFile execBrowseAction() {
- // browse for WSDL file or create new one
- WsdlLocationWizard wizard = new WsdlLocationWizard(m_bundle, m_buildJaxWsBean, m_sunJaxWsBean);
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.setPageSize(650, 350);
- wizardDialog.open();
- // as wizard operation is asynchronously, the presenter's value is updated by setting a new value with {@link AbstractPropertyPresenter#setInput(Object)}
- return null;
- }
-
- @Override
- protected String getConfiguredBrowseButtonLabel() {
- return Texts.get("Change");
- }
-
- public BuildJaxWsBean getBuildJaxWsBean() {
- return m_buildJaxWsBean;
- }
-
- public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
- m_buildJaxWsBean = buildJaxWsBean;
- }
-
- public SunJaxWsBean getSunJaxWsBean() {
- return m_sunJaxWsBean;
- }
-
- /**
- * Used by providers
- *
- * @param sunJaxWsBean
- */
- public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
- m_sunJaxWsBean = sunJaxWsBean;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsdlLocationWizard;
+import org.eclipse.swt.widgets.Composite;
+
+public class WsdlFilePresenter extends FilePresenter {
+
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private SunJaxWsBean m_sunJaxWsBean;
+
+ public WsdlFilePresenter(Composite parent, PropertyViewFormToolkit toolkit) {
+ super(parent, toolkit);
+ setLabel(Texts.get("WsdlFile"));
+ setUseLinkAsLabel(true);
+ setFileExtension("wsdl");
+ if (m_sunJaxWsBean != null) {
+ setFileDirectory(JaxWsConstants.PATH_WSDL_PROVIDER);
+ }
+ else {
+ setFileDirectory(JaxWsConstants.PATH_WSDL_CONSUMER);
+ }
+ }
+
+ @Override
+ protected IFile execBrowseAction() {
+ // browse for WSDL file or create new one
+ WsdlLocationWizard wizard = new WsdlLocationWizard(m_bundle, m_buildJaxWsBean, m_sunJaxWsBean);
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.setPageSize(650, 350);
+ wizardDialog.open();
+ // as wizard operation is asynchronously, the presenter's value is updated by setting a new value with {@link AbstractPropertyPresenter#setInput(Object)}
+ return null;
+ }
+
+ @Override
+ protected String getConfiguredBrowseButtonLabel() {
+ return Texts.get("Change");
+ }
+
+ public BuildJaxWsBean getBuildJaxWsBean() {
+ return m_buildJaxWsBean;
+ }
+
+ public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
+ m_buildJaxWsBean = buildJaxWsBean;
+ }
+
+ public SunJaxWsBean getSunJaxWsBean() {
+ return m_sunJaxWsBean;
+ }
+
+ /**
+ * Used by providers
+ *
+ * @param sunJaxWsBean
+ */
+ public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
+ m_sunJaxWsBean = sunJaxWsBean;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/WsdlFolderPresenter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/WsdlFolderPresenter.java
index 143eca5eb..410b0483b 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/WsdlFolderPresenter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/presenter/WsdlFolderPresenter.java
@@ -1,106 +1,106 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsFileMoveWizard;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsdlFolderViewerFilter;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-public class WsdlFolderPresenter extends FolderPresenter {
-
- private WebserviceEnum m_webserviceEnum;
- private SunJaxWsBean m_sunJaxWsBean;
- private BuildJaxWsBean m_buildJaxWsBean;
-
- public WsdlFolderPresenter(Composite parent, PropertyViewFormToolkit toolkit, WebserviceEnum webserviceEnum) {
- super(parent, toolkit, DEFAULT_LABEL_WIDTH, false);
- m_webserviceEnum = webserviceEnum;
- callInitializer();
- }
-
- @Override
- protected String getConfiguredBrowseButtonLabel() {
- return Texts.get("Change");
- }
-
- @Override
- protected IFolder execBrowseAction() {
- IFolder rootFolder = null;
- if (m_webserviceEnum == WebserviceEnum.Provider) {
- rootFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, true);
- }
- else {
- rootFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_CONSUMER, true);
- }
-
- IFolder folder = JaxWsSdkUtility.openProjectFolderDialog(
- m_bundle,
- new WsdlFolderViewerFilter(m_bundle, rootFolder),
- Texts.get("MovingFiles"),
- Texts.get("MoveWsdlFileAndArtefacts"),
- rootFolder,
- getValue());
- if (folder != null && (getValue() == null || !folder.getProjectRelativePath().equals(getValue().getProjectRelativePath()))) {
- WsFileMoveWizard wizard = new WsFileMoveWizard();
- wizard.setBundle(m_bundle);
- wizard.setWebserviceEnum(m_webserviceEnum);
- wizard.setBuildJaxWsBean(m_buildJaxWsBean);
- wizard.setSunJaxWsBean(m_sunJaxWsBean);
- wizard.setDestination(folder);
- wizard.setMarkerGroupUUID(getMarkerGroupUUID());
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- if (wizardDialog.open() == SWT.OK) {
- return folder;
- }
- }
- return null;
- }
-
- public SunJaxWsBean getSunJaxWsBean() {
- return m_sunJaxWsBean;
- }
-
- public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
- m_sunJaxWsBean = sunJaxWsBean;
- calculateAccessiblity();
- }
-
- public BuildJaxWsBean getBuildJaxWsBean() {
- return m_buildJaxWsBean;
- }
-
- public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
- m_buildJaxWsBean = buildJaxWsBean;
- calculateAccessiblity();
- }
-
- private void calculateAccessiblity() {
- if (m_buildJaxWsBean == null) {
- setEnabled(false);
- return;
- }
- if (m_webserviceEnum == WebserviceEnum.Provider && m_sunJaxWsBean == null) {
- setEnabled(false);
- return;
- }
- setEnabled(true);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.presenter;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.scout.sdk.ui.view.properties.PropertyViewFormToolkit;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.WsFileMoveWizard;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsdlFolderViewerFilter;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+public class WsdlFolderPresenter extends FolderPresenter {
+
+ private WebserviceEnum m_webserviceEnum;
+ private SunJaxWsBean m_sunJaxWsBean;
+ private BuildJaxWsBean m_buildJaxWsBean;
+
+ public WsdlFolderPresenter(Composite parent, PropertyViewFormToolkit toolkit, WebserviceEnum webserviceEnum) {
+ super(parent, toolkit, DEFAULT_LABEL_WIDTH, false);
+ m_webserviceEnum = webserviceEnum;
+ callInitializer();
+ }
+
+ @Override
+ protected String getConfiguredBrowseButtonLabel() {
+ return Texts.get("Change");
+ }
+
+ @Override
+ protected IFolder execBrowseAction() {
+ IFolder rootFolder = null;
+ if (m_webserviceEnum == WebserviceEnum.Provider) {
+ rootFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, true);
+ }
+ else {
+ rootFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_CONSUMER, true);
+ }
+
+ IFolder folder = JaxWsSdkUtility.openProjectFolderDialog(
+ m_bundle,
+ new WsdlFolderViewerFilter(m_bundle, rootFolder),
+ Texts.get("MovingFiles"),
+ Texts.get("MoveWsdlFileAndArtefacts"),
+ rootFolder,
+ getValue());
+ if (folder != null && (getValue() == null || !folder.getProjectRelativePath().equals(getValue().getProjectRelativePath()))) {
+ WsFileMoveWizard wizard = new WsFileMoveWizard();
+ wizard.setBundle(m_bundle);
+ wizard.setWebserviceEnum(m_webserviceEnum);
+ wizard.setBuildJaxWsBean(m_buildJaxWsBean);
+ wizard.setSunJaxWsBean(m_sunJaxWsBean);
+ wizard.setDestination(folder);
+ wizard.setMarkerGroupUUID(getMarkerGroupUUID());
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ if (wizardDialog.open() == SWT.OK) {
+ return folder;
+ }
+ }
+ return null;
+ }
+
+ public SunJaxWsBean getSunJaxWsBean() {
+ return m_sunJaxWsBean;
+ }
+
+ public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
+ m_sunJaxWsBean = sunJaxWsBean;
+ calculateAccessiblity();
+ }
+
+ public BuildJaxWsBean getBuildJaxWsBean() {
+ return m_buildJaxWsBean;
+ }
+
+ public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
+ m_buildJaxWsBean = buildJaxWsBean;
+ calculateAccessiblity();
+ }
+
+ private void calculateAccessiblity() {
+ if (m_buildJaxWsBean == null) {
+ setEnabled(false);
+ return;
+ }
+ if (m_webserviceEnum == WebserviceEnum.Provider && m_sunJaxWsBean == null) {
+ setEnabled(false);
+ return;
+ }
+ setEnabled(true);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/proposal/PathProposal.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/proposal/PathProposal.java
index 8ed97ad5f..15f1b1dc7 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/proposal/PathProposal.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/proposal/PathProposal.java
@@ -1,33 +1,33 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.proposal;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.scout.sdk.ui.fields.proposal.SimpleProposal;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-
-public class PathProposal extends SimpleProposal {
- private static final String DATA_PATH = "dataPath";
- private IPath m_path;
-
- public PathProposal(IPath path) {
- super(path.toPortableString(), ScoutSdkUi.getImage(ScoutSdkUi.Package));
- setData(DATA_PATH, path);
- }
-
- public IPath getPath() {
- return (IPath) getData(DATA_PATH);
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.proposal;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.scout.sdk.ui.fields.proposal.SimpleProposal;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+
+public class PathProposal extends SimpleProposal {
+ private static final String DATA_PATH = "dataPath";
+ private IPath m_path;
+
+ public PathProposal(IPath path) {
+ super(path.toPortableString(), ScoutSdkUi.getImage(ScoutSdkUi.Package));
+ setData(DATA_PATH, path);
+ }
+
+ public IPath getPath() {
+ return (IPath) getData(DATA_PATH);
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/proposal/QNameProposal.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/proposal/QNameProposal.java
index 5b3b94d4d..01a667ea4 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/proposal/QNameProposal.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/view/proposal/QNameProposal.java
@@ -1,45 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.view.proposal;
-
-import javax.xml.namespace.QName;
-
-import org.eclipse.scout.sdk.ui.fields.proposal.SimpleProposal;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-
-public class QNameProposal extends SimpleProposal {
-
- private static final String DATA_QNAME = "dataQname";
- private static final String DATA_ICON_NAME = "dataiconName";
-
- public QNameProposal(QName qname) {
- this(qname, null);
- }
-
- public QNameProposal(QName qname, String icon) {
- super(qname.getLocalPart(), (icon != null) ? (JaxWsSdk.getImage(icon)) : (null));
- setData(DATA_QNAME, qname);
- setData(DATA_ICON_NAME, icon);
- }
-
- public QName getQname() {
- return (QName) getData(DATA_QNAME);
- }
-
- @Override
- public String getTextSelected() {
- return getQname().toString();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.view.proposal;
+
+import javax.xml.namespace.QName;
+
+import org.eclipse.scout.sdk.ui.fields.proposal.SimpleProposal;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+
+public class QNameProposal extends SimpleProposal {
+
+ private static final String DATA_QNAME = "dataQname";
+ private static final String DATA_ICON_NAME = "dataiconName";
+
+ public QNameProposal(QName qname) {
+ this(qname, null);
+ }
+
+ public QNameProposal(QName qname, String icon) {
+ super(qname.getLocalPart(), (icon != null) ? (JaxWsSdk.getImage(icon)) : (null));
+ setData(DATA_QNAME, qname);
+ setData(DATA_ICON_NAME, icon);
+ }
+
+ public QName getQname() {
+ return (QName) getData(DATA_QNAME);
+ }
+
+ @Override
+ public String getTextSelected() {
+ return getQname().toString();
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/AdditionalResourcesWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/AdditionalResourcesWizard.java
index 2c6807465..5908084ef 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/AdditionalResourcesWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/AdditionalResourcesWizard.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import java.io.File;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.AdditionalResourcesWizardPage;
-
-public class AdditionalResourcesWizard extends AbstractWorkspaceWizard {
-
- private File[] m_files;
-
- private AdditionalResourcesWizardPage m_wizardPage;
-
- public AdditionalResourcesWizard(File[] files) {
- setWindowTitle(Texts.get("AdditionalResources"));
- m_files = files;
- }
-
- @Override
- public void addPages() {
- m_wizardPage = new AdditionalResourcesWizardPage();
- m_wizardPage.setFiles(m_files);
- addPage(m_wizardPage);
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_files = m_wizardPage.getFiles();
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- return true;
- }
-
- public File[] getFiles() {
- return m_files;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.AdditionalResourcesWizardPage;
+
+public class AdditionalResourcesWizard extends AbstractWorkspaceWizard {
+
+ private File[] m_files;
+
+ private AdditionalResourcesWizardPage m_wizardPage;
+
+ public AdditionalResourcesWizard(File[] files) {
+ setWindowTitle(Texts.get("AdditionalResources"));
+ m_files = files;
+ }
+
+ @Override
+ public void addPages() {
+ m_wizardPage = new AdditionalResourcesWizardPage();
+ m_wizardPage.setFiles(m_files);
+ addPage(m_wizardPage);
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_files = m_wizardPage.getFiles();
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ return true;
+ }
+
+ public File[] getFiles() {
+ return m_files;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/BuildPropertiesWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/BuildPropertiesWizard.java
index 4eff34a45..2a54e52d4 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/BuildPropertiesWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/BuildPropertiesWizard.java
@@ -1,99 +1,99 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.BuildPropertiesWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.BuildProperty;
-
-public class BuildPropertiesWizard extends AbstractWorkspaceWizard {
-
- private IScoutBundle m_bundle;
- private BuildJaxWsBean m_buildJaxWsBean;
- private List<BuildProperty> m_properties;
-
- private BuildPropertiesWizardPage m_wizardPage;
-
- public BuildPropertiesWizard(IScoutBundle bundle, BuildJaxWsBean buildJaxWsBean) {
- setWindowTitle(Texts.get("WsBuildDirectives"));
- m_bundle = bundle;
- m_buildJaxWsBean = buildJaxWsBean;
- m_properties = loadProperties(m_buildJaxWsBean);
- }
-
- @Override
- public void addPages() {
- m_wizardPage = new BuildPropertiesWizardPage();
- m_wizardPage.setProperties(m_properties);
- addPage(m_wizardPage);
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_properties = m_wizardPage.getProperties();
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- Map<String, List<String>> propertyMap = new HashMap<String, List<String>>();
- for (BuildProperty property : m_properties) {
- if (!propertyMap.containsKey(property.getName())) {
- propertyMap.put(property.getName(), new LinkedList<String>());
- }
- if (StringUtility.hasText(property.getValue())) {
- propertyMap.get(property.getName()).add(property.getValue());
- }
- }
- m_buildJaxWsBean.setProperties(propertyMap);
-
- // store buildJaxWsBean
- ScoutXmlDocument xmlDocument = m_buildJaxWsBean.getXml().getDocument();
- ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(xmlDocument, IResourceListener.EVENT_BUILDJAXWS_PROPERTIES_CHANGED, monitor, m_buildJaxWsBean.getAlias());
-
- return true;
- }
-
- private List<BuildProperty> loadProperties(BuildJaxWsBean buildJaxWsBean) {
- List<BuildProperty> properties = new LinkedList<BuildProperty>();
-
- for (Entry<String, List<String>> entry : buildJaxWsBean.getPropertiers().entrySet()) {
- String name = entry.getKey();
- List<String> values = entry.getValue();
-
- if (values == null || values.size() == 0) {
- properties.add(new BuildProperty(entry.getKey(), null));
- }
- else {
- for (String value : values) {
- properties.add(new BuildProperty(name, value));
- }
- }
- }
- return properties;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import java.util.HashMap;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.BuildPropertiesWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.BuildProperty;
+
+public class BuildPropertiesWizard extends AbstractWorkspaceWizard {
+
+ private IScoutBundle m_bundle;
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private List<BuildProperty> m_properties;
+
+ private BuildPropertiesWizardPage m_wizardPage;
+
+ public BuildPropertiesWizard(IScoutBundle bundle, BuildJaxWsBean buildJaxWsBean) {
+ setWindowTitle(Texts.get("WsBuildDirectives"));
+ m_bundle = bundle;
+ m_buildJaxWsBean = buildJaxWsBean;
+ m_properties = loadProperties(m_buildJaxWsBean);
+ }
+
+ @Override
+ public void addPages() {
+ m_wizardPage = new BuildPropertiesWizardPage();
+ m_wizardPage.setProperties(m_properties);
+ addPage(m_wizardPage);
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_properties = m_wizardPage.getProperties();
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ Map<String, List<String>> propertyMap = new HashMap<String, List<String>>();
+ for (BuildProperty property : m_properties) {
+ if (!propertyMap.containsKey(property.getName())) {
+ propertyMap.put(property.getName(), new LinkedList<String>());
+ }
+ if (StringUtility.hasText(property.getValue())) {
+ propertyMap.get(property.getName()).add(property.getValue());
+ }
+ }
+ m_buildJaxWsBean.setProperties(propertyMap);
+
+ // store buildJaxWsBean
+ ScoutXmlDocument xmlDocument = m_buildJaxWsBean.getXml().getDocument();
+ ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(xmlDocument, IResourceListener.EVENT_BUILDJAXWS_PROPERTIES_CHANGED, monitor, m_buildJaxWsBean.getAlias());
+
+ return true;
+ }
+
+ private List<BuildProperty> loadProperties(BuildJaxWsBean buildJaxWsBean) {
+ List<BuildProperty> properties = new LinkedList<BuildProperty>();
+
+ for (Entry<String, List<String>> entry : buildJaxWsBean.getPropertiers().entrySet()) {
+ String name = entry.getKey();
+ List<String> values = entry.getValue();
+
+ if (values == null || values.size() == 0) {
+ properties.add(new BuildProperty(entry.getKey(), null));
+ }
+ else {
+ for (String value : values) {
+ properties.add(new BuildProperty(name, value));
+ }
+ }
+ }
+ return properties;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/BuildPropertyWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/BuildPropertyWizard.java
index bd0cf42a8..29f4ce694 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/BuildPropertyWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/BuildPropertyWizard.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import java.util.Set;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.BuildPropertyWizardPage;
-
-public class BuildPropertyWizard extends AbstractWorkspaceWizard {
-
- private String m_directive;
- private String m_value;
- private Set<String> m_illegalNames;
- private BuildPropertyWizardPage m_wizardPage;
-
- public BuildPropertyWizard() {
- setWindowTitle(Texts.get("WsBuildDirective"));
- }
-
- @Override
- public void addPages() {
- m_wizardPage = new BuildPropertyWizardPage();
- m_wizardPage.setDirective(m_directive);
- m_wizardPage.setValue(m_value);
- m_wizardPage.setIllegalNames(m_illegalNames);
- addPage(m_wizardPage);
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_directive = m_wizardPage.getDirective();
- m_value = m_wizardPage.getValue();
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- return true;
- }
-
- public String getDirective() {
- return m_directive;
- }
-
- public void setDirective(String directive) {
- m_directive = directive;
- }
-
- public String getValue() {
- return m_value;
- }
-
- public void setValue(String value) {
- m_value = value;
- }
-
- public Set<String> getIllegalNames() {
- return m_illegalNames;
- }
-
- public void setIllegalNames(Set<String> illegalNames) {
- m_illegalNames = illegalNames;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import java.util.Set;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.BuildPropertyWizardPage;
+
+public class BuildPropertyWizard extends AbstractWorkspaceWizard {
+
+ private String m_directive;
+ private String m_value;
+ private Set<String> m_illegalNames;
+ private BuildPropertyWizardPage m_wizardPage;
+
+ public BuildPropertyWizard() {
+ setWindowTitle(Texts.get("WsBuildDirective"));
+ }
+
+ @Override
+ public void addPages() {
+ m_wizardPage = new BuildPropertyWizardPage();
+ m_wizardPage.setDirective(m_directive);
+ m_wizardPage.setValue(m_value);
+ m_wizardPage.setIllegalNames(m_illegalNames);
+ addPage(m_wizardPage);
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_directive = m_wizardPage.getDirective();
+ m_value = m_wizardPage.getValue();
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ return true;
+ }
+
+ public String getDirective() {
+ return m_directive;
+ }
+
+ public void setDirective(String directive) {
+ m_directive = directive;
+ }
+
+ public String getValue() {
+ return m_value;
+ }
+
+ public void setValue(String value) {
+ m_value = value;
+ }
+
+ public Set<String> getIllegalNames() {
+ return m_illegalNames;
+ }
+
+ public void setIllegalNames(Set<String> illegalNames) {
+ m_illegalNames = illegalNames;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/HandlerChainFilterWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/HandlerChainFilterWizard.java
index 8b02cfae7..d1dc2f7b4 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/HandlerChainFilterWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/HandlerChainFilterWizard.java
@@ -1,148 +1,148 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.HandlerChainFilterWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.HandlerChainFilterWizardPage.FilterTypeEnum;
-
-public class HandlerChainFilterWizard extends AbstractWorkspaceWizard {
-
- private HandlerChainFilterWizardPage m_wizardPage;
-
- private IScoutBundle m_bundle;
- private SunJaxWsBean m_sunJaxWsBean;
- private ScoutXmlElement m_xmlHandlerChain;
-
- private FilterTypeEnum m_filterTypeEnum;
- private String m_namespacePrefix;
- private String m_namespace;
- private String m_pattern;
-
- public HandlerChainFilterWizard() {
- setWindowTitle(Texts.get("HandlerChainFilter"));
- }
-
- public void init(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, ScoutXmlElement xmlHandlerChain) {
- m_bundle = bundle;
- m_sunJaxWsBean = sunJaxWsBean;
- m_xmlHandlerChain = xmlHandlerChain;
-
- ScoutXmlElement xmlFilterProtocol = m_xmlHandlerChain.getChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PROTOCOL));
- ScoutXmlElement xmlFilterService = m_xmlHandlerChain.getChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_SERVICE));
- ScoutXmlElement xmlFilterPort = m_xmlHandlerChain.getChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PORT));
-
- if (xmlFilterProtocol != null) {
- m_filterTypeEnum = FilterTypeEnum.ProtocolFilter;
- m_pattern = xmlFilterProtocol.getText();
- }
- else if (xmlFilterService != null || xmlFilterPort != null) {
- ScoutXmlElement xmlFilter;
- if (xmlFilterService != null) {
- xmlFilter = xmlFilterService;
- m_filterTypeEnum = FilterTypeEnum.ServiceFilter;
- }
- else {
- xmlFilter = xmlFilterPort;
- m_filterTypeEnum = FilterTypeEnum.PortFilter;
- }
- m_pattern = xmlFilter.getText();
- Map namespaces = xmlFilter.getNamespaces();
- if (namespaces != null && namespaces.size() > 0) {
- Entry ns = (Entry) namespaces.entrySet().iterator().next();
- m_namespacePrefix = (String) ns.getKey();
- m_namespace = (String) ns.getValue();
- }
- }
- else {
- m_filterTypeEnum = FilterTypeEnum.NoFilter;
- }
- }
-
- @Override
- public void addPages() {
- m_wizardPage = new HandlerChainFilterWizardPage(m_bundle);
- m_wizardPage.setFilterType(m_filterTypeEnum);
- m_wizardPage.setNamespacePrefix(m_namespacePrefix);
- m_wizardPage.setNamespace(m_namespace);
- m_wizardPage.setPattern(m_pattern);
- addPage(m_wizardPage);
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_filterTypeEnum = m_wizardPage.getFilterType();
- m_namespacePrefix = m_wizardPage.getNamespacePrefix();
- m_namespace = m_wizardPage.getNamespace();
- m_pattern = m_wizardPage.getPattern();
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- // workaround as {@link ScoutXmlElement#removeChildren(Collection)} not works properly
- while (m_xmlHandlerChain.hasChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PROTOCOL))) {
- m_xmlHandlerChain.removeChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PROTOCOL));
- }
- while (m_xmlHandlerChain.hasChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_SERVICE))) {
- m_xmlHandlerChain.removeChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_SERVICE));
- }
- while (m_xmlHandlerChain.hasChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PORT))) {
- m_xmlHandlerChain.removeChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PORT));
- }
-
- switch (m_filterTypeEnum) {
- case ProtocolFilter:
- ScoutXmlElement protocolFilter = m_xmlHandlerChain.addChild();
- m_xmlHandlerChain.removeChild(protocolFilter);
- m_xmlHandlerChain.addChild(protocolFilter, 0);
- protocolFilter.setName(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PROTOCOL));
- protocolFilter.addText(m_pattern);
- break;
- case ServiceFilter:
- ScoutXmlElement serviceFilter = m_xmlHandlerChain.addChild();
- m_xmlHandlerChain.removeChild(serviceFilter);
- m_xmlHandlerChain.addChild(serviceFilter, 0);
- serviceFilter.setName(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_SERVICE));
- serviceFilter.addText(m_pattern);
- serviceFilter.setNamespace(m_namespacePrefix, m_namespace);
- break;
- case PortFilter:
- ScoutXmlElement portFilter = m_xmlHandlerChain.addChild();
- m_xmlHandlerChain.removeChild(portFilter);
- m_xmlHandlerChain.addChild(portFilter, 0);
- portFilter.setName(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PORT));
- portFilter.addText(m_pattern);
- portFilter.setNamespace(m_namespacePrefix, m_namespace);
- break;
- }
-
- // persist
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_xmlHandlerChain.getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
- return true;
- }
-
- private String toQualifiedName(String name) {
- return m_sunJaxWsBean.toQualifiedName(name);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.HandlerChainFilterWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.HandlerChainFilterWizardPage.FilterTypeEnum;
+
+public class HandlerChainFilterWizard extends AbstractWorkspaceWizard {
+
+ private HandlerChainFilterWizardPage m_wizardPage;
+
+ private IScoutBundle m_bundle;
+ private SunJaxWsBean m_sunJaxWsBean;
+ private ScoutXmlElement m_xmlHandlerChain;
+
+ private FilterTypeEnum m_filterTypeEnum;
+ private String m_namespacePrefix;
+ private String m_namespace;
+ private String m_pattern;
+
+ public HandlerChainFilterWizard() {
+ setWindowTitle(Texts.get("HandlerChainFilter"));
+ }
+
+ public void init(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, ScoutXmlElement xmlHandlerChain) {
+ m_bundle = bundle;
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_xmlHandlerChain = xmlHandlerChain;
+
+ ScoutXmlElement xmlFilterProtocol = m_xmlHandlerChain.getChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PROTOCOL));
+ ScoutXmlElement xmlFilterService = m_xmlHandlerChain.getChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_SERVICE));
+ ScoutXmlElement xmlFilterPort = m_xmlHandlerChain.getChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PORT));
+
+ if (xmlFilterProtocol != null) {
+ m_filterTypeEnum = FilterTypeEnum.ProtocolFilter;
+ m_pattern = xmlFilterProtocol.getText();
+ }
+ else if (xmlFilterService != null || xmlFilterPort != null) {
+ ScoutXmlElement xmlFilter;
+ if (xmlFilterService != null) {
+ xmlFilter = xmlFilterService;
+ m_filterTypeEnum = FilterTypeEnum.ServiceFilter;
+ }
+ else {
+ xmlFilter = xmlFilterPort;
+ m_filterTypeEnum = FilterTypeEnum.PortFilter;
+ }
+ m_pattern = xmlFilter.getText();
+ Map namespaces = xmlFilter.getNamespaces();
+ if (namespaces != null && namespaces.size() > 0) {
+ Entry ns = (Entry) namespaces.entrySet().iterator().next();
+ m_namespacePrefix = (String) ns.getKey();
+ m_namespace = (String) ns.getValue();
+ }
+ }
+ else {
+ m_filterTypeEnum = FilterTypeEnum.NoFilter;
+ }
+ }
+
+ @Override
+ public void addPages() {
+ m_wizardPage = new HandlerChainFilterWizardPage(m_bundle);
+ m_wizardPage.setFilterType(m_filterTypeEnum);
+ m_wizardPage.setNamespacePrefix(m_namespacePrefix);
+ m_wizardPage.setNamespace(m_namespace);
+ m_wizardPage.setPattern(m_pattern);
+ addPage(m_wizardPage);
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_filterTypeEnum = m_wizardPage.getFilterType();
+ m_namespacePrefix = m_wizardPage.getNamespacePrefix();
+ m_namespace = m_wizardPage.getNamespace();
+ m_pattern = m_wizardPage.getPattern();
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ // workaround as {@link ScoutXmlElement#removeChildren(Collection)} not works properly
+ while (m_xmlHandlerChain.hasChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PROTOCOL))) {
+ m_xmlHandlerChain.removeChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PROTOCOL));
+ }
+ while (m_xmlHandlerChain.hasChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_SERVICE))) {
+ m_xmlHandlerChain.removeChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_SERVICE));
+ }
+ while (m_xmlHandlerChain.hasChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PORT))) {
+ m_xmlHandlerChain.removeChild(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PORT));
+ }
+
+ switch (m_filterTypeEnum) {
+ case ProtocolFilter:
+ ScoutXmlElement protocolFilter = m_xmlHandlerChain.addChild();
+ m_xmlHandlerChain.removeChild(protocolFilter);
+ m_xmlHandlerChain.addChild(protocolFilter, 0);
+ protocolFilter.setName(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PROTOCOL));
+ protocolFilter.addText(m_pattern);
+ break;
+ case ServiceFilter:
+ ScoutXmlElement serviceFilter = m_xmlHandlerChain.addChild();
+ m_xmlHandlerChain.removeChild(serviceFilter);
+ m_xmlHandlerChain.addChild(serviceFilter, 0);
+ serviceFilter.setName(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_SERVICE));
+ serviceFilter.addText(m_pattern);
+ serviceFilter.setNamespace(m_namespacePrefix, m_namespace);
+ break;
+ case PortFilter:
+ ScoutXmlElement portFilter = m_xmlHandlerChain.addChild();
+ m_xmlHandlerChain.removeChild(portFilter);
+ m_xmlHandlerChain.addChild(portFilter, 0);
+ portFilter.setName(toQualifiedName(SunJaxWsBean.XML_HANDLER_FILTER_PORT));
+ portFilter.addText(m_pattern);
+ portFilter.setNamespace(m_namespacePrefix, m_namespace);
+ break;
+ }
+
+ // persist
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXmlAsync(m_xmlHandlerChain.getDocument(), IResourceListener.EVENT_SUNJAXWS_HANDLER_CHANGED, m_sunJaxWsBean.getAlias());
+ return true;
+ }
+
+ private String toQualifiedName(String name) {
+ return m_sunJaxWsBean.toQualifiedName(name);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/HandlerNewWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/HandlerNewWizard.java
index abc86bd5e..f256254e3 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/HandlerNewWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/HandlerNewWizard.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.HandlerNewOperation;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.HandlerNewWizardPage;
-
-public class HandlerNewWizard extends AbstractWorkspaceWizard {
-
- public static final int TYPE_SERVICE_IMPLEMENTATION = 100;
- public static final int TYPE_SERVICE_REG_SERVER = 101;
-
- private IScoutBundle m_bundle;
- private HandlerNewWizardPage m_page;
-
- private HandlerNewOperation m_op;
-
- public HandlerNewWizard(IScoutBundle bundle) {
- m_bundle = bundle;
- setWindowTitle(Texts.get("CreateHandler"));
- }
-
- @Override
- public void addPages() {
- m_page = new HandlerNewWizardPage(m_bundle);
- addPage(m_page);
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_op = new HandlerNewOperation();
- m_op.setBundle(m_bundle);
- m_op.setPackageName(m_page.getPackageName());
- m_op.setTypeName(m_page.getTypeName());
- m_op.setTransactional(m_page.isTransactional());
- m_op.setSessionFactoryType(m_page.getSessionFactoryType());
- m_op.setSuperType(m_page.getSuperType());
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- m_op.run(monitor, workingCopyManager);
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.HandlerNewOperation;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.HandlerNewWizardPage;
+
+public class HandlerNewWizard extends AbstractWorkspaceWizard {
+
+ public static final int TYPE_SERVICE_IMPLEMENTATION = 100;
+ public static final int TYPE_SERVICE_REG_SERVER = 101;
+
+ private IScoutBundle m_bundle;
+ private HandlerNewWizardPage m_page;
+
+ private HandlerNewOperation m_op;
+
+ public HandlerNewWizard(IScoutBundle bundle) {
+ m_bundle = bundle;
+ setWindowTitle(Texts.get("CreateHandler"));
+ }
+
+ @Override
+ public void addPages() {
+ m_page = new HandlerNewWizardPage(m_bundle);
+ addPage(m_page);
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_op = new HandlerNewOperation();
+ m_op.setBundle(m_bundle);
+ m_op.setPackageName(m_page.getPackageName());
+ m_op.setTypeName(m_page.getTypeName());
+ m_op.setTransactional(m_page.isTransactional());
+ m_op.setSessionFactoryType(m_page.getSessionFactoryType());
+ m_op.setSuperType(m_page.getSuperType());
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ m_op.run(monitor, workingCopyManager);
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/JaxWsServletRegistrationWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/JaxWsServletRegistrationWizard.java
index 086b1aa78..8202b7dc7 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/JaxWsServletRegistrationWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/JaxWsServletRegistrationWizard.java
@@ -1,95 +1,95 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.JaxWsServletRegistrationOperation;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.JaxWsServletRegistrationWizardPage;
-
-public class JaxWsServletRegistrationWizard extends AbstractWorkspaceWizard {
-
- private IScoutBundle m_bundle;
- private JaxWsServletRegistrationWizardPage m_wizardPage;
- private JaxWsServletRegistrationOperation m_operation;
-
- private SunJaxWsBean m_sunJaxWsBean;
-
- /**
- * To change JAX-WS servlet registration
- *
- * @param bundle
- */
- public JaxWsServletRegistrationWizard(IScoutBundle bundle) {
- m_bundle = bundle;
- m_operation = new JaxWsServletRegistrationOperation();
- setWindowTitle(Texts.get("JaxWsServletRegistration"));
- }
-
- /**
- * To change JAX-WS servlet registration and URL pattern of the given SunJaxWs entry
- *
- * @param bundle
- * @param sunJaxWsBean
- */
- public JaxWsServletRegistrationWizard(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean) {
- m_bundle = bundle;
- m_sunJaxWsBean = sunJaxWsBean;
- m_operation = new JaxWsServletRegistrationOperation();
- m_operation.setSunJaxWsBean(m_sunJaxWsBean);
- setWindowTitle(Texts.get("JaxWsServletRegistration"));
- }
-
- @Override
- public void addPages() {
- m_wizardPage = new JaxWsServletRegistrationWizardPage(m_bundle, m_sunJaxWsBean != null);
- m_wizardPage.setTitle(Texts.get("ChangeJaxWsServletRegistration"));
- if (m_sunJaxWsBean != null) {
- m_wizardPage.setUrlPattern(m_sunJaxWsBean.getUrlPattern());
- m_wizardPage.setTitle(Texts.get("SpecifyUrlOfWsdl"));
- }
- else {
- m_wizardPage.setTitle(Texts.get("ChangeJaxWsServletRegistration"));
- }
- m_wizardPage.initializeDefaultValues(m_bundle);
- addPage(m_wizardPage);
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_operation.setBundle(m_bundle);
- m_operation.setRegistrationBundle(m_wizardPage.getRegistrationBundle());
- m_operation.setJaxWsAlias(m_wizardPage.getAlias());
- if (m_sunJaxWsBean != null) {
- m_operation.setSunJaxWsBean(m_sunJaxWsBean);
- m_operation.setUrlPattern(m_wizardPage.getUrlPattern());
- }
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- JaxWsSdk.getDefault().getMarkerQueueManager().suspend();
- try {
- m_operation.run(monitor, workingCopyManager);
- }
- finally {
- JaxWsSdk.getDefault().getMarkerQueueManager().resume();
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.JaxWsServletRegistrationOperation;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.JaxWsServletRegistrationWizardPage;
+
+public class JaxWsServletRegistrationWizard extends AbstractWorkspaceWizard {
+
+ private IScoutBundle m_bundle;
+ private JaxWsServletRegistrationWizardPage m_wizardPage;
+ private JaxWsServletRegistrationOperation m_operation;
+
+ private SunJaxWsBean m_sunJaxWsBean;
+
+ /**
+ * To change JAX-WS servlet registration
+ *
+ * @param bundle
+ */
+ public JaxWsServletRegistrationWizard(IScoutBundle bundle) {
+ m_bundle = bundle;
+ m_operation = new JaxWsServletRegistrationOperation();
+ setWindowTitle(Texts.get("JaxWsServletRegistration"));
+ }
+
+ /**
+ * To change JAX-WS servlet registration and URL pattern of the given SunJaxWs entry
+ *
+ * @param bundle
+ * @param sunJaxWsBean
+ */
+ public JaxWsServletRegistrationWizard(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean) {
+ m_bundle = bundle;
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_operation = new JaxWsServletRegistrationOperation();
+ m_operation.setSunJaxWsBean(m_sunJaxWsBean);
+ setWindowTitle(Texts.get("JaxWsServletRegistration"));
+ }
+
+ @Override
+ public void addPages() {
+ m_wizardPage = new JaxWsServletRegistrationWizardPage(m_bundle, m_sunJaxWsBean != null);
+ m_wizardPage.setTitle(Texts.get("ChangeJaxWsServletRegistration"));
+ if (m_sunJaxWsBean != null) {
+ m_wizardPage.setUrlPattern(m_sunJaxWsBean.getUrlPattern());
+ m_wizardPage.setTitle(Texts.get("SpecifyUrlOfWsdl"));
+ }
+ else {
+ m_wizardPage.setTitle(Texts.get("ChangeJaxWsServletRegistration"));
+ }
+ m_wizardPage.initializeDefaultValues(m_bundle);
+ addPage(m_wizardPage);
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_operation.setBundle(m_bundle);
+ m_operation.setRegistrationBundle(m_wizardPage.getRegistrationBundle());
+ m_operation.setJaxWsAlias(m_wizardPage.getAlias());
+ if (m_sunJaxWsBean != null) {
+ m_operation.setSunJaxWsBean(m_sunJaxWsBean);
+ m_operation.setUrlPattern(m_wizardPage.getUrlPattern());
+ }
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ JaxWsSdk.getDefault().getMarkerQueueManager().suspend();
+ try {
+ m_operation.run(monitor, workingCopyManager);
+ }
+ finally {
+ JaxWsSdk.getDefault().getMarkerQueueManager().resume();
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/PhantomJarFilesDeleteWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/PhantomJarFilesDeleteWizard.java
index b0287d8c8..09dace498 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/PhantomJarFilesDeleteWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/PhantomJarFilesDeleteWizard.java
@@ -1,98 +1,98 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ErrorDialog;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ResourceSelectionWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-
-public class PhantomJarFilesDeleteWizard extends AbstractWorkspaceWizard {
-
- private ResourceSelectionWizardPage m_wizardPage;
- private IScoutBundle m_bundle;
- private IFile[] m_phantomJarFiles;
- private IFile[] m_phantomJarFilesToBeDeleted;
-
- public PhantomJarFilesDeleteWizard(IScoutBundle bundle, IFile[] phantomJarFiles) {
- setWindowTitle(Texts.get("CleanupPhantomStubFiles"));
- m_bundle = bundle;
- m_phantomJarFiles = phantomJarFiles;
- }
-
- @Override
- public void addPages() {
- m_wizardPage = new ResourceSelectionWizardPage(Texts.get("CleanupPhantomStubFiles"), Texts.get("QuestionDeletion"));
- m_wizardPage.setElements(getPhantomElements());
- addPage(m_wizardPage);
- }
-
- private List<ElementBean> getPhantomElements() {
- List<ElementBean> elements = new LinkedList<ElementBean>();
- for (IFile file : m_phantomJarFiles) {
- elements.add(new ElementBean(0, file.getFullPath().toPortableString(), JaxWsSdk.getImageDescriptor(JaxWsIcons.Jar), file, false));
- }
- return elements;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- List<IFile> filesToBeDeleted = new LinkedList<IFile>();
- for (ElementBean candidate : m_wizardPage.getElements()) {
- if (candidate.isChecked() || candidate.isMandatory()) {
- filesToBeDeleted.add((IFile) candidate.getResource());
- }
- }
-
- m_phantomJarFilesToBeDeleted = filesToBeDeleted.toArray(new IFile[filesToBeDeleted.size()]);
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- for (final IFile jarFile : m_phantomJarFilesToBeDeleted) {
- try {
- jarFile.delete(true, true, monitor);
- JaxWsSdkUtility.registerJarLib(m_bundle, jarFile, true, monitor);
- }
- catch (final Exception e) {
- ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
-
- @Override
- public void run() {
- ErrorDialog dialog = new ErrorDialog(Texts.get("FailedToDeleteFile"));
- dialog.setError(Texts.get("FailedToDeleteFileX", jarFile.getProjectRelativePath().toPortableString()), e);
- dialog.open();
- }
- });
- return false;
- }
- }
- return true;
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ErrorDialog;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ResourceSelectionWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+
+public class PhantomJarFilesDeleteWizard extends AbstractWorkspaceWizard {
+
+ private ResourceSelectionWizardPage m_wizardPage;
+ private IScoutBundle m_bundle;
+ private IFile[] m_phantomJarFiles;
+ private IFile[] m_phantomJarFilesToBeDeleted;
+
+ public PhantomJarFilesDeleteWizard(IScoutBundle bundle, IFile[] phantomJarFiles) {
+ setWindowTitle(Texts.get("CleanupPhantomStubFiles"));
+ m_bundle = bundle;
+ m_phantomJarFiles = phantomJarFiles;
+ }
+
+ @Override
+ public void addPages() {
+ m_wizardPage = new ResourceSelectionWizardPage(Texts.get("CleanupPhantomStubFiles"), Texts.get("QuestionDeletion"));
+ m_wizardPage.setElements(getPhantomElements());
+ addPage(m_wizardPage);
+ }
+
+ private List<ElementBean> getPhantomElements() {
+ List<ElementBean> elements = new LinkedList<ElementBean>();
+ for (IFile file : m_phantomJarFiles) {
+ elements.add(new ElementBean(0, file.getFullPath().toPortableString(), JaxWsSdk.getImageDescriptor(JaxWsIcons.Jar), file, false));
+ }
+ return elements;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ List<IFile> filesToBeDeleted = new LinkedList<IFile>();
+ for (ElementBean candidate : m_wizardPage.getElements()) {
+ if (candidate.isChecked() || candidate.isMandatory()) {
+ filesToBeDeleted.add((IFile) candidate.getResource());
+ }
+ }
+
+ m_phantomJarFilesToBeDeleted = filesToBeDeleted.toArray(new IFile[filesToBeDeleted.size()]);
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ for (final IFile jarFile : m_phantomJarFilesToBeDeleted) {
+ try {
+ jarFile.delete(true, true, monitor);
+ JaxWsSdkUtility.registerJarLib(m_bundle, jarFile, true, monitor);
+ }
+ catch (final Exception e) {
+ ScoutSdkUi.getDisplay().asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ ErrorDialog dialog = new ErrorDialog(Texts.get("FailedToDeleteFile"));
+ dialog.setError(Texts.get("FailedToDeleteFileX", jarFile.getProjectRelativePath().toPortableString()), e);
+ dialog.open();
+ }
+ });
+ return false;
+ }
+ }
+ return true;
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/SourceFolderNewWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/SourceFolderNewWizard.java
index 8ca96679c..9d62bfc74 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/SourceFolderNewWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/SourceFolderNewWizard.java
@@ -1,54 +1,54 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.SourceFolderNewWizardPage;
-
-public class SourceFolderNewWizard extends AbstractWorkspaceWizard {
-
- private IScoutBundle m_bundle;
- private SourceFolderNewWizardPage m_wizardPage;
- private IPath m_sourceFolder;
-
- public SourceFolderNewWizard(IScoutBundle bundle) {
- m_bundle = bundle;
- setWindowTitle(Texts.get("CreateSourceFolder"));
- }
-
- @Override
- public void addPages() {
- m_wizardPage = new SourceFolderNewWizardPage();
- m_wizardPage.setBundle(m_bundle);
- addPage(m_wizardPage);
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_sourceFolder = m_wizardPage.getSourceFolderPath();
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- return true;
- }
-
- public IPath getSourceFolder() {
- return m_sourceFolder;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.SourceFolderNewWizardPage;
+
+public class SourceFolderNewWizard extends AbstractWorkspaceWizard {
+
+ private IScoutBundle m_bundle;
+ private SourceFolderNewWizardPage m_wizardPage;
+ private IPath m_sourceFolder;
+
+ public SourceFolderNewWizard(IScoutBundle bundle) {
+ m_bundle = bundle;
+ setWindowTitle(Texts.get("CreateSourceFolder"));
+ }
+
+ @Override
+ public void addPages() {
+ m_wizardPage = new SourceFolderNewWizardPage();
+ m_wizardPage.setBundle(m_bundle);
+ addPage(m_wizardPage);
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_sourceFolder = m_wizardPage.getSourceFolderPath();
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ return true;
+ }
+
+ public IPath getSourceFolder() {
+ return m_sourceFolder;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/TypeNewWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/TypeNewWizard.java
index 37f47ab3a..db6604114 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/TypeNewWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/TypeNewWizard.java
@@ -1,162 +1,162 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.TypeNewOperation;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.TypeNewWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.TypeNewWizardPage.JavaSearchScopeFactory;
-
-public class TypeNewWizard extends AbstractWorkspaceWizard {
-
- private IScoutBundle m_bundle;
- private String m_elementName;
- private String m_typeSuffix;
- private String m_recommendedPackageFragment;
- private boolean m_allowModifyPackage;
- private boolean m_allowModifySuperType;
- private boolean m_allowModifyInterfaceType;
- private JavaSearchScopeFactory m_superTypeSearchScopeFactory;
- private JavaSearchScopeFactory m_interfaceTypeSearchScopeFactory;
- private IType m_superType;
- private IType m_interfaceType;
-
- private TypeNewWizardPage m_page;
-
- private TypeNewOperation m_op;
-
- public TypeNewWizard(IScoutBundle bundle, String elementName) {
- m_bundle = bundle;
- m_elementName = elementName;
- setWindowTitle(Texts.get("CreateNewX", m_elementName));
- }
-
- @Override
- public void addPages() {
- m_page = new TypeNewWizardPage(m_bundle, m_elementName);
- m_page.setAllowModifyInterfaceType(isAllowModifyInterfaceType());
- m_page.setAllowModifySuperType(isAllowModifySuperType());
- m_page.setAllowModifyPackage(isAllowModifyPackage());
- m_page.setRecommendedPackageFragment(getRecommendedPackageFragment());
- m_page.setTypeSuffix(getTypeSuffix());
- if (getSuperTypeSearchScopeFactory() != null) {
- m_page.setSuperTypeSearchScopeFactory(getSuperTypeSearchScopeFactory());
- }
- else {
- m_page.setSuperTypeSearchScopeFactory(new JavaSearchScopeFactory());
- }
- if (getInterfaceTypeSearchScopeFactory() != null) {
- m_page.setInterfaceTypeSearchScopeFactory(getInterfaceTypeSearchScopeFactory());
- }
- else {
- m_page.setInterfaceTypeSearchScopeFactory(new JavaSearchScopeFactory());
- }
- m_page.setSuperType(getSuperType());
- m_page.setInterfaceType(getInterfaceType());
-
- addPage(m_page);
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_op = new TypeNewOperation();
- m_op.setBundle(m_bundle);
- m_op.setPackageName(m_page.getPackageName());
- m_op.setTypeName(m_page.getTypeName());
- m_op.setInterfaceType(m_page.getInterfaceType());
- m_op.setSuperType(m_page.getSuperType());
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- m_op.run(monitor, workingCopyManager);
- return true;
- }
-
- public String getTypeSuffix() {
- return m_typeSuffix;
- }
-
- public void setTypeSuffix(String typeSuffix) {
- m_typeSuffix = typeSuffix;
- }
-
- public String getRecommendedPackageFragment() {
- return m_recommendedPackageFragment;
- }
-
- public void setRecommendedPackageFragment(String recommendedPackageFragment) {
- m_recommendedPackageFragment = recommendedPackageFragment;
- }
-
- public boolean isAllowModifyPackage() {
- return m_allowModifyPackage;
- }
-
- public void setAllowModifyPackage(boolean allowModifyPackage) {
- m_allowModifyPackage = allowModifyPackage;
- }
-
- public boolean isAllowModifySuperType() {
- return m_allowModifySuperType;
- }
-
- public void setAllowModifySuperType(boolean allowModifySuperType) {
- m_allowModifySuperType = allowModifySuperType;
- }
-
- public boolean isAllowModifyInterfaceType() {
- return m_allowModifyInterfaceType;
- }
-
- public void setAllowModifyInterfaceType(boolean allowModifyInterfaceType) {
- m_allowModifyInterfaceType = allowModifyInterfaceType;
- }
-
- public JavaSearchScopeFactory getSuperTypeSearchScopeFactory() {
- return m_superTypeSearchScopeFactory;
- }
-
- public void setSuperTypeSearchScopeFactory(JavaSearchScopeFactory superTypeSearchScopeFactory) {
- m_superTypeSearchScopeFactory = superTypeSearchScopeFactory;
- }
-
- public JavaSearchScopeFactory getInterfaceTypeSearchScopeFactory() {
- return m_interfaceTypeSearchScopeFactory;
- }
-
- public void setInterfaceTypeSearchScopeFactory(JavaSearchScopeFactory interfaceTypeSearchScopeFactory) {
- m_interfaceTypeSearchScopeFactory = interfaceTypeSearchScopeFactory;
- }
-
- public IType getSuperType() {
- return m_superType;
- }
-
- public void setSuperType(IType superType) {
- m_superType = superType;
- }
-
- public IType getInterfaceType() {
- return m_interfaceType;
- }
-
- public void setInterfaceType(IType interfaceType) {
- m_interfaceType = interfaceType;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.TypeNewOperation;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.TypeNewWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.TypeNewWizardPage.JavaSearchScopeFactory;
+
+public class TypeNewWizard extends AbstractWorkspaceWizard {
+
+ private IScoutBundle m_bundle;
+ private String m_elementName;
+ private String m_typeSuffix;
+ private String m_recommendedPackageFragment;
+ private boolean m_allowModifyPackage;
+ private boolean m_allowModifySuperType;
+ private boolean m_allowModifyInterfaceType;
+ private JavaSearchScopeFactory m_superTypeSearchScopeFactory;
+ private JavaSearchScopeFactory m_interfaceTypeSearchScopeFactory;
+ private IType m_superType;
+ private IType m_interfaceType;
+
+ private TypeNewWizardPage m_page;
+
+ private TypeNewOperation m_op;
+
+ public TypeNewWizard(IScoutBundle bundle, String elementName) {
+ m_bundle = bundle;
+ m_elementName = elementName;
+ setWindowTitle(Texts.get("CreateNewX", m_elementName));
+ }
+
+ @Override
+ public void addPages() {
+ m_page = new TypeNewWizardPage(m_bundle, m_elementName);
+ m_page.setAllowModifyInterfaceType(isAllowModifyInterfaceType());
+ m_page.setAllowModifySuperType(isAllowModifySuperType());
+ m_page.setAllowModifyPackage(isAllowModifyPackage());
+ m_page.setRecommendedPackageFragment(getRecommendedPackageFragment());
+ m_page.setTypeSuffix(getTypeSuffix());
+ if (getSuperTypeSearchScopeFactory() != null) {
+ m_page.setSuperTypeSearchScopeFactory(getSuperTypeSearchScopeFactory());
+ }
+ else {
+ m_page.setSuperTypeSearchScopeFactory(new JavaSearchScopeFactory());
+ }
+ if (getInterfaceTypeSearchScopeFactory() != null) {
+ m_page.setInterfaceTypeSearchScopeFactory(getInterfaceTypeSearchScopeFactory());
+ }
+ else {
+ m_page.setInterfaceTypeSearchScopeFactory(new JavaSearchScopeFactory());
+ }
+ m_page.setSuperType(getSuperType());
+ m_page.setInterfaceType(getInterfaceType());
+
+ addPage(m_page);
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_op = new TypeNewOperation();
+ m_op.setBundle(m_bundle);
+ m_op.setPackageName(m_page.getPackageName());
+ m_op.setTypeName(m_page.getTypeName());
+ m_op.setInterfaceType(m_page.getInterfaceType());
+ m_op.setSuperType(m_page.getSuperType());
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ m_op.run(monitor, workingCopyManager);
+ return true;
+ }
+
+ public String getTypeSuffix() {
+ return m_typeSuffix;
+ }
+
+ public void setTypeSuffix(String typeSuffix) {
+ m_typeSuffix = typeSuffix;
+ }
+
+ public String getRecommendedPackageFragment() {
+ return m_recommendedPackageFragment;
+ }
+
+ public void setRecommendedPackageFragment(String recommendedPackageFragment) {
+ m_recommendedPackageFragment = recommendedPackageFragment;
+ }
+
+ public boolean isAllowModifyPackage() {
+ return m_allowModifyPackage;
+ }
+
+ public void setAllowModifyPackage(boolean allowModifyPackage) {
+ m_allowModifyPackage = allowModifyPackage;
+ }
+
+ public boolean isAllowModifySuperType() {
+ return m_allowModifySuperType;
+ }
+
+ public void setAllowModifySuperType(boolean allowModifySuperType) {
+ m_allowModifySuperType = allowModifySuperType;
+ }
+
+ public boolean isAllowModifyInterfaceType() {
+ return m_allowModifyInterfaceType;
+ }
+
+ public void setAllowModifyInterfaceType(boolean allowModifyInterfaceType) {
+ m_allowModifyInterfaceType = allowModifyInterfaceType;
+ }
+
+ public JavaSearchScopeFactory getSuperTypeSearchScopeFactory() {
+ return m_superTypeSearchScopeFactory;
+ }
+
+ public void setSuperTypeSearchScopeFactory(JavaSearchScopeFactory superTypeSearchScopeFactory) {
+ m_superTypeSearchScopeFactory = superTypeSearchScopeFactory;
+ }
+
+ public JavaSearchScopeFactory getInterfaceTypeSearchScopeFactory() {
+ return m_interfaceTypeSearchScopeFactory;
+ }
+
+ public void setInterfaceTypeSearchScopeFactory(JavaSearchScopeFactory interfaceTypeSearchScopeFactory) {
+ m_interfaceTypeSearchScopeFactory = interfaceTypeSearchScopeFactory;
+ }
+
+ public IType getSuperType() {
+ return m_superType;
+ }
+
+ public void setSuperType(IType superType) {
+ m_superType = superType;
+ }
+
+ public IType getInterfaceType() {
+ return m_interfaceType;
+ }
+
+ public void setInterfaceType(IType interfaceType) {
+ m_interfaceType = interfaceType;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsConsumerDeleteWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsConsumerDeleteWizard.java
index 5e0ccc512..05c5aabba 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsConsumerDeleteWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsConsumerDeleteWizard.java
@@ -1,185 +1,185 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsConsumerDeleteOperation;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ResourceSelectionWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.Artefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaImportArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaIncludeArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
-
-public class WsConsumerDeleteWizard extends AbstractWorkspaceWizard {
-
- private ResourceSelectionWizardPage m_wizardPage;
-
- private IScoutBundle m_bundle;
- private IType m_type;
- private BuildJaxWsBean m_buildJaxWsBean;
-
- private WsConsumerDeleteOperation m_operation;
-
- public WsConsumerDeleteWizard() {
- setWindowTitle(Texts.get("DeleteWebserviceConsumer"));
- }
-
- @Override
- public void addPages() {
- m_wizardPage = new ResourceSelectionWizardPage(Texts.get("DeleteWebserviceConsumer"), Texts.get("QuestionDeletion"));
- m_wizardPage.setElements(getElementsToBeDeleted());
- addPage(m_wizardPage);
- }
-
- private List<ElementBean> getElementsToBeDeleted() {
- List<ElementBean> elements = new LinkedList<ElementBean>();
- // registration
- elements.add(new ElementBean(WsConsumerDeleteOperation.ID_REGISTRATION, "Registration entry in build-jaxws.xml", JaxWsSdk.getImageDescriptor(JaxWsIcons.BuildJaxWsXmlFile), true));
-
- // service registration
- elements.add(new ElementBean(WsConsumerDeleteOperation.ID_SERVICE_REGISTRATION, "Service registration in plugin.xml of webservice client '" + m_type.getFullyQualifiedName() + "'", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ServiceLocator), m_type, true));
-
- // type
- elements.add(new ElementBean(WsConsumerDeleteOperation.ID_TYPE, "Webservice client type '" + m_type.getFullyQualifiedName() + "'", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), m_type, true));
-
- // stub JAR file
- String wsdlFileName = null;
- if (m_buildJaxWsBean != null) {
- wsdlFileName = m_buildJaxWsBean.getWsdl();
- }
-
- IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, m_buildJaxWsBean, wsdlFileName);
- if (stubJarFile != null && stubJarFile.exists()) {
- elements.add(new ElementBean(WsConsumerDeleteOperation.ID_STUB, "Stub JAR file '" + stubJarFile.getFullPath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.Jar), stubJarFile, false));
- }
-
- // WSDL file
- IFile wsdlFile = null;
- if (m_buildJaxWsBean != null && StringUtility.hasText(m_buildJaxWsBean.getWsdl())) {
- wsdlFile = JaxWsSdkUtility.getFile(m_bundle, m_buildJaxWsBean.getWsdl(), false);
- }
- if (wsdlFile != null && wsdlFile.exists()) {
- elements.add(new ElementBean(WsConsumerDeleteOperation.ID_WSDL_FILE, "WSDL file '" + wsdlFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), wsdlFile, false));
- }
-
- if (wsdlFile != null) {
- Artefact[] artefacts = SchemaUtility.getArtefacts(wsdlFile, false);
- for (Artefact artefact : artefacts) {
- // referenced WSDL definitions
- if (artefact instanceof WsdlArtefact) {
- WsdlArtefact wsdlArtefact = (WsdlArtefact) artefact;
- if (wsdlArtefact.getTypeEnum() == TypeEnum.ReferencedWsdl) {
- IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, wsdlArtefact.getFile());
- if (referencedWsdlFile != null && referencedWsdlFile.exists()) {
- elements.add(new ElementBean(WsConsumerDeleteOperation.ID_REF_WSDL, "Referenced WSDL file '" + referencedWsdlFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), referencedWsdlFile, false));
- }
- }
- }
- // imported XSD schemas
- if (artefact instanceof SchemaImportArtefact) {
- SchemaImportArtefact schemaArtefact = (SchemaImportArtefact) artefact;
- IFile importedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
- if (importedSchemaFile != null && importedSchemaFile.exists()) {
- elements.add(new ElementBean(WsConsumerDeleteOperation.ID_REF_XSD, "Imported XSD schema '" + importedSchemaFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), importedSchemaFile, false));
- }
- }
-
- // included XSD schemas
- if (artefact instanceof SchemaIncludeArtefact) {
- SchemaIncludeArtefact schemaArtefact = (SchemaIncludeArtefact) artefact;
- IFile includedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
- if (includedSchemaFile != null && includedSchemaFile.exists()) {
- elements.add(new ElementBean(WsConsumerDeleteOperation.ID_REF_XSD, "Included XSD schema '" + includedSchemaFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), includedSchemaFile, false));
- }
- }
- }
- }
-
- // binding file
- if (m_buildJaxWsBean != null) {
- IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(m_bundle, m_buildJaxWsBean.getPropertiers());
- for (IFile bindingFile : bindingFiles) {
- if (bindingFile != null && bindingFile.exists()) {
- elements.add(new ElementBean(WsConsumerDeleteOperation.ID_BINDING_FILE, "Binding file '" + bindingFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.BindingFile), bindingFile, false));
- }
- }
- }
-
- return elements;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_operation = new WsConsumerDeleteOperation();
- m_operation.setBundle(m_bundle);
- m_operation.setBuildJaxWsBean(m_buildJaxWsBean);
-
- List<ElementBean> elements = new LinkedList<ElementBean>();
- for (ElementBean element : m_wizardPage.getElements()) {
- if (element.isChecked() || element.isMandatory()) {
- elements.add(element);
- }
- }
- m_operation.setElements(elements);
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- OperationJob job = new OperationJob(m_operation);
- job.schedule();
- return true;
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public IType getType() {
- return m_type;
- }
-
- public void setType(IType type) {
- m_type = type;
- }
-
- public BuildJaxWsBean getBuildJaxWsBean() {
- return m_buildJaxWsBean;
- }
-
- public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
- m_buildJaxWsBean = buildJaxWsBean;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsConsumerDeleteOperation;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ResourceSelectionWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.Artefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaImportArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaIncludeArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
+
+public class WsConsumerDeleteWizard extends AbstractWorkspaceWizard {
+
+ private ResourceSelectionWizardPage m_wizardPage;
+
+ private IScoutBundle m_bundle;
+ private IType m_type;
+ private BuildJaxWsBean m_buildJaxWsBean;
+
+ private WsConsumerDeleteOperation m_operation;
+
+ public WsConsumerDeleteWizard() {
+ setWindowTitle(Texts.get("DeleteWebserviceConsumer"));
+ }
+
+ @Override
+ public void addPages() {
+ m_wizardPage = new ResourceSelectionWizardPage(Texts.get("DeleteWebserviceConsumer"), Texts.get("QuestionDeletion"));
+ m_wizardPage.setElements(getElementsToBeDeleted());
+ addPage(m_wizardPage);
+ }
+
+ private List<ElementBean> getElementsToBeDeleted() {
+ List<ElementBean> elements = new LinkedList<ElementBean>();
+ // registration
+ elements.add(new ElementBean(WsConsumerDeleteOperation.ID_REGISTRATION, "Registration entry in build-jaxws.xml", JaxWsSdk.getImageDescriptor(JaxWsIcons.BuildJaxWsXmlFile), true));
+
+ // service registration
+ elements.add(new ElementBean(WsConsumerDeleteOperation.ID_SERVICE_REGISTRATION, "Service registration in plugin.xml of webservice client '" + m_type.getFullyQualifiedName() + "'", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.ServiceLocator), m_type, true));
+
+ // type
+ elements.add(new ElementBean(WsConsumerDeleteOperation.ID_TYPE, "Webservice client type '" + m_type.getFullyQualifiedName() + "'", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), m_type, true));
+
+ // stub JAR file
+ String wsdlFileName = null;
+ if (m_buildJaxWsBean != null) {
+ wsdlFileName = m_buildJaxWsBean.getWsdl();
+ }
+
+ IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, m_buildJaxWsBean, wsdlFileName);
+ if (stubJarFile != null && stubJarFile.exists()) {
+ elements.add(new ElementBean(WsConsumerDeleteOperation.ID_STUB, "Stub JAR file '" + stubJarFile.getFullPath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.Jar), stubJarFile, false));
+ }
+
+ // WSDL file
+ IFile wsdlFile = null;
+ if (m_buildJaxWsBean != null && StringUtility.hasText(m_buildJaxWsBean.getWsdl())) {
+ wsdlFile = JaxWsSdkUtility.getFile(m_bundle, m_buildJaxWsBean.getWsdl(), false);
+ }
+ if (wsdlFile != null && wsdlFile.exists()) {
+ elements.add(new ElementBean(WsConsumerDeleteOperation.ID_WSDL_FILE, "WSDL file '" + wsdlFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), wsdlFile, false));
+ }
+
+ if (wsdlFile != null) {
+ Artefact[] artefacts = SchemaUtility.getArtefacts(wsdlFile, false);
+ for (Artefact artefact : artefacts) {
+ // referenced WSDL definitions
+ if (artefact instanceof WsdlArtefact) {
+ WsdlArtefact wsdlArtefact = (WsdlArtefact) artefact;
+ if (wsdlArtefact.getTypeEnum() == TypeEnum.ReferencedWsdl) {
+ IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, wsdlArtefact.getFile());
+ if (referencedWsdlFile != null && referencedWsdlFile.exists()) {
+ elements.add(new ElementBean(WsConsumerDeleteOperation.ID_REF_WSDL, "Referenced WSDL file '" + referencedWsdlFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), referencedWsdlFile, false));
+ }
+ }
+ }
+ // imported XSD schemas
+ if (artefact instanceof SchemaImportArtefact) {
+ SchemaImportArtefact schemaArtefact = (SchemaImportArtefact) artefact;
+ IFile importedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
+ if (importedSchemaFile != null && importedSchemaFile.exists()) {
+ elements.add(new ElementBean(WsConsumerDeleteOperation.ID_REF_XSD, "Imported XSD schema '" + importedSchemaFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), importedSchemaFile, false));
+ }
+ }
+
+ // included XSD schemas
+ if (artefact instanceof SchemaIncludeArtefact) {
+ SchemaIncludeArtefact schemaArtefact = (SchemaIncludeArtefact) artefact;
+ IFile includedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
+ if (includedSchemaFile != null && includedSchemaFile.exists()) {
+ elements.add(new ElementBean(WsConsumerDeleteOperation.ID_REF_XSD, "Included XSD schema '" + includedSchemaFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), includedSchemaFile, false));
+ }
+ }
+ }
+ }
+
+ // binding file
+ if (m_buildJaxWsBean != null) {
+ IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(m_bundle, m_buildJaxWsBean.getPropertiers());
+ for (IFile bindingFile : bindingFiles) {
+ if (bindingFile != null && bindingFile.exists()) {
+ elements.add(new ElementBean(WsConsumerDeleteOperation.ID_BINDING_FILE, "Binding file '" + bindingFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.BindingFile), bindingFile, false));
+ }
+ }
+ }
+
+ return elements;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_operation = new WsConsumerDeleteOperation();
+ m_operation.setBundle(m_bundle);
+ m_operation.setBuildJaxWsBean(m_buildJaxWsBean);
+
+ List<ElementBean> elements = new LinkedList<ElementBean>();
+ for (ElementBean element : m_wizardPage.getElements()) {
+ if (element.isChecked() || element.isMandatory()) {
+ elements.add(element);
+ }
+ }
+ m_operation.setElements(elements);
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ OperationJob job = new OperationJob(m_operation);
+ job.schedule();
+ return true;
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public IType getType() {
+ return m_type;
+ }
+
+ public void setType(IType type) {
+ m_type = type;
+ }
+
+ public BuildJaxWsBean getBuildJaxWsBean() {
+ return m_buildJaxWsBean;
+ }
+
+ public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
+ m_buildJaxWsBean = buildJaxWsBean;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsConsumerNewWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsConsumerNewWizard.java
index 31edbe670..493bc9562 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsConsumerNewWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsConsumerNewWizard.java
@@ -1,354 +1,354 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Definition;
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.BindingFileCreateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.operation.BuildJaxWsEntryCreateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.operation.ExternalFileCopyOperation;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsConsumerImplNewOperation;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsStubGenerationOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsConsumerImplClassWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsPropertiesExistingWsdlWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsStubWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsdlLocationWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper;
-import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper.SchemaCandidate;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IOperationFinishedListener;
-
-public class WsConsumerNewWizard extends AbstractWorkspaceWizard {
-
- public static final int TYPE_SERVICE_IMPLEMENTATION = 100;
- public static final int TYPE_SERVICE_REG_SERVER = 101;
-
- private IScoutBundle m_bundle;
- private WsdlLocationWizardPage m_wsdlLocationWizardPage;
- private WsPropertiesExistingWsdlWizardPage m_wsPropertiesExistingWsdlWizardPage;
- private WsConsumerImplClassWizardPage m_wsConsumerImplClassWizardPage;
- private WsStubWizardPage m_wsStubWizardPage;
-
- private ExternalFileCopyOperation[] m_copyOperations;
- private BuildJaxWsEntryCreateOperation m_buildJaxWsEntryCreateOperation;
- private WsStubGenerationOperation m_stubGenerationOperation;
- private WsConsumerImplNewOperation m_wsConsumerImplNewOperation;
-
- private QName m_serviceQName;
- private QName m_portTypeQName;
-
- private String m_alias;
- private boolean m_createBindingFile;
- private String m_wsdlFileName;
-
- public WsConsumerNewWizard(IScoutBundle bundle) {
- m_bundle = bundle;
- m_copyOperations = new ExternalFileCopyOperation[0];
- setWindowTitle(Texts.get("CreateWsConsumer"));
- }
-
- @Override
- public void addPages() {
- // WSDL selection
- m_wsdlLocationWizardPage = new WsdlLocationWizardPage(m_bundle);
- m_wsdlLocationWizardPage.setTitle(Texts.get("CreateWsConsumer"));
- m_wsdlLocationWizardPage.setWsdlFolderVisible(true);
- m_wsdlLocationWizardPage.setWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_CONSUMER, false)); // initial value
- m_wsdlLocationWizardPage.setRootWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_CONSUMER, false));
- m_wsdlLocationWizardPage.addPropertyChangeListener(new P_WsdlLocationPropertyListener());
- addPage(m_wsdlLocationWizardPage);
-
- // WS properties of existing WSDL Wizard Page
- m_wsPropertiesExistingWsdlWizardPage = new WsPropertiesExistingWsdlWizardPage(m_bundle, WebserviceEnum.Consumer);
- m_wsPropertiesExistingWsdlWizardPage.setTitle(Texts.get("CreateWsConsumer"));
- m_wsPropertiesExistingWsdlWizardPage.addPropertyChangeListener(new P_WsPropertiesPropertyListener());
- addPage(m_wsPropertiesExistingWsdlWizardPage);
-
- // WS Stub
- m_wsStubWizardPage = new WsStubWizardPage(m_bundle);
- m_wsStubWizardPage.setTitle(Texts.get("CreateWsConsumer"));
- addPage(m_wsStubWizardPage);
-
- // Implementing class
- m_wsConsumerImplClassWizardPage = new WsConsumerImplClassWizardPage(m_bundle);
- m_wsConsumerImplClassWizardPage.setTitle(Texts.get("CreateWsConsumer"));
- addPage(m_wsConsumerImplClassWizardPage);
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- IFolder wsdlFolder = m_wsdlLocationWizardPage.getWsdlFolder();
- m_alias = m_wsConsumerImplClassWizardPage.getTypeName();
- File wsdlFile = m_wsdlLocationWizardPage.getWsdlFile();
- m_wsdlFileName = wsdlFile.getName();
-
- List<ExternalFileCopyOperation> copyOperations = new LinkedList<ExternalFileCopyOperation>();
- if (isCopyRequired(wsdlFolder, wsdlFile)) {
- ExternalFileCopyOperation op = new ExternalFileCopyOperation();
- op.setBundle(m_bundle);
- op.setOverwrite(true);
- op.setExternalFile(m_wsdlLocationWizardPage.getWsdlFile());
- op.setWorkspacePath(wsdlFolder.getProjectRelativePath());
- copyOperations.add(op);
- }
-
- for (File file : m_wsdlLocationWizardPage.getAdditionalFiles()) {
- if (isCopyRequired(wsdlFolder, file)) {
- ExternalFileCopyOperation op = new ExternalFileCopyOperation();
- op.setBundle(m_bundle);
- op.setOverwrite(true);
- op.setExternalFile(file);
- op.setWorkspacePath(wsdlFolder.getProjectRelativePath());
- copyOperations.add(op);
- }
- }
- m_copyOperations = copyOperations.toArray(new ExternalFileCopyOperation[copyOperations.size()]);
-
- // prepare buildJaxWs.xml operation
- m_buildJaxWsEntryCreateOperation = new BuildJaxWsEntryCreateOperation(WebserviceEnum.Consumer);
- m_buildJaxWsEntryCreateOperation.setBundle(m_bundle);
- m_buildJaxWsEntryCreateOperation.setAlias(m_alias);
- m_buildJaxWsEntryCreateOperation.setWsdlFile(JaxWsSdkUtility.normalizePath(wsdlFolder.getProjectRelativePath().append(wsdlFile.getName()).toPortableString(), SeparatorType.None));
-
- m_createBindingFile = m_wsStubWizardPage.isCreateBindingFile();
-
- // build properties and binding file
- Map<String, List<String>> buildProperties = JaxWsSdkUtility.getDefaultBuildProperties();
-
- // custom stub package
- Definition wsdlDefinition = m_wsdlLocationWizardPage.getWsdlDefinition();
- String defaultPackageName = JaxWsSdkUtility.resolveStubPackageName(null, wsdlDefinition);
-
- if (!CompareUtility.equals(m_wsStubWizardPage.getPackageName(), defaultPackageName)) {
- JaxWsSdkUtility.addBuildProperty(buildProperties, JaxWsConstants.OPTION_PACKAGE, m_wsStubWizardPage.getPackageName());
- }
- m_buildJaxWsEntryCreateOperation.setBuildProperties(buildProperties);
-
- m_stubGenerationOperation = new WsStubGenerationOperation();
- m_stubGenerationOperation.setBundle(m_bundle);
- m_stubGenerationOperation.setAlias(m_alias);
- m_stubGenerationOperation.setWsdlFolder(wsdlFolder);
- m_stubGenerationOperation.setProperties(buildProperties);
- m_stubGenerationOperation.setWsdlFileName(wsdlFile.getName());
- m_stubGenerationOperation.addOperationFinishedListener(new P_StubGenerationFinishedListener());
-
- m_wsConsumerImplNewOperation = new WsConsumerImplNewOperation();
- m_wsConsumerImplNewOperation.setImplementationBundle(m_bundle);
- m_wsConsumerImplNewOperation.addServiceRegistrationBundle(m_bundle);
- m_wsConsumerImplNewOperation.setServicePackageName(m_wsConsumerImplClassWizardPage.getPackageName());
- m_wsConsumerImplNewOperation.setServiceName(m_wsConsumerImplClassWizardPage.getTypeName());
- m_wsConsumerImplNewOperation.setCreateScoutWebServiceAnnotation(m_wsConsumerImplClassWizardPage.isAnnotateImplClass());
- m_wsConsumerImplNewOperation.setAuthenticationHandlerQName(m_wsConsumerImplClassWizardPage.getAuthenticationHandler());
-
- m_portTypeQName = m_wsPropertiesExistingWsdlWizardPage.getPortType().getQName();
- if (m_wsPropertiesExistingWsdlWizardPage.getService() != null) {
- m_serviceQName = m_wsPropertiesExistingWsdlWizardPage.getService().getQName();
- }
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- JaxWsSdk.getDefault().getMarkerQueueManager().suspend();
- try {
- for (ExternalFileCopyOperation op : m_copyOperations) {
- op.validate();
- op.run(monitor, workingCopyManager);
- }
-
- // create binding file(s)
- if (m_createBindingFile) {
- Map<String, List<String>> buildProperties = m_buildJaxWsEntryCreateOperation.getBuildProperties();
-
- // get WSDL resource to determine associated XML schemas
- IFile wsdlFile = JaxWsSdkUtility.getFile(m_bundle, m_buildJaxWsEntryCreateOperation.getWsdlFile(), false);
- WsdlResource wsdlResource = new WsdlResource(m_bundle);
- wsdlResource.setFile(wsdlFile);
-
- // iterate through schemas to create respective binding files
- SchemaCandidate[] schemaCandidates = GlobalBindingRegistrationHelper.getSchemaCandidates(wsdlResource.getFile());
- for (int i = 0; i < schemaCandidates.length; i++) {
- SchemaCandidate candidate = schemaCandidates[i];
-
- // schema targetNamespace must only be specified if multiple schemas exist
- String schemaTargetNamespace = null;
- if (schemaCandidates.length > 1) {
- schemaTargetNamespace = SchemaUtility.getSchemaTargetNamespace(candidate.getSchema());
- }
-
- String bindingFileName = JaxWsSdkUtility.createUniqueBindingFileNamePath(m_bundle, m_alias, schemaTargetNamespace);
- BindingFileCreateOperation op = new BindingFileCreateOperation();
- op.setBundle(m_bundle);
- op.setWsdlDestinationFolder(m_wsdlLocationWizardPage.getWsdlFolder());
- op.setSchemaTargetNamespace(schemaTargetNamespace);
- if (candidate.getWsdlArtefact().getTypeEnum() == TypeEnum.ReferencedWsdl) {
- IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, candidate.getWsdlArtefact().getFile());
- op.setWsdlLocation(referencedWsdlFile);
- }
- op.setProjectRelativeFilePath(new Path(bindingFileName));
- JaxWsSdkUtility.addBuildProperty(buildProperties, JaxWsConstants.OPTION_BINDING_FILE, bindingFileName);
-
- // Global binding file section can only be defined in one file -> pick first
- if (i == 0) {
- op.setCreateGlobalBindingSection(true);
- }
- op.validate();
- op.run(monitor, workingCopyManager);
- }
-
- m_buildJaxWsEntryCreateOperation.setBuildProperties(buildProperties);
- }
-
- m_stubGenerationOperation.validate();
- m_stubGenerationOperation.run(monitor, workingCopyManager);
- TypeUtility.getPrimaryTypeHierarchy(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient)).invalidate();
-
- IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, m_buildJaxWsEntryCreateOperation.getBuildProperties(), m_wsdlFileName);
- IType portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(m_portTypeQName, stubJarFile);
-
- // wait for stub JAR to be part of classpth
- int maxWaitLoops = 10;
- while (portTypeInterfaceType == null && maxWaitLoops > 0) {
- try {
- Thread.sleep(500);
- }
- catch (InterruptedException e) {
- JaxWsSdk.logError(e);
- }
- portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(m_portTypeQName, stubJarFile);
- maxWaitLoops--;
- }
-
- IType serviceType = JaxWsSdkUtility.resolveServiceType(m_serviceQName, stubJarFile);
- m_wsConsumerImplNewOperation.setJaxWsPortType(portTypeInterfaceType);
- m_wsConsumerImplNewOperation.setJaxWsServiceType(serviceType);
-
- m_wsConsumerImplNewOperation.validate();
- m_wsConsumerImplNewOperation.run(monitor, workingCopyManager);
-
- String fqnWebserviceClient = m_wsConsumerImplNewOperation.getCreatedServiceImplementation().getFullyQualifiedName();
-
- // wait for port type to be part of the hierarchy
- maxWaitLoops = 10;
- while (!TypeUtility.exists(TypeUtility.getType(fqnWebserviceClient)) && maxWaitLoops > 0) {
- try {
- Thread.sleep(500);
- }
- catch (InterruptedException e) {
- JaxWsSdk.logError(e);
- }
- maxWaitLoops--;
- }
-
- m_buildJaxWsEntryCreateOperation.validate();
- m_buildJaxWsEntryCreateOperation.run(monitor, workingCopyManager);
- return true;
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- return false;
- }
- finally {
- JaxWsSdk.getDefault().getMarkerQueueManager().resume();
- }
- }
-
- private boolean isCopyRequired(IFolder wsdlFolder, File wsdlFile) {
- IFile potentialSameFile = JaxWsSdkUtility.getFile(m_bundle, wsdlFolder.getProjectRelativePath().toPortableString(), wsdlFile.getName(), false);
-
- if (potentialSameFile != null && potentialSameFile.exists()) {
- IPath potentialSameFilePath = new Path(potentialSameFile.getLocationURI().getRawPath());
- IPath wsdlFilePath = new Path(wsdlFile.getAbsolutePath());
-
- if (potentialSameFilePath.equals(wsdlFilePath)) {
- return false;
- }
- }
-
- return true;
- }
-
- private class P_WsdlLocationPropertyListener implements PropertyChangeListener {
-
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (WsdlLocationWizardPage.PROP_WSDL_DEFINITION.equals(event.getPropertyName())) {
- Definition wsdlDefinition = (Definition) event.getNewValue();
- m_wsPropertiesExistingWsdlWizardPage.setWsdlDefinition(wsdlDefinition);
-
- if (wsdlDefinition != null) {
- String defaultPackageName = JaxWsSdkUtility.resolveStubPackageName(null, wsdlDefinition);
- m_wsStubWizardPage.setDefaultPackageName(defaultPackageName);
- m_wsStubWizardPage.setPackageName(defaultPackageName);
- }
- else {
- m_wsStubWizardPage.setDefaultPackageName(null);
- }
- }
- }
- }
-
- private class P_WsPropertiesPropertyListener implements PropertyChangeListener {
-
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (WsPropertiesExistingWsdlWizardPage.PROP_PORT_TYPE.equals(event.getPropertyName())) {
- String portTypeName = null;
- PortType portType = (PortType) event.getNewValue();
- if (portType != null) {
- portTypeName = portType.getQName().getLocalPart();
- m_wsConsumerImplClassWizardPage.setTypeName(JaxWsSdkUtility.getPlainPortTypeName(portTypeName));
- }
- else {
- m_wsConsumerImplClassWizardPage.setTypeName(null);
- }
- }
- }
- }
-
- private class P_StubGenerationFinishedListener implements IOperationFinishedListener {
-
- @Override
- public void operationFinished(boolean success, Throwable exception) {
- // nop
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.BindingFileCreateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.operation.BuildJaxWsEntryCreateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.operation.ExternalFileCopyOperation;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsConsumerImplNewOperation;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsStubGenerationOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsConsumerImplClassWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsPropertiesExistingWsdlWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsStubWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsdlLocationWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper;
+import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper.SchemaCandidate;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IOperationFinishedListener;
+
+public class WsConsumerNewWizard extends AbstractWorkspaceWizard {
+
+ public static final int TYPE_SERVICE_IMPLEMENTATION = 100;
+ public static final int TYPE_SERVICE_REG_SERVER = 101;
+
+ private IScoutBundle m_bundle;
+ private WsdlLocationWizardPage m_wsdlLocationWizardPage;
+ private WsPropertiesExistingWsdlWizardPage m_wsPropertiesExistingWsdlWizardPage;
+ private WsConsumerImplClassWizardPage m_wsConsumerImplClassWizardPage;
+ private WsStubWizardPage m_wsStubWizardPage;
+
+ private ExternalFileCopyOperation[] m_copyOperations;
+ private BuildJaxWsEntryCreateOperation m_buildJaxWsEntryCreateOperation;
+ private WsStubGenerationOperation m_stubGenerationOperation;
+ private WsConsumerImplNewOperation m_wsConsumerImplNewOperation;
+
+ private QName m_serviceQName;
+ private QName m_portTypeQName;
+
+ private String m_alias;
+ private boolean m_createBindingFile;
+ private String m_wsdlFileName;
+
+ public WsConsumerNewWizard(IScoutBundle bundle) {
+ m_bundle = bundle;
+ m_copyOperations = new ExternalFileCopyOperation[0];
+ setWindowTitle(Texts.get("CreateWsConsumer"));
+ }
+
+ @Override
+ public void addPages() {
+ // WSDL selection
+ m_wsdlLocationWizardPage = new WsdlLocationWizardPage(m_bundle);
+ m_wsdlLocationWizardPage.setTitle(Texts.get("CreateWsConsumer"));
+ m_wsdlLocationWizardPage.setWsdlFolderVisible(true);
+ m_wsdlLocationWizardPage.setWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_CONSUMER, false)); // initial value
+ m_wsdlLocationWizardPage.setRootWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_CONSUMER, false));
+ m_wsdlLocationWizardPage.addPropertyChangeListener(new P_WsdlLocationPropertyListener());
+ addPage(m_wsdlLocationWizardPage);
+
+ // WS properties of existing WSDL Wizard Page
+ m_wsPropertiesExistingWsdlWizardPage = new WsPropertiesExistingWsdlWizardPage(m_bundle, WebserviceEnum.Consumer);
+ m_wsPropertiesExistingWsdlWizardPage.setTitle(Texts.get("CreateWsConsumer"));
+ m_wsPropertiesExistingWsdlWizardPage.addPropertyChangeListener(new P_WsPropertiesPropertyListener());
+ addPage(m_wsPropertiesExistingWsdlWizardPage);
+
+ // WS Stub
+ m_wsStubWizardPage = new WsStubWizardPage(m_bundle);
+ m_wsStubWizardPage.setTitle(Texts.get("CreateWsConsumer"));
+ addPage(m_wsStubWizardPage);
+
+ // Implementing class
+ m_wsConsumerImplClassWizardPage = new WsConsumerImplClassWizardPage(m_bundle);
+ m_wsConsumerImplClassWizardPage.setTitle(Texts.get("CreateWsConsumer"));
+ addPage(m_wsConsumerImplClassWizardPage);
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ IFolder wsdlFolder = m_wsdlLocationWizardPage.getWsdlFolder();
+ m_alias = m_wsConsumerImplClassWizardPage.getTypeName();
+ File wsdlFile = m_wsdlLocationWizardPage.getWsdlFile();
+ m_wsdlFileName = wsdlFile.getName();
+
+ List<ExternalFileCopyOperation> copyOperations = new LinkedList<ExternalFileCopyOperation>();
+ if (isCopyRequired(wsdlFolder, wsdlFile)) {
+ ExternalFileCopyOperation op = new ExternalFileCopyOperation();
+ op.setBundle(m_bundle);
+ op.setOverwrite(true);
+ op.setExternalFile(m_wsdlLocationWizardPage.getWsdlFile());
+ op.setWorkspacePath(wsdlFolder.getProjectRelativePath());
+ copyOperations.add(op);
+ }
+
+ for (File file : m_wsdlLocationWizardPage.getAdditionalFiles()) {
+ if (isCopyRequired(wsdlFolder, file)) {
+ ExternalFileCopyOperation op = new ExternalFileCopyOperation();
+ op.setBundle(m_bundle);
+ op.setOverwrite(true);
+ op.setExternalFile(file);
+ op.setWorkspacePath(wsdlFolder.getProjectRelativePath());
+ copyOperations.add(op);
+ }
+ }
+ m_copyOperations = copyOperations.toArray(new ExternalFileCopyOperation[copyOperations.size()]);
+
+ // prepare buildJaxWs.xml operation
+ m_buildJaxWsEntryCreateOperation = new BuildJaxWsEntryCreateOperation(WebserviceEnum.Consumer);
+ m_buildJaxWsEntryCreateOperation.setBundle(m_bundle);
+ m_buildJaxWsEntryCreateOperation.setAlias(m_alias);
+ m_buildJaxWsEntryCreateOperation.setWsdlFile(JaxWsSdkUtility.normalizePath(wsdlFolder.getProjectRelativePath().append(wsdlFile.getName()).toPortableString(), SeparatorType.None));
+
+ m_createBindingFile = m_wsStubWizardPage.isCreateBindingFile();
+
+ // build properties and binding file
+ Map<String, List<String>> buildProperties = JaxWsSdkUtility.getDefaultBuildProperties();
+
+ // custom stub package
+ Definition wsdlDefinition = m_wsdlLocationWizardPage.getWsdlDefinition();
+ String defaultPackageName = JaxWsSdkUtility.resolveStubPackageName(null, wsdlDefinition);
+
+ if (!CompareUtility.equals(m_wsStubWizardPage.getPackageName(), defaultPackageName)) {
+ JaxWsSdkUtility.addBuildProperty(buildProperties, JaxWsConstants.OPTION_PACKAGE, m_wsStubWizardPage.getPackageName());
+ }
+ m_buildJaxWsEntryCreateOperation.setBuildProperties(buildProperties);
+
+ m_stubGenerationOperation = new WsStubGenerationOperation();
+ m_stubGenerationOperation.setBundle(m_bundle);
+ m_stubGenerationOperation.setAlias(m_alias);
+ m_stubGenerationOperation.setWsdlFolder(wsdlFolder);
+ m_stubGenerationOperation.setProperties(buildProperties);
+ m_stubGenerationOperation.setWsdlFileName(wsdlFile.getName());
+ m_stubGenerationOperation.addOperationFinishedListener(new P_StubGenerationFinishedListener());
+
+ m_wsConsumerImplNewOperation = new WsConsumerImplNewOperation();
+ m_wsConsumerImplNewOperation.setImplementationBundle(m_bundle);
+ m_wsConsumerImplNewOperation.addServiceRegistrationBundle(m_bundle);
+ m_wsConsumerImplNewOperation.setServicePackageName(m_wsConsumerImplClassWizardPage.getPackageName());
+ m_wsConsumerImplNewOperation.setServiceName(m_wsConsumerImplClassWizardPage.getTypeName());
+ m_wsConsumerImplNewOperation.setCreateScoutWebServiceAnnotation(m_wsConsumerImplClassWizardPage.isAnnotateImplClass());
+ m_wsConsumerImplNewOperation.setAuthenticationHandlerQName(m_wsConsumerImplClassWizardPage.getAuthenticationHandler());
+
+ m_portTypeQName = m_wsPropertiesExistingWsdlWizardPage.getPortType().getQName();
+ if (m_wsPropertiesExistingWsdlWizardPage.getService() != null) {
+ m_serviceQName = m_wsPropertiesExistingWsdlWizardPage.getService().getQName();
+ }
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ JaxWsSdk.getDefault().getMarkerQueueManager().suspend();
+ try {
+ for (ExternalFileCopyOperation op : m_copyOperations) {
+ op.validate();
+ op.run(monitor, workingCopyManager);
+ }
+
+ // create binding file(s)
+ if (m_createBindingFile) {
+ Map<String, List<String>> buildProperties = m_buildJaxWsEntryCreateOperation.getBuildProperties();
+
+ // get WSDL resource to determine associated XML schemas
+ IFile wsdlFile = JaxWsSdkUtility.getFile(m_bundle, m_buildJaxWsEntryCreateOperation.getWsdlFile(), false);
+ WsdlResource wsdlResource = new WsdlResource(m_bundle);
+ wsdlResource.setFile(wsdlFile);
+
+ // iterate through schemas to create respective binding files
+ SchemaCandidate[] schemaCandidates = GlobalBindingRegistrationHelper.getSchemaCandidates(wsdlResource.getFile());
+ for (int i = 0; i < schemaCandidates.length; i++) {
+ SchemaCandidate candidate = schemaCandidates[i];
+
+ // schema targetNamespace must only be specified if multiple schemas exist
+ String schemaTargetNamespace = null;
+ if (schemaCandidates.length > 1) {
+ schemaTargetNamespace = SchemaUtility.getSchemaTargetNamespace(candidate.getSchema());
+ }
+
+ String bindingFileName = JaxWsSdkUtility.createUniqueBindingFileNamePath(m_bundle, m_alias, schemaTargetNamespace);
+ BindingFileCreateOperation op = new BindingFileCreateOperation();
+ op.setBundle(m_bundle);
+ op.setWsdlDestinationFolder(m_wsdlLocationWizardPage.getWsdlFolder());
+ op.setSchemaTargetNamespace(schemaTargetNamespace);
+ if (candidate.getWsdlArtefact().getTypeEnum() == TypeEnum.ReferencedWsdl) {
+ IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, candidate.getWsdlArtefact().getFile());
+ op.setWsdlLocation(referencedWsdlFile);
+ }
+ op.setProjectRelativeFilePath(new Path(bindingFileName));
+ JaxWsSdkUtility.addBuildProperty(buildProperties, JaxWsConstants.OPTION_BINDING_FILE, bindingFileName);
+
+ // Global binding file section can only be defined in one file -> pick first
+ if (i == 0) {
+ op.setCreateGlobalBindingSection(true);
+ }
+ op.validate();
+ op.run(monitor, workingCopyManager);
+ }
+
+ m_buildJaxWsEntryCreateOperation.setBuildProperties(buildProperties);
+ }
+
+ m_stubGenerationOperation.validate();
+ m_stubGenerationOperation.run(monitor, workingCopyManager);
+ TypeUtility.getPrimaryTypeHierarchy(TypeUtility.getType(JaxWsRuntimeClasses.AbstractWebServiceClient)).invalidate();
+
+ IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, m_buildJaxWsEntryCreateOperation.getBuildProperties(), m_wsdlFileName);
+ IType portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(m_portTypeQName, stubJarFile);
+
+ // wait for stub JAR to be part of classpth
+ int maxWaitLoops = 10;
+ while (portTypeInterfaceType == null && maxWaitLoops > 0) {
+ try {
+ Thread.sleep(500);
+ }
+ catch (InterruptedException e) {
+ JaxWsSdk.logError(e);
+ }
+ portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(m_portTypeQName, stubJarFile);
+ maxWaitLoops--;
+ }
+
+ IType serviceType = JaxWsSdkUtility.resolveServiceType(m_serviceQName, stubJarFile);
+ m_wsConsumerImplNewOperation.setJaxWsPortType(portTypeInterfaceType);
+ m_wsConsumerImplNewOperation.setJaxWsServiceType(serviceType);
+
+ m_wsConsumerImplNewOperation.validate();
+ m_wsConsumerImplNewOperation.run(monitor, workingCopyManager);
+
+ String fqnWebserviceClient = m_wsConsumerImplNewOperation.getCreatedServiceImplementation().getFullyQualifiedName();
+
+ // wait for port type to be part of the hierarchy
+ maxWaitLoops = 10;
+ while (!TypeUtility.exists(TypeUtility.getType(fqnWebserviceClient)) && maxWaitLoops > 0) {
+ try {
+ Thread.sleep(500);
+ }
+ catch (InterruptedException e) {
+ JaxWsSdk.logError(e);
+ }
+ maxWaitLoops--;
+ }
+
+ m_buildJaxWsEntryCreateOperation.validate();
+ m_buildJaxWsEntryCreateOperation.run(monitor, workingCopyManager);
+ return true;
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ return false;
+ }
+ finally {
+ JaxWsSdk.getDefault().getMarkerQueueManager().resume();
+ }
+ }
+
+ private boolean isCopyRequired(IFolder wsdlFolder, File wsdlFile) {
+ IFile potentialSameFile = JaxWsSdkUtility.getFile(m_bundle, wsdlFolder.getProjectRelativePath().toPortableString(), wsdlFile.getName(), false);
+
+ if (potentialSameFile != null && potentialSameFile.exists()) {
+ IPath potentialSameFilePath = new Path(potentialSameFile.getLocationURI().getRawPath());
+ IPath wsdlFilePath = new Path(wsdlFile.getAbsolutePath());
+
+ if (potentialSameFilePath.equals(wsdlFilePath)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private class P_WsdlLocationPropertyListener implements PropertyChangeListener {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (WsdlLocationWizardPage.PROP_WSDL_DEFINITION.equals(event.getPropertyName())) {
+ Definition wsdlDefinition = (Definition) event.getNewValue();
+ m_wsPropertiesExistingWsdlWizardPage.setWsdlDefinition(wsdlDefinition);
+
+ if (wsdlDefinition != null) {
+ String defaultPackageName = JaxWsSdkUtility.resolveStubPackageName(null, wsdlDefinition);
+ m_wsStubWizardPage.setDefaultPackageName(defaultPackageName);
+ m_wsStubWizardPage.setPackageName(defaultPackageName);
+ }
+ else {
+ m_wsStubWizardPage.setDefaultPackageName(null);
+ }
+ }
+ }
+ }
+
+ private class P_WsPropertiesPropertyListener implements PropertyChangeListener {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (WsPropertiesExistingWsdlWizardPage.PROP_PORT_TYPE.equals(event.getPropertyName())) {
+ String portTypeName = null;
+ PortType portType = (PortType) event.getNewValue();
+ if (portType != null) {
+ portTypeName = portType.getQName().getLocalPart();
+ m_wsConsumerImplClassWizardPage.setTypeName(JaxWsSdkUtility.getPlainPortTypeName(portTypeName));
+ }
+ else {
+ m_wsConsumerImplClassWizardPage.setTypeName(null);
+ }
+ }
+ }
+ }
+
+ private class P_StubGenerationFinishedListener implements IOperationFinishedListener {
+
+ @Override
+ public void operationFinished(boolean success, Throwable exception) {
+ // nop
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsFileMoveWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsFileMoveWizard.java
index 3bca6c14f..1d2904c7d 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsFileMoveWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsFileMoveWizard.java
@@ -1,231 +1,231 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsFilesMoveOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceConsumerNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderNodePage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ResourceSelectionWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.Artefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaImportArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaIncludeArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
-
-public class WsFileMoveWizard extends AbstractWorkspaceWizard {
-
- private ResourceSelectionWizardPage m_wizardPage;
-
- private IScoutBundle m_bundle;
- private SunJaxWsBean m_sunJaxWsBean;
- private BuildJaxWsBean m_buildJaxWsBean;
- private WebserviceEnum m_webserviceEnum;
- private IFolder m_destination;
- private String m_markerGroupUUID;
-
- private WsFilesMoveOperation m_operation;
-
- public WsFileMoveWizard() {
- setWindowTitle(Texts.get("MovingFiles"));
- }
-
- @Override
- public void addPages() {
- m_wizardPage = new ResourceSelectionWizardPage(Texts.get("QuestionMoveFiles", m_destination.getProjectRelativePath().toPortableString()), Texts.get("QuestionMove"));
- m_wizardPage.setElements(getElementsToBeMoved());
- addPage(m_wizardPage);
- }
-
- private List<ElementBean> getElementsToBeMoved() {
- List<ElementBean> elements = new LinkedList<ElementBean>();
- // WSDL file
- IFile wsdlFile = null;
- if (m_webserviceEnum == WebserviceEnum.Provider) {
- if (m_sunJaxWsBean != null && StringUtility.hasText(m_sunJaxWsBean.getWsdl())) {
- wsdlFile = JaxWsSdkUtility.getFile(m_bundle, m_sunJaxWsBean.getWsdl(), false);
- }
- }
- else {
- if (m_buildJaxWsBean != null && StringUtility.hasText(m_buildJaxWsBean.getWsdl())) {
- wsdlFile = JaxWsSdkUtility.getFile(m_bundle, m_buildJaxWsBean.getWsdl(), false);
- }
- }
- if (wsdlFile == null || !wsdlFile.exists()) {
- return elements;
- }
-
- // registration in sun-jaxws.xml (provider) / build-jaxws.xml (consumer)
- if (m_webserviceEnum == WebserviceEnum.Provider) {
- elements.add(new ElementBean(WsFilesMoveOperation.ID_WSDL_SUNJAXWS_REGISTRATION, "Change WSDL file registration in sun-jaxws.xml to '" + m_destination.getProjectRelativePath().append(wsdlFile.getName()) + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.SunJaxWsXmlFile), true));
- }
- else {
- elements.add(new ElementBean(WsFilesMoveOperation.ID_WSDL_BUILDJAXWS_REGISTRATION, "Change WSDL file registration in build-jaxws.xml to '" + m_destination.getProjectRelativePath().append(wsdlFile.getName()) + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.BuildJaxWsXmlFile), true));
- }
-
- elements.add(new ElementBean(WsFilesMoveOperation.ID_WSDL_FILE, Texts.get("MoveXToY", "WSDL file", m_destination.getProjectRelativePath().append(wsdlFile.getName()).toPortableString()), JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), wsdlFile, true));
- if (wsdlFile != null) {
- Artefact[] artefacts = SchemaUtility.getArtefacts(wsdlFile, false);
- for (Artefact artefact : artefacts) {
- // referenced WSDL definitions
- if (artefact instanceof WsdlArtefact) {
- WsdlArtefact wsdlArtefact = (WsdlArtefact) artefact;
- if (wsdlArtefact.getTypeEnum() == TypeEnum.ReferencedWsdl) {
- IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, wsdlArtefact.getFile());
- if (referencedWsdlFile != null && referencedWsdlFile.exists()) {
- elements.add(new ElementBean(WsFilesMoveOperation.ID_REF_WSDL, Texts.get("MoveReferencedXToY", "WSDL file", m_destination.getProjectRelativePath().append(referencedWsdlFile.getName()).toPortableString()), JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), referencedWsdlFile, false));
- }
- }
- }
- // imported XSD schemas
- if (artefact instanceof SchemaImportArtefact) {
- SchemaImportArtefact schemaArtefact = (SchemaImportArtefact) artefact;
- IFile importedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
- if (importedSchemaFile != null && importedSchemaFile.exists()) {
- elements.add(new ElementBean(WsFilesMoveOperation.ID_REF_XSD, Texts.get("MoveReferencedXToY", "XSD schema (imported)", m_destination.getProjectRelativePath().append(importedSchemaFile.getName()).toPortableString()), JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), importedSchemaFile, false));
- }
- }
-
- // included XSD schemas
- if (artefact instanceof SchemaIncludeArtefact) {
- SchemaIncludeArtefact schemaArtefact = (SchemaIncludeArtefact) artefact;
- IFile includedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
- if (includedSchemaFile != null && includedSchemaFile.exists()) {
- elements.add(new ElementBean(WsFilesMoveOperation.ID_REF_XSD, Texts.get("MoveReferencedXToY", "XSD schema (included)", m_destination.getProjectRelativePath().append(includedSchemaFile.getName()).toPortableString()), JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), includedSchemaFile, false));
- }
- }
- }
- }
-
- // WSDL location in binding files
- IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(m_bundle, m_buildJaxWsBean.getPropertiers());
- for (IFile bindingFile : bindingFiles) {
- XmlResource xmlResource = new XmlResource(m_bundle);
- xmlResource.setFile(bindingFile);
- ScoutXmlDocument xmlDocument = xmlResource.loadXml();
- String namespacePrefix = xmlDocument.getRoot().getNamePrefix();
- ScoutXmlElement xmlBindings = xmlDocument.getChild(StringUtility.join(":", namespacePrefix, "bindings"));
- if (xmlBindings != null && xmlBindings.hasAttribute("wsdlLocation")) {
- String wsdlLocation = xmlBindings.getAttribute("wsdlLocation");
- String schemaDefiningFileName = new Path(wsdlLocation).toFile().getName();
- IPath relativeWsdlFolderPath = m_destination.getProjectRelativePath().makeRelativeTo(JaxWsSdkUtility.getParentFolder(m_bundle, bindingFile).getProjectRelativePath());
- String newWsdlLocation = JaxWsSdkUtility.normalizePath(relativeWsdlFolderPath.toPortableString(), SeparatorType.TrailingType) + schemaDefiningFileName;
- ElementBean elementBean = new ElementBean(WsFilesMoveOperation.ID_BINDING_FILE, "Change attribute 'wsdlLocation' in binding file '" + bindingFile.getName() + "' to '" + newWsdlLocation + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), bindingFile, false);
- elementBean.setData(newWsdlLocation);
- elements.add(elementBean);
- }
- }
- return elements;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_operation = new WsFilesMoveOperation();
- m_operation.setBundle(m_bundle);
- m_operation.setBuildJaxWsBean(m_buildJaxWsBean);
- m_operation.setSunJaxWsBean(m_sunJaxWsBean);
- m_operation.setDestination(m_destination);
-
- List<ElementBean> elements = new LinkedList<ElementBean>();
- for (ElementBean element : m_wizardPage.getElements()) {
- if (element.isChecked() || element.isMandatory()) {
- elements.add(element);
- }
- }
- m_operation.setElements(elements);
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- m_operation.run(monitor, workingCopyManager);
- if (m_webserviceEnum == WebserviceEnum.Provider) {
- JaxWsSdk.getDefault().notifyPageReload(WebServiceProviderNodePage.class, m_markerGroupUUID, WebServiceProviderNodePage.DATA_WSDL_FILE | WebServiceProviderNodePage.DATA_SUN_JAXWS_ENTRY | WebServiceProviderNodePage.DATA_BINDING_FILE);
- }
- else {
- JaxWsSdk.getDefault().notifyPageReload(WebServiceProviderNodePage.class, m_markerGroupUUID, WebServiceConsumerNodePage.DATA_WSDL_FILE | WebServiceConsumerNodePage.DATA_BUILD_JAXWS_ENTRY | WebServiceConsumerNodePage.DATA_BINDING_FILE);
- }
- return true;
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public SunJaxWsBean getSunJaxWsBean() {
- return m_sunJaxWsBean;
- }
-
- public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
- m_sunJaxWsBean = sunJaxWsBean;
- }
-
- public BuildJaxWsBean getBuildJaxWsBean() {
- return m_buildJaxWsBean;
- }
-
- public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
- m_buildJaxWsBean = buildJaxWsBean;
- }
-
- public WebserviceEnum getWebserviceEnum() {
- return m_webserviceEnum;
- }
-
- public void setWebserviceEnum(WebserviceEnum webserviceEnum) {
- m_webserviceEnum = webserviceEnum;
- }
-
- public IFolder getDestination() {
- return m_destination;
- }
-
- public void setDestination(IFolder destination) {
- m_destination = destination;
- }
-
- public String getMarkerGroupUUID() {
- return m_markerGroupUUID;
- }
-
- public void setMarkerGroupUUID(String markerGroupUUID) {
- m_markerGroupUUID = markerGroupUUID;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsFilesMoveOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceConsumerNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.pages.WebServiceProviderNodePage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ResourceSelectionWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.Artefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaImportArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaIncludeArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
+
+public class WsFileMoveWizard extends AbstractWorkspaceWizard {
+
+ private ResourceSelectionWizardPage m_wizardPage;
+
+ private IScoutBundle m_bundle;
+ private SunJaxWsBean m_sunJaxWsBean;
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private WebserviceEnum m_webserviceEnum;
+ private IFolder m_destination;
+ private String m_markerGroupUUID;
+
+ private WsFilesMoveOperation m_operation;
+
+ public WsFileMoveWizard() {
+ setWindowTitle(Texts.get("MovingFiles"));
+ }
+
+ @Override
+ public void addPages() {
+ m_wizardPage = new ResourceSelectionWizardPage(Texts.get("QuestionMoveFiles", m_destination.getProjectRelativePath().toPortableString()), Texts.get("QuestionMove"));
+ m_wizardPage.setElements(getElementsToBeMoved());
+ addPage(m_wizardPage);
+ }
+
+ private List<ElementBean> getElementsToBeMoved() {
+ List<ElementBean> elements = new LinkedList<ElementBean>();
+ // WSDL file
+ IFile wsdlFile = null;
+ if (m_webserviceEnum == WebserviceEnum.Provider) {
+ if (m_sunJaxWsBean != null && StringUtility.hasText(m_sunJaxWsBean.getWsdl())) {
+ wsdlFile = JaxWsSdkUtility.getFile(m_bundle, m_sunJaxWsBean.getWsdl(), false);
+ }
+ }
+ else {
+ if (m_buildJaxWsBean != null && StringUtility.hasText(m_buildJaxWsBean.getWsdl())) {
+ wsdlFile = JaxWsSdkUtility.getFile(m_bundle, m_buildJaxWsBean.getWsdl(), false);
+ }
+ }
+ if (wsdlFile == null || !wsdlFile.exists()) {
+ return elements;
+ }
+
+ // registration in sun-jaxws.xml (provider) / build-jaxws.xml (consumer)
+ if (m_webserviceEnum == WebserviceEnum.Provider) {
+ elements.add(new ElementBean(WsFilesMoveOperation.ID_WSDL_SUNJAXWS_REGISTRATION, "Change WSDL file registration in sun-jaxws.xml to '" + m_destination.getProjectRelativePath().append(wsdlFile.getName()) + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.SunJaxWsXmlFile), true));
+ }
+ else {
+ elements.add(new ElementBean(WsFilesMoveOperation.ID_WSDL_BUILDJAXWS_REGISTRATION, "Change WSDL file registration in build-jaxws.xml to '" + m_destination.getProjectRelativePath().append(wsdlFile.getName()) + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.BuildJaxWsXmlFile), true));
+ }
+
+ elements.add(new ElementBean(WsFilesMoveOperation.ID_WSDL_FILE, Texts.get("MoveXToY", "WSDL file", m_destination.getProjectRelativePath().append(wsdlFile.getName()).toPortableString()), JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), wsdlFile, true));
+ if (wsdlFile != null) {
+ Artefact[] artefacts = SchemaUtility.getArtefacts(wsdlFile, false);
+ for (Artefact artefact : artefacts) {
+ // referenced WSDL definitions
+ if (artefact instanceof WsdlArtefact) {
+ WsdlArtefact wsdlArtefact = (WsdlArtefact) artefact;
+ if (wsdlArtefact.getTypeEnum() == TypeEnum.ReferencedWsdl) {
+ IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, wsdlArtefact.getFile());
+ if (referencedWsdlFile != null && referencedWsdlFile.exists()) {
+ elements.add(new ElementBean(WsFilesMoveOperation.ID_REF_WSDL, Texts.get("MoveReferencedXToY", "WSDL file", m_destination.getProjectRelativePath().append(referencedWsdlFile.getName()).toPortableString()), JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), referencedWsdlFile, false));
+ }
+ }
+ }
+ // imported XSD schemas
+ if (artefact instanceof SchemaImportArtefact) {
+ SchemaImportArtefact schemaArtefact = (SchemaImportArtefact) artefact;
+ IFile importedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
+ if (importedSchemaFile != null && importedSchemaFile.exists()) {
+ elements.add(new ElementBean(WsFilesMoveOperation.ID_REF_XSD, Texts.get("MoveReferencedXToY", "XSD schema (imported)", m_destination.getProjectRelativePath().append(importedSchemaFile.getName()).toPortableString()), JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), importedSchemaFile, false));
+ }
+ }
+
+ // included XSD schemas
+ if (artefact instanceof SchemaIncludeArtefact) {
+ SchemaIncludeArtefact schemaArtefact = (SchemaIncludeArtefact) artefact;
+ IFile includedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
+ if (includedSchemaFile != null && includedSchemaFile.exists()) {
+ elements.add(new ElementBean(WsFilesMoveOperation.ID_REF_XSD, Texts.get("MoveReferencedXToY", "XSD schema (included)", m_destination.getProjectRelativePath().append(includedSchemaFile.getName()).toPortableString()), JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), includedSchemaFile, false));
+ }
+ }
+ }
+ }
+
+ // WSDL location in binding files
+ IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(m_bundle, m_buildJaxWsBean.getPropertiers());
+ for (IFile bindingFile : bindingFiles) {
+ XmlResource xmlResource = new XmlResource(m_bundle);
+ xmlResource.setFile(bindingFile);
+ ScoutXmlDocument xmlDocument = xmlResource.loadXml();
+ String namespacePrefix = xmlDocument.getRoot().getNamePrefix();
+ ScoutXmlElement xmlBindings = xmlDocument.getChild(StringUtility.join(":", namespacePrefix, "bindings"));
+ if (xmlBindings != null && xmlBindings.hasAttribute("wsdlLocation")) {
+ String wsdlLocation = xmlBindings.getAttribute("wsdlLocation");
+ String schemaDefiningFileName = new Path(wsdlLocation).toFile().getName();
+ IPath relativeWsdlFolderPath = m_destination.getProjectRelativePath().makeRelativeTo(JaxWsSdkUtility.getParentFolder(m_bundle, bindingFile).getProjectRelativePath());
+ String newWsdlLocation = JaxWsSdkUtility.normalizePath(relativeWsdlFolderPath.toPortableString(), SeparatorType.TrailingType) + schemaDefiningFileName;
+ ElementBean elementBean = new ElementBean(WsFilesMoveOperation.ID_BINDING_FILE, "Change attribute 'wsdlLocation' in binding file '" + bindingFile.getName() + "' to '" + newWsdlLocation + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), bindingFile, false);
+ elementBean.setData(newWsdlLocation);
+ elements.add(elementBean);
+ }
+ }
+ return elements;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_operation = new WsFilesMoveOperation();
+ m_operation.setBundle(m_bundle);
+ m_operation.setBuildJaxWsBean(m_buildJaxWsBean);
+ m_operation.setSunJaxWsBean(m_sunJaxWsBean);
+ m_operation.setDestination(m_destination);
+
+ List<ElementBean> elements = new LinkedList<ElementBean>();
+ for (ElementBean element : m_wizardPage.getElements()) {
+ if (element.isChecked() || element.isMandatory()) {
+ elements.add(element);
+ }
+ }
+ m_operation.setElements(elements);
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ m_operation.run(monitor, workingCopyManager);
+ if (m_webserviceEnum == WebserviceEnum.Provider) {
+ JaxWsSdk.getDefault().notifyPageReload(WebServiceProviderNodePage.class, m_markerGroupUUID, WebServiceProviderNodePage.DATA_WSDL_FILE | WebServiceProviderNodePage.DATA_SUN_JAXWS_ENTRY | WebServiceProviderNodePage.DATA_BINDING_FILE);
+ }
+ else {
+ JaxWsSdk.getDefault().notifyPageReload(WebServiceProviderNodePage.class, m_markerGroupUUID, WebServiceConsumerNodePage.DATA_WSDL_FILE | WebServiceConsumerNodePage.DATA_BUILD_JAXWS_ENTRY | WebServiceConsumerNodePage.DATA_BINDING_FILE);
+ }
+ return true;
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public SunJaxWsBean getSunJaxWsBean() {
+ return m_sunJaxWsBean;
+ }
+
+ public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
+ m_sunJaxWsBean = sunJaxWsBean;
+ }
+
+ public BuildJaxWsBean getBuildJaxWsBean() {
+ return m_buildJaxWsBean;
+ }
+
+ public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
+ m_buildJaxWsBean = buildJaxWsBean;
+ }
+
+ public WebserviceEnum getWebserviceEnum() {
+ return m_webserviceEnum;
+ }
+
+ public void setWebserviceEnum(WebserviceEnum webserviceEnum) {
+ m_webserviceEnum = webserviceEnum;
+ }
+
+ public IFolder getDestination() {
+ return m_destination;
+ }
+
+ public void setDestination(IFolder destination) {
+ m_destination = destination;
+ }
+
+ public String getMarkerGroupUUID() {
+ return m_markerGroupUUID;
+ }
+
+ public void setMarkerGroupUUID(String markerGroupUUID) {
+ m_markerGroupUUID = markerGroupUUID;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderCodeFirstDeleteWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderCodeFirstDeleteWizard.java
index bdd22c648..84d7d379d 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderCodeFirstDeleteWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderCodeFirstDeleteWizard.java
@@ -1,107 +1,107 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsProviderCodeFirstDeleteOperation;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsProviderDeleteOperation;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ResourceSelectionWizardPage;
-
-public class WsProviderCodeFirstDeleteWizard extends AbstractWorkspaceWizard {
-
- private ResourceSelectionWizardPage m_wizardPage;
-
- private IScoutBundle m_bundle;
- private SunJaxWsBean m_sunJaxWsBean;
-
- private WsProviderCodeFirstDeleteOperation m_operation;
-
- public WsProviderCodeFirstDeleteWizard() {
- setWindowTitle(Texts.get("DeleteWebServiceProvider"));
- }
-
- @Override
- public void addPages() {
- m_wizardPage = new ResourceSelectionWizardPage(Texts.get("DeleteWebServiceProvider"), Texts.get("QuestionDeletion"));
- m_wizardPage.setElements(getElementsToBeDeleted());
- addPage(m_wizardPage);
- }
-
- private List<ElementBean> getElementsToBeDeleted() {
- List<ElementBean> elements = new LinkedList<ElementBean>();
- // registration
- elements.add(new ElementBean(WsProviderDeleteOperation.ID_REGISTRATION, "Registration entry in sun-jaxws.xml and build-jaxws.xml", JaxWsSdk.getImageDescriptor(JaxWsIcons.SunJaxWsXmlFile), true));
-
- // port type
- String fqn = m_sunJaxWsBean.getImplementation();
- if (TypeUtility.existsType(fqn)) {
- IType portType = TypeUtility.getType(fqn);
- elements.add(new ElementBean(WsProviderDeleteOperation.ID_IMPL_TYPE, "Port type '" + portType.getFullyQualifiedName() + "'", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), portType, false));
- }
-
- return elements;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_operation = new WsProviderCodeFirstDeleteOperation();
- m_operation.setBundle(m_bundle);
- m_operation.setSunJaxWsBean(m_sunJaxWsBean);
-
- List<ElementBean> elements = new LinkedList<ElementBean>();
- for (ElementBean element : m_wizardPage.getElements()) {
- if (element.isChecked() || element.isMandatory()) {
- elements.add(element);
- }
- }
- m_operation.setElements(elements);
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- OperationJob job = new OperationJob(m_operation);
- job.schedule();
- return true;
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public SunJaxWsBean getSunJaxWsBean() {
- return m_sunJaxWsBean;
- }
-
- public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
- m_sunJaxWsBean = sunJaxWsBean;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsProviderCodeFirstDeleteOperation;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsProviderDeleteOperation;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ResourceSelectionWizardPage;
+
+public class WsProviderCodeFirstDeleteWizard extends AbstractWorkspaceWizard {
+
+ private ResourceSelectionWizardPage m_wizardPage;
+
+ private IScoutBundle m_bundle;
+ private SunJaxWsBean m_sunJaxWsBean;
+
+ private WsProviderCodeFirstDeleteOperation m_operation;
+
+ public WsProviderCodeFirstDeleteWizard() {
+ setWindowTitle(Texts.get("DeleteWebServiceProvider"));
+ }
+
+ @Override
+ public void addPages() {
+ m_wizardPage = new ResourceSelectionWizardPage(Texts.get("DeleteWebServiceProvider"), Texts.get("QuestionDeletion"));
+ m_wizardPage.setElements(getElementsToBeDeleted());
+ addPage(m_wizardPage);
+ }
+
+ private List<ElementBean> getElementsToBeDeleted() {
+ List<ElementBean> elements = new LinkedList<ElementBean>();
+ // registration
+ elements.add(new ElementBean(WsProviderDeleteOperation.ID_REGISTRATION, "Registration entry in sun-jaxws.xml and build-jaxws.xml", JaxWsSdk.getImageDescriptor(JaxWsIcons.SunJaxWsXmlFile), true));
+
+ // port type
+ String fqn = m_sunJaxWsBean.getImplementation();
+ if (TypeUtility.existsType(fqn)) {
+ IType portType = TypeUtility.getType(fqn);
+ elements.add(new ElementBean(WsProviderDeleteOperation.ID_IMPL_TYPE, "Port type '" + portType.getFullyQualifiedName() + "'", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), portType, false));
+ }
+
+ return elements;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_operation = new WsProviderCodeFirstDeleteOperation();
+ m_operation.setBundle(m_bundle);
+ m_operation.setSunJaxWsBean(m_sunJaxWsBean);
+
+ List<ElementBean> elements = new LinkedList<ElementBean>();
+ for (ElementBean element : m_wizardPage.getElements()) {
+ if (element.isChecked() || element.isMandatory()) {
+ elements.add(element);
+ }
+ }
+ m_operation.setElements(elements);
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ OperationJob job = new OperationJob(m_operation);
+ job.schedule();
+ return true;
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public SunJaxWsBean getSunJaxWsBean() {
+ return m_sunJaxWsBean;
+ }
+
+ public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
+ m_sunJaxWsBean = sunJaxWsBean;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderDeleteWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderDeleteWizard.java
index 9b21336e9..06c6a4586 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderDeleteWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderDeleteWizard.java
@@ -1,184 +1,184 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsProviderDeleteOperation;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ResourceSelectionWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.Artefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaImportArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaIncludeArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
-
-public class WsProviderDeleteWizard extends AbstractWorkspaceWizard {
-
- private ResourceSelectionWizardPage m_wizardPage;
-
- private IScoutBundle m_bundle;
- private SunJaxWsBean m_sunJaxWsBean;
- private BuildJaxWsBean m_buildJaxWsBean;
-
- private WsProviderDeleteOperation m_operation;
-
- public WsProviderDeleteWizard() {
- setWindowTitle(Texts.get("DeleteWebServiceProvider"));
- }
-
- @Override
- public void addPages() {
- m_wizardPage = new ResourceSelectionWizardPage(Texts.get("DeleteWebServiceProvider"), Texts.get("QuestionDeletion"));
- m_wizardPage.setElements(getElementsToBeDeleted());
- addPage(m_wizardPage);
- }
-
- private List<ElementBean> getElementsToBeDeleted() {
- List<ElementBean> elements = new LinkedList<ElementBean>();
- // registration
- elements.add(new ElementBean(WsProviderDeleteOperation.ID_REGISTRATION, "Registration entry in sun-jaxws.xml and build-jaxws.xml", JaxWsSdk.getImageDescriptor(JaxWsIcons.SunJaxWsXmlFile), true));
-
- // port type
- String fqn = m_sunJaxWsBean.getImplementation();
- if (TypeUtility.existsType(fqn)) {
- IType portType = TypeUtility.getType(fqn);
- elements.add(new ElementBean(WsProviderDeleteOperation.ID_IMPL_TYPE, "Port type '" + portType.getFullyQualifiedName() + "'", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), portType, false));
- }
-
- // stub JAR file
- IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, m_buildJaxWsBean, m_sunJaxWsBean.getWsdl());
- if (stubJarFile != null && stubJarFile.exists()) {
- elements.add(new ElementBean(WsProviderDeleteOperation.ID_STUB, "Stub JAR file '" + stubJarFile.getFullPath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.Jar), stubJarFile, false));
- }
-
- // WSDL file
- IFile wsdlFile = null;
- if (StringUtility.hasText(m_sunJaxWsBean.getWsdl())) {
- wsdlFile = JaxWsSdkUtility.getFile(m_bundle, m_sunJaxWsBean.getWsdl(), false);
- }
- if (wsdlFile != null && wsdlFile.exists()) {
- elements.add(new ElementBean(WsProviderDeleteOperation.ID_WSDL_FILE, "WSDL file '" + wsdlFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), wsdlFile, false));
- }
-
- if (wsdlFile != null) {
- Artefact[] artefacts = SchemaUtility.getArtefacts(wsdlFile, false);
- for (Artefact artefact : artefacts) {
- // referenced WSDL definitions
- if (artefact instanceof WsdlArtefact) {
- WsdlArtefact wsdlArtefact = (WsdlArtefact) artefact;
- if (wsdlArtefact.getTypeEnum() == TypeEnum.ReferencedWsdl) {
- IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, wsdlArtefact.getFile());
- if (referencedWsdlFile != null && referencedWsdlFile.exists()) {
- elements.add(new ElementBean(WsProviderDeleteOperation.ID_REF_WSDL, "Referenced WSDL file '" + referencedWsdlFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), referencedWsdlFile, false));
- }
- }
- }
- // imported XSD schemas
- if (artefact instanceof SchemaImportArtefact) {
- SchemaImportArtefact schemaArtefact = (SchemaImportArtefact) artefact;
- IFile importedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
- if (importedSchemaFile != null && importedSchemaFile.exists()) {
- elements.add(new ElementBean(WsProviderDeleteOperation.ID_REF_XSD, "Imported XSD schema '" + importedSchemaFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), importedSchemaFile, false));
- }
- }
-
- // included XSD schemas
- if (artefact instanceof SchemaIncludeArtefact) {
- SchemaIncludeArtefact schemaArtefact = (SchemaIncludeArtefact) artefact;
- IFile includedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
- if (includedSchemaFile != null && includedSchemaFile.exists()) {
- elements.add(new ElementBean(WsProviderDeleteOperation.ID_REF_XSD, "Included XSD schema '" + includedSchemaFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), includedSchemaFile, false));
- }
- }
- }
- }
-
- // binding file
- if (m_buildJaxWsBean != null) {
- IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(m_bundle, m_buildJaxWsBean.getPropertiers());
- for (IFile bindingFile : bindingFiles) {
- if (bindingFile != null && bindingFile.exists()) {
- elements.add(new ElementBean(WsProviderDeleteOperation.ID_BINDING_FILE, "Binding file '" + bindingFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.BindingFile), bindingFile, false));
- }
- }
- }
-
- return elements;
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- m_operation = new WsProviderDeleteOperation();
- m_operation.setBundle(m_bundle);
- m_operation.setSunJaxWsBean(m_sunJaxWsBean);
- m_operation.setBuildJaxWsBean(m_buildJaxWsBean);
-
- List<ElementBean> elements = new LinkedList<ElementBean>();
- for (ElementBean element : m_wizardPage.getElements()) {
- if (element.isChecked() || element.isMandatory()) {
- elements.add(element);
- }
- }
- m_operation.setElements(elements);
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- OperationJob job = new OperationJob(m_operation);
- job.schedule();
- return true;
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public SunJaxWsBean getSunJaxWsBean() {
- return m_sunJaxWsBean;
- }
-
- public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
- m_sunJaxWsBean = sunJaxWsBean;
- }
-
- public BuildJaxWsBean getBuildJaxWsBean() {
- return m_buildJaxWsBean;
- }
-
- public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
- m_buildJaxWsBean = buildJaxWsBean;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsProviderDeleteOperation;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ElementBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.ResourceSelectionWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.Artefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaImportArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaIncludeArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
+
+public class WsProviderDeleteWizard extends AbstractWorkspaceWizard {
+
+ private ResourceSelectionWizardPage m_wizardPage;
+
+ private IScoutBundle m_bundle;
+ private SunJaxWsBean m_sunJaxWsBean;
+ private BuildJaxWsBean m_buildJaxWsBean;
+
+ private WsProviderDeleteOperation m_operation;
+
+ public WsProviderDeleteWizard() {
+ setWindowTitle(Texts.get("DeleteWebServiceProvider"));
+ }
+
+ @Override
+ public void addPages() {
+ m_wizardPage = new ResourceSelectionWizardPage(Texts.get("DeleteWebServiceProvider"), Texts.get("QuestionDeletion"));
+ m_wizardPage.setElements(getElementsToBeDeleted());
+ addPage(m_wizardPage);
+ }
+
+ private List<ElementBean> getElementsToBeDeleted() {
+ List<ElementBean> elements = new LinkedList<ElementBean>();
+ // registration
+ elements.add(new ElementBean(WsProviderDeleteOperation.ID_REGISTRATION, "Registration entry in sun-jaxws.xml and build-jaxws.xml", JaxWsSdk.getImageDescriptor(JaxWsIcons.SunJaxWsXmlFile), true));
+
+ // port type
+ String fqn = m_sunJaxWsBean.getImplementation();
+ if (TypeUtility.existsType(fqn)) {
+ IType portType = TypeUtility.getType(fqn);
+ elements.add(new ElementBean(WsProviderDeleteOperation.ID_IMPL_TYPE, "Port type '" + portType.getFullyQualifiedName() + "'", ScoutSdkUi.getImageDescriptor(ScoutSdkUi.Class), portType, false));
+ }
+
+ // stub JAR file
+ IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, m_buildJaxWsBean, m_sunJaxWsBean.getWsdl());
+ if (stubJarFile != null && stubJarFile.exists()) {
+ elements.add(new ElementBean(WsProviderDeleteOperation.ID_STUB, "Stub JAR file '" + stubJarFile.getFullPath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.Jar), stubJarFile, false));
+ }
+
+ // WSDL file
+ IFile wsdlFile = null;
+ if (StringUtility.hasText(m_sunJaxWsBean.getWsdl())) {
+ wsdlFile = JaxWsSdkUtility.getFile(m_bundle, m_sunJaxWsBean.getWsdl(), false);
+ }
+ if (wsdlFile != null && wsdlFile.exists()) {
+ elements.add(new ElementBean(WsProviderDeleteOperation.ID_WSDL_FILE, "WSDL file '" + wsdlFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), wsdlFile, false));
+ }
+
+ if (wsdlFile != null) {
+ Artefact[] artefacts = SchemaUtility.getArtefacts(wsdlFile, false);
+ for (Artefact artefact : artefacts) {
+ // referenced WSDL definitions
+ if (artefact instanceof WsdlArtefact) {
+ WsdlArtefact wsdlArtefact = (WsdlArtefact) artefact;
+ if (wsdlArtefact.getTypeEnum() == TypeEnum.ReferencedWsdl) {
+ IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, wsdlArtefact.getFile());
+ if (referencedWsdlFile != null && referencedWsdlFile.exists()) {
+ elements.add(new ElementBean(WsProviderDeleteOperation.ID_REF_WSDL, "Referenced WSDL file '" + referencedWsdlFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile), referencedWsdlFile, false));
+ }
+ }
+ }
+ // imported XSD schemas
+ if (artefact instanceof SchemaImportArtefact) {
+ SchemaImportArtefact schemaArtefact = (SchemaImportArtefact) artefact;
+ IFile importedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
+ if (importedSchemaFile != null && importedSchemaFile.exists()) {
+ elements.add(new ElementBean(WsProviderDeleteOperation.ID_REF_XSD, "Imported XSD schema '" + importedSchemaFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), importedSchemaFile, false));
+ }
+ }
+
+ // included XSD schemas
+ if (artefact instanceof SchemaIncludeArtefact) {
+ SchemaIncludeArtefact schemaArtefact = (SchemaIncludeArtefact) artefact;
+ IFile includedSchemaFile = JaxWsSdkUtility.toFile(m_bundle, schemaArtefact.getFile());
+ if (includedSchemaFile != null && includedSchemaFile.exists()) {
+ elements.add(new ElementBean(WsProviderDeleteOperation.ID_REF_XSD, "Included XSD schema '" + includedSchemaFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema), includedSchemaFile, false));
+ }
+ }
+ }
+ }
+
+ // binding file
+ if (m_buildJaxWsBean != null) {
+ IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(m_bundle, m_buildJaxWsBean.getPropertiers());
+ for (IFile bindingFile : bindingFiles) {
+ if (bindingFile != null && bindingFile.exists()) {
+ elements.add(new ElementBean(WsProviderDeleteOperation.ID_BINDING_FILE, "Binding file '" + bindingFile.getProjectRelativePath().toPortableString() + "'", JaxWsSdk.getImageDescriptor(JaxWsIcons.BindingFile), bindingFile, false));
+ }
+ }
+ }
+
+ return elements;
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ m_operation = new WsProviderDeleteOperation();
+ m_operation.setBundle(m_bundle);
+ m_operation.setSunJaxWsBean(m_sunJaxWsBean);
+ m_operation.setBuildJaxWsBean(m_buildJaxWsBean);
+
+ List<ElementBean> elements = new LinkedList<ElementBean>();
+ for (ElementBean element : m_wizardPage.getElements()) {
+ if (element.isChecked() || element.isMandatory()) {
+ elements.add(element);
+ }
+ }
+ m_operation.setElements(elements);
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ OperationJob job = new OperationJob(m_operation);
+ job.schedule();
+ return true;
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public SunJaxWsBean getSunJaxWsBean() {
+ return m_sunJaxWsBean;
+ }
+
+ public void setSunJaxWsBean(SunJaxWsBean sunJaxWsBean) {
+ m_sunJaxWsBean = sunJaxWsBean;
+ }
+
+ public BuildJaxWsBean getBuildJaxWsBean() {
+ return m_buildJaxWsBean;
+ }
+
+ public void setBuildJaxWsBean(BuildJaxWsBean buildJaxWsBean) {
+ m_buildJaxWsBean = buildJaxWsBean;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderNewWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderNewWizard.java
index cf6247bbf..1d2f2b56d 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderNewWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsProviderNewWizard.java
@@ -1,541 +1,541 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Definition;
-import javax.wsdl.PortType;
-import javax.xml.namespace.QName;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.BindingFileCreateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.operation.BuildJaxWsEntryCreateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.operation.ExternalFileCopyOperation;
-import org.eclipse.scout.sdk.ws.jaxws.operation.JaxWsServletRegistrationOperation;
-import org.eclipse.scout.sdk.ws.jaxws.operation.SunJaxWsEntryCreateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsProviderImplNewOperation;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsStubGenerationOperation;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsdlCreateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.JaxWsServletRegistrationWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsPropertiesExistingWsdlWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsPropertiesNewWsdlWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsProviderImplClassWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsStubWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsdlLocationWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsdlSelectionWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper;
-import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper.SchemaCandidate;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
-import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility.Registration;
-import org.eclipse.scout.sdk.ws.jaxws.util.listener.IOperationFinishedListener;
-
-public class WsProviderNewWizard extends AbstractWorkspaceWizard {
-
- private IScoutBundle m_bundle;
-
- private WsdlSelectionWizardPage m_wsdlSelectionWizardPage;
- private WsdlLocationWizardPage m_wsdlLocationWizardPage;
- private JaxWsServletRegistrationWizardPage m_servletRegistrationWizardPage;
- private WsPropertiesNewWsdlWizardPage m_wsPropertiesNewWsdlWizardPage;
- private WsPropertiesExistingWsdlWizardPage m_wsPropertiesExistingWsdlWizardPage;
- private WsProviderImplClassWizardPage m_wsProviderImplClassWizardPage;
- private WsStubWizardPage m_wsStubWizardPage;
-
- private JaxWsServletRegistrationOperation m_servletRegistrationOperation;
- private ExternalFileCopyOperation[] m_copyOperations;
- private BuildJaxWsEntryCreateOperation m_buildJaxWsEntryCreateOperation;
- private SunJaxWsEntryCreateOperation m_sunJaxWsEntryCreateOperation;
- private WsdlCreateOperation m_wsdlCreateOperation;
- private WsStubGenerationOperation m_stubGenerationOperation;
- private WsProviderImplNewOperation m_wsProviderImplNewOperation;
-
- private QName m_portTypeQName;
- private String m_alias;
- private boolean m_createBindingFile;
- private String m_wsdlFileName;
-
- public WsProviderNewWizard(IScoutBundle bundle) {
- m_bundle = bundle;
- m_copyOperations = new ExternalFileCopyOperation[0];
- setWindowTitle(Texts.get("CreateWsProvider"));
- }
-
- @Override
- public void addPages() {
- // new or existing WSDL
- m_wsdlSelectionWizardPage = new WsdlSelectionWizardPage(m_bundle);
- m_wsdlSelectionWizardPage.setTitle(Texts.get("CreateWsProvider"));
- m_wsdlSelectionWizardPage.setWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false)); // initial value
- m_wsdlSelectionWizardPage.setRootWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false));
- m_wsdlSelectionWizardPage.addPropertyChangeListener(new P_WsdlSelectionPropertyListener());
- addPage(m_wsdlSelectionWizardPage);
-
- // WSDL selection
- m_wsdlLocationWizardPage = new WsdlLocationWizardPage(m_bundle);
- m_wsdlLocationWizardPage.setTitle(Texts.get("CreateWsProvider"));
- m_wsdlLocationWizardPage.setExcludePage(m_wsdlSelectionWizardPage.isNewWsdl());
- m_wsdlLocationWizardPage.setWsdlFolderVisible(false);
- m_wsdlLocationWizardPage.setWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false)); // initial value
- m_wsdlLocationWizardPage.setRootWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false));
- m_wsdlLocationWizardPage.setExcludePage(true);
- m_wsdlLocationWizardPage.addPropertyChangeListener(new P_WsdlLocationPropertyListener());
- addPage(m_wsdlLocationWizardPage);
-
- // Servlet registration
- m_servletRegistrationWizardPage = new JaxWsServletRegistrationWizardPage(m_bundle, false);
- m_servletRegistrationWizardPage.setTitle(Texts.get("CreateWsProvider"));
- m_servletRegistrationWizardPage.addPropertyChangeListener(new P_ServletRegistrationPropertyListener());
- m_servletRegistrationWizardPage.initializeDefaultValues(m_bundle);
- Registration registration = ServletRegistrationUtility.getServletRegistration(m_bundle);
- m_servletRegistrationWizardPage.setExcludePage(registration != null && !StringUtility.isNullOrEmpty(registration.getAlias()));
- addPage(m_servletRegistrationWizardPage);
-
- // WS properties of new WSDL Wizard Page
- m_wsPropertiesNewWsdlWizardPage = new WsPropertiesNewWsdlWizardPage(m_bundle);
- m_wsPropertiesNewWsdlWizardPage.setTitle(Texts.get("CreateWsProvider"));
- m_wsPropertiesNewWsdlWizardPage.setJaxWsServletAlias(m_servletRegistrationWizardPage.getAlias());
- m_wsPropertiesNewWsdlWizardPage.addPropertyChangeListener(new P_WsPropertiesNewWsdlPropertyListener());
- m_wsPropertiesNewWsdlWizardPage.setExcludePage(true);
- addPage(m_wsPropertiesNewWsdlWizardPage);
-
- // WS properties of existing WSDL Wizard Page
- m_wsPropertiesExistingWsdlWizardPage = new WsPropertiesExistingWsdlWizardPage(m_bundle, WebserviceEnum.Provider);
- m_wsPropertiesExistingWsdlWizardPage.setTitle(Texts.get("CreateWsProvider"));
- m_wsPropertiesExistingWsdlWizardPage.setJaxWsServletAlias(m_servletRegistrationWizardPage.getAlias());
- m_wsPropertiesExistingWsdlWizardPage.addPropertyChangeListener(new P_WsPropertiesExistingWsdlPropertyListener());
- m_wsPropertiesExistingWsdlWizardPage.setExcludePage(true);
- addPage(m_wsPropertiesExistingWsdlWizardPage);
-
- // WS Stub
- m_wsStubWizardPage = new WsStubWizardPage(m_bundle);
- m_wsStubWizardPage.setTitle(Texts.get("CreateWsProvider"));
- addPage(m_wsStubWizardPage);
-
- // Implementing class
- m_wsProviderImplClassWizardPage = new WsProviderImplClassWizardPage(m_bundle);
- m_wsProviderImplClassWizardPage.setTitle(Texts.get("CreateWsProvider"));
- addPage(m_wsProviderImplClassWizardPage);
-
- // set default value
- m_wsdlSelectionWizardPage.setNewWsdl(true);
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- IFolder wsdlFolder = m_wsdlLocationWizardPage.getWsdlFolder();
-
- if (!m_wsdlSelectionWizardPage.isNewWsdl()) {
- File wsdlFile = m_wsdlLocationWizardPage.getWsdlFile();
-
- List<ExternalFileCopyOperation> copyOperations = new LinkedList<ExternalFileCopyOperation>();
- if (isCopyRequired(m_wsdlLocationWizardPage.getWsdlFolder(), wsdlFile)) {
- ExternalFileCopyOperation op = new ExternalFileCopyOperation();
- op.setBundle(m_bundle);
- op.setOverwrite(true);
- op.setExternalFile(m_wsdlLocationWizardPage.getWsdlFile());
- op.setWorkspacePath(wsdlFolder.getProjectRelativePath());
- copyOperations.add(op);
- }
-
- for (File file : m_wsdlLocationWizardPage.getAdditionalFiles()) {
- if (isCopyRequired(m_wsdlLocationWizardPage.getWsdlFolder(), file)) {
- ExternalFileCopyOperation op = new ExternalFileCopyOperation();
- op.setBundle(m_bundle);
- op.setOverwrite(true);
- op.setExternalFile(file);
- op.setWorkspacePath(wsdlFolder.getProjectRelativePath());
- copyOperations.add(op);
- }
- }
- m_copyOperations = copyOperations.toArray(new ExternalFileCopyOperation[copyOperations.size()]);
- }
-
- m_createBindingFile = m_wsStubWizardPage.isCreateBindingFile();
-
- QName serviceQName = null;
- QName portQName = null;
- String urlPattern;
- String wsdlFileName;
- String targetNamespace;
-
- // prepare jaxWsServletRegistrationOperation
- m_servletRegistrationOperation = new JaxWsServletRegistrationOperation();
- m_servletRegistrationOperation.setBundle(m_bundle);
- m_servletRegistrationOperation.setRegistrationBundle(m_servletRegistrationWizardPage.getRegistrationBundle());
- m_servletRegistrationOperation.setJaxWsAlias(m_servletRegistrationWizardPage.getAlias());
-
- // prepare buildJaxWs.xml operation
- m_buildJaxWsEntryCreateOperation = new BuildJaxWsEntryCreateOperation(WebserviceEnum.Provider);
- m_buildJaxWsEntryCreateOperation.setBundle(m_bundle);
- if (m_wsdlSelectionWizardPage.isNewWsdl()) {
- m_alias = m_wsPropertiesNewWsdlWizardPage.getAlias();
- targetNamespace = m_wsPropertiesNewWsdlWizardPage.getTargetNamespace();
- }
- else {
- m_alias = m_wsPropertiesExistingWsdlWizardPage.getAlias();
- targetNamespace = m_wsdlLocationWizardPage.getWsdlDefinition().getTargetNamespace();
- }
-
- m_buildJaxWsEntryCreateOperation.setAlias(m_alias);
-
- // build properties and binding file
- Map<String, List<String>> buildProperties = JaxWsSdkUtility.getDefaultBuildProperties();
-
- // custom stub package
- String defaultPackageName;
- if (m_wsdlSelectionWizardPage.isNewWsdl()) {
- defaultPackageName = JaxWsSdkUtility.targetNamespaceToPackageName(targetNamespace);
- }
- else {
- Definition wsdlDefinition = m_wsdlLocationWizardPage.getWsdlDefinition();
- defaultPackageName = JaxWsSdkUtility.resolveStubPackageName(null, wsdlDefinition);
- }
-
- if (!CompareUtility.equals(m_wsStubWizardPage.getPackageName(), defaultPackageName)) {
- // register custom package name
- JaxWsSdkUtility.addBuildProperty(buildProperties, JaxWsConstants.OPTION_PACKAGE, m_wsStubWizardPage.getPackageName());
- }
- m_buildJaxWsEntryCreateOperation.setBuildProperties(buildProperties);
-
- // prepare sunJaxWs.xml operation
- if (m_wsdlSelectionWizardPage.isNewWsdl()) {
- // new WSDL file
- serviceQName = new QName(targetNamespace, m_wsPropertiesNewWsdlWizardPage.getServiceName());
- portQName = new QName(targetNamespace, m_wsPropertiesNewWsdlWizardPage.getPortName());
- m_portTypeQName = new QName(targetNamespace, m_wsPropertiesNewWsdlWizardPage.getPortTypeName());
- urlPattern = m_wsPropertiesNewWsdlWizardPage.getUrlPattern();
- wsdlFileName = m_wsPropertiesNewWsdlWizardPage.getWsdlName();
-
- m_wsdlCreateOperation = new WsdlCreateOperation();
- m_wsdlCreateOperation.setBundle(m_bundle);
- m_wsdlCreateOperation.setAlias(m_alias);
-
- WsdlResource wsdlResource = new WsdlResource(m_bundle);
- wsdlResource.setFile(JaxWsSdkUtility.getFile(m_bundle, wsdlFolder.getProjectRelativePath().append(m_wsPropertiesNewWsdlWizardPage.getWsdlName()).toPortableString(), false));
- m_wsdlCreateOperation.setWsdlResource(wsdlResource);
- m_wsdlCreateOperation.setTargetNamespace(targetNamespace);
- m_wsdlCreateOperation.setService(m_wsPropertiesNewWsdlWizardPage.getServiceName());
- m_wsdlCreateOperation.setPortName(m_wsPropertiesNewWsdlWizardPage.getPortName());
- m_wsdlCreateOperation.setPortType(m_wsPropertiesNewWsdlWizardPage.getPortTypeName());
- m_wsdlCreateOperation.setBinding(m_wsPropertiesNewWsdlWizardPage.getBinding());
- m_wsdlCreateOperation.setUrlPattern(m_wsPropertiesNewWsdlWizardPage.getUrlPattern());
- m_wsdlCreateOperation.setServiceOperationName(m_wsPropertiesNewWsdlWizardPage.getServiceOperationName());
- m_wsdlCreateOperation.setWsdlStyle(m_wsPropertiesNewWsdlWizardPage.getWsdlStyle());
- }
- else {
- // existing WSDL file
- if (m_wsPropertiesExistingWsdlWizardPage.getService() != null) {
- serviceQName = m_wsPropertiesExistingWsdlWizardPage.getService().getQName();
- }
- if (m_wsPropertiesExistingWsdlWizardPage.getPort() != null) {
- if (serviceQName != null) {
- portQName = new QName(serviceQName.getNamespaceURI(), m_wsPropertiesExistingWsdlWizardPage.getPort().getName());
- }
- else {
- portQName = new QName(m_wsPropertiesExistingWsdlWizardPage.getPort().getName());
- }
- }
- m_portTypeQName = m_wsPropertiesExistingWsdlWizardPage.getPortType().getQName();
- urlPattern = m_wsPropertiesExistingWsdlWizardPage.getUrlPattern();
- wsdlFileName = m_wsdlLocationWizardPage.getWsdlFile().getName();
- }
-
- m_sunJaxWsEntryCreateOperation = new SunJaxWsEntryCreateOperation();
- m_sunJaxWsEntryCreateOperation.setBundle(m_bundle);
- m_sunJaxWsEntryCreateOperation.setImplTypeQualifiedName(StringUtility.join(".", m_wsProviderImplClassWizardPage.getPackageName(), m_wsProviderImplClassWizardPage.getTypeName()));
- m_sunJaxWsEntryCreateOperation.setAlias(m_alias);
- m_sunJaxWsEntryCreateOperation.setServiceQName(serviceQName);
- m_sunJaxWsEntryCreateOperation.setPortQName(portQName);
- m_sunJaxWsEntryCreateOperation.setUrlPattern(urlPattern);
- m_sunJaxWsEntryCreateOperation.setWsdlFile(JaxWsSdkUtility.normalizePath(wsdlFolder.getProjectRelativePath().toPortableString(), SeparatorType.TrailingType) + wsdlFileName);
-
- m_stubGenerationOperation = new WsStubGenerationOperation();
- m_stubGenerationOperation.setBundle(m_bundle);
- m_stubGenerationOperation.setAlias(m_alias);
- m_stubGenerationOperation.setWsdlFolder(wsdlFolder);
- m_stubGenerationOperation.setProperties(buildProperties);
- m_stubGenerationOperation.setWsdlFileName(wsdlFileName);
- m_stubGenerationOperation.addOperationFinishedListener(new P_StubGenerationFinishedListener());
-
- m_wsProviderImplNewOperation = new WsProviderImplNewOperation();
- m_wsProviderImplNewOperation.setBundle(m_bundle);
- m_wsProviderImplNewOperation.setPackageName(m_wsProviderImplClassWizardPage.getPackageName());
- m_wsProviderImplNewOperation.setTypeName(m_wsProviderImplClassWizardPage.getTypeName());
- m_wsProviderImplNewOperation.setCreateScoutWebServiceAnnotation(m_wsProviderImplClassWizardPage.isAnnotateImplClass());
- m_wsProviderImplNewOperation.setSessionFactoryQName(m_wsProviderImplClassWizardPage.getSessionFactory());
- m_wsProviderImplNewOperation.setAuthenticationHandlerQName(m_wsProviderImplClassWizardPage.getAuthenticationHandler());
- m_wsProviderImplNewOperation.setCredentialValidationStrategyQName(m_wsProviderImplClassWizardPage.getCredentialValidationStrategy());
-
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- JaxWsSdk.getDefault().getMarkerQueueManager().suspend();
- try {
- m_servletRegistrationOperation.run(monitor, workingCopyManager);
-
- for (ExternalFileCopyOperation op : m_copyOperations) {
- op.validate();
- op.run(monitor, workingCopyManager);
- }
-
- if (m_wsdlCreateOperation != null) {
- m_wsdlCreateOperation.validate();
- m_wsdlCreateOperation.run(monitor, workingCopyManager);
- }
-
- // create binding file(s)
- if (m_createBindingFile) {
- Map<String, List<String>> buildProperties = m_buildJaxWsEntryCreateOperation.getBuildProperties();
-
- // get WSDL resource to determine associated XML schemas
- WsdlResource wsdlResource;
- if (m_wsdlCreateOperation != null) {
- wsdlResource = m_wsdlCreateOperation.getWsdlResource();
- }
- else {
- IFile wsdlFile = JaxWsSdkUtility.getFile(m_bundle, m_sunJaxWsEntryCreateOperation.getWsdlFileName(), false);
- wsdlResource = new WsdlResource(m_bundle);
- wsdlResource.setFile(wsdlFile);
- }
-
- // iterate through schemas to create respective binding files
- SchemaCandidate[] schemaCandidates = GlobalBindingRegistrationHelper.getSchemaCandidates(wsdlResource.getFile());
- for (int i = 0; i < schemaCandidates.length; i++) {
- SchemaCandidate candidate = schemaCandidates[i];
-
- // schema targetNamespace must only be specified if multiple schemas exist
- String schemaTargetNamespace = null;
- if (schemaCandidates.length > 1) {
- schemaTargetNamespace = SchemaUtility.getSchemaTargetNamespace(candidate.getSchema());
- }
-
- String bindingFileName = JaxWsSdkUtility.createUniqueBindingFileNamePath(m_bundle, m_alias, schemaTargetNamespace);
-
- BindingFileCreateOperation op = new BindingFileCreateOperation();
- op.setBundle(m_bundle);
- op.setWsdlDestinationFolder(m_wsdlLocationWizardPage.getWsdlFolder());
- op.setSchemaTargetNamespace(schemaTargetNamespace);
- if (candidate.getWsdlArtefact().getTypeEnum() == TypeEnum.ReferencedWsdl) {
- IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, candidate.getWsdlArtefact().getFile());
- op.setWsdlLocation(referencedWsdlFile);
- }
- op.setProjectRelativeFilePath(new Path(bindingFileName));
- JaxWsSdkUtility.addBuildProperty(buildProperties, JaxWsConstants.OPTION_BINDING_FILE, bindingFileName);
-
- // Global binding file section can only be defined in one file -> pick first
- if (i == 0) {
- op.setCreateGlobalBindingSection(true);
- }
- op.validate();
- op.run(monitor, workingCopyManager);
- }
-
- m_buildJaxWsEntryCreateOperation.setBuildProperties(buildProperties);
- }
-
- try {
- m_stubGenerationOperation.validate();
- m_stubGenerationOperation.run(monitor, workingCopyManager);
-
- IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, m_buildJaxWsEntryCreateOperation.getBuildProperties(), m_sunJaxWsEntryCreateOperation.getWsdlFileName());
- IType portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(m_portTypeQName, stubJarFile);
-
- // wait for stub JAR to be part of the classpth
- int maxWaitLoops = 10;
- while (portTypeInterfaceType == null && maxWaitLoops > 0) {
- try {
- Thread.sleep(500);
- }
- catch (InterruptedException e) {
- JaxWsSdk.logError(e);
- }
- portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(m_portTypeQName, stubJarFile);
- maxWaitLoops--;
- }
-
- m_wsProviderImplNewOperation.setPortTypeInterfaceType(portTypeInterfaceType);
- m_wsProviderImplNewOperation.validate();
- m_wsProviderImplNewOperation.run(monitor, workingCopyManager);
-
- String fqnPortType = m_wsProviderImplNewOperation.getCreatedType().getFullyQualifiedName();
-
- // wait for port type to be part of the hierarchy
- maxWaitLoops = 10;
- while (!TypeUtility.existsType(fqnPortType) && maxWaitLoops > 0) {
- try {
- Thread.sleep(500);
- }
- catch (InterruptedException e) {
- JaxWsSdk.logError(e);
- }
- maxWaitLoops--;
- }
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- }
-
- m_buildJaxWsEntryCreateOperation.validate();
- m_buildJaxWsEntryCreateOperation.run(monitor, workingCopyManager);
-
- // creation of JAX-WS entry must be at the very end as this causes load of node page
- m_sunJaxWsEntryCreateOperation.validate();
- m_sunJaxWsEntryCreateOperation.run(monitor, workingCopyManager);
-
- return true;
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- return false;
- }
- finally {
- JaxWsSdk.getDefault().getMarkerQueueManager().resume();
- }
- }
-
- private boolean isCopyRequired(IFolder wsdlFolder, File wsdlFile) {
- IFile potentialSameFile = JaxWsSdkUtility.getFile(m_bundle, wsdlFolder.getProjectRelativePath().toPortableString(), wsdlFile.getName(), false);
-
- if (potentialSameFile != null && potentialSameFile.exists()) {
- IPath potentialSameFilePath = new Path(potentialSameFile.getLocationURI().getRawPath());
- IPath wsdlFilePath = new Path(wsdlFile.getAbsolutePath());
-
- if (potentialSameFilePath.equals(wsdlFilePath)) {
- return false;
- }
- }
-
- return true;
- }
-
- private class P_WsdlSelectionPropertyListener implements PropertyChangeListener {
-
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (WsdlSelectionWizardPage.PROP_CREATE_NEW_WSDL.equals(event.getPropertyName())) {
- boolean createNewWsdl = (Boolean) event.getNewValue();
-
- m_wsdlLocationWizardPage.setExcludePage(createNewWsdl);
- m_wsPropertiesNewWsdlWizardPage.setExcludePage(!createNewWsdl);
- m_wsPropertiesExistingWsdlWizardPage.setExcludePage(createNewWsdl);
- }
- else if (WsdlSelectionWizardPage.PROP_WSDL_FOLDER.equals(event.getPropertyName())) {
- m_wsdlLocationWizardPage.setWsdlFolder((IFolder) event.getNewValue());
- }
- }
- }
-
- private class P_WsdlLocationPropertyListener implements PropertyChangeListener {
-
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (WsdlLocationWizardPage.PROP_WSDL_DEFINITION.equals(event.getPropertyName())) {
- Definition wsdlDefinition = (Definition) event.getNewValue();
- m_wsPropertiesExistingWsdlWizardPage.setWsdlDefinition(wsdlDefinition);
-
- if (wsdlDefinition != null) {
- String defaultPackageName = JaxWsSdkUtility.resolveStubPackageName(null, wsdlDefinition);
- m_wsStubWizardPage.setDefaultPackageName(defaultPackageName);
- m_wsStubWizardPage.setPackageName(defaultPackageName);
- }
- else {
- m_wsStubWizardPage.setDefaultPackageName(null);
- }
- }
- }
- }
-
- private class P_WsPropertiesExistingWsdlPropertyListener implements PropertyChangeListener {
-
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (WsPropertiesExistingWsdlWizardPage.PROP_PORT_TYPE.equals(event.getPropertyName())) {
- String portTypeName = null;
- PortType portType = (PortType) event.getNewValue();
- if (portType != null) {
- portTypeName = portType.getQName().getLocalPart();
- m_wsProviderImplClassWizardPage.setTypeName(JaxWsSdkUtility.getPlainPortTypeName(portTypeName));
- }
- else {
- m_wsProviderImplClassWizardPage.setTypeName(null);
- }
- }
- }
- }
-
- private class P_WsPropertiesNewWsdlPropertyListener implements PropertyChangeListener {
-
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (WsPropertiesNewWsdlWizardPage.PROP_TARGET_NAMESPACE.equals(event.getPropertyName())) {
- String targetNamespace = (String) event.getNewValue();
- String defaultPackageName = JaxWsSdkUtility.targetNamespaceToPackageName(targetNamespace);
- m_wsStubWizardPage.setDefaultPackageName(defaultPackageName);
- m_wsStubWizardPage.setPackageName(defaultPackageName);
- }
- else if (WsPropertiesNewWsdlWizardPage.PROP_PORT_TYPE_NAME.equals(event.getPropertyName())) {
- m_wsProviderImplClassWizardPage.setTypeName(JaxWsSdkUtility.getPlainPortTypeName((String) event.getNewValue()));
- }
- }
- }
-
- private class P_ServletRegistrationPropertyListener implements PropertyChangeListener {
-
- @Override
- public void propertyChange(PropertyChangeEvent event) {
- if (JaxWsServletRegistrationWizardPage.PROP_ALIAS.equals(event.getPropertyName())) {
- if (m_wsPropertiesNewWsdlWizardPage != null) {
- m_wsPropertiesNewWsdlWizardPage.setJaxWsServletAlias(m_servletRegistrationWizardPage.getAlias());
- }
- if (m_wsPropertiesExistingWsdlWizardPage != null) {
- m_wsPropertiesExistingWsdlWizardPage.setJaxWsServletAlias(m_servletRegistrationWizardPage.getAlias());
- }
- }
- }
- }
-
- private class P_StubGenerationFinishedListener implements IOperationFinishedListener {
-
- @Override
- public void operationFinished(boolean success, Throwable exception) {
- // nop at the time
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.PortType;
+import javax.xml.namespace.QName;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.BindingFileCreateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.operation.BuildJaxWsEntryCreateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.operation.ExternalFileCopyOperation;
+import org.eclipse.scout.sdk.ws.jaxws.operation.JaxWsServletRegistrationOperation;
+import org.eclipse.scout.sdk.ws.jaxws.operation.SunJaxWsEntryCreateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsProviderImplNewOperation;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsStubGenerationOperation;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsdlCreateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.JaxWsServletRegistrationWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WebserviceEnum;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsPropertiesExistingWsdlWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsPropertiesNewWsdlWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsProviderImplClassWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsStubWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsdlLocationWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsdlSelectionWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper;
+import org.eclipse.scout.sdk.ws.jaxws.util.GlobalBindingRegistrationHelper.SchemaCandidate;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
+import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility.Registration;
+import org.eclipse.scout.sdk.ws.jaxws.util.listener.IOperationFinishedListener;
+
+public class WsProviderNewWizard extends AbstractWorkspaceWizard {
+
+ private IScoutBundle m_bundle;
+
+ private WsdlSelectionWizardPage m_wsdlSelectionWizardPage;
+ private WsdlLocationWizardPage m_wsdlLocationWizardPage;
+ private JaxWsServletRegistrationWizardPage m_servletRegistrationWizardPage;
+ private WsPropertiesNewWsdlWizardPage m_wsPropertiesNewWsdlWizardPage;
+ private WsPropertiesExistingWsdlWizardPage m_wsPropertiesExistingWsdlWizardPage;
+ private WsProviderImplClassWizardPage m_wsProviderImplClassWizardPage;
+ private WsStubWizardPage m_wsStubWizardPage;
+
+ private JaxWsServletRegistrationOperation m_servletRegistrationOperation;
+ private ExternalFileCopyOperation[] m_copyOperations;
+ private BuildJaxWsEntryCreateOperation m_buildJaxWsEntryCreateOperation;
+ private SunJaxWsEntryCreateOperation m_sunJaxWsEntryCreateOperation;
+ private WsdlCreateOperation m_wsdlCreateOperation;
+ private WsStubGenerationOperation m_stubGenerationOperation;
+ private WsProviderImplNewOperation m_wsProviderImplNewOperation;
+
+ private QName m_portTypeQName;
+ private String m_alias;
+ private boolean m_createBindingFile;
+ private String m_wsdlFileName;
+
+ public WsProviderNewWizard(IScoutBundle bundle) {
+ m_bundle = bundle;
+ m_copyOperations = new ExternalFileCopyOperation[0];
+ setWindowTitle(Texts.get("CreateWsProvider"));
+ }
+
+ @Override
+ public void addPages() {
+ // new or existing WSDL
+ m_wsdlSelectionWizardPage = new WsdlSelectionWizardPage(m_bundle);
+ m_wsdlSelectionWizardPage.setTitle(Texts.get("CreateWsProvider"));
+ m_wsdlSelectionWizardPage.setWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false)); // initial value
+ m_wsdlSelectionWizardPage.setRootWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false));
+ m_wsdlSelectionWizardPage.addPropertyChangeListener(new P_WsdlSelectionPropertyListener());
+ addPage(m_wsdlSelectionWizardPage);
+
+ // WSDL selection
+ m_wsdlLocationWizardPage = new WsdlLocationWizardPage(m_bundle);
+ m_wsdlLocationWizardPage.setTitle(Texts.get("CreateWsProvider"));
+ m_wsdlLocationWizardPage.setExcludePage(m_wsdlSelectionWizardPage.isNewWsdl());
+ m_wsdlLocationWizardPage.setWsdlFolderVisible(false);
+ m_wsdlLocationWizardPage.setWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false)); // initial value
+ m_wsdlLocationWizardPage.setRootWsdlFolder(JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false));
+ m_wsdlLocationWizardPage.setExcludePage(true);
+ m_wsdlLocationWizardPage.addPropertyChangeListener(new P_WsdlLocationPropertyListener());
+ addPage(m_wsdlLocationWizardPage);
+
+ // Servlet registration
+ m_servletRegistrationWizardPage = new JaxWsServletRegistrationWizardPage(m_bundle, false);
+ m_servletRegistrationWizardPage.setTitle(Texts.get("CreateWsProvider"));
+ m_servletRegistrationWizardPage.addPropertyChangeListener(new P_ServletRegistrationPropertyListener());
+ m_servletRegistrationWizardPage.initializeDefaultValues(m_bundle);
+ Registration registration = ServletRegistrationUtility.getServletRegistration(m_bundle);
+ m_servletRegistrationWizardPage.setExcludePage(registration != null && !StringUtility.isNullOrEmpty(registration.getAlias()));
+ addPage(m_servletRegistrationWizardPage);
+
+ // WS properties of new WSDL Wizard Page
+ m_wsPropertiesNewWsdlWizardPage = new WsPropertiesNewWsdlWizardPage(m_bundle);
+ m_wsPropertiesNewWsdlWizardPage.setTitle(Texts.get("CreateWsProvider"));
+ m_wsPropertiesNewWsdlWizardPage.setJaxWsServletAlias(m_servletRegistrationWizardPage.getAlias());
+ m_wsPropertiesNewWsdlWizardPage.addPropertyChangeListener(new P_WsPropertiesNewWsdlPropertyListener());
+ m_wsPropertiesNewWsdlWizardPage.setExcludePage(true);
+ addPage(m_wsPropertiesNewWsdlWizardPage);
+
+ // WS properties of existing WSDL Wizard Page
+ m_wsPropertiesExistingWsdlWizardPage = new WsPropertiesExistingWsdlWizardPage(m_bundle, WebserviceEnum.Provider);
+ m_wsPropertiesExistingWsdlWizardPage.setTitle(Texts.get("CreateWsProvider"));
+ m_wsPropertiesExistingWsdlWizardPage.setJaxWsServletAlias(m_servletRegistrationWizardPage.getAlias());
+ m_wsPropertiesExistingWsdlWizardPage.addPropertyChangeListener(new P_WsPropertiesExistingWsdlPropertyListener());
+ m_wsPropertiesExistingWsdlWizardPage.setExcludePage(true);
+ addPage(m_wsPropertiesExistingWsdlWizardPage);
+
+ // WS Stub
+ m_wsStubWizardPage = new WsStubWizardPage(m_bundle);
+ m_wsStubWizardPage.setTitle(Texts.get("CreateWsProvider"));
+ addPage(m_wsStubWizardPage);
+
+ // Implementing class
+ m_wsProviderImplClassWizardPage = new WsProviderImplClassWizardPage(m_bundle);
+ m_wsProviderImplClassWizardPage.setTitle(Texts.get("CreateWsProvider"));
+ addPage(m_wsProviderImplClassWizardPage);
+
+ // set default value
+ m_wsdlSelectionWizardPage.setNewWsdl(true);
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ IFolder wsdlFolder = m_wsdlLocationWizardPage.getWsdlFolder();
+
+ if (!m_wsdlSelectionWizardPage.isNewWsdl()) {
+ File wsdlFile = m_wsdlLocationWizardPage.getWsdlFile();
+
+ List<ExternalFileCopyOperation> copyOperations = new LinkedList<ExternalFileCopyOperation>();
+ if (isCopyRequired(m_wsdlLocationWizardPage.getWsdlFolder(), wsdlFile)) {
+ ExternalFileCopyOperation op = new ExternalFileCopyOperation();
+ op.setBundle(m_bundle);
+ op.setOverwrite(true);
+ op.setExternalFile(m_wsdlLocationWizardPage.getWsdlFile());
+ op.setWorkspacePath(wsdlFolder.getProjectRelativePath());
+ copyOperations.add(op);
+ }
+
+ for (File file : m_wsdlLocationWizardPage.getAdditionalFiles()) {
+ if (isCopyRequired(m_wsdlLocationWizardPage.getWsdlFolder(), file)) {
+ ExternalFileCopyOperation op = new ExternalFileCopyOperation();
+ op.setBundle(m_bundle);
+ op.setOverwrite(true);
+ op.setExternalFile(file);
+ op.setWorkspacePath(wsdlFolder.getProjectRelativePath());
+ copyOperations.add(op);
+ }
+ }
+ m_copyOperations = copyOperations.toArray(new ExternalFileCopyOperation[copyOperations.size()]);
+ }
+
+ m_createBindingFile = m_wsStubWizardPage.isCreateBindingFile();
+
+ QName serviceQName = null;
+ QName portQName = null;
+ String urlPattern;
+ String wsdlFileName;
+ String targetNamespace;
+
+ // prepare jaxWsServletRegistrationOperation
+ m_servletRegistrationOperation = new JaxWsServletRegistrationOperation();
+ m_servletRegistrationOperation.setBundle(m_bundle);
+ m_servletRegistrationOperation.setRegistrationBundle(m_servletRegistrationWizardPage.getRegistrationBundle());
+ m_servletRegistrationOperation.setJaxWsAlias(m_servletRegistrationWizardPage.getAlias());
+
+ // prepare buildJaxWs.xml operation
+ m_buildJaxWsEntryCreateOperation = new BuildJaxWsEntryCreateOperation(WebserviceEnum.Provider);
+ m_buildJaxWsEntryCreateOperation.setBundle(m_bundle);
+ if (m_wsdlSelectionWizardPage.isNewWsdl()) {
+ m_alias = m_wsPropertiesNewWsdlWizardPage.getAlias();
+ targetNamespace = m_wsPropertiesNewWsdlWizardPage.getTargetNamespace();
+ }
+ else {
+ m_alias = m_wsPropertiesExistingWsdlWizardPage.getAlias();
+ targetNamespace = m_wsdlLocationWizardPage.getWsdlDefinition().getTargetNamespace();
+ }
+
+ m_buildJaxWsEntryCreateOperation.setAlias(m_alias);
+
+ // build properties and binding file
+ Map<String, List<String>> buildProperties = JaxWsSdkUtility.getDefaultBuildProperties();
+
+ // custom stub package
+ String defaultPackageName;
+ if (m_wsdlSelectionWizardPage.isNewWsdl()) {
+ defaultPackageName = JaxWsSdkUtility.targetNamespaceToPackageName(targetNamespace);
+ }
+ else {
+ Definition wsdlDefinition = m_wsdlLocationWizardPage.getWsdlDefinition();
+ defaultPackageName = JaxWsSdkUtility.resolveStubPackageName(null, wsdlDefinition);
+ }
+
+ if (!CompareUtility.equals(m_wsStubWizardPage.getPackageName(), defaultPackageName)) {
+ // register custom package name
+ JaxWsSdkUtility.addBuildProperty(buildProperties, JaxWsConstants.OPTION_PACKAGE, m_wsStubWizardPage.getPackageName());
+ }
+ m_buildJaxWsEntryCreateOperation.setBuildProperties(buildProperties);
+
+ // prepare sunJaxWs.xml operation
+ if (m_wsdlSelectionWizardPage.isNewWsdl()) {
+ // new WSDL file
+ serviceQName = new QName(targetNamespace, m_wsPropertiesNewWsdlWizardPage.getServiceName());
+ portQName = new QName(targetNamespace, m_wsPropertiesNewWsdlWizardPage.getPortName());
+ m_portTypeQName = new QName(targetNamespace, m_wsPropertiesNewWsdlWizardPage.getPortTypeName());
+ urlPattern = m_wsPropertiesNewWsdlWizardPage.getUrlPattern();
+ wsdlFileName = m_wsPropertiesNewWsdlWizardPage.getWsdlName();
+
+ m_wsdlCreateOperation = new WsdlCreateOperation();
+ m_wsdlCreateOperation.setBundle(m_bundle);
+ m_wsdlCreateOperation.setAlias(m_alias);
+
+ WsdlResource wsdlResource = new WsdlResource(m_bundle);
+ wsdlResource.setFile(JaxWsSdkUtility.getFile(m_bundle, wsdlFolder.getProjectRelativePath().append(m_wsPropertiesNewWsdlWizardPage.getWsdlName()).toPortableString(), false));
+ m_wsdlCreateOperation.setWsdlResource(wsdlResource);
+ m_wsdlCreateOperation.setTargetNamespace(targetNamespace);
+ m_wsdlCreateOperation.setService(m_wsPropertiesNewWsdlWizardPage.getServiceName());
+ m_wsdlCreateOperation.setPortName(m_wsPropertiesNewWsdlWizardPage.getPortName());
+ m_wsdlCreateOperation.setPortType(m_wsPropertiesNewWsdlWizardPage.getPortTypeName());
+ m_wsdlCreateOperation.setBinding(m_wsPropertiesNewWsdlWizardPage.getBinding());
+ m_wsdlCreateOperation.setUrlPattern(m_wsPropertiesNewWsdlWizardPage.getUrlPattern());
+ m_wsdlCreateOperation.setServiceOperationName(m_wsPropertiesNewWsdlWizardPage.getServiceOperationName());
+ m_wsdlCreateOperation.setWsdlStyle(m_wsPropertiesNewWsdlWizardPage.getWsdlStyle());
+ }
+ else {
+ // existing WSDL file
+ if (m_wsPropertiesExistingWsdlWizardPage.getService() != null) {
+ serviceQName = m_wsPropertiesExistingWsdlWizardPage.getService().getQName();
+ }
+ if (m_wsPropertiesExistingWsdlWizardPage.getPort() != null) {
+ if (serviceQName != null) {
+ portQName = new QName(serviceQName.getNamespaceURI(), m_wsPropertiesExistingWsdlWizardPage.getPort().getName());
+ }
+ else {
+ portQName = new QName(m_wsPropertiesExistingWsdlWizardPage.getPort().getName());
+ }
+ }
+ m_portTypeQName = m_wsPropertiesExistingWsdlWizardPage.getPortType().getQName();
+ urlPattern = m_wsPropertiesExistingWsdlWizardPage.getUrlPattern();
+ wsdlFileName = m_wsdlLocationWizardPage.getWsdlFile().getName();
+ }
+
+ m_sunJaxWsEntryCreateOperation = new SunJaxWsEntryCreateOperation();
+ m_sunJaxWsEntryCreateOperation.setBundle(m_bundle);
+ m_sunJaxWsEntryCreateOperation.setImplTypeQualifiedName(StringUtility.join(".", m_wsProviderImplClassWizardPage.getPackageName(), m_wsProviderImplClassWizardPage.getTypeName()));
+ m_sunJaxWsEntryCreateOperation.setAlias(m_alias);
+ m_sunJaxWsEntryCreateOperation.setServiceQName(serviceQName);
+ m_sunJaxWsEntryCreateOperation.setPortQName(portQName);
+ m_sunJaxWsEntryCreateOperation.setUrlPattern(urlPattern);
+ m_sunJaxWsEntryCreateOperation.setWsdlFile(JaxWsSdkUtility.normalizePath(wsdlFolder.getProjectRelativePath().toPortableString(), SeparatorType.TrailingType) + wsdlFileName);
+
+ m_stubGenerationOperation = new WsStubGenerationOperation();
+ m_stubGenerationOperation.setBundle(m_bundle);
+ m_stubGenerationOperation.setAlias(m_alias);
+ m_stubGenerationOperation.setWsdlFolder(wsdlFolder);
+ m_stubGenerationOperation.setProperties(buildProperties);
+ m_stubGenerationOperation.setWsdlFileName(wsdlFileName);
+ m_stubGenerationOperation.addOperationFinishedListener(new P_StubGenerationFinishedListener());
+
+ m_wsProviderImplNewOperation = new WsProviderImplNewOperation();
+ m_wsProviderImplNewOperation.setBundle(m_bundle);
+ m_wsProviderImplNewOperation.setPackageName(m_wsProviderImplClassWizardPage.getPackageName());
+ m_wsProviderImplNewOperation.setTypeName(m_wsProviderImplClassWizardPage.getTypeName());
+ m_wsProviderImplNewOperation.setCreateScoutWebServiceAnnotation(m_wsProviderImplClassWizardPage.isAnnotateImplClass());
+ m_wsProviderImplNewOperation.setSessionFactoryQName(m_wsProviderImplClassWizardPage.getSessionFactory());
+ m_wsProviderImplNewOperation.setAuthenticationHandlerQName(m_wsProviderImplClassWizardPage.getAuthenticationHandler());
+ m_wsProviderImplNewOperation.setCredentialValidationStrategyQName(m_wsProviderImplClassWizardPage.getCredentialValidationStrategy());
+
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ JaxWsSdk.getDefault().getMarkerQueueManager().suspend();
+ try {
+ m_servletRegistrationOperation.run(monitor, workingCopyManager);
+
+ for (ExternalFileCopyOperation op : m_copyOperations) {
+ op.validate();
+ op.run(monitor, workingCopyManager);
+ }
+
+ if (m_wsdlCreateOperation != null) {
+ m_wsdlCreateOperation.validate();
+ m_wsdlCreateOperation.run(monitor, workingCopyManager);
+ }
+
+ // create binding file(s)
+ if (m_createBindingFile) {
+ Map<String, List<String>> buildProperties = m_buildJaxWsEntryCreateOperation.getBuildProperties();
+
+ // get WSDL resource to determine associated XML schemas
+ WsdlResource wsdlResource;
+ if (m_wsdlCreateOperation != null) {
+ wsdlResource = m_wsdlCreateOperation.getWsdlResource();
+ }
+ else {
+ IFile wsdlFile = JaxWsSdkUtility.getFile(m_bundle, m_sunJaxWsEntryCreateOperation.getWsdlFileName(), false);
+ wsdlResource = new WsdlResource(m_bundle);
+ wsdlResource.setFile(wsdlFile);
+ }
+
+ // iterate through schemas to create respective binding files
+ SchemaCandidate[] schemaCandidates = GlobalBindingRegistrationHelper.getSchemaCandidates(wsdlResource.getFile());
+ for (int i = 0; i < schemaCandidates.length; i++) {
+ SchemaCandidate candidate = schemaCandidates[i];
+
+ // schema targetNamespace must only be specified if multiple schemas exist
+ String schemaTargetNamespace = null;
+ if (schemaCandidates.length > 1) {
+ schemaTargetNamespace = SchemaUtility.getSchemaTargetNamespace(candidate.getSchema());
+ }
+
+ String bindingFileName = JaxWsSdkUtility.createUniqueBindingFileNamePath(m_bundle, m_alias, schemaTargetNamespace);
+
+ BindingFileCreateOperation op = new BindingFileCreateOperation();
+ op.setBundle(m_bundle);
+ op.setWsdlDestinationFolder(m_wsdlLocationWizardPage.getWsdlFolder());
+ op.setSchemaTargetNamespace(schemaTargetNamespace);
+ if (candidate.getWsdlArtefact().getTypeEnum() == TypeEnum.ReferencedWsdl) {
+ IFile referencedWsdlFile = JaxWsSdkUtility.toFile(m_bundle, candidate.getWsdlArtefact().getFile());
+ op.setWsdlLocation(referencedWsdlFile);
+ }
+ op.setProjectRelativeFilePath(new Path(bindingFileName));
+ JaxWsSdkUtility.addBuildProperty(buildProperties, JaxWsConstants.OPTION_BINDING_FILE, bindingFileName);
+
+ // Global binding file section can only be defined in one file -> pick first
+ if (i == 0) {
+ op.setCreateGlobalBindingSection(true);
+ }
+ op.validate();
+ op.run(monitor, workingCopyManager);
+ }
+
+ m_buildJaxWsEntryCreateOperation.setBuildProperties(buildProperties);
+ }
+
+ try {
+ m_stubGenerationOperation.validate();
+ m_stubGenerationOperation.run(monitor, workingCopyManager);
+
+ IFile stubJarFile = JaxWsSdkUtility.getStubJarFile(m_bundle, m_buildJaxWsEntryCreateOperation.getBuildProperties(), m_sunJaxWsEntryCreateOperation.getWsdlFileName());
+ IType portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(m_portTypeQName, stubJarFile);
+
+ // wait for stub JAR to be part of the classpth
+ int maxWaitLoops = 10;
+ while (portTypeInterfaceType == null && maxWaitLoops > 0) {
+ try {
+ Thread.sleep(500);
+ }
+ catch (InterruptedException e) {
+ JaxWsSdk.logError(e);
+ }
+ portTypeInterfaceType = JaxWsSdkUtility.resolvePortTypeInterfaceType(m_portTypeQName, stubJarFile);
+ maxWaitLoops--;
+ }
+
+ m_wsProviderImplNewOperation.setPortTypeInterfaceType(portTypeInterfaceType);
+ m_wsProviderImplNewOperation.validate();
+ m_wsProviderImplNewOperation.run(monitor, workingCopyManager);
+
+ String fqnPortType = m_wsProviderImplNewOperation.getCreatedType().getFullyQualifiedName();
+
+ // wait for port type to be part of the hierarchy
+ maxWaitLoops = 10;
+ while (!TypeUtility.existsType(fqnPortType) && maxWaitLoops > 0) {
+ try {
+ Thread.sleep(500);
+ }
+ catch (InterruptedException e) {
+ JaxWsSdk.logError(e);
+ }
+ maxWaitLoops--;
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ }
+
+ m_buildJaxWsEntryCreateOperation.validate();
+ m_buildJaxWsEntryCreateOperation.run(monitor, workingCopyManager);
+
+ // creation of JAX-WS entry must be at the very end as this causes load of node page
+ m_sunJaxWsEntryCreateOperation.validate();
+ m_sunJaxWsEntryCreateOperation.run(monitor, workingCopyManager);
+
+ return true;
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ return false;
+ }
+ finally {
+ JaxWsSdk.getDefault().getMarkerQueueManager().resume();
+ }
+ }
+
+ private boolean isCopyRequired(IFolder wsdlFolder, File wsdlFile) {
+ IFile potentialSameFile = JaxWsSdkUtility.getFile(m_bundle, wsdlFolder.getProjectRelativePath().toPortableString(), wsdlFile.getName(), false);
+
+ if (potentialSameFile != null && potentialSameFile.exists()) {
+ IPath potentialSameFilePath = new Path(potentialSameFile.getLocationURI().getRawPath());
+ IPath wsdlFilePath = new Path(wsdlFile.getAbsolutePath());
+
+ if (potentialSameFilePath.equals(wsdlFilePath)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ private class P_WsdlSelectionPropertyListener implements PropertyChangeListener {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (WsdlSelectionWizardPage.PROP_CREATE_NEW_WSDL.equals(event.getPropertyName())) {
+ boolean createNewWsdl = (Boolean) event.getNewValue();
+
+ m_wsdlLocationWizardPage.setExcludePage(createNewWsdl);
+ m_wsPropertiesNewWsdlWizardPage.setExcludePage(!createNewWsdl);
+ m_wsPropertiesExistingWsdlWizardPage.setExcludePage(createNewWsdl);
+ }
+ else if (WsdlSelectionWizardPage.PROP_WSDL_FOLDER.equals(event.getPropertyName())) {
+ m_wsdlLocationWizardPage.setWsdlFolder((IFolder) event.getNewValue());
+ }
+ }
+ }
+
+ private class P_WsdlLocationPropertyListener implements PropertyChangeListener {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (WsdlLocationWizardPage.PROP_WSDL_DEFINITION.equals(event.getPropertyName())) {
+ Definition wsdlDefinition = (Definition) event.getNewValue();
+ m_wsPropertiesExistingWsdlWizardPage.setWsdlDefinition(wsdlDefinition);
+
+ if (wsdlDefinition != null) {
+ String defaultPackageName = JaxWsSdkUtility.resolveStubPackageName(null, wsdlDefinition);
+ m_wsStubWizardPage.setDefaultPackageName(defaultPackageName);
+ m_wsStubWizardPage.setPackageName(defaultPackageName);
+ }
+ else {
+ m_wsStubWizardPage.setDefaultPackageName(null);
+ }
+ }
+ }
+ }
+
+ private class P_WsPropertiesExistingWsdlPropertyListener implements PropertyChangeListener {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (WsPropertiesExistingWsdlWizardPage.PROP_PORT_TYPE.equals(event.getPropertyName())) {
+ String portTypeName = null;
+ PortType portType = (PortType) event.getNewValue();
+ if (portType != null) {
+ portTypeName = portType.getQName().getLocalPart();
+ m_wsProviderImplClassWizardPage.setTypeName(JaxWsSdkUtility.getPlainPortTypeName(portTypeName));
+ }
+ else {
+ m_wsProviderImplClassWizardPage.setTypeName(null);
+ }
+ }
+ }
+ }
+
+ private class P_WsPropertiesNewWsdlPropertyListener implements PropertyChangeListener {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (WsPropertiesNewWsdlWizardPage.PROP_TARGET_NAMESPACE.equals(event.getPropertyName())) {
+ String targetNamespace = (String) event.getNewValue();
+ String defaultPackageName = JaxWsSdkUtility.targetNamespaceToPackageName(targetNamespace);
+ m_wsStubWizardPage.setDefaultPackageName(defaultPackageName);
+ m_wsStubWizardPage.setPackageName(defaultPackageName);
+ }
+ else if (WsPropertiesNewWsdlWizardPage.PROP_PORT_TYPE_NAME.equals(event.getPropertyName())) {
+ m_wsProviderImplClassWizardPage.setTypeName(JaxWsSdkUtility.getPlainPortTypeName((String) event.getNewValue()));
+ }
+ }
+ }
+
+ private class P_ServletRegistrationPropertyListener implements PropertyChangeListener {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ if (JaxWsServletRegistrationWizardPage.PROP_ALIAS.equals(event.getPropertyName())) {
+ if (m_wsPropertiesNewWsdlWizardPage != null) {
+ m_wsPropertiesNewWsdlWizardPage.setJaxWsServletAlias(m_servletRegistrationWizardPage.getAlias());
+ }
+ if (m_wsPropertiesExistingWsdlWizardPage != null) {
+ m_wsPropertiesExistingWsdlWizardPage.setJaxWsServletAlias(m_servletRegistrationWizardPage.getAlias());
+ }
+ }
+ }
+ }
+
+ private class P_StubGenerationFinishedListener implements IOperationFinishedListener {
+
+ @Override
+ public void operationFinished(boolean success, Throwable exception) {
+ // nop at the time
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsdlLocationWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsdlLocationWizard.java
index e34e048be..17069d358 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsdlLocationWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsdlLocationWizard.java
@@ -1,174 +1,174 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import java.io.File;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.ExternalFileCopyOperation;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsStubGenerationOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsdlLocationWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-
-public class WsdlLocationWizard extends AbstractWorkspaceWizard {
-
- private IScoutBundle m_bundle;
- private BuildJaxWsBean m_buildJaxWsBean;
- private SunJaxWsBean m_sunJaxWsBean;
- private String m_wsdlFileName;
-
- private WsdlLocationWizardPage m_wsdlLocationWizardPage;
-
- private ExternalFileCopyOperation[] m_copyOperations;
- private WsStubGenerationOperation m_stubGenerationOperation;
- private IFolder m_wsdlFolder;
-
- /**
- * @param bundle
- * @param buildJaxWsBean
- * @param sunJaxWsBean
- * is only used by webservice providers
- * @param oldWsdlFolder
- */
- public WsdlLocationWizard(IScoutBundle bundle, BuildJaxWsBean buildJaxWsBean, SunJaxWsBean sunJaxWsBean) {
- m_bundle = bundle;
- m_copyOperations = new ExternalFileCopyOperation[0];
- m_buildJaxWsBean = buildJaxWsBean;
- m_sunJaxWsBean = sunJaxWsBean;
- setWindowTitle(Texts.get("BrowseForWsdlFile"));
- }
-
- @Override
- public void addPages() {
- IFolder oldWsdlFolder = null;
- IFolder wsdlRootFolder = null;
- String wsdlLocation = null;
- if (m_sunJaxWsBean != null) {
- wsdlLocation = m_sunJaxWsBean.getWsdl();
- oldWsdlFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false);
- wsdlRootFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false);
- }
- else {
- wsdlLocation = m_buildJaxWsBean.getWsdl();
- oldWsdlFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_CONSUMER, false);
- wsdlRootFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_CONSUMER, false);
- }
-
- if (StringUtility.hasText(wsdlLocation)) {
- oldWsdlFolder = JaxWsSdkUtility.getParentFolder(m_bundle, JaxWsSdkUtility.getFile(m_bundle, wsdlLocation, false));
- }
-
- m_wsdlLocationWizardPage = new WsdlLocationWizardPage(m_bundle);
- m_wsdlLocationWizardPage.setRebuildStubOptionVisible(true);
- m_wsdlLocationWizardPage.setRebuildStub(true);
- m_wsdlLocationWizardPage.setWsdlFolderVisible(true);
- m_wsdlLocationWizardPage.setWsdlFolder(oldWsdlFolder); // initial value
- m_wsdlLocationWizardPage.setRootWsdlFolder(wsdlRootFolder);
- addPage(m_wsdlLocationWizardPage);
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- File wsdlFile = m_wsdlLocationWizardPage.getWsdlFile();
- m_wsdlFolder = m_wsdlLocationWizardPage.getWsdlFolder();
- m_wsdlFileName = wsdlFile.getName();
-
- List<ExternalFileCopyOperation> copyOperations = new LinkedList<ExternalFileCopyOperation>();
- if (isCopyRequired(m_wsdlFolder, wsdlFile)) {
- ExternalFileCopyOperation op = new ExternalFileCopyOperation();
- op.setBundle(m_bundle);
- op.setOverwrite(true);
- op.setExternalFile(m_wsdlLocationWizardPage.getWsdlFile());
- op.setWorkspacePath(m_wsdlFolder.getProjectRelativePath());
- copyOperations.add(op);
- }
-
- for (File file : m_wsdlLocationWizardPage.getAdditionalFiles()) {
- if (isCopyRequired(m_wsdlFolder, file)) {
- ExternalFileCopyOperation op = new ExternalFileCopyOperation();
- op.setBundle(m_bundle);
- op.setOverwrite(true);
- op.setExternalFile(file);
- op.setWorkspacePath(m_wsdlFolder.getProjectRelativePath());
- copyOperations.add(op);
- }
- }
- m_copyOperations = copyOperations.toArray(new ExternalFileCopyOperation[copyOperations.size()]);
-
- if (m_wsdlLocationWizardPage.isRebuildStub()) {
- m_stubGenerationOperation = new WsStubGenerationOperation();
- m_stubGenerationOperation.setBundle(m_bundle);
- m_stubGenerationOperation.setAlias(m_buildJaxWsBean.getAlias());
- m_stubGenerationOperation.setWsdlFolder(m_wsdlFolder);
- m_stubGenerationOperation.setProperties(m_buildJaxWsBean.getPropertiers());
- m_stubGenerationOperation.setWsdlFileName(wsdlFile.getName());
- }
-
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- for (ExternalFileCopyOperation op : m_copyOperations) {
- op.validate();
- op.run(monitor, workingCopyManager);
- }
-
- if (m_sunJaxWsBean != null) { // webservice provider
- // update entry in sunJaxWs.xml
- m_sunJaxWsBean.setWsdl(JaxWsSdkUtility.normalizePath(m_wsdlFolder.getProjectRelativePath().append(m_wsdlFileName).toPortableString(), SeparatorType.None));
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXml(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_WSDL_CHANGED, monitor, m_sunJaxWsBean.getAlias());
- }
- else { // webservice consumer
- // update entry in buildJaxWs.xml
- m_buildJaxWsBean.setWsdl(JaxWsSdkUtility.normalizePath(m_wsdlFolder.getProjectRelativePath().append(m_wsdlFileName).toPortableString(), SeparatorType.None));
- ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(m_buildJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_WSDL_CHANGED, monitor, m_buildJaxWsBean.getAlias());
- }
-
- if (m_stubGenerationOperation != null) {
- m_stubGenerationOperation.run(monitor, workingCopyManager);
- }
- return true;
- }
-
- private boolean isCopyRequired(IFolder wsdlFolder, File wsdlFile) {
- IFile potentialSameFile = JaxWsSdkUtility.getFile(m_bundle, wsdlFolder.getProjectRelativePath().toPortableString(), wsdlFile.getName(), false);
-
- if (potentialSameFile != null && potentialSameFile.exists()) {
- IPath potentialSameFilePath = new Path(potentialSameFile.getLocationURI().getRawPath());
- IPath wsdlFilePath = new Path(wsdlFile.getAbsolutePath());
-
- if (potentialSameFilePath.equals(wsdlFilePath)) {
- return false;
- }
- }
-
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import java.io.File;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.ExternalFileCopyOperation;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsStubGenerationOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsdlLocationWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+
+public class WsdlLocationWizard extends AbstractWorkspaceWizard {
+
+ private IScoutBundle m_bundle;
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private SunJaxWsBean m_sunJaxWsBean;
+ private String m_wsdlFileName;
+
+ private WsdlLocationWizardPage m_wsdlLocationWizardPage;
+
+ private ExternalFileCopyOperation[] m_copyOperations;
+ private WsStubGenerationOperation m_stubGenerationOperation;
+ private IFolder m_wsdlFolder;
+
+ /**
+ * @param bundle
+ * @param buildJaxWsBean
+ * @param sunJaxWsBean
+ * is only used by webservice providers
+ * @param oldWsdlFolder
+ */
+ public WsdlLocationWizard(IScoutBundle bundle, BuildJaxWsBean buildJaxWsBean, SunJaxWsBean sunJaxWsBean) {
+ m_bundle = bundle;
+ m_copyOperations = new ExternalFileCopyOperation[0];
+ m_buildJaxWsBean = buildJaxWsBean;
+ m_sunJaxWsBean = sunJaxWsBean;
+ setWindowTitle(Texts.get("BrowseForWsdlFile"));
+ }
+
+ @Override
+ public void addPages() {
+ IFolder oldWsdlFolder = null;
+ IFolder wsdlRootFolder = null;
+ String wsdlLocation = null;
+ if (m_sunJaxWsBean != null) {
+ wsdlLocation = m_sunJaxWsBean.getWsdl();
+ oldWsdlFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false);
+ wsdlRootFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_PROVIDER, false);
+ }
+ else {
+ wsdlLocation = m_buildJaxWsBean.getWsdl();
+ oldWsdlFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_CONSUMER, false);
+ wsdlRootFolder = JaxWsSdkUtility.getFolder(m_bundle, JaxWsConstants.PATH_WSDL_CONSUMER, false);
+ }
+
+ if (StringUtility.hasText(wsdlLocation)) {
+ oldWsdlFolder = JaxWsSdkUtility.getParentFolder(m_bundle, JaxWsSdkUtility.getFile(m_bundle, wsdlLocation, false));
+ }
+
+ m_wsdlLocationWizardPage = new WsdlLocationWizardPage(m_bundle);
+ m_wsdlLocationWizardPage.setRebuildStubOptionVisible(true);
+ m_wsdlLocationWizardPage.setRebuildStub(true);
+ m_wsdlLocationWizardPage.setWsdlFolderVisible(true);
+ m_wsdlLocationWizardPage.setWsdlFolder(oldWsdlFolder); // initial value
+ m_wsdlLocationWizardPage.setRootWsdlFolder(wsdlRootFolder);
+ addPage(m_wsdlLocationWizardPage);
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ File wsdlFile = m_wsdlLocationWizardPage.getWsdlFile();
+ m_wsdlFolder = m_wsdlLocationWizardPage.getWsdlFolder();
+ m_wsdlFileName = wsdlFile.getName();
+
+ List<ExternalFileCopyOperation> copyOperations = new LinkedList<ExternalFileCopyOperation>();
+ if (isCopyRequired(m_wsdlFolder, wsdlFile)) {
+ ExternalFileCopyOperation op = new ExternalFileCopyOperation();
+ op.setBundle(m_bundle);
+ op.setOverwrite(true);
+ op.setExternalFile(m_wsdlLocationWizardPage.getWsdlFile());
+ op.setWorkspacePath(m_wsdlFolder.getProjectRelativePath());
+ copyOperations.add(op);
+ }
+
+ for (File file : m_wsdlLocationWizardPage.getAdditionalFiles()) {
+ if (isCopyRequired(m_wsdlFolder, file)) {
+ ExternalFileCopyOperation op = new ExternalFileCopyOperation();
+ op.setBundle(m_bundle);
+ op.setOverwrite(true);
+ op.setExternalFile(file);
+ op.setWorkspacePath(m_wsdlFolder.getProjectRelativePath());
+ copyOperations.add(op);
+ }
+ }
+ m_copyOperations = copyOperations.toArray(new ExternalFileCopyOperation[copyOperations.size()]);
+
+ if (m_wsdlLocationWizardPage.isRebuildStub()) {
+ m_stubGenerationOperation = new WsStubGenerationOperation();
+ m_stubGenerationOperation.setBundle(m_bundle);
+ m_stubGenerationOperation.setAlias(m_buildJaxWsBean.getAlias());
+ m_stubGenerationOperation.setWsdlFolder(m_wsdlFolder);
+ m_stubGenerationOperation.setProperties(m_buildJaxWsBean.getPropertiers());
+ m_stubGenerationOperation.setWsdlFileName(wsdlFile.getName());
+ }
+
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ for (ExternalFileCopyOperation op : m_copyOperations) {
+ op.validate();
+ op.run(monitor, workingCopyManager);
+ }
+
+ if (m_sunJaxWsBean != null) { // webservice provider
+ // update entry in sunJaxWs.xml
+ m_sunJaxWsBean.setWsdl(JaxWsSdkUtility.normalizePath(m_wsdlFolder.getProjectRelativePath().append(m_wsdlFileName).toPortableString(), SeparatorType.None));
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXml(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_WSDL_CHANGED, monitor, m_sunJaxWsBean.getAlias());
+ }
+ else { // webservice consumer
+ // update entry in buildJaxWs.xml
+ m_buildJaxWsBean.setWsdl(JaxWsSdkUtility.normalizePath(m_wsdlFolder.getProjectRelativePath().append(m_wsdlFileName).toPortableString(), SeparatorType.None));
+ ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(m_buildJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_WSDL_CHANGED, monitor, m_buildJaxWsBean.getAlias());
+ }
+
+ if (m_stubGenerationOperation != null) {
+ m_stubGenerationOperation.run(monitor, workingCopyManager);
+ }
+ return true;
+ }
+
+ private boolean isCopyRequired(IFolder wsdlFolder, File wsdlFile) {
+ IFile potentialSameFile = JaxWsSdkUtility.getFile(m_bundle, wsdlFolder.getProjectRelativePath().toPortableString(), wsdlFile.getName(), false);
+
+ if (potentialSameFile != null && potentialSameFile.exists()) {
+ IPath potentialSameFilePath = new Path(potentialSameFile.getLocationURI().getRawPath());
+ IPath wsdlFilePath = new Path(wsdlFile.getAbsolutePath());
+
+ if (potentialSameFilePath.equals(wsdlFilePath)) {
+ return false;
+ }
+ }
+
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsdlNewWizard.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsdlNewWizard.java
index 0edccdea3..e5aafa3e1 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsdlNewWizard.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/WsdlNewWizard.java
@@ -1,117 +1,117 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsdlCreateOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsPropertiesNewWsdlWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-
-public class WsdlNewWizard extends AbstractWorkspaceWizard {
-
- private IScoutBundle m_bundle;
- // used for WS provider
- private SunJaxWsBean m_sunJaxWsBean;
- // used for WS consumer
- private BuildJaxWsBean m_buildJaxWsBean;
- private WsdlResource m_wsdlResource;
- private WsPropertiesNewWsdlWizardPage m_wizardPage;
- private String m_alias;
-
- private WsdlCreateOperation m_operation;
-
- /**
- * Used for WS provider
- *
- * @param bundle
- * @param sunJaxWsBean
- * @param wsdlResource
- */
- public WsdlNewWizard(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, WsdlResource wsdlResource) {
- m_bundle = bundle;
- m_sunJaxWsBean = sunJaxWsBean;
- m_wsdlResource = wsdlResource;
- m_alias = m_sunJaxWsBean.getAlias();
- setWindowTitle(Texts.get("CreateWsdlFile"));
- }
-
- /**
- * Used for WS consumer
- *
- * @param bundle
- * @param buildJaxWsBean
- * @param wsdlResource
- */
- public WsdlNewWizard(IScoutBundle bundle, BuildJaxWsBean buildJaxWsBean, WsdlResource wsdlResource) {
- m_bundle = bundle;
- m_buildJaxWsBean = buildJaxWsBean;
- m_wsdlResource = wsdlResource;
- m_alias = m_buildJaxWsBean.getAlias();
- setWindowTitle(Texts.get("CreateWsdlFile"));
- }
-
- @Override
- public void addPages() {
- m_wizardPage = new WsPropertiesNewWsdlWizardPage(m_bundle);
- m_wizardPage.setShowOnlyWsdlProperties(true);
- m_wizardPage.setAlias(m_alias);
- m_wizardPage.setWsdlName(m_wsdlResource.getFile().getName());
- addPage(m_wizardPage);
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- String targetNamespace = JaxWsSdkUtility.normalizePath(m_wizardPage.getTargetNamespace(), SeparatorType.TrailingType);
-
- m_operation = new WsdlCreateOperation();
- m_operation.setBundle(m_bundle);
- m_operation.setAlias(m_alias);
- m_operation.setWsdlResource(m_wsdlResource);
- m_operation.setTargetNamespace(targetNamespace);
- m_operation.setService(m_wizardPage.getServiceName());
- m_operation.setPortName(m_wizardPage.getPortName());
- m_operation.setPortType(m_wizardPage.getPortTypeName());
- m_operation.setBinding(m_wizardPage.getBinding());
- m_operation.setUrlPattern(m_wizardPage.getUrlPattern());
- m_operation.setServiceOperationName(m_wizardPage.getServiceOperationName());
-
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- m_operation.validate();
- m_operation.run(monitor, workingCopyManager);
-
- if (m_sunJaxWsBean != null) {
- // update entry in sunJaxWs.xml
- m_sunJaxWsBean.setWsdl(JaxWsSdkUtility.normalizePath(m_wsdlResource.getFile().getName(), SeparatorType.None));
- ResourceFactory.getSunJaxWsResource(m_bundle).storeXml(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_WSDL_CHANGED, monitor, m_sunJaxWsBean.getAlias());
- }
- else {
- // update entry in buildJaxWs.xml
- m_buildJaxWsBean.setWsdl(JaxWsSdkUtility.normalizePath(m_wsdlResource.getFile().getName(), SeparatorType.None));
- ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(m_buildJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_WSDL_CHANGED, monitor, m_buildJaxWsBean.getAlias());
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsdlCreateOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.IResourceListener;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.WsdlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page.WsPropertiesNewWsdlWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+
+public class WsdlNewWizard extends AbstractWorkspaceWizard {
+
+ private IScoutBundle m_bundle;
+ // used for WS provider
+ private SunJaxWsBean m_sunJaxWsBean;
+ // used for WS consumer
+ private BuildJaxWsBean m_buildJaxWsBean;
+ private WsdlResource m_wsdlResource;
+ private WsPropertiesNewWsdlWizardPage m_wizardPage;
+ private String m_alias;
+
+ private WsdlCreateOperation m_operation;
+
+ /**
+ * Used for WS provider
+ *
+ * @param bundle
+ * @param sunJaxWsBean
+ * @param wsdlResource
+ */
+ public WsdlNewWizard(IScoutBundle bundle, SunJaxWsBean sunJaxWsBean, WsdlResource wsdlResource) {
+ m_bundle = bundle;
+ m_sunJaxWsBean = sunJaxWsBean;
+ m_wsdlResource = wsdlResource;
+ m_alias = m_sunJaxWsBean.getAlias();
+ setWindowTitle(Texts.get("CreateWsdlFile"));
+ }
+
+ /**
+ * Used for WS consumer
+ *
+ * @param bundle
+ * @param buildJaxWsBean
+ * @param wsdlResource
+ */
+ public WsdlNewWizard(IScoutBundle bundle, BuildJaxWsBean buildJaxWsBean, WsdlResource wsdlResource) {
+ m_bundle = bundle;
+ m_buildJaxWsBean = buildJaxWsBean;
+ m_wsdlResource = wsdlResource;
+ m_alias = m_buildJaxWsBean.getAlias();
+ setWindowTitle(Texts.get("CreateWsdlFile"));
+ }
+
+ @Override
+ public void addPages() {
+ m_wizardPage = new WsPropertiesNewWsdlWizardPage(m_bundle);
+ m_wizardPage.setShowOnlyWsdlProperties(true);
+ m_wizardPage.setAlias(m_alias);
+ m_wizardPage.setWsdlName(m_wsdlResource.getFile().getName());
+ addPage(m_wizardPage);
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ String targetNamespace = JaxWsSdkUtility.normalizePath(m_wizardPage.getTargetNamespace(), SeparatorType.TrailingType);
+
+ m_operation = new WsdlCreateOperation();
+ m_operation.setBundle(m_bundle);
+ m_operation.setAlias(m_alias);
+ m_operation.setWsdlResource(m_wsdlResource);
+ m_operation.setTargetNamespace(targetNamespace);
+ m_operation.setService(m_wizardPage.getServiceName());
+ m_operation.setPortName(m_wizardPage.getPortName());
+ m_operation.setPortType(m_wizardPage.getPortTypeName());
+ m_operation.setBinding(m_wizardPage.getBinding());
+ m_operation.setUrlPattern(m_wizardPage.getUrlPattern());
+ m_operation.setServiceOperationName(m_wizardPage.getServiceOperationName());
+
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ m_operation.validate();
+ m_operation.run(monitor, workingCopyManager);
+
+ if (m_sunJaxWsBean != null) {
+ // update entry in sunJaxWs.xml
+ m_sunJaxWsBean.setWsdl(JaxWsSdkUtility.normalizePath(m_wsdlResource.getFile().getName(), SeparatorType.None));
+ ResourceFactory.getSunJaxWsResource(m_bundle).storeXml(m_sunJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_SUNJAXWS_WSDL_CHANGED, monitor, m_sunJaxWsBean.getAlias());
+ }
+ else {
+ // update entry in buildJaxWs.xml
+ m_buildJaxWsBean.setWsdl(JaxWsSdkUtility.normalizePath(m_wsdlResource.getFile().getName(), SeparatorType.None));
+ ResourceFactory.getBuildJaxWsResource(m_bundle).storeXml(m_buildJaxWsBean.getXml().getDocument(), IResourceListener.EVENT_BUILDJAXWS_WSDL_CHANGED, monitor, m_buildJaxWsBean.getAlias());
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/AdditionalResourcesWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/AdditionalResourcesWizardPage.java
index fe92d167b..cc0ceddb2 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/AdditionalResourcesWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/AdditionalResourcesWizardPage.java
@@ -1,232 +1,232 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.jface.layout.TableColumnLayout;
-import org.eclipse.jface.viewers.CellLabelProvider;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Table;
-
-public class AdditionalResourcesWizardPage extends AbstractWorkspaceWizardPage {
-
- private List<File> m_files;
-
- private TableViewer m_tableViewer;
- private Button m_addButton;
- private Button m_removeButton;
-
- public AdditionalResourcesWizardPage() {
- super(AdditionalResourcesWizardPage.class.getName());
- setTitle(Texts.get("AdditionalResources"));
- setDescription(Texts.get("AddAdditionalResources1"));
- }
-
- @Override
- protected void createContent(Composite parent) {
- Composite container = new Composite(parent, SWT.NONE);
-
- Composite tableComposite = new Composite(container, SWT.NONE);
- m_tableViewer = new TableViewer(new Table(tableComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI));
- m_tableViewer.setUseHashlookup(true);
- m_tableViewer.getTable().setHeaderVisible(true);
- m_tableViewer.getTable().setLinesVisible(false);
- m_tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- m_removeButton.setEnabled(!event.getSelection().isEmpty());
- }
- });
-
- m_tableViewer.getTable().addKeyListener(new KeyAdapter() {
-
- @Override
- public void keyPressed(KeyEvent e) {
- if (e.keyCode == SWT.DEL) {
- if (m_removeButton.isEnabled()) {
- IStructuredSelection selection = (IStructuredSelection) m_tableViewer.getSelection();
- Iterator iterator = selection.iterator();
-
- while (iterator.hasNext()) {
- File file = (File) iterator.next();
- m_files.remove(file);
- }
- m_tableViewer.refresh();
- }
- }
- }
- });
-
- TableViewerColumn nameColumn = new TableViewerColumn(m_tableViewer, SWT.LEFT, 0);
- nameColumn.setLabelProvider(new P_LabelProvider());
- nameColumn.getColumn().setResizable(false);
- nameColumn.getColumn().setText(Texts.get("Resource"));
-
- m_tableViewer.setContentProvider(new P_ContentProvider());
- m_tableViewer.setInput(m_files);
-
- Composite buttonComposite = new Composite(container, SWT.NONE);
-
- m_addButton = new Button(buttonComposite, SWT.PUSH | SWT.FLAT);
- m_addButton.setText(Texts.get("Add"));
- m_addButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- openFileBrowser();
- }
- });
-
- m_removeButton = new Button(buttonComposite, SWT.PUSH | SWT.FLAT);
- m_removeButton.setText(Texts.get("Remove"));
- m_removeButton.setEnabled(false);
- m_removeButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IStructuredSelection selection = (IStructuredSelection) m_tableViewer.getSelection();
- Iterator iterator = selection.iterator();
-
- while (iterator.hasNext()) {
- File file = (File) iterator.next();
- m_files.remove(file);
- }
- m_tableViewer.refresh();
- }
- });
-
- // layout
- container.setLayout(new GridLayout(2, false));
- // table composite
- GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
- tableComposite.setLayoutData(gd);
-
- // button composite
- gd = new GridData(GridData.FILL_VERTICAL);
- gd.horizontalAlignment = SWT.TOP;
- buttonComposite.setLayoutData(gd);
-
- // layout within button composite
- GridLayout layout = new GridLayout(1, true);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- buttonComposite.setLayout(layout);
- m_addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- m_removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // layout within table composite (autoresize of columns)
- TableColumnLayout tableLayout = new TableColumnLayout();
- tableComposite.setLayout(tableLayout);
- tableLayout.setColumnData(nameColumn.getColumn(), new ColumnWeightData(100));
- }
-
- private void openFileBrowser() {
- FileDialog dialog = new FileDialog(getShell(), SWT.OPEN | SWT.MULTI);
- String[] filterNames = new String[]{"XSD Schema (*.xsd)", "WSDL file (*.wsdl)", "All Files (*.*)"};
- String[] filterExtensions = new String[]{"*.xsd", "*.wsdl", "*.*"};
- dialog.setFilterNames(filterNames);
- dialog.setFilterExtensions(filterExtensions);
- if (dialog.open() != null) {
- String[] files = dialog.getFileNames();
-
- // prefix with base path since files only consists of filename
- String basePath = dialog.getFilterPath();
- for (int i = 0, n = files.length; i < n; i++) {
- String path = basePath;
- if (path.charAt(path.length() - 1) != File.separatorChar) {
- path += File.separatorChar;
- }
- path += files[i];
-
- File file = new File(path);
-
- if (!m_files.contains(file)) {
- m_files.add(new File(path));
- }
- }
- }
-
- m_tableViewer.refresh();
- }
-
- public File[] getFiles() {
- return m_files.toArray(new File[m_files.size()]);
- }
-
- public void setFiles(File[] files) {
- m_files = new ArrayList<File>(Arrays.asList(files));
- }
-
- private class P_LabelProvider extends CellLabelProvider {
-
- @Override
- public void update(ViewerCell cell) {
- File file = (File) cell.getElement();
- cell.setText(file.getName());
-
- String fileExtension = IOUtility.getFileExtension(file.getName());
- if (StringUtility.equalsIgnoreCase(fileExtension, "wsdl")) {
- cell.setImage(JaxWsSdk.getImage(JaxWsIcons.WsdlFile));
- }
- else {
- cell.setImage(JaxWsSdk.getImage(JaxWsIcons.XsdSchema));
- }
- }
- }
-
- public class P_ContentProvider implements IStructuredContentProvider {
-
- @Override
- @SuppressWarnings("unchecked")
- public Object[] getElements(Object inputElement) {
- List<File> files = (List<File>) inputElement;
- return files.toArray(new File[files.size()]);
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.jface.layout.TableColumnLayout;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Table;
+
+public class AdditionalResourcesWizardPage extends AbstractWorkspaceWizardPage {
+
+ private List<File> m_files;
+
+ private TableViewer m_tableViewer;
+ private Button m_addButton;
+ private Button m_removeButton;
+
+ public AdditionalResourcesWizardPage() {
+ super(AdditionalResourcesWizardPage.class.getName());
+ setTitle(Texts.get("AdditionalResources"));
+ setDescription(Texts.get("AddAdditionalResources1"));
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ Composite container = new Composite(parent, SWT.NONE);
+
+ Composite tableComposite = new Composite(container, SWT.NONE);
+ m_tableViewer = new TableViewer(new Table(tableComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI));
+ m_tableViewer.setUseHashlookup(true);
+ m_tableViewer.getTable().setHeaderVisible(true);
+ m_tableViewer.getTable().setLinesVisible(false);
+ m_tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ m_removeButton.setEnabled(!event.getSelection().isEmpty());
+ }
+ });
+
+ m_tableViewer.getTable().addKeyListener(new KeyAdapter() {
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.keyCode == SWT.DEL) {
+ if (m_removeButton.isEnabled()) {
+ IStructuredSelection selection = (IStructuredSelection) m_tableViewer.getSelection();
+ Iterator iterator = selection.iterator();
+
+ while (iterator.hasNext()) {
+ File file = (File) iterator.next();
+ m_files.remove(file);
+ }
+ m_tableViewer.refresh();
+ }
+ }
+ }
+ });
+
+ TableViewerColumn nameColumn = new TableViewerColumn(m_tableViewer, SWT.LEFT, 0);
+ nameColumn.setLabelProvider(new P_LabelProvider());
+ nameColumn.getColumn().setResizable(false);
+ nameColumn.getColumn().setText(Texts.get("Resource"));
+
+ m_tableViewer.setContentProvider(new P_ContentProvider());
+ m_tableViewer.setInput(m_files);
+
+ Composite buttonComposite = new Composite(container, SWT.NONE);
+
+ m_addButton = new Button(buttonComposite, SWT.PUSH | SWT.FLAT);
+ m_addButton.setText(Texts.get("Add"));
+ m_addButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ openFileBrowser();
+ }
+ });
+
+ m_removeButton = new Button(buttonComposite, SWT.PUSH | SWT.FLAT);
+ m_removeButton.setText(Texts.get("Remove"));
+ m_removeButton.setEnabled(false);
+ m_removeButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) m_tableViewer.getSelection();
+ Iterator iterator = selection.iterator();
+
+ while (iterator.hasNext()) {
+ File file = (File) iterator.next();
+ m_files.remove(file);
+ }
+ m_tableViewer.refresh();
+ }
+ });
+
+ // layout
+ container.setLayout(new GridLayout(2, false));
+ // table composite
+ GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
+ tableComposite.setLayoutData(gd);
+
+ // button composite
+ gd = new GridData(GridData.FILL_VERTICAL);
+ gd.horizontalAlignment = SWT.TOP;
+ buttonComposite.setLayoutData(gd);
+
+ // layout within button composite
+ GridLayout layout = new GridLayout(1, true);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ buttonComposite.setLayout(layout);
+ m_addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ m_removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // layout within table composite (autoresize of columns)
+ TableColumnLayout tableLayout = new TableColumnLayout();
+ tableComposite.setLayout(tableLayout);
+ tableLayout.setColumnData(nameColumn.getColumn(), new ColumnWeightData(100));
+ }
+
+ private void openFileBrowser() {
+ FileDialog dialog = new FileDialog(getShell(), SWT.OPEN | SWT.MULTI);
+ String[] filterNames = new String[]{"XSD Schema (*.xsd)", "WSDL file (*.wsdl)", "All Files (*.*)"};
+ String[] filterExtensions = new String[]{"*.xsd", "*.wsdl", "*.*"};
+ dialog.setFilterNames(filterNames);
+ dialog.setFilterExtensions(filterExtensions);
+ if (dialog.open() != null) {
+ String[] files = dialog.getFileNames();
+
+ // prefix with base path since files only consists of filename
+ String basePath = dialog.getFilterPath();
+ for (int i = 0, n = files.length; i < n; i++) {
+ String path = basePath;
+ if (path.charAt(path.length() - 1) != File.separatorChar) {
+ path += File.separatorChar;
+ }
+ path += files[i];
+
+ File file = new File(path);
+
+ if (!m_files.contains(file)) {
+ m_files.add(new File(path));
+ }
+ }
+ }
+
+ m_tableViewer.refresh();
+ }
+
+ public File[] getFiles() {
+ return m_files.toArray(new File[m_files.size()]);
+ }
+
+ public void setFiles(File[] files) {
+ m_files = new ArrayList<File>(Arrays.asList(files));
+ }
+
+ private class P_LabelProvider extends CellLabelProvider {
+
+ @Override
+ public void update(ViewerCell cell) {
+ File file = (File) cell.getElement();
+ cell.setText(file.getName());
+
+ String fileExtension = IOUtility.getFileExtension(file.getName());
+ if (StringUtility.equalsIgnoreCase(fileExtension, "wsdl")) {
+ cell.setImage(JaxWsSdk.getImage(JaxWsIcons.WsdlFile));
+ }
+ else {
+ cell.setImage(JaxWsSdk.getImage(JaxWsIcons.XsdSchema));
+ }
+ }
+ }
+
+ public class P_ContentProvider implements IStructuredContentProvider {
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Object[] getElements(Object inputElement) {
+ List<File> files = (List<File>) inputElement;
+ return files.toArray(new File[files.size()]);
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildPropertiesWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildPropertiesWizardPage.java
index 24e809566..c18b5ed47 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildPropertiesWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildPropertiesWizardPage.java
@@ -1,269 +1,269 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.jface.layout.TableColumnLayout;
-import org.eclipse.jface.viewers.CellLabelProvider;
-import org.eclipse.jface.viewers.ColumnWeightData;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TableViewerColumn;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.BuildPropertyWizard;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Table;
-
-public class BuildPropertiesWizardPage extends AbstractWorkspaceWizardPage {
-
- private List<BuildProperty> m_properties;
-
- private TableViewer m_tableViewer;
- private Button m_addButton;
- private Button m_editButton;
- private Button m_removeButton;
-
- public BuildPropertiesWizardPage() {
- super(BuildPropertiesWizardPage.class.getName());
- setTitle(Texts.get("WsBuildDirectives"));
- setDescription(Texts.get("DescriptionBuildDirectives"));
- }
-
- @Override
- protected void createContent(Composite parent) {
- Composite container = new Composite(parent, SWT.NONE);
-
- Composite tableComposite = new Composite(container, SWT.NONE);
- m_tableViewer = new TableViewer(new Table(tableComposite, SWT.BORDER | SWT.FULL_SELECTION));
- m_tableViewer.setUseHashlookup(true);
- m_tableViewer.getTable().setHeaderVisible(true);
- m_tableViewer.getTable().setLinesVisible(false);
- m_tableViewer.addDoubleClickListener(new IDoubleClickListener() {
-
- @Override
- public void doubleClick(DoubleClickEvent event) {
- BuildProperty property = (BuildProperty) ((IStructuredSelection) m_tableViewer.getSelection()).getFirstElement();
- if (openEditPropertyWizard(property) != null) {
- m_tableViewer.refresh(property);
- }
- }
- });
-
- m_tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
-
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- m_editButton.setEnabled(!event.getSelection().isEmpty());
- m_removeButton.setEnabled(!event.getSelection().isEmpty());
- }
- });
-
- m_tableViewer.getTable().addKeyListener(new KeyAdapter() {
-
- @Override
- public void keyPressed(KeyEvent e) {
- if (e.keyCode == SWT.DEL) {
- if (m_removeButton.isEnabled()) {
- IStructuredSelection selection = (IStructuredSelection) m_tableViewer.getSelection();
- Iterator iterator = selection.iterator();
-
- while (iterator.hasNext()) {
- BuildProperty property = (BuildProperty) iterator.next();
- m_properties.remove(property);
- }
- m_tableViewer.refresh();
- }
- }
- }
- });
-
- TableViewerColumn nameColumn = new TableViewerColumn(m_tableViewer, SWT.LEFT, 0);
- nameColumn.setLabelProvider(new P_LabelProvider());
- nameColumn.getColumn().setResizable(false);
- nameColumn.getColumn().setText(Texts.get("Directive"));
-
- TableViewerColumn valueColumn = new TableViewerColumn(m_tableViewer, SWT.LEFT, 1);
- valueColumn.setLabelProvider(new P_LabelProvider());
- valueColumn.getColumn().setResizable(true);
- valueColumn.getColumn().setText(Texts.get("Value"));
-
- m_tableViewer.setContentProvider(new P_ContentProvider());
- m_tableViewer.setInput(m_properties);
-
- Composite buttonComposite = new Composite(container, SWT.NONE);
-
- m_addButton = new Button(buttonComposite, SWT.PUSH | SWT.FLAT);
- m_addButton.setText(Texts.get("Add"));
- m_addButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- BuildProperty property = new BuildProperty();
- property = openEditPropertyWizard(property);
- if (property != null) {
- m_properties.add(property);
- m_tableViewer.refresh();
- }
- }
- });
-
- m_editButton = new Button(buttonComposite, SWT.PUSH | SWT.FLAT);
- m_editButton.setText(Texts.get("Edit"));
- m_editButton.setEnabled(false);
- m_editButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- BuildProperty property = (BuildProperty) ((IStructuredSelection) m_tableViewer.getSelection()).getFirstElement();
- if (openEditPropertyWizard(property) != null) {
- m_tableViewer.refresh(property);
- }
- }
- });
-
- m_removeButton = new Button(buttonComposite, SWT.PUSH | SWT.FLAT);
- m_removeButton.setText(Texts.get("Remove"));
- m_removeButton.setEnabled(false);
- m_removeButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IStructuredSelection selection = (IStructuredSelection) m_tableViewer.getSelection();
- Iterator iterator = selection.iterator();
-
- while (iterator.hasNext()) {
- BuildProperty property = (BuildProperty) iterator.next();
- m_properties.remove(property);
- }
- m_tableViewer.refresh();
- }
- });
-
- // layout
- container.setLayout(new GridLayout(2, false));
- // table composite
- GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
- tableComposite.setLayoutData(gd);
-
- // button composite
- gd = new GridData(GridData.FILL_VERTICAL);
- gd.horizontalAlignment = SWT.TOP;
- buttonComposite.setLayoutData(gd);
-
- // layout within button composite
- GridLayout layout = new GridLayout(1, true);
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- buttonComposite.setLayout(layout);
- m_addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- m_editButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- m_removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
-
- // layout within table composite (autoresize of columns)
- TableColumnLayout tableLayout = new TableColumnLayout();
- tableComposite.setLayout(tableLayout);
- tableLayout.setColumnData(nameColumn.getColumn(), new ColumnWeightData(30));
- tableLayout.setColumnData(valueColumn.getColumn(), new ColumnWeightData(70));
- }
-
- private BuildProperty openEditPropertyWizard(BuildProperty property) {
- if (property == null) {
- return null;
- }
- // prepare illegal names
- Set<String> illegalNames = new HashSet<String>();
- for (BuildProperty prop : m_properties) {
- if (!CompareUtility.equals(property.getName(), prop.getName())) {
- illegalNames.add(prop.getName());
- }
- }
-
- BuildPropertyWizard wizard = new BuildPropertyWizard();
- wizard.setDirective(property.getName());
- wizard.setValue(property.getValue());
- wizard.setIllegalNames(illegalNames);
-
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.setHelpAvailable(false);
- if (wizardDialog.open() == Window.OK) {
- property.setName(wizard.getDirective());
- property.setValue(wizard.getValue());
- return property;
- }
- return null;
- }
-
- public List<BuildProperty> getProperties() {
- return m_properties;
- }
-
- public void setProperties(List<BuildProperty> properties) {
- m_properties = properties;
- }
-
- private class P_LabelProvider extends CellLabelProvider {
-
- @Override
- public void update(ViewerCell cell) {
- BuildProperty property = (BuildProperty) cell.getElement();
- if (cell.getColumnIndex() == 0) {
- cell.setText(property.getName());
- cell.setImage(JaxWsSdk.getImage(JaxWsIcons.BuildDirective));
- }
- else {
- cell.setText(property.getValue());
- }
- }
- }
-
- public class P_ContentProvider implements IStructuredContentProvider {
-
- @Override
- @SuppressWarnings("unchecked")
- public Object[] getElements(Object inputElement) {
- List<BuildProperty> properties = (List<BuildProperty>) inputElement;
- return properties.toArray(new BuildProperty[properties.size()]);
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.jface.layout.TableColumnLayout;
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.ColumnWeightData;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TableViewerColumn;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.BuildPropertyWizard;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Table;
+
+public class BuildPropertiesWizardPage extends AbstractWorkspaceWizardPage {
+
+ private List<BuildProperty> m_properties;
+
+ private TableViewer m_tableViewer;
+ private Button m_addButton;
+ private Button m_editButton;
+ private Button m_removeButton;
+
+ public BuildPropertiesWizardPage() {
+ super(BuildPropertiesWizardPage.class.getName());
+ setTitle(Texts.get("WsBuildDirectives"));
+ setDescription(Texts.get("DescriptionBuildDirectives"));
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ Composite container = new Composite(parent, SWT.NONE);
+
+ Composite tableComposite = new Composite(container, SWT.NONE);
+ m_tableViewer = new TableViewer(new Table(tableComposite, SWT.BORDER | SWT.FULL_SELECTION));
+ m_tableViewer.setUseHashlookup(true);
+ m_tableViewer.getTable().setHeaderVisible(true);
+ m_tableViewer.getTable().setLinesVisible(false);
+ m_tableViewer.addDoubleClickListener(new IDoubleClickListener() {
+
+ @Override
+ public void doubleClick(DoubleClickEvent event) {
+ BuildProperty property = (BuildProperty) ((IStructuredSelection) m_tableViewer.getSelection()).getFirstElement();
+ if (openEditPropertyWizard(property) != null) {
+ m_tableViewer.refresh(property);
+ }
+ }
+ });
+
+ m_tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ m_editButton.setEnabled(!event.getSelection().isEmpty());
+ m_removeButton.setEnabled(!event.getSelection().isEmpty());
+ }
+ });
+
+ m_tableViewer.getTable().addKeyListener(new KeyAdapter() {
+
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if (e.keyCode == SWT.DEL) {
+ if (m_removeButton.isEnabled()) {
+ IStructuredSelection selection = (IStructuredSelection) m_tableViewer.getSelection();
+ Iterator iterator = selection.iterator();
+
+ while (iterator.hasNext()) {
+ BuildProperty property = (BuildProperty) iterator.next();
+ m_properties.remove(property);
+ }
+ m_tableViewer.refresh();
+ }
+ }
+ }
+ });
+
+ TableViewerColumn nameColumn = new TableViewerColumn(m_tableViewer, SWT.LEFT, 0);
+ nameColumn.setLabelProvider(new P_LabelProvider());
+ nameColumn.getColumn().setResizable(false);
+ nameColumn.getColumn().setText(Texts.get("Directive"));
+
+ TableViewerColumn valueColumn = new TableViewerColumn(m_tableViewer, SWT.LEFT, 1);
+ valueColumn.setLabelProvider(new P_LabelProvider());
+ valueColumn.getColumn().setResizable(true);
+ valueColumn.getColumn().setText(Texts.get("Value"));
+
+ m_tableViewer.setContentProvider(new P_ContentProvider());
+ m_tableViewer.setInput(m_properties);
+
+ Composite buttonComposite = new Composite(container, SWT.NONE);
+
+ m_addButton = new Button(buttonComposite, SWT.PUSH | SWT.FLAT);
+ m_addButton.setText(Texts.get("Add"));
+ m_addButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ BuildProperty property = new BuildProperty();
+ property = openEditPropertyWizard(property);
+ if (property != null) {
+ m_properties.add(property);
+ m_tableViewer.refresh();
+ }
+ }
+ });
+
+ m_editButton = new Button(buttonComposite, SWT.PUSH | SWT.FLAT);
+ m_editButton.setText(Texts.get("Edit"));
+ m_editButton.setEnabled(false);
+ m_editButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ BuildProperty property = (BuildProperty) ((IStructuredSelection) m_tableViewer.getSelection()).getFirstElement();
+ if (openEditPropertyWizard(property) != null) {
+ m_tableViewer.refresh(property);
+ }
+ }
+ });
+
+ m_removeButton = new Button(buttonComposite, SWT.PUSH | SWT.FLAT);
+ m_removeButton.setText(Texts.get("Remove"));
+ m_removeButton.setEnabled(false);
+ m_removeButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) m_tableViewer.getSelection();
+ Iterator iterator = selection.iterator();
+
+ while (iterator.hasNext()) {
+ BuildProperty property = (BuildProperty) iterator.next();
+ m_properties.remove(property);
+ }
+ m_tableViewer.refresh();
+ }
+ });
+
+ // layout
+ container.setLayout(new GridLayout(2, false));
+ // table composite
+ GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL);
+ tableComposite.setLayoutData(gd);
+
+ // button composite
+ gd = new GridData(GridData.FILL_VERTICAL);
+ gd.horizontalAlignment = SWT.TOP;
+ buttonComposite.setLayoutData(gd);
+
+ // layout within button composite
+ GridLayout layout = new GridLayout(1, true);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ buttonComposite.setLayout(layout);
+ m_addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ m_editButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ m_removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ // layout within table composite (autoresize of columns)
+ TableColumnLayout tableLayout = new TableColumnLayout();
+ tableComposite.setLayout(tableLayout);
+ tableLayout.setColumnData(nameColumn.getColumn(), new ColumnWeightData(30));
+ tableLayout.setColumnData(valueColumn.getColumn(), new ColumnWeightData(70));
+ }
+
+ private BuildProperty openEditPropertyWizard(BuildProperty property) {
+ if (property == null) {
+ return null;
+ }
+ // prepare illegal names
+ Set<String> illegalNames = new HashSet<String>();
+ for (BuildProperty prop : m_properties) {
+ if (!CompareUtility.equals(property.getName(), prop.getName())) {
+ illegalNames.add(prop.getName());
+ }
+ }
+
+ BuildPropertyWizard wizard = new BuildPropertyWizard();
+ wizard.setDirective(property.getName());
+ wizard.setValue(property.getValue());
+ wizard.setIllegalNames(illegalNames);
+
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.setHelpAvailable(false);
+ if (wizardDialog.open() == Window.OK) {
+ property.setName(wizard.getDirective());
+ property.setValue(wizard.getValue());
+ return property;
+ }
+ return null;
+ }
+
+ public List<BuildProperty> getProperties() {
+ return m_properties;
+ }
+
+ public void setProperties(List<BuildProperty> properties) {
+ m_properties = properties;
+ }
+
+ private class P_LabelProvider extends CellLabelProvider {
+
+ @Override
+ public void update(ViewerCell cell) {
+ BuildProperty property = (BuildProperty) cell.getElement();
+ if (cell.getColumnIndex() == 0) {
+ cell.setText(property.getName());
+ cell.setImage(JaxWsSdk.getImage(JaxWsIcons.BuildDirective));
+ }
+ else {
+ cell.setText(property.getValue());
+ }
+ }
+ }
+
+ public class P_ContentProvider implements IStructuredContentProvider {
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Object[] getElements(Object inputElement) {
+ List<BuildProperty> properties = (List<BuildProperty>) inputElement;
+ return properties.toArray(new BuildProperty[properties.size()]);
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildProperty.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildProperty.java
index b4ef1dee1..e4bac3283 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildProperty.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildProperty.java
@@ -1,43 +1,43 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-public class BuildProperty {
- private String m_name;
- private String m_value;
-
- public BuildProperty() {
- }
-
- public BuildProperty(String name, String value) {
- m_name = name;
- m_value = value;
- }
-
- public String getName() {
- return m_name;
- }
-
- public void setName(String name) {
- m_name = name;
- }
-
- public String getValue() {
- return m_value;
- }
-
- public void setValue(String value) {
- m_value = value;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+public class BuildProperty {
+ private String m_name;
+ private String m_value;
+
+ public BuildProperty() {
+ }
+
+ public BuildProperty(String name, String value) {
+ m_name = name;
+ m_value = value;
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public void setName(String name) {
+ m_name = name;
+ }
+
+ public String getValue() {
+ return m_value;
+ }
+
+ public void setValue(String value) {
+ m_value = value;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildPropertyWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildPropertyWizardPage.java
index ca97939e6..6ce54361e 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildPropertyWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/BuildPropertyWizardPage.java
@@ -1,144 +1,144 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-
-public class BuildPropertyWizardPage extends AbstractWorkspaceWizardPage {
-
- public static final String PROP_DIRECTIVE = "name";
- public static final String PROP_VALUE = "value";
-
- private BasicPropertySupport m_propertySupport;
- private StyledTextField m_directiveField;
- private StyledTextField m_valueField;
- private Set<String> m_illegalNames;
-
- public BuildPropertyWizardPage() {
- super(BuildPropertyWizardPage.class.getName());
- setTitle(Texts.get("WsBuildDirective"));
- m_illegalNames = new HashSet<String>();
- m_propertySupport = new BasicPropertySupport(this);
- setDescription("");
- }
-
- @Override
- protected void createContent(Composite parent) {
- Composite container = new Composite(parent, SWT.NONE);
-
- m_directiveField = getFieldToolkit().createStyledTextField(container, Texts.get("Name"));
- m_directiveField.setText(StringUtility.nvl(getDirective(), ""));
- m_directiveField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setDirectiveInternal(m_directiveField.getText());
- pingStateChanging();
- }
- });
-
- m_valueField = getFieldToolkit().createStyledTextField(container, Texts.get("Value"));
- m_valueField.setText(StringUtility.nvl(getValue(), ""));
- m_valueField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setValueInternal(m_valueField.getText());
- pingStateChanging();
- }
- });
-
- // layout
- container.setLayout(new GridLayout(1, true));
- m_directiveField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- m_valueField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- if (!StringUtility.hasText(getDirective())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("Name"))));
- }
- else {
- if (!getDirective().equals(JaxWsConstants.OPTION_BINDING_FILE) && m_illegalNames.contains(getDirective())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("DirectiveXMustBeUnique", getDirective())));
- }
- }
- }
-
- public void setDirective(String directive) {
- try {
- setStateChanging(true);
- setDirectiveInternal(directive);
- if (isControlCreated()) {
- m_directiveField.setText(directive);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setDirectiveInternal(String directive) {
- m_propertySupport.setPropertyString(PROP_DIRECTIVE, directive);
- }
-
- public String getDirective() {
- return m_propertySupport.getPropertyString(PROP_DIRECTIVE);
- }
-
- public void setValue(String value) {
- try {
- setStateChanging(true);
- setValueInternal(value);
- if (isControlCreated()) {
- m_valueField.setText(value);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setValueInternal(String value) {
- m_propertySupport.setPropertyString(PROP_VALUE, value);
- }
-
- public String getValue() {
- return m_propertySupport.getPropertyString(PROP_VALUE);
- }
-
- public Set<String> getIllegalNames() {
- return m_illegalNames;
- }
-
- public void setIllegalNames(Set<String> illegalNames) {
- m_illegalNames = illegalNames;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+
+public class BuildPropertyWizardPage extends AbstractWorkspaceWizardPage {
+
+ public static final String PROP_DIRECTIVE = "name";
+ public static final String PROP_VALUE = "value";
+
+ private BasicPropertySupport m_propertySupport;
+ private StyledTextField m_directiveField;
+ private StyledTextField m_valueField;
+ private Set<String> m_illegalNames;
+
+ public BuildPropertyWizardPage() {
+ super(BuildPropertyWizardPage.class.getName());
+ setTitle(Texts.get("WsBuildDirective"));
+ m_illegalNames = new HashSet<String>();
+ m_propertySupport = new BasicPropertySupport(this);
+ setDescription("");
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ Composite container = new Composite(parent, SWT.NONE);
+
+ m_directiveField = getFieldToolkit().createStyledTextField(container, Texts.get("Name"));
+ m_directiveField.setText(StringUtility.nvl(getDirective(), ""));
+ m_directiveField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setDirectiveInternal(m_directiveField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_valueField = getFieldToolkit().createStyledTextField(container, Texts.get("Value"));
+ m_valueField.setText(StringUtility.nvl(getValue(), ""));
+ m_valueField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setValueInternal(m_valueField.getText());
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ container.setLayout(new GridLayout(1, true));
+ m_directiveField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ m_valueField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ if (!StringUtility.hasText(getDirective())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("Name"))));
+ }
+ else {
+ if (!getDirective().equals(JaxWsConstants.OPTION_BINDING_FILE) && m_illegalNames.contains(getDirective())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("DirectiveXMustBeUnique", getDirective())));
+ }
+ }
+ }
+
+ public void setDirective(String directive) {
+ try {
+ setStateChanging(true);
+ setDirectiveInternal(directive);
+ if (isControlCreated()) {
+ m_directiveField.setText(directive);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setDirectiveInternal(String directive) {
+ m_propertySupport.setPropertyString(PROP_DIRECTIVE, directive);
+ }
+
+ public String getDirective() {
+ return m_propertySupport.getPropertyString(PROP_DIRECTIVE);
+ }
+
+ public void setValue(String value) {
+ try {
+ setStateChanging(true);
+ setValueInternal(value);
+ if (isControlCreated()) {
+ m_valueField.setText(value);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setValueInternal(String value) {
+ m_propertySupport.setPropertyString(PROP_VALUE, value);
+ }
+
+ public String getValue() {
+ return m_propertySupport.getPropertyString(PROP_VALUE);
+ }
+
+ public Set<String> getIllegalNames() {
+ return m_illegalNames;
+ }
+
+ public void setIllegalNames(Set<String> illegalNames) {
+ m_illegalNames = illegalNames;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/ElementBean.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/ElementBean.java
index 81c240136..0034a0067 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/ElementBean.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/ElementBean.java
@@ -1,112 +1,112 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jface.resource.ImageDescriptor;
-
-public class ElementBean {
-
- private int m_id;
- private String m_name;
- private ImageDescriptor m_imageDescriptor;
- private boolean m_checked;
- private boolean m_mandatory;
- private IResource m_resource;
- private IJavaElement m_javaElement;
- private Object m_data;
-
- public ElementBean(int id, String name, ImageDescriptor imageDescriptor, boolean mandatory) {
- m_id = id;
- m_name = name;
- m_imageDescriptor = imageDescriptor;
- m_mandatory = mandatory;
- m_checked = true;
- }
-
- public ElementBean(int id, String name, ImageDescriptor imageDescriptor, IJavaElement javaElement, boolean mandatory) {
- this(id, name, imageDescriptor, mandatory);
- m_javaElement = javaElement;
- }
-
- public ElementBean(int id, String name, ImageDescriptor imageDescriptor, IResource resource, boolean mandatory) {
- this(id, name, imageDescriptor, mandatory);
- m_resource = resource;
- }
-
- public int getId() {
- return m_id;
- }
-
- public void setId(int id) {
- m_id = id;
- }
-
- public String getName() {
- return m_name;
- }
-
- public void setName(String name) {
- m_name = name;
- }
-
- public ImageDescriptor getImageDescriptor() {
- return m_imageDescriptor;
- }
-
- public void setImageDescriptor(ImageDescriptor imageDescriptor) {
- m_imageDescriptor = imageDescriptor;
- }
-
- public boolean isChecked() {
- return m_checked;
- }
-
- public void setChecked(boolean checked) {
- m_checked = checked;
- }
-
- public boolean isMandatory() {
- return m_mandatory;
- }
-
- public void setMandatory(boolean mandatory) {
- m_mandatory = mandatory;
- }
-
- public IResource getResource() {
- return m_resource;
- }
-
- public void setResource(IResource resource) {
- m_resource = resource;
- }
-
- public IJavaElement getJavaElement() {
- return m_javaElement;
- }
-
- public void setJavaElement(IJavaElement javaElement) {
- m_javaElement = javaElement;
- }
-
- public Object getData() {
- return m_data;
- }
-
- public void setData(Object data) {
- m_data = data;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jface.resource.ImageDescriptor;
+
+public class ElementBean {
+
+ private int m_id;
+ private String m_name;
+ private ImageDescriptor m_imageDescriptor;
+ private boolean m_checked;
+ private boolean m_mandatory;
+ private IResource m_resource;
+ private IJavaElement m_javaElement;
+ private Object m_data;
+
+ public ElementBean(int id, String name, ImageDescriptor imageDescriptor, boolean mandatory) {
+ m_id = id;
+ m_name = name;
+ m_imageDescriptor = imageDescriptor;
+ m_mandatory = mandatory;
+ m_checked = true;
+ }
+
+ public ElementBean(int id, String name, ImageDescriptor imageDescriptor, IJavaElement javaElement, boolean mandatory) {
+ this(id, name, imageDescriptor, mandatory);
+ m_javaElement = javaElement;
+ }
+
+ public ElementBean(int id, String name, ImageDescriptor imageDescriptor, IResource resource, boolean mandatory) {
+ this(id, name, imageDescriptor, mandatory);
+ m_resource = resource;
+ }
+
+ public int getId() {
+ return m_id;
+ }
+
+ public void setId(int id) {
+ m_id = id;
+ }
+
+ public String getName() {
+ return m_name;
+ }
+
+ public void setName(String name) {
+ m_name = name;
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return m_imageDescriptor;
+ }
+
+ public void setImageDescriptor(ImageDescriptor imageDescriptor) {
+ m_imageDescriptor = imageDescriptor;
+ }
+
+ public boolean isChecked() {
+ return m_checked;
+ }
+
+ public void setChecked(boolean checked) {
+ m_checked = checked;
+ }
+
+ public boolean isMandatory() {
+ return m_mandatory;
+ }
+
+ public void setMandatory(boolean mandatory) {
+ m_mandatory = mandatory;
+ }
+
+ public IResource getResource() {
+ return m_resource;
+ }
+
+ public void setResource(IResource resource) {
+ m_resource = resource;
+ }
+
+ public IJavaElement getJavaElement() {
+ return m_javaElement;
+ }
+
+ public void setJavaElement(IJavaElement javaElement) {
+ m_javaElement = javaElement;
+ }
+
+ public Object getData() {
+ return m_data;
+ }
+
+ public void setData(Object data) {
+ m_data = data;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/HandlerChainFilterWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/HandlerChainFilterWizardPage.java
index 34ca2e614..6a6c99e17 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/HandlerChainFilterWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/HandlerChainFilterWizardPage.java
@@ -1,519 +1,519 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.beans.PropertyChangeListener;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-public class HandlerChainFilterWizardPage extends AbstractWorkspaceWizardPage {
-
- public static final String PROP_FILTER_TYPE = "filterType";
- public static final String PROP_NAMESPACE_PREFIX = "namespacePrefix";
- public static final String PROP_NAMESPACE = "namespace";
- public static final String PROP_PATTERN = "pattern";
-
- private BasicPropertySupport m_propertySupport;
-
- private IScoutBundle m_bundle;
-
- private Button m_filterTypeNoneButton;
- private Button m_filterTypeProtocolButton;
- private Button m_filterTypeServiceButton;
- private Button m_filterTypePortButton;
-
- private Composite m_filterTypeProtocolComposite;
- private Composite m_filterTypeServiceComposite;
- private Composite m_filterTypePortComposite;
-
- private Map<Button, Composite> m_radioButtonMap;
-
- private StyledTextField m_protocolBindings;
-
- private StyledTextField m_serviceNamespacePrefix;
- private StyledTextField m_serviceNamespace;
- private StyledTextField m_servicePattern;
-
- private StyledTextField m_portNamespacePrefix;
- private StyledTextField m_portNamespace;
- private StyledTextField m_portPattern;
-
- public HandlerChainFilterWizardPage(IScoutBundle bundle) {
- super(HandlerChainFilterWizardPage.class.getName());
- setTitle(Texts.get("HandlerChainFilter"));
- setDescription(Texts.get("DescriptionHandlerChainFilter"));
-
- m_radioButtonMap = new HashMap<Button, Composite>();
- m_bundle = bundle;
- m_propertySupport = new BasicPropertySupport(this);
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_filterTypeNoneButton = createRadioButton(parent, FilterTypeEnum.NoFilter);
- m_radioButtonMap.put(m_filterTypeNoneButton, null);
-
- // protocol filter
- m_filterTypeProtocolButton = createRadioButton(parent, FilterTypeEnum.ProtocolFilter);
- m_filterTypeProtocolComposite = new Composite(parent, SWT.NONE);
- m_radioButtonMap.put(m_filterTypeProtocolButton, m_filterTypeProtocolComposite);
-
- m_protocolBindings = new StyledTextField(m_filterTypeProtocolComposite, Texts.get("ProtocolBindings"));
- m_protocolBindings.setToolTipText(Texts.get("TooltipProtocolBindings"));
- m_protocolBindings.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setPatternInternal(m_protocolBindings.getText());
- pingStateChanging();
- }
- });
- if (getFilterType() == FilterTypeEnum.ProtocolFilter) {
- m_protocolBindings.setText(getPattern());
- }
-
- // service filter
- m_filterTypeServiceButton = createRadioButton(parent, FilterTypeEnum.ServiceFilter);
- m_filterTypeServiceComposite = new Composite(parent, SWT.NONE);
- m_radioButtonMap.put(m_filterTypeServiceButton, m_filterTypeServiceComposite);
- // namespace prefix
- m_serviceNamespacePrefix = new StyledTextField(m_filterTypeServiceComposite, Texts.get("NamespacePrefix"));
- m_serviceNamespacePrefix.setToolTipText(Texts.get("TooltipNamespacePrefix"));
- m_serviceNamespacePrefix.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setNamespacePrefixInternal(m_serviceNamespacePrefix.getText());
- pingStateChanging();
- }
- });
- // namespace
- m_serviceNamespace = new StyledTextField(m_filterTypeServiceComposite, Texts.get("Namespace"));
- m_serviceNamespace.setToolTipText(Texts.get("TooltipNamespace"));
- m_serviceNamespace.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setNamespaceInternal(m_serviceNamespace.getText());
- pingStateChanging();
- }
- });
- // pattern
- m_servicePattern = new StyledTextField(m_filterTypeServiceComposite, Texts.get("RestrictionPattern"));
- m_servicePattern.setToolTipText(Texts.get("TooltipRestriction", Texts.get("services")));
- m_servicePattern.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setPatternInternal(m_servicePattern.getText());
- pingStateChanging();
- }
- });
- if (getFilterType() == FilterTypeEnum.ServiceFilter) {
- m_serviceNamespacePrefix.setText(getNamespacePrefix());
- m_serviceNamespace.setText(getNamespace());
- m_servicePattern.setText(getPattern());
- }
-
- // port filter
- m_filterTypePortButton = createRadioButton(parent, FilterTypeEnum.PortFilter);
- m_filterTypePortComposite = new Composite(parent, SWT.NONE);
- m_radioButtonMap.put(m_filterTypePortButton, m_filterTypePortComposite);
- // namespace prefix
- m_portNamespacePrefix = new StyledTextField(m_filterTypePortComposite, Texts.get("NamespacePrefix"));
- m_portNamespacePrefix.setToolTipText(Texts.get("TooltipNamespacePrefix"));
- m_portNamespacePrefix.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setNamespacePrefixInternal(m_portNamespacePrefix.getText());
- pingStateChanging();
- }
- });
- // namespace
- m_portNamespace = new StyledTextField(m_filterTypePortComposite, Texts.get("Namespace"));
- m_portNamespace.setToolTipText(Texts.get("TooltipNamespace"));
- m_portNamespace.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setNamespaceInternal(m_portNamespace.getText());
- pingStateChanging();
- }
- });
- // pattern
- m_portPattern = new StyledTextField(m_filterTypePortComposite, Texts.get("RestrictionPattern"));
- m_portPattern.setToolTipText(Texts.get("TooltipRestriction", Texts.get("ports")));
- m_portPattern.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setPatternInternal(m_portPattern.getText());
- pingStateChanging();
- }
- });
- if (getFilterType() == FilterTypeEnum.PortFilter) {
- m_portNamespacePrefix.setText(getNamespacePrefix());
- m_portNamespace.setText(getNamespace());
- m_portPattern.setText(getPattern());
- }
-
- // layout
- parent.setLayout(new FormLayout());
-
- FormData formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_filterTypeNoneButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_filterTypeNoneButton, 10, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_filterTypeProtocolButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_filterTypeProtocolButton, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_filterTypeProtocolComposite.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_filterTypeProtocolComposite, 10, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_filterTypeServiceButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_filterTypeServiceButton, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_filterTypeServiceComposite.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_filterTypeServiceComposite, 10, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_filterTypePortButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_filterTypePortButton, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_filterTypePortComposite.setLayoutData(formData);
-
- // protocol composite
- GridLayout gridLayout = new GridLayout(1, false);
- gridLayout.marginLeft = 0;
- gridLayout.marginRight = 0;
- m_filterTypeProtocolComposite.setLayout(gridLayout);
- m_protocolBindings.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
-
- // service composite
- gridLayout = new GridLayout(1, false);
- gridLayout.marginLeft = 0;
- gridLayout.marginRight = 0;
- m_filterTypeServiceComposite.setLayout(gridLayout);
- m_serviceNamespacePrefix.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- m_serviceNamespace.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- m_servicePattern.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
-
- // port composite
- gridLayout = new GridLayout(1, false);
- gridLayout.marginLeft = 0;
- gridLayout.marginRight = 0;
- m_filterTypePortComposite.setLayout(gridLayout);
- m_portNamespacePrefix.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- m_portNamespace.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- m_portPattern.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- }
-
- private Button createRadioButton(Composite parent, final FilterTypeEnum filterType) {
- Button button = new Button(parent, SWT.RADIO);
- button.setData(filterType);
- button.setText(filterType.getLabel());
- button.setSelection(getFilterType() == filterType);
- button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- setFilterType(filterType);
- }
- });
- return button;
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- switch (getFilterType()) {
- case ServiceFilter:
- case PortFilter:
- if (!StringUtility.hasText(getNamespacePrefix())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("NamespacePrefix"))));
- }
- else if (!StringUtility.hasText(getNamespace())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("Namespace"))));
- }
- else if (!StringUtility.hasText(getPattern()) || getPattern().equals(getNamespacePrefix() + ":")) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("RestrictionPattern"))));
- }
- break;
- case ProtocolFilter:
- if (!StringUtility.hasText(getPattern())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("ProtocolBindings"))));
- }
- break;
- }
- }
-
- public void setPattern(String pattern) {
- try {
- setStateChanging(true);
- setPatternInternal(pattern);
- if (isControlCreated()) {
- m_protocolBindings.setText("");
- m_servicePattern.setText("");
- m_portPattern.setText("");
-
- switch (getFilterType()) {
- case ProtocolFilter:
- m_protocolBindings.setText(pattern);
- break;
- case ServiceFilter:
- m_servicePattern.setText(pattern);
- break;
- case PortFilter:
- m_portPattern.setText(pattern);
- break;
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setPatternInternal(String pattern) {
- m_propertySupport.setPropertyString(PROP_PATTERN, pattern);
- }
-
- public String getPattern() {
- return m_propertySupport.getPropertyString(PROP_PATTERN);
- }
-
- public void setNamespacePrefix(String namespacePrefix) {
- try {
- setStateChanging(true);
- setNamespacePrefixInternal(namespacePrefix);
- if (isControlCreated()) {
- switch (getFilterType()) {
- case ServiceFilter:
- m_serviceNamespacePrefix.setText(namespacePrefix);
- break;
- case PortFilter:
- m_portNamespacePrefix.setText(namespacePrefix);
- break;
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void prefixNamespace() {
- if (!isControlCreated()) {
- return;
- }
-
- String prefix = getNamespacePrefix();
- if (!StringUtility.hasText(prefix)) {
- m_servicePattern.setReadOnlyPrefix(null);
- m_portPattern.setReadOnlyPrefix(null);
- }
- else {
- prefix += ":";
- switch (getFilterType()) {
- case ServiceFilter:
- m_portPattern.setReadOnlyPrefix(null);
- m_servicePattern.setReadOnlyPrefix(prefix);
- break;
- case PortFilter:
- m_servicePattern.setReadOnlyPrefix(null);
- m_portPattern.setReadOnlyPrefix(prefix);
- break;
- }
- }
- }
-
- private void setNamespacePrefixInternal(String namespacePrefix) {
- m_propertySupport.setPropertyString(PROP_NAMESPACE_PREFIX, namespacePrefix);
- prefixNamespace();
- }
-
- public String getNamespacePrefix() {
- return m_propertySupport.getPropertyString(PROP_NAMESPACE_PREFIX);
- }
-
- public void setNamespace(String namespace) {
- try {
- setStateChanging(true);
- setNamespaceInternal(namespace);
- if (isControlCreated()) {
- switch (getFilterType()) {
- case ServiceFilter:
- m_serviceNamespace.setText(namespace);
- break;
- case PortFilter:
- m_portNamespace.setText(namespace);
- break;
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setNamespaceInternal(String namespace) {
- m_propertySupport.setPropertyString(PROP_NAMESPACE, namespace);
- }
-
- public String getNamespace() {
- return m_propertySupport.getPropertyString(PROP_NAMESPACE);
- }
-
- public void setFilterType(FilterTypeEnum filterType) {
- try {
- setStateChanging(true);
- setFilterTypeInternal(filterType);
- if (isControlCreated()) {
- for (Entry<Button, Composite> entry : m_radioButtonMap.entrySet()) {
- Button button = entry.getKey();
- Composite composite = entry.getValue();
- FilterTypeEnum id = (FilterTypeEnum) button.getData();
- button.setSelection(id == filterType);
- if (composite != null) {
- JaxWsSdkUtility.setView(composite, id == filterType);
- }
-
- switch (filterType) {
- case NoFilter:
- m_protocolBindings.setText("");
- m_portNamespacePrefix.setText("");
- m_portNamespace.setText("");
- m_portPattern.setText("");
- m_serviceNamespacePrefix.setText("");
- m_serviceNamespace.setText("");
- m_servicePattern.setText("");
- setNamespace(null);
- setNamespacePrefix(null);
- break;
- case ServiceFilter:
- m_protocolBindings.setText("");
- m_portNamespacePrefix.setText("");
- m_portNamespace.setText("");
- m_portPattern.setText("");
- setNamespace("urn:namespace");
- setNamespacePrefix("ns1");
- break;
- case PortFilter:
- m_protocolBindings.setText("");
- m_serviceNamespacePrefix.setText("");
- m_serviceNamespace.setText("");
- m_servicePattern.setText("");
- setNamespace("urn:namespace");
- setNamespacePrefix("ns1");
- break;
- case ProtocolFilter:
- m_serviceNamespacePrefix.setText("");
- m_serviceNamespace.setText("");
- m_servicePattern.setText("");
- m_portNamespacePrefix.setText("");
- m_portNamespace.setText("");
- m_portPattern.setText("");
- setNamespace(null);
- setNamespacePrefix(null);
- setPattern("##SOAP11_HTTP");
- break;
- }
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setFilterTypeInternal(FilterTypeEnum filterType) {
- m_propertySupport.setProperty(PROP_FILTER_TYPE, filterType);
- }
-
- public FilterTypeEnum getFilterType() {
- return (FilterTypeEnum) m_propertySupport.getProperty(PROP_FILTER_TYPE);
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.addPropertyChangeListener(listener);
- super.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.removePropertyChangeListener(listener);
- super.removePropertyChangeListener(listener);
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public static enum FilterTypeEnum {
- NoFilter(Texts.get("NoFilter")), ProtocolFilter(Texts.get("ProtocolFilter")), ServiceFilter(Texts.get("ServiceFilter")), PortFilter(Texts.get("PortFilter"));
-
- private String m_label;
-
- private FilterTypeEnum(String label) {
- m_label = label;
- }
-
- public String getLabel() {
- return m_label;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.beans.PropertyChangeListener;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+public class HandlerChainFilterWizardPage extends AbstractWorkspaceWizardPage {
+
+ public static final String PROP_FILTER_TYPE = "filterType";
+ public static final String PROP_NAMESPACE_PREFIX = "namespacePrefix";
+ public static final String PROP_NAMESPACE = "namespace";
+ public static final String PROP_PATTERN = "pattern";
+
+ private BasicPropertySupport m_propertySupport;
+
+ private IScoutBundle m_bundle;
+
+ private Button m_filterTypeNoneButton;
+ private Button m_filterTypeProtocolButton;
+ private Button m_filterTypeServiceButton;
+ private Button m_filterTypePortButton;
+
+ private Composite m_filterTypeProtocolComposite;
+ private Composite m_filterTypeServiceComposite;
+ private Composite m_filterTypePortComposite;
+
+ private Map<Button, Composite> m_radioButtonMap;
+
+ private StyledTextField m_protocolBindings;
+
+ private StyledTextField m_serviceNamespacePrefix;
+ private StyledTextField m_serviceNamespace;
+ private StyledTextField m_servicePattern;
+
+ private StyledTextField m_portNamespacePrefix;
+ private StyledTextField m_portNamespace;
+ private StyledTextField m_portPattern;
+
+ public HandlerChainFilterWizardPage(IScoutBundle bundle) {
+ super(HandlerChainFilterWizardPage.class.getName());
+ setTitle(Texts.get("HandlerChainFilter"));
+ setDescription(Texts.get("DescriptionHandlerChainFilter"));
+
+ m_radioButtonMap = new HashMap<Button, Composite>();
+ m_bundle = bundle;
+ m_propertySupport = new BasicPropertySupport(this);
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_filterTypeNoneButton = createRadioButton(parent, FilterTypeEnum.NoFilter);
+ m_radioButtonMap.put(m_filterTypeNoneButton, null);
+
+ // protocol filter
+ m_filterTypeProtocolButton = createRadioButton(parent, FilterTypeEnum.ProtocolFilter);
+ m_filterTypeProtocolComposite = new Composite(parent, SWT.NONE);
+ m_radioButtonMap.put(m_filterTypeProtocolButton, m_filterTypeProtocolComposite);
+
+ m_protocolBindings = new StyledTextField(m_filterTypeProtocolComposite, Texts.get("ProtocolBindings"));
+ m_protocolBindings.setToolTipText(Texts.get("TooltipProtocolBindings"));
+ m_protocolBindings.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setPatternInternal(m_protocolBindings.getText());
+ pingStateChanging();
+ }
+ });
+ if (getFilterType() == FilterTypeEnum.ProtocolFilter) {
+ m_protocolBindings.setText(getPattern());
+ }
+
+ // service filter
+ m_filterTypeServiceButton = createRadioButton(parent, FilterTypeEnum.ServiceFilter);
+ m_filterTypeServiceComposite = new Composite(parent, SWT.NONE);
+ m_radioButtonMap.put(m_filterTypeServiceButton, m_filterTypeServiceComposite);
+ // namespace prefix
+ m_serviceNamespacePrefix = new StyledTextField(m_filterTypeServiceComposite, Texts.get("NamespacePrefix"));
+ m_serviceNamespacePrefix.setToolTipText(Texts.get("TooltipNamespacePrefix"));
+ m_serviceNamespacePrefix.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setNamespacePrefixInternal(m_serviceNamespacePrefix.getText());
+ pingStateChanging();
+ }
+ });
+ // namespace
+ m_serviceNamespace = new StyledTextField(m_filterTypeServiceComposite, Texts.get("Namespace"));
+ m_serviceNamespace.setToolTipText(Texts.get("TooltipNamespace"));
+ m_serviceNamespace.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setNamespaceInternal(m_serviceNamespace.getText());
+ pingStateChanging();
+ }
+ });
+ // pattern
+ m_servicePattern = new StyledTextField(m_filterTypeServiceComposite, Texts.get("RestrictionPattern"));
+ m_servicePattern.setToolTipText(Texts.get("TooltipRestriction", Texts.get("services")));
+ m_servicePattern.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setPatternInternal(m_servicePattern.getText());
+ pingStateChanging();
+ }
+ });
+ if (getFilterType() == FilterTypeEnum.ServiceFilter) {
+ m_serviceNamespacePrefix.setText(getNamespacePrefix());
+ m_serviceNamespace.setText(getNamespace());
+ m_servicePattern.setText(getPattern());
+ }
+
+ // port filter
+ m_filterTypePortButton = createRadioButton(parent, FilterTypeEnum.PortFilter);
+ m_filterTypePortComposite = new Composite(parent, SWT.NONE);
+ m_radioButtonMap.put(m_filterTypePortButton, m_filterTypePortComposite);
+ // namespace prefix
+ m_portNamespacePrefix = new StyledTextField(m_filterTypePortComposite, Texts.get("NamespacePrefix"));
+ m_portNamespacePrefix.setToolTipText(Texts.get("TooltipNamespacePrefix"));
+ m_portNamespacePrefix.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setNamespacePrefixInternal(m_portNamespacePrefix.getText());
+ pingStateChanging();
+ }
+ });
+ // namespace
+ m_portNamespace = new StyledTextField(m_filterTypePortComposite, Texts.get("Namespace"));
+ m_portNamespace.setToolTipText(Texts.get("TooltipNamespace"));
+ m_portNamespace.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setNamespaceInternal(m_portNamespace.getText());
+ pingStateChanging();
+ }
+ });
+ // pattern
+ m_portPattern = new StyledTextField(m_filterTypePortComposite, Texts.get("RestrictionPattern"));
+ m_portPattern.setToolTipText(Texts.get("TooltipRestriction", Texts.get("ports")));
+ m_portPattern.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setPatternInternal(m_portPattern.getText());
+ pingStateChanging();
+ }
+ });
+ if (getFilterType() == FilterTypeEnum.PortFilter) {
+ m_portNamespacePrefix.setText(getNamespacePrefix());
+ m_portNamespace.setText(getNamespace());
+ m_portPattern.setText(getPattern());
+ }
+
+ // layout
+ parent.setLayout(new FormLayout());
+
+ FormData formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_filterTypeNoneButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_filterTypeNoneButton, 10, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_filterTypeProtocolButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_filterTypeProtocolButton, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_filterTypeProtocolComposite.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_filterTypeProtocolComposite, 10, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_filterTypeServiceButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_filterTypeServiceButton, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_filterTypeServiceComposite.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_filterTypeServiceComposite, 10, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_filterTypePortButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_filterTypePortButton, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_filterTypePortComposite.setLayoutData(formData);
+
+ // protocol composite
+ GridLayout gridLayout = new GridLayout(1, false);
+ gridLayout.marginLeft = 0;
+ gridLayout.marginRight = 0;
+ m_filterTypeProtocolComposite.setLayout(gridLayout);
+ m_protocolBindings.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+
+ // service composite
+ gridLayout = new GridLayout(1, false);
+ gridLayout.marginLeft = 0;
+ gridLayout.marginRight = 0;
+ m_filterTypeServiceComposite.setLayout(gridLayout);
+ m_serviceNamespacePrefix.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+ m_serviceNamespace.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+ m_servicePattern.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+
+ // port composite
+ gridLayout = new GridLayout(1, false);
+ gridLayout.marginLeft = 0;
+ gridLayout.marginRight = 0;
+ m_filterTypePortComposite.setLayout(gridLayout);
+ m_portNamespacePrefix.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+ m_portNamespace.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+ m_portPattern.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+ }
+
+ private Button createRadioButton(Composite parent, final FilterTypeEnum filterType) {
+ Button button = new Button(parent, SWT.RADIO);
+ button.setData(filterType);
+ button.setText(filterType.getLabel());
+ button.setSelection(getFilterType() == filterType);
+ button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setFilterType(filterType);
+ }
+ });
+ return button;
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ switch (getFilterType()) {
+ case ServiceFilter:
+ case PortFilter:
+ if (!StringUtility.hasText(getNamespacePrefix())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("NamespacePrefix"))));
+ }
+ else if (!StringUtility.hasText(getNamespace())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("Namespace"))));
+ }
+ else if (!StringUtility.hasText(getPattern()) || getPattern().equals(getNamespacePrefix() + ":")) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("RestrictionPattern"))));
+ }
+ break;
+ case ProtocolFilter:
+ if (!StringUtility.hasText(getPattern())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("ProtocolBindings"))));
+ }
+ break;
+ }
+ }
+
+ public void setPattern(String pattern) {
+ try {
+ setStateChanging(true);
+ setPatternInternal(pattern);
+ if (isControlCreated()) {
+ m_protocolBindings.setText("");
+ m_servicePattern.setText("");
+ m_portPattern.setText("");
+
+ switch (getFilterType()) {
+ case ProtocolFilter:
+ m_protocolBindings.setText(pattern);
+ break;
+ case ServiceFilter:
+ m_servicePattern.setText(pattern);
+ break;
+ case PortFilter:
+ m_portPattern.setText(pattern);
+ break;
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setPatternInternal(String pattern) {
+ m_propertySupport.setPropertyString(PROP_PATTERN, pattern);
+ }
+
+ public String getPattern() {
+ return m_propertySupport.getPropertyString(PROP_PATTERN);
+ }
+
+ public void setNamespacePrefix(String namespacePrefix) {
+ try {
+ setStateChanging(true);
+ setNamespacePrefixInternal(namespacePrefix);
+ if (isControlCreated()) {
+ switch (getFilterType()) {
+ case ServiceFilter:
+ m_serviceNamespacePrefix.setText(namespacePrefix);
+ break;
+ case PortFilter:
+ m_portNamespacePrefix.setText(namespacePrefix);
+ break;
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void prefixNamespace() {
+ if (!isControlCreated()) {
+ return;
+ }
+
+ String prefix = getNamespacePrefix();
+ if (!StringUtility.hasText(prefix)) {
+ m_servicePattern.setReadOnlyPrefix(null);
+ m_portPattern.setReadOnlyPrefix(null);
+ }
+ else {
+ prefix += ":";
+ switch (getFilterType()) {
+ case ServiceFilter:
+ m_portPattern.setReadOnlyPrefix(null);
+ m_servicePattern.setReadOnlyPrefix(prefix);
+ break;
+ case PortFilter:
+ m_servicePattern.setReadOnlyPrefix(null);
+ m_portPattern.setReadOnlyPrefix(prefix);
+ break;
+ }
+ }
+ }
+
+ private void setNamespacePrefixInternal(String namespacePrefix) {
+ m_propertySupport.setPropertyString(PROP_NAMESPACE_PREFIX, namespacePrefix);
+ prefixNamespace();
+ }
+
+ public String getNamespacePrefix() {
+ return m_propertySupport.getPropertyString(PROP_NAMESPACE_PREFIX);
+ }
+
+ public void setNamespace(String namespace) {
+ try {
+ setStateChanging(true);
+ setNamespaceInternal(namespace);
+ if (isControlCreated()) {
+ switch (getFilterType()) {
+ case ServiceFilter:
+ m_serviceNamespace.setText(namespace);
+ break;
+ case PortFilter:
+ m_portNamespace.setText(namespace);
+ break;
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setNamespaceInternal(String namespace) {
+ m_propertySupport.setPropertyString(PROP_NAMESPACE, namespace);
+ }
+
+ public String getNamespace() {
+ return m_propertySupport.getPropertyString(PROP_NAMESPACE);
+ }
+
+ public void setFilterType(FilterTypeEnum filterType) {
+ try {
+ setStateChanging(true);
+ setFilterTypeInternal(filterType);
+ if (isControlCreated()) {
+ for (Entry<Button, Composite> entry : m_radioButtonMap.entrySet()) {
+ Button button = entry.getKey();
+ Composite composite = entry.getValue();
+ FilterTypeEnum id = (FilterTypeEnum) button.getData();
+ button.setSelection(id == filterType);
+ if (composite != null) {
+ JaxWsSdkUtility.setView(composite, id == filterType);
+ }
+
+ switch (filterType) {
+ case NoFilter:
+ m_protocolBindings.setText("");
+ m_portNamespacePrefix.setText("");
+ m_portNamespace.setText("");
+ m_portPattern.setText("");
+ m_serviceNamespacePrefix.setText("");
+ m_serviceNamespace.setText("");
+ m_servicePattern.setText("");
+ setNamespace(null);
+ setNamespacePrefix(null);
+ break;
+ case ServiceFilter:
+ m_protocolBindings.setText("");
+ m_portNamespacePrefix.setText("");
+ m_portNamespace.setText("");
+ m_portPattern.setText("");
+ setNamespace("urn:namespace");
+ setNamespacePrefix("ns1");
+ break;
+ case PortFilter:
+ m_protocolBindings.setText("");
+ m_serviceNamespacePrefix.setText("");
+ m_serviceNamespace.setText("");
+ m_servicePattern.setText("");
+ setNamespace("urn:namespace");
+ setNamespacePrefix("ns1");
+ break;
+ case ProtocolFilter:
+ m_serviceNamespacePrefix.setText("");
+ m_serviceNamespace.setText("");
+ m_servicePattern.setText("");
+ m_portNamespacePrefix.setText("");
+ m_portNamespace.setText("");
+ m_portPattern.setText("");
+ setNamespace(null);
+ setNamespacePrefix(null);
+ setPattern("##SOAP11_HTTP");
+ break;
+ }
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setFilterTypeInternal(FilterTypeEnum filterType) {
+ m_propertySupport.setProperty(PROP_FILTER_TYPE, filterType);
+ }
+
+ public FilterTypeEnum getFilterType() {
+ return (FilterTypeEnum) m_propertySupport.getProperty(PROP_FILTER_TYPE);
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.addPropertyChangeListener(listener);
+ super.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.removePropertyChangeListener(listener);
+ super.removePropertyChangeListener(listener);
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public static enum FilterTypeEnum {
+ NoFilter(Texts.get("NoFilter")), ProtocolFilter(Texts.get("ProtocolFilter")), ServiceFilter(Texts.get("ServiceFilter")), PortFilter(Texts.get("PortFilter"));
+
+ private String m_label;
+
+ private FilterTypeEnum(String label) {
+ m_label = label;
+ }
+
+ public String getLabel() {
+ return m_label;
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/HandlerNewWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/HandlerNewWizardPage.java
index 2aafad317..bc3de5f7f 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/HandlerNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/HandlerNewWizardPage.java
@@ -1,528 +1,528 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
-import javax.xml.ws.handler.LogicalHandler;
-import javax.xml.ws.handler.soap.SOAPHandler;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
-import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.tooltip.JavadocTooltip;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-@SuppressWarnings("restriction")
-public class HandlerNewWizardPage extends AbstractWorkspaceWizardPage {
-
- public static final String PROP_TYPE_NAME = "typeName";
- public static final String PROP_PACKAGE_NAME = "packageName";
- public static final String PROP_TRANSACTIONAL = "transactional";
- public static final String PROP_SESSION_TYPE = "sessionFactory";
- public static final String PROP_SUPER_TYPE = "superType";
-
- private BasicPropertySupport m_propertySupport;
-
- private IScoutBundle m_bundle;
-
- private StyledTextField m_typeNameField;
- private StyledTextField m_superTypeField;
- private StyledTextField m_packageField;
- private Button m_packageBrowseButton;
- private Button m_superTypeBrowseButton;
- private JavadocTooltip m_tooltipSuperType;
-
- private Button m_transactionalButton;
- private StyledTextField m_sessionFactoryField;
- private Text m_descriptionSessionFactory;
- private Button m_sessionFactoryBrowseButton;
- private JavadocTooltip m_tooltipSessionFactory;
-
- public HandlerNewWizardPage(IScoutBundle bundle) {
- super(HandlerNewWizardPage.class.getName());
- setTitle(Texts.get("CreateHandler"));
- setDescription(Texts.get("ByClickingFinishHandlerIsCreated"));
-
- m_bundle = bundle;
- m_propertySupport = new BasicPropertySupport(this);
- setPackageName(JaxWsSdkUtility.getRecommendedHandlerPackageName(m_bundle));
- setTransactional(true);
-
- try {
- String defaultSessionFactory = (String) TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getMethod(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, new String[0]).getDefaultValue().getValue();
- setSessionFactoryType(TypeUtility.getType(defaultSessionFactory));
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- setSuperType(TypeUtility.getType(SOAPHandler.class.getName()));
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("Name"));
- m_typeNameField.setReadOnlySuffix(JaxWsConstants.SUFFIX_HANDLER);
- m_typeNameField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setTypeNameInternal(m_typeNameField.getText());
- pingStateChanging();
- }
- });
-
- m_superTypeField = getFieldToolkit().createStyledTextField(parent, Texts.get("SuperType"));
- if (TypeUtility.exists(getSuperType())) {
- m_superTypeField.setText(getSuperType().getElementName());
- }
- m_superTypeField.setEditable(false);
- m_tooltipSuperType = new JavadocTooltip(m_superTypeField.getTextComponent());
- updateJavaDoc(m_tooltipSuperType, getSuperType());
-
- m_superTypeBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
- m_superTypeBrowseButton.setText(Texts.get("Browse"));
- m_superTypeBrowseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- IJavaSearchScope searchScope = createSuperTypeSearchScope();
-
- SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES | IJavaElementSearchConstants.CONSIDER_INTERFACES, false, "*.*");
- dialog.setTitle(Texts.get("SuperType"));
- dialog.setMessage(Texts.get("ChooseXY", Texts.get("SuperType")));
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- IType type = (IType) dialog.getResult()[0];
- setSuperType(type);
- }
- }
- }
- catch (JavaModelException exception) {
- JaxWsSdk.logError(exception);
- }
- }
- });
-
- m_packageField = getFieldToolkit().createStyledTextField(parent, Texts.get("Package"));
- m_packageField.setText(getPackageName());
- m_packageField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setPackageNameInternal(m_packageField.getText());
- pingStateChanging();
- }
- });
-
- m_packageBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
- m_packageBrowseButton.setText(Texts.get("Browse"));
- m_packageBrowseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IPackageFragment[] packageFragment = openBrowsePackagesDialog();
- if (packageFragment != null && packageFragment.length > 0) {
- setPackageName(packageFragment[0].getElementName());
- }
- }
- });
-
- m_transactionalButton = new Button(parent, SWT.CHECK);
- m_transactionalButton.setText(Texts.get("RunHandlerInScoutTransaction"));
- m_transactionalButton.setSelection(isTransactional());
- m_transactionalButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- setTransactionalInternal(m_transactionalButton.getSelection());
- m_sessionFactoryBrowseButton.setEnabled(isTransactional());
- m_sessionFactoryField.setEnabled(isTransactional());
- }
- });
-
- m_descriptionSessionFactory = new Text(parent, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
- m_descriptionSessionFactory.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- m_descriptionSessionFactory.setText(Texts.get("DescriptionHandlerSession"));
-
- m_sessionFactoryField = getFieldToolkit().createStyledTextField(parent, Texts.get("SessionFactory"));
- if (TypeUtility.exists(getSuperType())) {
- m_sessionFactoryField.setText(getSessionFactoryType().getElementName());
- }
- m_sessionFactoryField.setEditable(false);
- m_tooltipSessionFactory = new JavadocTooltip(m_sessionFactoryField.getTextComponent());
- updateJavaDoc(m_tooltipSessionFactory, getSessionFactoryType());
-
- m_sessionFactoryBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
- m_sessionFactoryBrowseButton.setText(Texts.get("Browse"));
- m_sessionFactoryBrowseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- IJavaSearchScope searchScope = createSubClassesSearchScope(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory));
-
- SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*.*");
- dialog.setTitle(Texts.get("SessionFactory"));
- dialog.setMessage(Texts.get("ChooseXY", Texts.get("SessionFactory")));
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- IType type = (IType) dialog.getResult()[0];
- setSessionFactoryType(type);
- }
- }
- }
- catch (JavaModelException exception) {
- JaxWsSdk.logError(exception);
- }
- }
- });
-
- // layout
- parent.setLayout(new FormLayout());
-
- FormData formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_typeNameField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_typeNameField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_packageField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_packageField, 0, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_packageBrowseButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_packageBrowseButton, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_superTypeField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_superTypeField, -2, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_superTypeBrowseButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_superTypeBrowseButton, 25, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_transactionalButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_transactionalButton, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 2);
- formData.right = new FormAttachment(100, 0);
- m_descriptionSessionFactory.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_descriptionSessionFactory, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_sessionFactoryField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_sessionFactoryField, -2, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_sessionFactoryBrowseButton.setLayoutData(formData);
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- validateType(multiStatus);
-
- if (isTransactional() && !TypeUtility.exists(getSessionFactoryType())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("SessionFactory"))));
- }
- }
-
- protected void validateType(MultiStatus multiStatus) {
- // package
- if (StringUtility.isNullOrEmpty(getPackageName())) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("UsageOfDefaultPackageDiscouraged")));
- }
- else {
- multiStatus.add(JavaConventionsUtil.validatePackageName(getPackageName(), m_bundle.getJavaProject()));
-
- String recommendedPackageName = JaxWsSdkUtility.getRecommendedHandlerPackageName(m_bundle);
- if (!getPackageName().equals(recommendedPackageName)) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("ByConventionXShouldByY", Texts.get("Package"), recommendedPackageName)));
- }
- }
-
- // name
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(JaxWsConstants.SUFFIX_HANDLER)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("Name"))));
- }
- else {
- multiStatus.add(JavaConventionsUtil.validateJavaTypeName(getTypeName(), m_bundle.getJavaProject()));
- if (Character.isLowerCase(getTypeName().charAt(0))) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("LowerCaseTypeName")));
- }
- }
- if (multiStatus.getSeverity() < IStatus.ERROR) {
- try {
- String fqn = StringUtility.join(".", getPackageName(), getTypeName());
- if (TypeUtility.existsType(fqn)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("TypeAlreadyExsits", fqn)));
- }
- }
- catch (Exception e) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidJavaType", getTypeName())));
- }
- }
- }
-
- public void setTransactional(boolean transactional) {
- try {
- setStateChanging(true);
- setTransactionalInternal(transactional);
- if (isControlCreated()) {
- m_transactionalButton.setSelection(transactional);
- m_sessionFactoryBrowseButton.setEnabled(isTransactional());
- m_sessionFactoryField.setEnabled(isTransactional());
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setTransactionalInternal(boolean transactional) {
- m_propertySupport.setPropertyBool(PROP_TRANSACTIONAL, transactional);
- }
-
- public boolean isTransactional() {
- return m_propertySupport.getPropertyBool(PROP_TRANSACTIONAL);
- }
-
- private void updateJavaDoc(JavadocTooltip javadocTooltip, IType type) {
- try {
- javadocTooltip.setMember(null);
- if (TypeUtility.exists(type)) {
- javadocTooltip.setMember(type);
- }
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("Could not render tooltip", e);
- }
- }
-
- public void setSessionFactoryType(IType sessionFactoryType) {
- try {
- setStateChanging(true);
- setSessionFactoryTypeInternal(sessionFactoryType);
- if (isControlCreated()) {
- if (sessionFactoryType != null) {
- m_sessionFactoryField.setText(sessionFactoryType.getElementName());
- }
- else {
- m_sessionFactoryField.setText("");
- }
- updateJavaDoc(m_tooltipSessionFactory, getSessionFactoryType());
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setSessionFactoryTypeInternal(IType sessionFactoryType) {
- m_propertySupport.setProperty(PROP_SESSION_TYPE, sessionFactoryType);
- }
-
- public IType getSessionFactoryType() {
- return (IType) m_propertySupport.getProperty(PROP_SESSION_TYPE);
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- setSuperTypeInternal(superType);
- if (isControlCreated()) {
- if (superType != null) {
- m_superTypeField.setText(superType.getElementName());
- }
- else {
- m_superTypeField.setText("");
- }
- updateJavaDoc(m_tooltipSuperType, getSuperType());
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setSuperTypeInternal(IType superType) {
- m_propertySupport.setProperty(PROP_SUPER_TYPE, superType);
- }
-
- public IType getSuperType() {
- return (IType) m_propertySupport.getProperty(PROP_SUPER_TYPE);
- }
-
- public void setTypeName(String typeName) {
- try {
- typeName = JaxWsSdkUtility.toStartWithUpperCase(typeName);
-
- setStateChanging(true);
- setTypeNameInternal(typeName);
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setTypeNameInternal(String typeName) {
- m_propertySupport.setProperty(PROP_TYPE_NAME, typeName);
- }
-
- public String getTypeName() {
- return m_propertySupport.getPropertyString(PROP_TYPE_NAME);
- }
-
- public void setPackageName(String packageName) {
- try {
- setStateChanging(true);
- setPackageNameInternal(packageName);
- if (isControlCreated()) {
- m_packageField.setText(packageName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setPackageNameInternal(String packageName) {
- m_propertySupport.setPropertyString(PROP_PACKAGE_NAME, packageName);
- }
-
- public String getPackageName() {
- return m_propertySupport.getPropertyString(PROP_PACKAGE_NAME);
- }
-
- private IJavaSearchScope createSubClassesSearchScope(IType superType) {
- // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
- IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
- return SearchEngine.createJavaSearchScope(subTypes);
- }
-
- private IJavaSearchScope createSuperTypeSearchScope() {
- // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
- List<IType> types = new ArrayList<IType>();
- types.add(TypeUtility.getType(SOAPHandler.class.getName()));
- types.add(TypeUtility.getType(LogicalHandler.class.getName()));
-
- types.addAll(Arrays.asList(JaxWsSdkUtility.getJdtSubTypes(m_bundle, LogicalHandler.class.getName(), true, true, false, false)));
- types.addAll(Arrays.asList(JaxWsSdkUtility.getJdtSubTypes(m_bundle, SOAPHandler.class.getName(), true, true, false, false)));
-
- IType authHandlerProv = TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider);
- IType authHandlerCons = TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer);
-
- // remove authentication handlers (provider)
- IType[] providerAuthHandlers = JaxWsSdkUtility.getJdtSubTypes(m_bundle, authHandlerProv.getFullyQualifiedName(), true, true, false, false);
- types.removeAll(Arrays.asList(providerAuthHandlers));
- types.remove(TypeUtility.getType(authHandlerProv.getFullyQualifiedName()));
-
- // remove authentication handlers (consumer)
- IType[] consumerAuthHandlers = JaxWsSdkUtility.getJdtSubTypes(m_bundle, authHandlerCons.getFullyQualifiedName(), true, true, false, false);
- types.removeAll(Arrays.asList(consumerAuthHandlers));
- types.remove(TypeUtility.getType(authHandlerCons.getFullyQualifiedName()));
-
- // remove internal classes
- Iterator<IType> iterator = types.iterator();
- while (iterator.hasNext()) {
- IType candidate = iterator.next();
- if (Signature.getQualifier(candidate.getFullyQualifiedName()).contains("internal")) {
- iterator.remove();
- }
- }
-
- JaxWsSdkUtility.sortTypesByName(types, true);
-
- return SearchEngine.createJavaSearchScope(types.toArray(new IType[types.size()]));
- }
-
- private IPackageFragment[] openBrowsePackagesDialog() {
- IPackageFragment[] packageFragments = null;
- IRunnableContext context = new BusyIndicatorRunnableContext();
- SelectionDialog dialog = JavaUI.createPackageDialog(ScoutSdkUi.getShell(), context, m_bundle.getSearchScope(), false, true, null);
- dialog.setTitle(Texts.get("Package"));
- dialog.setMessage(Texts.get("ChoosePackageForHandler"));
-
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- packageFragments = Arrays.asList(dialog.getResult()).toArray(new IPackageFragment[0]);
- }
- }
- if (packageFragments != null) {
- return packageFragments;
- }
- else {
- return null;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.xml.ws.handler.LogicalHandler;
+import javax.xml.ws.handler.soap.SOAPHandler;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
+import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
+import org.eclipse.jdt.ui.IJavaElementSearchConstants;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.tooltip.JavadocTooltip;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+@SuppressWarnings("restriction")
+public class HandlerNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ public static final String PROP_TYPE_NAME = "typeName";
+ public static final String PROP_PACKAGE_NAME = "packageName";
+ public static final String PROP_TRANSACTIONAL = "transactional";
+ public static final String PROP_SESSION_TYPE = "sessionFactory";
+ public static final String PROP_SUPER_TYPE = "superType";
+
+ private BasicPropertySupport m_propertySupport;
+
+ private IScoutBundle m_bundle;
+
+ private StyledTextField m_typeNameField;
+ private StyledTextField m_superTypeField;
+ private StyledTextField m_packageField;
+ private Button m_packageBrowseButton;
+ private Button m_superTypeBrowseButton;
+ private JavadocTooltip m_tooltipSuperType;
+
+ private Button m_transactionalButton;
+ private StyledTextField m_sessionFactoryField;
+ private Text m_descriptionSessionFactory;
+ private Button m_sessionFactoryBrowseButton;
+ private JavadocTooltip m_tooltipSessionFactory;
+
+ public HandlerNewWizardPage(IScoutBundle bundle) {
+ super(HandlerNewWizardPage.class.getName());
+ setTitle(Texts.get("CreateHandler"));
+ setDescription(Texts.get("ByClickingFinishHandlerIsCreated"));
+
+ m_bundle = bundle;
+ m_propertySupport = new BasicPropertySupport(this);
+ setPackageName(JaxWsSdkUtility.getRecommendedHandlerPackageName(m_bundle));
+ setTransactional(true);
+
+ try {
+ String defaultSessionFactory = (String) TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getMethod(JaxWsRuntimeClasses.PROP_SWS_SESSION_FACTORY, new String[0]).getDefaultValue().getValue();
+ setSessionFactoryType(TypeUtility.getType(defaultSessionFactory));
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ setSuperType(TypeUtility.getType(SOAPHandler.class.getName()));
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("Name"));
+ m_typeNameField.setReadOnlySuffix(JaxWsConstants.SUFFIX_HANDLER);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setTypeNameInternal(m_typeNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createStyledTextField(parent, Texts.get("SuperType"));
+ if (TypeUtility.exists(getSuperType())) {
+ m_superTypeField.setText(getSuperType().getElementName());
+ }
+ m_superTypeField.setEditable(false);
+ m_tooltipSuperType = new JavadocTooltip(m_superTypeField.getTextComponent());
+ updateJavaDoc(m_tooltipSuperType, getSuperType());
+
+ m_superTypeBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
+ m_superTypeBrowseButton.setText(Texts.get("Browse"));
+ m_superTypeBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ IJavaSearchScope searchScope = createSuperTypeSearchScope();
+
+ SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES | IJavaElementSearchConstants.CONSIDER_INTERFACES, false, "*.*");
+ dialog.setTitle(Texts.get("SuperType"));
+ dialog.setMessage(Texts.get("ChooseXY", Texts.get("SuperType")));
+ dialog.setBlockOnOpen(true);
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ IType type = (IType) dialog.getResult()[0];
+ setSuperType(type);
+ }
+ }
+ }
+ catch (JavaModelException exception) {
+ JaxWsSdk.logError(exception);
+ }
+ }
+ });
+
+ m_packageField = getFieldToolkit().createStyledTextField(parent, Texts.get("Package"));
+ m_packageField.setText(getPackageName());
+ m_packageField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setPackageNameInternal(m_packageField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_packageBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
+ m_packageBrowseButton.setText(Texts.get("Browse"));
+ m_packageBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IPackageFragment[] packageFragment = openBrowsePackagesDialog();
+ if (packageFragment != null && packageFragment.length > 0) {
+ setPackageName(packageFragment[0].getElementName());
+ }
+ }
+ });
+
+ m_transactionalButton = new Button(parent, SWT.CHECK);
+ m_transactionalButton.setText(Texts.get("RunHandlerInScoutTransaction"));
+ m_transactionalButton.setSelection(isTransactional());
+ m_transactionalButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setTransactionalInternal(m_transactionalButton.getSelection());
+ m_sessionFactoryBrowseButton.setEnabled(isTransactional());
+ m_sessionFactoryField.setEnabled(isTransactional());
+ }
+ });
+
+ m_descriptionSessionFactory = new Text(parent, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
+ m_descriptionSessionFactory.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
+ m_descriptionSessionFactory.setText(Texts.get("DescriptionHandlerSession"));
+
+ m_sessionFactoryField = getFieldToolkit().createStyledTextField(parent, Texts.get("SessionFactory"));
+ if (TypeUtility.exists(getSuperType())) {
+ m_sessionFactoryField.setText(getSessionFactoryType().getElementName());
+ }
+ m_sessionFactoryField.setEditable(false);
+ m_tooltipSessionFactory = new JavadocTooltip(m_sessionFactoryField.getTextComponent());
+ updateJavaDoc(m_tooltipSessionFactory, getSessionFactoryType());
+
+ m_sessionFactoryBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
+ m_sessionFactoryBrowseButton.setText(Texts.get("Browse"));
+ m_sessionFactoryBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ IJavaSearchScope searchScope = createSubClassesSearchScope(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory));
+
+ SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*.*");
+ dialog.setTitle(Texts.get("SessionFactory"));
+ dialog.setMessage(Texts.get("ChooseXY", Texts.get("SessionFactory")));
+ dialog.setBlockOnOpen(true);
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ IType type = (IType) dialog.getResult()[0];
+ setSessionFactoryType(type);
+ }
+ }
+ }
+ catch (JavaModelException exception) {
+ JaxWsSdk.logError(exception);
+ }
+ }
+ });
+
+ // layout
+ parent.setLayout(new FormLayout());
+
+ FormData formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_typeNameField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_typeNameField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_packageField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_packageField, 0, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_packageBrowseButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_packageBrowseButton, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_superTypeField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_superTypeField, -2, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_superTypeBrowseButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_superTypeBrowseButton, 25, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_transactionalButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_transactionalButton, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 2);
+ formData.right = new FormAttachment(100, 0);
+ m_descriptionSessionFactory.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_descriptionSessionFactory, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_sessionFactoryField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_sessionFactoryField, -2, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_sessionFactoryBrowseButton.setLayoutData(formData);
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ validateType(multiStatus);
+
+ if (isTransactional() && !TypeUtility.exists(getSessionFactoryType())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("SessionFactory"))));
+ }
+ }
+
+ protected void validateType(MultiStatus multiStatus) {
+ // package
+ if (StringUtility.isNullOrEmpty(getPackageName())) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("UsageOfDefaultPackageDiscouraged")));
+ }
+ else {
+ multiStatus.add(JavaConventionsUtil.validatePackageName(getPackageName(), m_bundle.getJavaProject()));
+
+ String recommendedPackageName = JaxWsSdkUtility.getRecommendedHandlerPackageName(m_bundle);
+ if (!getPackageName().equals(recommendedPackageName)) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("ByConventionXShouldByY", Texts.get("Package"), recommendedPackageName)));
+ }
+ }
+
+ // name
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(JaxWsConstants.SUFFIX_HANDLER)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("Name"))));
+ }
+ else {
+ multiStatus.add(JavaConventionsUtil.validateJavaTypeName(getTypeName(), m_bundle.getJavaProject()));
+ if (Character.isLowerCase(getTypeName().charAt(0))) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("LowerCaseTypeName")));
+ }
+ }
+ if (multiStatus.getSeverity() < IStatus.ERROR) {
+ try {
+ String fqn = StringUtility.join(".", getPackageName(), getTypeName());
+ if (TypeUtility.existsType(fqn)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("TypeAlreadyExsits", fqn)));
+ }
+ }
+ catch (Exception e) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidJavaType", getTypeName())));
+ }
+ }
+ }
+
+ public void setTransactional(boolean transactional) {
+ try {
+ setStateChanging(true);
+ setTransactionalInternal(transactional);
+ if (isControlCreated()) {
+ m_transactionalButton.setSelection(transactional);
+ m_sessionFactoryBrowseButton.setEnabled(isTransactional());
+ m_sessionFactoryField.setEnabled(isTransactional());
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setTransactionalInternal(boolean transactional) {
+ m_propertySupport.setPropertyBool(PROP_TRANSACTIONAL, transactional);
+ }
+
+ public boolean isTransactional() {
+ return m_propertySupport.getPropertyBool(PROP_TRANSACTIONAL);
+ }
+
+ private void updateJavaDoc(JavadocTooltip javadocTooltip, IType type) {
+ try {
+ javadocTooltip.setMember(null);
+ if (TypeUtility.exists(type)) {
+ javadocTooltip.setMember(type);
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("Could not render tooltip", e);
+ }
+ }
+
+ public void setSessionFactoryType(IType sessionFactoryType) {
+ try {
+ setStateChanging(true);
+ setSessionFactoryTypeInternal(sessionFactoryType);
+ if (isControlCreated()) {
+ if (sessionFactoryType != null) {
+ m_sessionFactoryField.setText(sessionFactoryType.getElementName());
+ }
+ else {
+ m_sessionFactoryField.setText("");
+ }
+ updateJavaDoc(m_tooltipSessionFactory, getSessionFactoryType());
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setSessionFactoryTypeInternal(IType sessionFactoryType) {
+ m_propertySupport.setProperty(PROP_SESSION_TYPE, sessionFactoryType);
+ }
+
+ public IType getSessionFactoryType() {
+ return (IType) m_propertySupport.getProperty(PROP_SESSION_TYPE);
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ setSuperTypeInternal(superType);
+ if (isControlCreated()) {
+ if (superType != null) {
+ m_superTypeField.setText(superType.getElementName());
+ }
+ else {
+ m_superTypeField.setText("");
+ }
+ updateJavaDoc(m_tooltipSuperType, getSuperType());
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setSuperTypeInternal(IType superType) {
+ m_propertySupport.setProperty(PROP_SUPER_TYPE, superType);
+ }
+
+ public IType getSuperType() {
+ return (IType) m_propertySupport.getProperty(PROP_SUPER_TYPE);
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ typeName = JaxWsSdkUtility.toStartWithUpperCase(typeName);
+
+ setStateChanging(true);
+ setTypeNameInternal(typeName);
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setTypeNameInternal(String typeName) {
+ m_propertySupport.setProperty(PROP_TYPE_NAME, typeName);
+ }
+
+ public String getTypeName() {
+ return m_propertySupport.getPropertyString(PROP_TYPE_NAME);
+ }
+
+ public void setPackageName(String packageName) {
+ try {
+ setStateChanging(true);
+ setPackageNameInternal(packageName);
+ if (isControlCreated()) {
+ m_packageField.setText(packageName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setPackageNameInternal(String packageName) {
+ m_propertySupport.setPropertyString(PROP_PACKAGE_NAME, packageName);
+ }
+
+ public String getPackageName() {
+ return m_propertySupport.getPropertyString(PROP_PACKAGE_NAME);
+ }
+
+ private IJavaSearchScope createSubClassesSearchScope(IType superType) {
+ // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
+ IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
+ return SearchEngine.createJavaSearchScope(subTypes);
+ }
+
+ private IJavaSearchScope createSuperTypeSearchScope() {
+ // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
+ List<IType> types = new ArrayList<IType>();
+ types.add(TypeUtility.getType(SOAPHandler.class.getName()));
+ types.add(TypeUtility.getType(LogicalHandler.class.getName()));
+
+ types.addAll(Arrays.asList(JaxWsSdkUtility.getJdtSubTypes(m_bundle, LogicalHandler.class.getName(), true, true, false, false)));
+ types.addAll(Arrays.asList(JaxWsSdkUtility.getJdtSubTypes(m_bundle, SOAPHandler.class.getName(), true, true, false, false)));
+
+ IType authHandlerProv = TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider);
+ IType authHandlerCons = TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer);
+
+ // remove authentication handlers (provider)
+ IType[] providerAuthHandlers = JaxWsSdkUtility.getJdtSubTypes(m_bundle, authHandlerProv.getFullyQualifiedName(), true, true, false, false);
+ types.removeAll(Arrays.asList(providerAuthHandlers));
+ types.remove(TypeUtility.getType(authHandlerProv.getFullyQualifiedName()));
+
+ // remove authentication handlers (consumer)
+ IType[] consumerAuthHandlers = JaxWsSdkUtility.getJdtSubTypes(m_bundle, authHandlerCons.getFullyQualifiedName(), true, true, false, false);
+ types.removeAll(Arrays.asList(consumerAuthHandlers));
+ types.remove(TypeUtility.getType(authHandlerCons.getFullyQualifiedName()));
+
+ // remove internal classes
+ Iterator<IType> iterator = types.iterator();
+ while (iterator.hasNext()) {
+ IType candidate = iterator.next();
+ if (Signature.getQualifier(candidate.getFullyQualifiedName()).contains("internal")) {
+ iterator.remove();
+ }
+ }
+
+ JaxWsSdkUtility.sortTypesByName(types, true);
+
+ return SearchEngine.createJavaSearchScope(types.toArray(new IType[types.size()]));
+ }
+
+ private IPackageFragment[] openBrowsePackagesDialog() {
+ IPackageFragment[] packageFragments = null;
+ IRunnableContext context = new BusyIndicatorRunnableContext();
+ SelectionDialog dialog = JavaUI.createPackageDialog(ScoutSdkUi.getShell(), context, m_bundle.getSearchScope(), false, true, null);
+ dialog.setTitle(Texts.get("Package"));
+ dialog.setMessage(Texts.get("ChoosePackageForHandler"));
+
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ packageFragments = Arrays.asList(dialog.getResult()).toArray(new IPackageFragment[0]);
+ }
+ }
+ if (packageFragments != null) {
+ return packageFragments;
+ }
+ else {
+ return null;
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/JaxWsServletRegistrationWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/JaxWsServletRegistrationWizardPage.java
index 9193c4f86..4686725ff 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/JaxWsServletRegistrationWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/JaxWsServletRegistrationWizardPage.java
@@ -1,366 +1,366 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.beans.PropertyChangeListener;
-import java.util.HashMap;
-import java.util.Map;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.SimpleLabelProvider;
-import org.eclipse.scout.sdk.ui.fields.proposal.SimpleProposal;
-import org.eclipse.scout.sdk.ui.fields.proposal.SimpleProposalProvider;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.internal.SdkIcons;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility.Registration;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-
-public class JaxWsServletRegistrationWizardPage extends AbstractWorkspaceWizardPage {
-
- public static final String PROP_REGISTRATION_BUNDLE = "registrationBundle";
- public static final String PROP_ALIAS = "alias";
- public static final String PROP_URL_PATTERN = "urlPattern";
-
- private BasicPropertySupport m_propertySupport;
-
- private ProposalTextField m_registrationBundleField;
- private StyledTextField m_aliasField;
- private Composite m_descriptionContainer;
- private Text m_descriptionField;
- private StyledTextField m_urlPatternField;
-
- private IScoutBundle m_bundle;
- private IScoutBundle[] m_candidateBundles;
- private Map<IScoutBundle, String> m_servletRegistrationAliasMap;
-
- private boolean m_urlPatternVisible;
-
- public JaxWsServletRegistrationWizardPage(IScoutBundle bundle, boolean urlPatternVisible) {
- super(JaxWsServletRegistrationWizardPage.class.getName());
- setDescription(Texts.get("DescriptionJaxWsBundleConfiguration"));
- m_urlPatternVisible = urlPatternVisible;
- m_propertySupport = new BasicPropertySupport(this);
- m_bundle = bundle;
- m_candidateBundles = ServletRegistrationUtility.getJaxWsBundlesOnClasspath(m_bundle);
- m_servletRegistrationAliasMap = new HashMap<IScoutBundle, String>();
- Registration[] registrations = ServletRegistrationUtility.getJaxWsServletRegistrationsOnClasspath(m_bundle);
- for (Registration registration : registrations) {
- m_servletRegistrationAliasMap.put(registration.getBundle(), registration.getAlias());
- }
- }
-
- @Override
- protected void createContent(Composite parent) {
- // registration bundle
- m_registrationBundleField = getFieldToolkit().createProposalField(parent, Texts.get("ServletRegistrationBundle"));
- m_registrationBundleField.setLabelProvider(new SimpleLabelProvider());
- SimpleProposal[] proposals = new SimpleProposal[m_candidateBundles.length];
- for (int i = 0; i < proposals.length; i++) {
- proposals[i] = new P_BundleProposal(m_candidateBundles[i]);
- }
- m_registrationBundleField.setContentProvider(new SimpleProposalProvider(proposals));
- m_registrationBundleField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- Object proposal = event.proposal;
- if (proposal != null) {
- IScoutBundle registrationBundle = ((P_BundleProposal) proposal).getBundle();
- setRegistrationBundleInternal(registrationBundle);
-
- if (m_servletRegistrationAliasMap.containsKey(registrationBundle)) {
- // only allow to change the alias if the bundle that hosts the servlet registration is the bundle of the caller itself or has no alias defined
- m_aliasField.setEnabled(registrationBundle.getBundleName().equals(getBundle().getBundleName()) || !StringUtility.hasText(m_servletRegistrationAliasMap.get(registrationBundle)));
- setAlias(StringUtility.nvl(m_servletRegistrationAliasMap.get(registrationBundle), JaxWsConstants.JAX_WS_ALIAS));
- }
- else {
- // the servlet registration does not exist yet in that bundle
- m_aliasField.setEnabled(true);
- setAlias(JaxWsConstants.JAX_WS_ALIAS);
- }
- }
- else {
- setRegistrationBundleInternal(null);
- }
- pingStateChanging();
- }
- });
-
- // servlet alias
- m_aliasField = getFieldToolkit().createStyledTextField(parent, Texts.get("ServletAlias"));
- m_aliasField.setReadOnlyPrefix("/");
- m_aliasField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setAliasInternal(m_aliasField.getText());
- m_urlPatternField.setReadOnlyPrefix(JaxWsSdkUtility.normalizePath(m_aliasField.getText(), SeparatorType.BothType));
- pingStateChanging();
- }
- });
-
- // description
- m_descriptionContainer = new Composite(parent, SWT.NONE);
- m_descriptionField = new Text(m_descriptionContainer, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
- m_descriptionField.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- m_descriptionField.setText(Texts.get("DescriptionChangeJaxWsServletAlias"));
-
- // URL pattern
- m_urlPatternField = getFieldToolkit().createStyledTextField(parent, Texts.get("UrlPattern"));
- m_urlPatternField.setReadOnlyPrefix(JaxWsSdkUtility.normalizePath(StringUtility.emptyIfNull(getAlias()), SeparatorType.BothType));
- m_urlPatternField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setUrlPatternInternal(m_urlPatternField.getText());
- pingStateChanging();
- }
- });
- m_urlPatternField.setText(StringUtility.emptyIfNull(getUrlPattern()));
-
- // must be after other fields are created
- IScoutBundle registrationBundle = getRegistrationBundle();
- if (registrationBundle != null) {
- m_registrationBundleField.acceptProposal(new P_BundleProposal(registrationBundle));
- }
- m_aliasField.setText(StringUtility.emptyIfNull(getAlias()));
-
- // layout
- parent.setLayout(new GridLayout(1, true));
-
- // servlet
- GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.exclude = (m_candidateBundles.length <= 1);
- m_registrationBundleField.setLayoutData(gd);
- // alias
- gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- m_aliasField.setLayoutData(gd);
- // description
- gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- m_descriptionContainer.setLayoutData(gd);
- // url pattern
- gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
- gd.exclude = !m_urlPatternVisible;
- gd.verticalIndent = 15;
- m_urlPatternField.setLayoutData(gd);
-
- m_descriptionContainer.setLayout(new FormLayout());
- FormData formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(40, 2);
- formData.right = new FormAttachment(100, 0);
- m_descriptionField.setLayoutData(formData);
- }
-
- public void initializeDefaultValues(IScoutBundle bundle) {
- Registration registration = ServletRegistrationUtility.getServletRegistration(m_bundle);
- if (registration == null || StringUtility.isNullOrEmpty(registration.getAlias())) {
- Registration[] candidateRegistrations = ServletRegistrationUtility.getJaxWsServletRegistrationsOnClasspath(m_bundle);
- IScoutBundle[] candidateBundles = ServletRegistrationUtility.getJaxWsBundlesOnClasspath(m_bundle);
- if (candidateRegistrations.length > 0) {
- Registration candidateRegistration = candidateRegistrations[0];
- setRegistrationBundle(candidateRegistration.getBundle());
- setAlias(candidateRegistration.getAlias());
- }
- else if (candidateBundles.length > 0) {
- setRegistrationBundle(candidateBundles[0]);
- setAlias(JaxWsConstants.JAX_WS_ALIAS);
- }
- else {
- setAlias(JaxWsConstants.JAX_WS_ALIAS);
- }
- }
- else {
- setAlias(registration.getAlias());
- setRegistrationBundle(registration.getBundle());
- }
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- if (!isControlCreated()) {
- return;
- }
- if (getRegistrationBundle() == null) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, "Please choose the bundle to contain the JAX-WS servlet registration"));
- return;
- }
- if (StringUtility.isNullOrEmpty(getAlias()) || getAlias().equals("/")) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("EnterJaxWsAlias")));
- return;
- }
- if (!getAlias().startsWith("/")) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("jaxWsAliasMustStartWithSlash")));
- return;
- }
- if (getAlias().endsWith("/")) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("jaxWsAliasMustNotEndWithSlash")));
- return;
- }
- if (!getAlias().matches("[\\w\\-/]*")) { // check for illegal characters
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidServletAliasX", getAlias())));
- return;
- }
-
- for (Registration registration : ServletRegistrationUtility.getJaxWsServletRegistrationsOnClasspath(m_bundle)) {
- if (!CompareUtility.equals(getRegistrationBundle().getBundleName(), registration.getBundle().getBundleName()) && CompareUtility.equals(registration.getAlias(), getAlias())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, "There already exists a JAX-WS servlet registration with the given alias in the bundle '" + registration.getBundle().getBundleName() + "'.\nPlease choose this bundle or another alias."));
- return;
- }
- }
-
- // URL pattern
- if (m_urlPatternVisible) {
- if (StringUtility.isNullOrEmpty(getUrlPattern()) || JaxWsSdkUtility.normalizePath(getUrlPattern(), SeparatorType.BothType).equals(JaxWsSdkUtility.normalizePath(getAlias(), SeparatorType.BothType))) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_urlPatternField.getLabelText())));
- return;
- }
- if (!getUrlPattern().startsWith(getAlias())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XshouldStartWithY", m_urlPatternField.getLabelText(), getAlias())));
- return;
- }
- if (!getUrlPattern().matches("[\\w\\-/]*")) { // check for illegal characters
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidUrlX", getUrlPattern())));
- return;
- }
- if (getUrlPattern().endsWith("/")) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, "URL pattern must not end with a '/'."));
- return;
- }
- // TODO check for duplicate URL patterns
- }
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.addPropertyChangeListener(listener);
- super.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.removePropertyChangeListener(listener);
- super.removePropertyChangeListener(listener);
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public IScoutBundle getRegistrationBundle() {
- return (IScoutBundle) m_propertySupport.getProperty(PROP_REGISTRATION_BUNDLE);
- }
-
- public void setRegistrationBundle(IScoutBundle registrationBundle) {
- try {
- setStateChanging(true);
- setRegistrationBundleInternal(registrationBundle);
-
- if (isControlCreated()) {
- if (registrationBundle != null) {
- m_registrationBundleField.acceptProposal(new P_BundleProposal(registrationBundle));
- }
- else {
- m_registrationBundleField.acceptProposal(null);
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setRegistrationBundleInternal(IScoutBundle registrationBundle) {
- m_propertySupport.setProperty(PROP_REGISTRATION_BUNDLE, registrationBundle);
- }
-
- public void setAlias(String alias) {
- try {
- setStateChanging(true);
- setAliasInternal(alias);
- if (isControlCreated()) {
- m_aliasField.setText(StringUtility.nvl(alias, ""));
- m_urlPatternField.setReadOnlyPrefix(JaxWsSdkUtility.normalizePath(StringUtility.nvl(alias, ""), SeparatorType.BothType));
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setAliasInternal(String alias) {
- m_propertySupport.setPropertyString(PROP_ALIAS, alias);
- }
-
- public String getAlias() {
- return m_propertySupport.getPropertyString(PROP_ALIAS);
- }
-
- public void setUrlPattern(String urlPattern) {
- try {
- setStateChanging(true);
- setUrlPatternInternal(urlPattern);
- if (isControlCreated()) {
- m_aliasField.setText(StringUtility.nvl(urlPattern, ""));
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setUrlPatternInternal(String urlPattern) {
- m_propertySupport.setPropertyString(PROP_URL_PATTERN, urlPattern);
- }
-
- public String getUrlPattern() {
- return m_propertySupport.getPropertyString(PROP_URL_PATTERN);
- }
-
- private class P_BundleProposal extends SimpleProposal {
-
- private static final String DATA_BUNDLE = "dataBundle";
-
- private P_BundleProposal(IScoutBundle bundle) {
- super(bundle.getBundleName(), ScoutSdkUi.getImage(SdkIcons.ServerBundle));
- setData(DATA_BUNDLE, bundle);
- }
-
- public IScoutBundle getBundle() {
- return (IScoutBundle) getData(DATA_BUNDLE);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.beans.PropertyChangeListener;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.SimpleLabelProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.SimpleProposal;
+import org.eclipse.scout.sdk.ui.fields.proposal.SimpleProposalProvider;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.internal.SdkIcons;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.ServletRegistrationUtility.Registration;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+public class JaxWsServletRegistrationWizardPage extends AbstractWorkspaceWizardPage {
+
+ public static final String PROP_REGISTRATION_BUNDLE = "registrationBundle";
+ public static final String PROP_ALIAS = "alias";
+ public static final String PROP_URL_PATTERN = "urlPattern";
+
+ private BasicPropertySupport m_propertySupport;
+
+ private ProposalTextField m_registrationBundleField;
+ private StyledTextField m_aliasField;
+ private Composite m_descriptionContainer;
+ private Text m_descriptionField;
+ private StyledTextField m_urlPatternField;
+
+ private IScoutBundle m_bundle;
+ private IScoutBundle[] m_candidateBundles;
+ private Map<IScoutBundle, String> m_servletRegistrationAliasMap;
+
+ private boolean m_urlPatternVisible;
+
+ public JaxWsServletRegistrationWizardPage(IScoutBundle bundle, boolean urlPatternVisible) {
+ super(JaxWsServletRegistrationWizardPage.class.getName());
+ setDescription(Texts.get("DescriptionJaxWsBundleConfiguration"));
+ m_urlPatternVisible = urlPatternVisible;
+ m_propertySupport = new BasicPropertySupport(this);
+ m_bundle = bundle;
+ m_candidateBundles = ServletRegistrationUtility.getJaxWsBundlesOnClasspath(m_bundle);
+ m_servletRegistrationAliasMap = new HashMap<IScoutBundle, String>();
+ Registration[] registrations = ServletRegistrationUtility.getJaxWsServletRegistrationsOnClasspath(m_bundle);
+ for (Registration registration : registrations) {
+ m_servletRegistrationAliasMap.put(registration.getBundle(), registration.getAlias());
+ }
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ // registration bundle
+ m_registrationBundleField = getFieldToolkit().createProposalField(parent, Texts.get("ServletRegistrationBundle"));
+ m_registrationBundleField.setLabelProvider(new SimpleLabelProvider());
+ SimpleProposal[] proposals = new SimpleProposal[m_candidateBundles.length];
+ for (int i = 0; i < proposals.length; i++) {
+ proposals[i] = new P_BundleProposal(m_candidateBundles[i]);
+ }
+ m_registrationBundleField.setContentProvider(new SimpleProposalProvider(proposals));
+ m_registrationBundleField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ Object proposal = event.proposal;
+ if (proposal != null) {
+ IScoutBundle registrationBundle = ((P_BundleProposal) proposal).getBundle();
+ setRegistrationBundleInternal(registrationBundle);
+
+ if (m_servletRegistrationAliasMap.containsKey(registrationBundle)) {
+ // only allow to change the alias if the bundle that hosts the servlet registration is the bundle of the caller itself or has no alias defined
+ m_aliasField.setEnabled(registrationBundle.getBundleName().equals(getBundle().getBundleName()) || !StringUtility.hasText(m_servletRegistrationAliasMap.get(registrationBundle)));
+ setAlias(StringUtility.nvl(m_servletRegistrationAliasMap.get(registrationBundle), JaxWsConstants.JAX_WS_ALIAS));
+ }
+ else {
+ // the servlet registration does not exist yet in that bundle
+ m_aliasField.setEnabled(true);
+ setAlias(JaxWsConstants.JAX_WS_ALIAS);
+ }
+ }
+ else {
+ setRegistrationBundleInternal(null);
+ }
+ pingStateChanging();
+ }
+ });
+
+ // servlet alias
+ m_aliasField = getFieldToolkit().createStyledTextField(parent, Texts.get("ServletAlias"));
+ m_aliasField.setReadOnlyPrefix("/");
+ m_aliasField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setAliasInternal(m_aliasField.getText());
+ m_urlPatternField.setReadOnlyPrefix(JaxWsSdkUtility.normalizePath(m_aliasField.getText(), SeparatorType.BothType));
+ pingStateChanging();
+ }
+ });
+
+ // description
+ m_descriptionContainer = new Composite(parent, SWT.NONE);
+ m_descriptionField = new Text(m_descriptionContainer, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
+ m_descriptionField.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
+ m_descriptionField.setText(Texts.get("DescriptionChangeJaxWsServletAlias"));
+
+ // URL pattern
+ m_urlPatternField = getFieldToolkit().createStyledTextField(parent, Texts.get("UrlPattern"));
+ m_urlPatternField.setReadOnlyPrefix(JaxWsSdkUtility.normalizePath(StringUtility.emptyIfNull(getAlias()), SeparatorType.BothType));
+ m_urlPatternField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setUrlPatternInternal(m_urlPatternField.getText());
+ pingStateChanging();
+ }
+ });
+ m_urlPatternField.setText(StringUtility.emptyIfNull(getUrlPattern()));
+
+ // must be after other fields are created
+ IScoutBundle registrationBundle = getRegistrationBundle();
+ if (registrationBundle != null) {
+ m_registrationBundleField.acceptProposal(new P_BundleProposal(registrationBundle));
+ }
+ m_aliasField.setText(StringUtility.emptyIfNull(getAlias()));
+
+ // layout
+ parent.setLayout(new GridLayout(1, true));
+
+ // servlet
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.exclude = (m_candidateBundles.length <= 1);
+ m_registrationBundleField.setLayoutData(gd);
+ // alias
+ gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ m_aliasField.setLayoutData(gd);
+ // description
+ gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ m_descriptionContainer.setLayoutData(gd);
+ // url pattern
+ gd = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+ gd.exclude = !m_urlPatternVisible;
+ gd.verticalIndent = 15;
+ m_urlPatternField.setLayoutData(gd);
+
+ m_descriptionContainer.setLayout(new FormLayout());
+ FormData formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(40, 2);
+ formData.right = new FormAttachment(100, 0);
+ m_descriptionField.setLayoutData(formData);
+ }
+
+ public void initializeDefaultValues(IScoutBundle bundle) {
+ Registration registration = ServletRegistrationUtility.getServletRegistration(m_bundle);
+ if (registration == null || StringUtility.isNullOrEmpty(registration.getAlias())) {
+ Registration[] candidateRegistrations = ServletRegistrationUtility.getJaxWsServletRegistrationsOnClasspath(m_bundle);
+ IScoutBundle[] candidateBundles = ServletRegistrationUtility.getJaxWsBundlesOnClasspath(m_bundle);
+ if (candidateRegistrations.length > 0) {
+ Registration candidateRegistration = candidateRegistrations[0];
+ setRegistrationBundle(candidateRegistration.getBundle());
+ setAlias(candidateRegistration.getAlias());
+ }
+ else if (candidateBundles.length > 0) {
+ setRegistrationBundle(candidateBundles[0]);
+ setAlias(JaxWsConstants.JAX_WS_ALIAS);
+ }
+ else {
+ setAlias(JaxWsConstants.JAX_WS_ALIAS);
+ }
+ }
+ else {
+ setAlias(registration.getAlias());
+ setRegistrationBundle(registration.getBundle());
+ }
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ if (!isControlCreated()) {
+ return;
+ }
+ if (getRegistrationBundle() == null) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, "Please choose the bundle to contain the JAX-WS servlet registration"));
+ return;
+ }
+ if (StringUtility.isNullOrEmpty(getAlias()) || getAlias().equals("/")) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("EnterJaxWsAlias")));
+ return;
+ }
+ if (!getAlias().startsWith("/")) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("jaxWsAliasMustStartWithSlash")));
+ return;
+ }
+ if (getAlias().endsWith("/")) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("jaxWsAliasMustNotEndWithSlash")));
+ return;
+ }
+ if (!getAlias().matches("[\\w\\-/]*")) { // check for illegal characters
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidServletAliasX", getAlias())));
+ return;
+ }
+
+ for (Registration registration : ServletRegistrationUtility.getJaxWsServletRegistrationsOnClasspath(m_bundle)) {
+ if (!CompareUtility.equals(getRegistrationBundle().getBundleName(), registration.getBundle().getBundleName()) && CompareUtility.equals(registration.getAlias(), getAlias())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, "There already exists a JAX-WS servlet registration with the given alias in the bundle '" + registration.getBundle().getBundleName() + "'.\nPlease choose this bundle or another alias."));
+ return;
+ }
+ }
+
+ // URL pattern
+ if (m_urlPatternVisible) {
+ if (StringUtility.isNullOrEmpty(getUrlPattern()) || JaxWsSdkUtility.normalizePath(getUrlPattern(), SeparatorType.BothType).equals(JaxWsSdkUtility.normalizePath(getAlias(), SeparatorType.BothType))) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_urlPatternField.getLabelText())));
+ return;
+ }
+ if (!getUrlPattern().startsWith(getAlias())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XshouldStartWithY", m_urlPatternField.getLabelText(), getAlias())));
+ return;
+ }
+ if (!getUrlPattern().matches("[\\w\\-/]*")) { // check for illegal characters
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidUrlX", getUrlPattern())));
+ return;
+ }
+ if (getUrlPattern().endsWith("/")) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, "URL pattern must not end with a '/'."));
+ return;
+ }
+ // TODO check for duplicate URL patterns
+ }
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.addPropertyChangeListener(listener);
+ super.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.removePropertyChangeListener(listener);
+ super.removePropertyChangeListener(listener);
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public IScoutBundle getRegistrationBundle() {
+ return (IScoutBundle) m_propertySupport.getProperty(PROP_REGISTRATION_BUNDLE);
+ }
+
+ public void setRegistrationBundle(IScoutBundle registrationBundle) {
+ try {
+ setStateChanging(true);
+ setRegistrationBundleInternal(registrationBundle);
+
+ if (isControlCreated()) {
+ if (registrationBundle != null) {
+ m_registrationBundleField.acceptProposal(new P_BundleProposal(registrationBundle));
+ }
+ else {
+ m_registrationBundleField.acceptProposal(null);
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setRegistrationBundleInternal(IScoutBundle registrationBundle) {
+ m_propertySupport.setProperty(PROP_REGISTRATION_BUNDLE, registrationBundle);
+ }
+
+ public void setAlias(String alias) {
+ try {
+ setStateChanging(true);
+ setAliasInternal(alias);
+ if (isControlCreated()) {
+ m_aliasField.setText(StringUtility.nvl(alias, ""));
+ m_urlPatternField.setReadOnlyPrefix(JaxWsSdkUtility.normalizePath(StringUtility.nvl(alias, ""), SeparatorType.BothType));
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setAliasInternal(String alias) {
+ m_propertySupport.setPropertyString(PROP_ALIAS, alias);
+ }
+
+ public String getAlias() {
+ return m_propertySupport.getPropertyString(PROP_ALIAS);
+ }
+
+ public void setUrlPattern(String urlPattern) {
+ try {
+ setStateChanging(true);
+ setUrlPatternInternal(urlPattern);
+ if (isControlCreated()) {
+ m_aliasField.setText(StringUtility.nvl(urlPattern, ""));
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setUrlPatternInternal(String urlPattern) {
+ m_propertySupport.setPropertyString(PROP_URL_PATTERN, urlPattern);
+ }
+
+ public String getUrlPattern() {
+ return m_propertySupport.getPropertyString(PROP_URL_PATTERN);
+ }
+
+ private class P_BundleProposal extends SimpleProposal {
+
+ private static final String DATA_BUNDLE = "dataBundle";
+
+ private P_BundleProposal(IScoutBundle bundle) {
+ super(bundle.getBundleName(), ScoutSdkUi.getImage(SdkIcons.ServerBundle));
+ setData(DATA_BUNDLE, bundle);
+ }
+
+ public IScoutBundle getBundle() {
+ return (IScoutBundle) getData(DATA_BUNDLE);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/ResourceSelectionWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/ResourceSelectionWizardPage.java
index ad5c16ad8..05d6fc007 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/ResourceSelectionWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/ResourceSelectionWizardPage.java
@@ -1,113 +1,113 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.util.LinkedList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.CellLabelProvider;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.CheckboxTableViewer;
-import org.eclipse.jface.viewers.ICheckStateListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-public class ResourceSelectionWizardPage extends AbstractWorkspaceWizardPage {
-
- private CheckboxTableViewer m_tableViewer;
- private List<ElementBean> m_elements;
-
- public ResourceSelectionWizardPage(String title, String description) {
- super(ResourceSelectionWizardPage.class.getName());
- setTitle(title);
- setDescription(description);
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_tableViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER);
- m_tableViewer.setContentProvider(new P_ContentProvider());
- m_tableViewer.setLabelProvider(new P_LabelProvider());
-
- m_tableViewer.addCheckStateListener(new ICheckStateListener() {
-
- @Override
- public void checkStateChanged(CheckStateChangedEvent event) {
- ElementBean element = (ElementBean) event.getElement();
- if (element.isMandatory()) {
- m_tableViewer.setChecked(element, true);
- }
- else {
- element.setChecked(event.getChecked());
- }
- }
- });
- m_tableViewer.setInput(m_elements);
-
- // preselect elements
- List<ElementBean> checkedElements = new LinkedList<ElementBean>();
- for (ElementBean element : m_elements) {
- if (element.isChecked()) {
- checkedElements.add(element);
- }
- }
- m_tableViewer.setCheckedElements(checkedElements.toArray(new ElementBean[checkedElements.size()]));
- }
-
- public List<ElementBean> getElements() {
- return m_elements;
- }
-
- public void setElements(List<ElementBean> elements) {
- m_elements = elements;
- }
-
- private class P_LabelProvider extends CellLabelProvider {
-
- @Override
- public void update(ViewerCell cell) {
- ElementBean element = (ElementBean) cell.getElement();
- cell.setText(element.getName());
- if (element.getImageDescriptor() != null) {
- cell.setImage(element.getImageDescriptor().createImage());
- }
- else {
- cell.setImage(null);
- }
- if (element.isMandatory()) {
- cell.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
- }
- }
- }
-
- public class P_ContentProvider implements IStructuredContentProvider {
-
- @Override
- @SuppressWarnings("unchecked")
- public Object[] getElements(Object inputElement) {
- List<ElementBean> elements = (List<ElementBean>) inputElement;
- return elements.toArray(new ElementBean[elements.size()]);
- }
-
- @Override
- public void dispose() {
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.CellLabelProvider;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTableViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+public class ResourceSelectionWizardPage extends AbstractWorkspaceWizardPage {
+
+ private CheckboxTableViewer m_tableViewer;
+ private List<ElementBean> m_elements;
+
+ public ResourceSelectionWizardPage(String title, String description) {
+ super(ResourceSelectionWizardPage.class.getName());
+ setTitle(title);
+ setDescription(description);
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_tableViewer = CheckboxTableViewer.newCheckList(parent, SWT.BORDER);
+ m_tableViewer.setContentProvider(new P_ContentProvider());
+ m_tableViewer.setLabelProvider(new P_LabelProvider());
+
+ m_tableViewer.addCheckStateListener(new ICheckStateListener() {
+
+ @Override
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ ElementBean element = (ElementBean) event.getElement();
+ if (element.isMandatory()) {
+ m_tableViewer.setChecked(element, true);
+ }
+ else {
+ element.setChecked(event.getChecked());
+ }
+ }
+ });
+ m_tableViewer.setInput(m_elements);
+
+ // preselect elements
+ List<ElementBean> checkedElements = new LinkedList<ElementBean>();
+ for (ElementBean element : m_elements) {
+ if (element.isChecked()) {
+ checkedElements.add(element);
+ }
+ }
+ m_tableViewer.setCheckedElements(checkedElements.toArray(new ElementBean[checkedElements.size()]));
+ }
+
+ public List<ElementBean> getElements() {
+ return m_elements;
+ }
+
+ public void setElements(List<ElementBean> elements) {
+ m_elements = elements;
+ }
+
+ private class P_LabelProvider extends CellLabelProvider {
+
+ @Override
+ public void update(ViewerCell cell) {
+ ElementBean element = (ElementBean) cell.getElement();
+ cell.setText(element.getName());
+ if (element.getImageDescriptor() != null) {
+ cell.setImage(element.getImageDescriptor().createImage());
+ }
+ else {
+ cell.setImage(null);
+ }
+ if (element.isMandatory()) {
+ cell.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW));
+ }
+ }
+ }
+
+ public class P_ContentProvider implements IStructuredContentProvider {
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public Object[] getElements(Object inputElement) {
+ List<ElementBean> elements = (List<ElementBean>) inputElement;
+ return elements.toArray(new ElementBean[elements.size()]);
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/SourceFolderNewWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/SourceFolderNewWizardPage.java
index e27b4f280..40ada9f32 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/SourceFolderNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/SourceFolderNewWizardPage.java
@@ -1,148 +1,148 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Composite;
-
-public class SourceFolderNewWizardPage extends AbstractWorkspaceWizardPage {
-
- public static final String PROP_SOURCE_FOLDER = "sourceFolder";
-
- private BasicPropertySupport m_propertySupport;
-
- private IScoutBundle m_bundle;
- private StyledTextField m_textField;
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public SourceFolderNewWizardPage() {
- super(SourceFolderNewWizardPage.class.getName());
- m_propertySupport = new BasicPropertySupport(this);
- setTitle(Texts.get("CreateNewSourceFolder"));
- setDescription(Texts.get("ByClickingFinishSourceFolderIsCreated"));
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_textField = new StyledTextField(parent);
- m_textField.setReadOnlyPrefix(m_bundle.getJavaProject().getPath().toPortableString() + "/");
- m_textField.setLabelText(Texts.get("SourceFolder"));
- m_textField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setSourceFolderInternal(m_textField.getText());
- pingStateChanging();
- }
- });
-
- // layout
- parent.setLayout(new FormLayout());
-
- FormData formData = new FormData();
- formData.left = new FormAttachment(0, 0);
- formData.top = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_textField.setLayoutData(formData);
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- if (StringUtility.isNullOrEmpty(getSourceFolder())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("EnterSourceFolder")));
- return;
- }
- IWorkspace workspace = m_bundle.getProject().getWorkspace();
- IStatus status = workspace.validatePath(getSourceFolder(), IResource.FOLDER);
- if (status.matches(IStatus.ERROR)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidSourceFolder")));
- return;
- }
-
- Path candidatePath = new Path(getSourceFolder());
- for (IPath path : getExistingSourcePaths()) {
- if (candidatePath.equals(path)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("SourceFolderAlreadyExsists")));
- return;
- }
- }
- }
-
- private Set<IPath> getExistingSourcePaths() {
- Set<IPath> sourceFolders = new HashSet<IPath>();
- try {
- for (IClasspathEntry classpathEntry : m_bundle.getJavaProject().getRawClasspath()) {
- if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
- sourceFolders.add(classpathEntry.getPath());
- }
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("Error occured while fetching source folders.", e);
- }
- return sourceFolders;
- }
-
- public void setSourceFolder(String sourceFolder) {
- try {
- setStateChanging(true);
- setSourceFolderInternal(sourceFolder);
- if (isControlCreated()) {
- m_textField.setText(sourceFolder);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setSourceFolderInternal(String sourceFolder) {
- m_propertySupport.setPropertyString(PROP_SOURCE_FOLDER, sourceFolder);
- }
-
- public String getSourceFolder() {
- return m_propertySupport.getPropertyString(PROP_SOURCE_FOLDER);
- }
-
- public Path getSourceFolderPath() {
- return new Path(m_propertySupport.getPropertyString(PROP_SOURCE_FOLDER));
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Composite;
+
+public class SourceFolderNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ public static final String PROP_SOURCE_FOLDER = "sourceFolder";
+
+ private BasicPropertySupport m_propertySupport;
+
+ private IScoutBundle m_bundle;
+ private StyledTextField m_textField;
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public SourceFolderNewWizardPage() {
+ super(SourceFolderNewWizardPage.class.getName());
+ m_propertySupport = new BasicPropertySupport(this);
+ setTitle(Texts.get("CreateNewSourceFolder"));
+ setDescription(Texts.get("ByClickingFinishSourceFolderIsCreated"));
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_textField = new StyledTextField(parent);
+ m_textField.setReadOnlyPrefix(m_bundle.getJavaProject().getPath().toPortableString() + "/");
+ m_textField.setLabelText(Texts.get("SourceFolder"));
+ m_textField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setSourceFolderInternal(m_textField.getText());
+ pingStateChanging();
+ }
+ });
+
+ // layout
+ parent.setLayout(new FormLayout());
+
+ FormData formData = new FormData();
+ formData.left = new FormAttachment(0, 0);
+ formData.top = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_textField.setLayoutData(formData);
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ if (StringUtility.isNullOrEmpty(getSourceFolder())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("EnterSourceFolder")));
+ return;
+ }
+ IWorkspace workspace = m_bundle.getProject().getWorkspace();
+ IStatus status = workspace.validatePath(getSourceFolder(), IResource.FOLDER);
+ if (status.matches(IStatus.ERROR)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidSourceFolder")));
+ return;
+ }
+
+ Path candidatePath = new Path(getSourceFolder());
+ for (IPath path : getExistingSourcePaths()) {
+ if (candidatePath.equals(path)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("SourceFolderAlreadyExsists")));
+ return;
+ }
+ }
+ }
+
+ private Set<IPath> getExistingSourcePaths() {
+ Set<IPath> sourceFolders = new HashSet<IPath>();
+ try {
+ for (IClasspathEntry classpathEntry : m_bundle.getJavaProject().getRawClasspath()) {
+ if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ sourceFolders.add(classpathEntry.getPath());
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("Error occured while fetching source folders.", e);
+ }
+ return sourceFolders;
+ }
+
+ public void setSourceFolder(String sourceFolder) {
+ try {
+ setStateChanging(true);
+ setSourceFolderInternal(sourceFolder);
+ if (isControlCreated()) {
+ m_textField.setText(sourceFolder);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setSourceFolderInternal(String sourceFolder) {
+ m_propertySupport.setPropertyString(PROP_SOURCE_FOLDER, sourceFolder);
+ }
+
+ public String getSourceFolder() {
+ return m_propertySupport.getPropertyString(PROP_SOURCE_FOLDER);
+ }
+
+ public Path getSourceFolderPath() {
+ return new Path(m_propertySupport.getPropertyString(PROP_SOURCE_FOLDER));
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/TypeNewWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/TypeNewWizardPage.java
index 610d7b47e..0334a5e46 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/TypeNewWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/TypeNewWizardPage.java
@@ -1,491 +1,491 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
-import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.tooltip.JavadocTooltip;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-@SuppressWarnings("restriction")
-public class TypeNewWizardPage extends AbstractWorkspaceWizardPage {
-
- public static final String PROP_TYPE_NAME = "typeName";
- public static final String PROP_PACKAGE_NAME = "packageName";
- public static final String PROP_INTERFACE_TYPE = "interfaceType";
- public static final String PROP_SUPER_TYPE = "superType";
-
- private BasicPropertySupport m_propertySupport;
-
- private IScoutBundle m_bundle;
-
- private String m_elementName;
- private String m_typeSuffix;
- private String m_recommendedPackageFragment;
- private boolean m_allowModifyPackage;
- private boolean m_allowModifySuperType;
- private boolean m_allowModifyInterfaceType;
- private JavaSearchScopeFactory m_superTypeSearchScopeFactory;
- private JavaSearchScopeFactory m_interfaceTypeSearchScopeFactory;
-
- private StyledTextField m_typeNameField;
- private StyledTextField m_packageField;
- private Button m_packageBrowseButton;
- private StyledTextField m_superTypeField;
- private Button m_superTypeBrowseButton;
- private JavadocTooltip m_tooltipSuperType;
- private StyledTextField m_interfaceTypeField;
- private Button m_interfaceTypeBrowseButton;
- private JavadocTooltip m_tooltipInterfaceType;
-
- public TypeNewWizardPage(IScoutBundle bundle, String elementName) {
- super(TypeNewWizardPage.class.getName());
- setTitle(Texts.get("CreateNewX", elementName));
- setDescription(Texts.get("ByClickingFinishXIsCreated", getElementName()));
-
- m_bundle = bundle;
- m_elementName = elementName;
- m_propertySupport = new BasicPropertySupport(this);
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("Name"));
- m_typeNameField.setReadOnlySuffix(getTypeSuffix());
- m_typeNameField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setTypeNameInternal(m_typeNameField.getText());
- pingStateChanging();
- }
- });
-
- m_packageField = getFieldToolkit().createStyledTextField(parent, Texts.get("Package"));
- m_packageField.setText(getPackageName());
- m_packageField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setPackageNameInternal(m_packageField.getText());
- pingStateChanging();
- }
- });
- m_packageField.setEnabled(isAllowModifyPackage());
- m_packageField.setText(StringUtility.nvl(getRecommendedPackageFragment(), ""));
-
- m_packageBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
- m_packageBrowseButton.setText(Texts.get("Browse"));
- m_packageBrowseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IPackageFragment[] packageFragment = openBrowsePackagesDialog();
- if (packageFragment != null && packageFragment.length > 0) {
- setPackageName(packageFragment[0].getElementName());
- }
- }
- });
- m_packageBrowseButton.setEnabled(isAllowModifyPackage());
-
- m_interfaceTypeField = getFieldToolkit().createStyledTextField(parent, Texts.get("Interface"));
- if (TypeUtility.exists(getInterfaceType())) {
- m_interfaceTypeField.setText(getInterfaceType().getElementName());
- }
- m_interfaceTypeField.setEditable(false);
- m_interfaceTypeField.setEnabled(isAllowModifyInterfaceType());
- m_tooltipInterfaceType = new JavadocTooltip(m_interfaceTypeField.getTextComponent());
- updateJavaDoc(m_tooltipInterfaceType, getInterfaceType());
-
- m_interfaceTypeBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
- m_interfaceTypeBrowseButton.setText(Texts.get("Browse"));
- m_interfaceTypeBrowseButton.setEnabled(isAllowModifyInterfaceType());
- m_interfaceTypeBrowseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- IJavaSearchScope searchScope = getInterfaceTypeSearchScopeFactory().create();
-
- SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES | IJavaElementSearchConstants.CONSIDER_INTERFACES, false, "*.*");
- dialog.setTitle(Texts.get("Interface"));
- dialog.setMessage(Texts.get("ChooseXY", Texts.get("Interface")));
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- IType type = (IType) dialog.getResult()[0];
- setInterfaceType(type);
- }
- }
- }
- catch (JavaModelException exception) {
- JaxWsSdk.logError(exception);
- }
- }
- });
-
- m_superTypeField = getFieldToolkit().createStyledTextField(parent, Texts.get("SuperType"));
- if (TypeUtility.exists(getSuperType())) {
- m_superTypeField.setText(getSuperType().getElementName());
- }
- m_superTypeField.setEditable(false);
- m_superTypeField.setEnabled(isAllowModifySuperType());
- m_tooltipSuperType = new JavadocTooltip(m_superTypeField.getTextComponent());
- updateJavaDoc(m_tooltipSuperType, getSuperType());
-
- m_superTypeBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
- m_superTypeBrowseButton.setText(Texts.get("Browse"));
- m_superTypeBrowseButton.setEnabled(isAllowModifySuperType());
- m_superTypeBrowseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- IJavaSearchScope searchScope = getSuperTypeSearchScopeFactory().create();
-
- SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES | IJavaElementSearchConstants.CONSIDER_INTERFACES, false, "*.*");
- dialog.setTitle(Texts.get("SuperType"));
- dialog.setMessage(Texts.get("ChooseXY", Texts.get("SuperType")));
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- IType type = (IType) dialog.getResult()[0];
- setSuperType(type);
- }
- }
- }
- catch (JavaModelException exception) {
- JaxWsSdk.logError(exception);
- }
- }
- });
-
- // layout
- parent.setLayout(new FormLayout());
-
- FormData formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_typeNameField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_typeNameField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_packageField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_packageField, 0, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_packageBrowseButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_packageBrowseButton, 20, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_interfaceTypeField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_interfaceTypeField, -2, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_interfaceTypeBrowseButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_interfaceTypeField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_superTypeField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_superTypeField, -2, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_superTypeBrowseButton.setLayoutData(formData);
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- validateType(multiStatus);
- }
-
- protected void validateType(MultiStatus multiStatus) {
- // package
- if (StringUtility.isNullOrEmpty(getPackageName())) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("UsageOfDefaultPackageDiscouraged")));
- }
- else {
- multiStatus.add(JavaConventionsUtil.validatePackageName(getPackageName(), m_bundle.getJavaProject()));
-
- if (getRecommendedPackageFragment() != null && !getPackageName().equals(getRecommendedPackageFragment())) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("ByConventionXShouldByY", Texts.get("Package"), getRecommendedPackageFragment())));
- }
- }
-
- // name
- if (StringUtility.isNullOrEmpty(getTypeName()) || (getTypeSuffix() != null && getTypeName().equals(getTypeSuffix()))) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("Name"))));
- }
- else {
- multiStatus.add(JavaConventionsUtil.validateJavaTypeName(getTypeName(), m_bundle.getJavaProject()));
- if (Character.isLowerCase(getTypeName().charAt(0))) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("LowerCaseTypeName")));
- }
- }
- if (multiStatus.getSeverity() < IStatus.ERROR) {
- try {
- String fqn = StringUtility.join(".", getPackageName(), getTypeName());
- if (TypeUtility.existsType(fqn)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("TypeAlreadyExsits", fqn)));
- }
- }
- catch (Exception e) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidJavaType", getTypeName())));
- }
- }
- }
-
- private void updateJavaDoc(JavadocTooltip javadocTooltip, IType type) {
- try {
- javadocTooltip.setMember(null);
- if (TypeUtility.exists(type)) {
- javadocTooltip.setMember(type);
- }
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("Could not render tooltip", e);
- }
- }
-
- public void setSuperType(IType superType) {
- try {
- setStateChanging(true);
- setSuperTypeInternal(superType);
- if (isControlCreated()) {
- if (superType != null) {
- m_superTypeField.setText(superType.getElementName());
- }
- else {
- m_superTypeField.setText("");
- }
- updateJavaDoc(m_tooltipSuperType, getSuperType());
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setSuperTypeInternal(IType superType) {
- m_propertySupport.setProperty(PROP_SUPER_TYPE, superType);
- }
-
- public IType getSuperType() {
- return (IType) m_propertySupport.getProperty(PROP_SUPER_TYPE);
- }
-
- public void setInterfaceType(IType interfaceType) {
- try {
- setStateChanging(true);
- setInterfaceTypeInternal(interfaceType);
- if (isControlCreated()) {
- if (interfaceType != null) {
- m_interfaceTypeField.setText(interfaceType.getElementName());
- }
- else {
- m_interfaceTypeField.setText("");
- }
- updateJavaDoc(m_tooltipInterfaceType, getInterfaceType());
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setInterfaceTypeInternal(IType interfaceType) {
- m_propertySupport.setProperty(PROP_INTERFACE_TYPE, interfaceType);
- }
-
- public IType getInterfaceType() {
- return (IType) m_propertySupport.getProperty(PROP_INTERFACE_TYPE);
- }
-
- public void setTypeName(String typeName) {
- try {
- typeName = JaxWsSdkUtility.toStartWithUpperCase(typeName);
-
- setStateChanging(true);
- setTypeNameInternal(typeName);
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setTypeNameInternal(String typeName) {
- m_propertySupport.setProperty(PROP_TYPE_NAME, typeName);
- }
-
- public String getTypeName() {
- return m_propertySupport.getPropertyString(PROP_TYPE_NAME);
- }
-
- public void setPackageName(String packageName) {
- try {
- setStateChanging(true);
- setPackageNameInternal(packageName);
- if (isControlCreated()) {
- m_packageField.setText(packageName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setPackageNameInternal(String packageName) {
- m_propertySupport.setPropertyString(PROP_PACKAGE_NAME, packageName);
- }
-
- public String getPackageName() {
- return m_propertySupport.getPropertyString(PROP_PACKAGE_NAME);
- }
-
- private IPackageFragment[] openBrowsePackagesDialog() {
- IPackageFragment[] packageFragments = null;
- IRunnableContext context = new BusyIndicatorRunnableContext();
- SelectionDialog dialog = JavaUI.createPackageDialog(ScoutSdkUi.getShell(), context, m_bundle.getSearchScope(), false, true, null);
- dialog.setTitle(Texts.get("Package"));
- dialog.setMessage(Texts.get("ChoosePackageForX", getElementName()));
-
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- packageFragments = Arrays.asList(dialog.getResult()).toArray(new IPackageFragment[0]);
- }
- }
- if (packageFragments != null) {
- return packageFragments;
- }
- else {
- return null;
- }
- }
-
- public String getElementName() {
- return m_elementName;
- }
-
- public void setElementName(String elementName) {
- m_elementName = elementName;
- }
-
- public String getTypeSuffix() {
- return m_typeSuffix;
- }
-
- public void setTypeSuffix(String typeSuffix) {
- m_typeSuffix = typeSuffix;
- }
-
- public String getRecommendedPackageFragment() {
- return m_recommendedPackageFragment;
- }
-
- public void setRecommendedPackageFragment(String recommendedPackageFragment) {
- m_recommendedPackageFragment = recommendedPackageFragment;
- }
-
- public boolean isAllowModifySuperType() {
- return m_allowModifySuperType;
- }
-
- public void setAllowModifySuperType(boolean allowModifySuperType) {
- m_allowModifySuperType = allowModifySuperType;
- }
-
- public boolean isAllowModifyInterfaceType() {
- return m_allowModifyInterfaceType;
- }
-
- public void setAllowModifyInterfaceType(boolean allowModifyInterfaceType) {
- m_allowModifyInterfaceType = allowModifyInterfaceType;
- }
-
- public boolean isAllowModifyPackage() {
- return m_allowModifyPackage;
- }
-
- public void setAllowModifyPackage(boolean allowModifyPackage) {
- m_allowModifyPackage = allowModifyPackage;
- }
-
- public JavaSearchScopeFactory getSuperTypeSearchScopeFactory() {
- return m_superTypeSearchScopeFactory;
- }
-
- public void setSuperTypeSearchScopeFactory(JavaSearchScopeFactory superTypeSearchScopeFactory) {
- m_superTypeSearchScopeFactory = superTypeSearchScopeFactory;
- }
-
- public JavaSearchScopeFactory getInterfaceTypeSearchScopeFactory() {
- return m_interfaceTypeSearchScopeFactory;
- }
-
- public void setInterfaceTypeSearchScopeFactory(JavaSearchScopeFactory interfaceTypeSearchScopeFactory) {
- m_interfaceTypeSearchScopeFactory = interfaceTypeSearchScopeFactory;
- }
-
- public static class JavaSearchScopeFactory {
- public IJavaSearchScope create() {
- return SearchEngine.createWorkspaceScope();
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
+import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
+import org.eclipse.jdt.ui.IJavaElementSearchConstants;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.tooltip.JavadocTooltip;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+@SuppressWarnings("restriction")
+public class TypeNewWizardPage extends AbstractWorkspaceWizardPage {
+
+ public static final String PROP_TYPE_NAME = "typeName";
+ public static final String PROP_PACKAGE_NAME = "packageName";
+ public static final String PROP_INTERFACE_TYPE = "interfaceType";
+ public static final String PROP_SUPER_TYPE = "superType";
+
+ private BasicPropertySupport m_propertySupport;
+
+ private IScoutBundle m_bundle;
+
+ private String m_elementName;
+ private String m_typeSuffix;
+ private String m_recommendedPackageFragment;
+ private boolean m_allowModifyPackage;
+ private boolean m_allowModifySuperType;
+ private boolean m_allowModifyInterfaceType;
+ private JavaSearchScopeFactory m_superTypeSearchScopeFactory;
+ private JavaSearchScopeFactory m_interfaceTypeSearchScopeFactory;
+
+ private StyledTextField m_typeNameField;
+ private StyledTextField m_packageField;
+ private Button m_packageBrowseButton;
+ private StyledTextField m_superTypeField;
+ private Button m_superTypeBrowseButton;
+ private JavadocTooltip m_tooltipSuperType;
+ private StyledTextField m_interfaceTypeField;
+ private Button m_interfaceTypeBrowseButton;
+ private JavadocTooltip m_tooltipInterfaceType;
+
+ public TypeNewWizardPage(IScoutBundle bundle, String elementName) {
+ super(TypeNewWizardPage.class.getName());
+ setTitle(Texts.get("CreateNewX", elementName));
+ setDescription(Texts.get("ByClickingFinishXIsCreated", getElementName()));
+
+ m_bundle = bundle;
+ m_elementName = elementName;
+ m_propertySupport = new BasicPropertySupport(this);
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("Name"));
+ m_typeNameField.setReadOnlySuffix(getTypeSuffix());
+ m_typeNameField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setTypeNameInternal(m_typeNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_packageField = getFieldToolkit().createStyledTextField(parent, Texts.get("Package"));
+ m_packageField.setText(getPackageName());
+ m_packageField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setPackageNameInternal(m_packageField.getText());
+ pingStateChanging();
+ }
+ });
+ m_packageField.setEnabled(isAllowModifyPackage());
+ m_packageField.setText(StringUtility.nvl(getRecommendedPackageFragment(), ""));
+
+ m_packageBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
+ m_packageBrowseButton.setText(Texts.get("Browse"));
+ m_packageBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IPackageFragment[] packageFragment = openBrowsePackagesDialog();
+ if (packageFragment != null && packageFragment.length > 0) {
+ setPackageName(packageFragment[0].getElementName());
+ }
+ }
+ });
+ m_packageBrowseButton.setEnabled(isAllowModifyPackage());
+
+ m_interfaceTypeField = getFieldToolkit().createStyledTextField(parent, Texts.get("Interface"));
+ if (TypeUtility.exists(getInterfaceType())) {
+ m_interfaceTypeField.setText(getInterfaceType().getElementName());
+ }
+ m_interfaceTypeField.setEditable(false);
+ m_interfaceTypeField.setEnabled(isAllowModifyInterfaceType());
+ m_tooltipInterfaceType = new JavadocTooltip(m_interfaceTypeField.getTextComponent());
+ updateJavaDoc(m_tooltipInterfaceType, getInterfaceType());
+
+ m_interfaceTypeBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
+ m_interfaceTypeBrowseButton.setText(Texts.get("Browse"));
+ m_interfaceTypeBrowseButton.setEnabled(isAllowModifyInterfaceType());
+ m_interfaceTypeBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ IJavaSearchScope searchScope = getInterfaceTypeSearchScopeFactory().create();
+
+ SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES | IJavaElementSearchConstants.CONSIDER_INTERFACES, false, "*.*");
+ dialog.setTitle(Texts.get("Interface"));
+ dialog.setMessage(Texts.get("ChooseXY", Texts.get("Interface")));
+ dialog.setBlockOnOpen(true);
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ IType type = (IType) dialog.getResult()[0];
+ setInterfaceType(type);
+ }
+ }
+ }
+ catch (JavaModelException exception) {
+ JaxWsSdk.logError(exception);
+ }
+ }
+ });
+
+ m_superTypeField = getFieldToolkit().createStyledTextField(parent, Texts.get("SuperType"));
+ if (TypeUtility.exists(getSuperType())) {
+ m_superTypeField.setText(getSuperType().getElementName());
+ }
+ m_superTypeField.setEditable(false);
+ m_superTypeField.setEnabled(isAllowModifySuperType());
+ m_tooltipSuperType = new JavadocTooltip(m_superTypeField.getTextComponent());
+ updateJavaDoc(m_tooltipSuperType, getSuperType());
+
+ m_superTypeBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
+ m_superTypeBrowseButton.setText(Texts.get("Browse"));
+ m_superTypeBrowseButton.setEnabled(isAllowModifySuperType());
+ m_superTypeBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ IJavaSearchScope searchScope = getSuperTypeSearchScopeFactory().create();
+
+ SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES | IJavaElementSearchConstants.CONSIDER_INTERFACES, false, "*.*");
+ dialog.setTitle(Texts.get("SuperType"));
+ dialog.setMessage(Texts.get("ChooseXY", Texts.get("SuperType")));
+ dialog.setBlockOnOpen(true);
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ IType type = (IType) dialog.getResult()[0];
+ setSuperType(type);
+ }
+ }
+ }
+ catch (JavaModelException exception) {
+ JaxWsSdk.logError(exception);
+ }
+ }
+ });
+
+ // layout
+ parent.setLayout(new FormLayout());
+
+ FormData formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_typeNameField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_typeNameField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_packageField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_packageField, 0, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_packageBrowseButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_packageBrowseButton, 20, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_interfaceTypeField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_interfaceTypeField, -2, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_interfaceTypeBrowseButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_interfaceTypeField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_superTypeField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_superTypeField, -2, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_superTypeBrowseButton.setLayoutData(formData);
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ validateType(multiStatus);
+ }
+
+ protected void validateType(MultiStatus multiStatus) {
+ // package
+ if (StringUtility.isNullOrEmpty(getPackageName())) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("UsageOfDefaultPackageDiscouraged")));
+ }
+ else {
+ multiStatus.add(JavaConventionsUtil.validatePackageName(getPackageName(), m_bundle.getJavaProject()));
+
+ if (getRecommendedPackageFragment() != null && !getPackageName().equals(getRecommendedPackageFragment())) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("ByConventionXShouldByY", Texts.get("Package"), getRecommendedPackageFragment())));
+ }
+ }
+
+ // name
+ if (StringUtility.isNullOrEmpty(getTypeName()) || (getTypeSuffix() != null && getTypeName().equals(getTypeSuffix()))) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", Texts.get("Name"))));
+ }
+ else {
+ multiStatus.add(JavaConventionsUtil.validateJavaTypeName(getTypeName(), m_bundle.getJavaProject()));
+ if (Character.isLowerCase(getTypeName().charAt(0))) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("LowerCaseTypeName")));
+ }
+ }
+ if (multiStatus.getSeverity() < IStatus.ERROR) {
+ try {
+ String fqn = StringUtility.join(".", getPackageName(), getTypeName());
+ if (TypeUtility.existsType(fqn)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("TypeAlreadyExsits", fqn)));
+ }
+ }
+ catch (Exception e) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidJavaType", getTypeName())));
+ }
+ }
+ }
+
+ private void updateJavaDoc(JavadocTooltip javadocTooltip, IType type) {
+ try {
+ javadocTooltip.setMember(null);
+ if (TypeUtility.exists(type)) {
+ javadocTooltip.setMember(type);
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("Could not render tooltip", e);
+ }
+ }
+
+ public void setSuperType(IType superType) {
+ try {
+ setStateChanging(true);
+ setSuperTypeInternal(superType);
+ if (isControlCreated()) {
+ if (superType != null) {
+ m_superTypeField.setText(superType.getElementName());
+ }
+ else {
+ m_superTypeField.setText("");
+ }
+ updateJavaDoc(m_tooltipSuperType, getSuperType());
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setSuperTypeInternal(IType superType) {
+ m_propertySupport.setProperty(PROP_SUPER_TYPE, superType);
+ }
+
+ public IType getSuperType() {
+ return (IType) m_propertySupport.getProperty(PROP_SUPER_TYPE);
+ }
+
+ public void setInterfaceType(IType interfaceType) {
+ try {
+ setStateChanging(true);
+ setInterfaceTypeInternal(interfaceType);
+ if (isControlCreated()) {
+ if (interfaceType != null) {
+ m_interfaceTypeField.setText(interfaceType.getElementName());
+ }
+ else {
+ m_interfaceTypeField.setText("");
+ }
+ updateJavaDoc(m_tooltipInterfaceType, getInterfaceType());
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setInterfaceTypeInternal(IType interfaceType) {
+ m_propertySupport.setProperty(PROP_INTERFACE_TYPE, interfaceType);
+ }
+
+ public IType getInterfaceType() {
+ return (IType) m_propertySupport.getProperty(PROP_INTERFACE_TYPE);
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ typeName = JaxWsSdkUtility.toStartWithUpperCase(typeName);
+
+ setStateChanging(true);
+ setTypeNameInternal(typeName);
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setTypeNameInternal(String typeName) {
+ m_propertySupport.setProperty(PROP_TYPE_NAME, typeName);
+ }
+
+ public String getTypeName() {
+ return m_propertySupport.getPropertyString(PROP_TYPE_NAME);
+ }
+
+ public void setPackageName(String packageName) {
+ try {
+ setStateChanging(true);
+ setPackageNameInternal(packageName);
+ if (isControlCreated()) {
+ m_packageField.setText(packageName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setPackageNameInternal(String packageName) {
+ m_propertySupport.setPropertyString(PROP_PACKAGE_NAME, packageName);
+ }
+
+ public String getPackageName() {
+ return m_propertySupport.getPropertyString(PROP_PACKAGE_NAME);
+ }
+
+ private IPackageFragment[] openBrowsePackagesDialog() {
+ IPackageFragment[] packageFragments = null;
+ IRunnableContext context = new BusyIndicatorRunnableContext();
+ SelectionDialog dialog = JavaUI.createPackageDialog(ScoutSdkUi.getShell(), context, m_bundle.getSearchScope(), false, true, null);
+ dialog.setTitle(Texts.get("Package"));
+ dialog.setMessage(Texts.get("ChoosePackageForX", getElementName()));
+
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ packageFragments = Arrays.asList(dialog.getResult()).toArray(new IPackageFragment[0]);
+ }
+ }
+ if (packageFragments != null) {
+ return packageFragments;
+ }
+ else {
+ return null;
+ }
+ }
+
+ public String getElementName() {
+ return m_elementName;
+ }
+
+ public void setElementName(String elementName) {
+ m_elementName = elementName;
+ }
+
+ public String getTypeSuffix() {
+ return m_typeSuffix;
+ }
+
+ public void setTypeSuffix(String typeSuffix) {
+ m_typeSuffix = typeSuffix;
+ }
+
+ public String getRecommendedPackageFragment() {
+ return m_recommendedPackageFragment;
+ }
+
+ public void setRecommendedPackageFragment(String recommendedPackageFragment) {
+ m_recommendedPackageFragment = recommendedPackageFragment;
+ }
+
+ public boolean isAllowModifySuperType() {
+ return m_allowModifySuperType;
+ }
+
+ public void setAllowModifySuperType(boolean allowModifySuperType) {
+ m_allowModifySuperType = allowModifySuperType;
+ }
+
+ public boolean isAllowModifyInterfaceType() {
+ return m_allowModifyInterfaceType;
+ }
+
+ public void setAllowModifyInterfaceType(boolean allowModifyInterfaceType) {
+ m_allowModifyInterfaceType = allowModifyInterfaceType;
+ }
+
+ public boolean isAllowModifyPackage() {
+ return m_allowModifyPackage;
+ }
+
+ public void setAllowModifyPackage(boolean allowModifyPackage) {
+ m_allowModifyPackage = allowModifyPackage;
+ }
+
+ public JavaSearchScopeFactory getSuperTypeSearchScopeFactory() {
+ return m_superTypeSearchScopeFactory;
+ }
+
+ public void setSuperTypeSearchScopeFactory(JavaSearchScopeFactory superTypeSearchScopeFactory) {
+ m_superTypeSearchScopeFactory = superTypeSearchScopeFactory;
+ }
+
+ public JavaSearchScopeFactory getInterfaceTypeSearchScopeFactory() {
+ return m_interfaceTypeSearchScopeFactory;
+ }
+
+ public void setInterfaceTypeSearchScopeFactory(JavaSearchScopeFactory interfaceTypeSearchScopeFactory) {
+ m_interfaceTypeSearchScopeFactory = interfaceTypeSearchScopeFactory;
+ }
+
+ public static class JavaSearchScopeFactory {
+ public IJavaSearchScope create() {
+ return SearchEngine.createWorkspaceScope();
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WebserviceEnum.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WebserviceEnum.java
index e8597ea93..8812ce0b4 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WebserviceEnum.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WebserviceEnum.java
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-public enum WebserviceEnum {
- Provider, Consumer;
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+public enum WebserviceEnum {
+ Provider, Consumer;
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsConsumerImplClassWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsConsumerImplClassWizardPage.java
index d46b7b84f..c1eaf4998 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsConsumerImplClassWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsConsumerImplClassWizardPage.java
@@ -1,517 +1,517 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.beans.PropertyChangeListener;
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
-import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.TypeCastUtility;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.tooltip.JavadocTooltip;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-@SuppressWarnings("restriction")
-public class WsConsumerImplClassWizardPage extends AbstractWorkspaceWizardPage {
-
- public static final String PROP_PACKAGE = "package";
- public static final String PROP_TYPE_NAME = "name";
- public static final String PROP_ANNOTATE_IMPL = "createScoutWsAnnotation";
- public static final String PROP_AUTHENTICATION_HANDLER = "authenticationHandler";
-
- private BasicPropertySupport m_propertySupport;
-
- private IScoutBundle m_bundle;
-
- private Button m_createImplClassButton;
- private StyledTextField m_packageField;
- private Button m_packageBrowseButton;
- private StyledTextField m_typeNameField;
- private Button m_annotateImplButton;
- private Text m_descriptionScoutAnnotation;
- private Composite m_containerAnnotation;
- private StyledTextField m_authenticationHandlerField;
- private Button m_authenticationFactoryBrowseButton;
- private Set<String> m_illegalTypeNames;
-
- private JavadocTooltip m_tooltipAuthenticationFactory;
-
- public WsConsumerImplClassWizardPage(IScoutBundle bundle) {
- super(WsConsumerImplClassWizardPage.class.getName());
- setTitle(Texts.get("ConfigureImplementingClass"));
- setDescription(Texts.get("ConfigureImplementingClass"));
-
- m_propertySupport = new BasicPropertySupport(this);
- m_bundle = bundle;
- m_illegalTypeNames = getIllegalTypeNames();
- applyDefaults();
- }
-
- private void applyDefaults() {
- setAnnotateImplClass(true);
- setAuthenticationHandler(TypeUtility.getType(JaxWsRuntimeClasses.NullAuthenticationHandlerConsumer).getFullyQualifiedName());
- setPackageName(JaxWsSdkUtility.getRecommendedConsumerImplPackageName(m_bundle));
- }
-
- @Override
- public void postActivate() {
- // set value to intall tooltip
- setAuthenticationHandler(getAuthenticationHandler());
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("Name"));
- m_typeNameField.setReadOnlySuffix(JaxWsConstants.SUFFIX_WS_CONSUMER);
- m_typeNameField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setTypeNameInternal(m_typeNameField.getText());
- pingStateChanging();
- }
- });
-
- m_packageField = getFieldToolkit().createStyledTextField(parent, Texts.get("Package"));
- m_packageField.setText(getPackageName());
- m_packageField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setPackageNameInternal(m_packageField.getText());
- pingStateChanging();
- }
- });
-
- m_packageBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
- m_packageBrowseButton.setText(Texts.get("Browse"));
- m_packageBrowseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IPackageFragment[] packageFragment = openBrowsePackagesDialog();
- if (packageFragment != null && packageFragment.length > 0) {
- setPackageName(packageFragment[0].getElementName());
- }
- }
- });
-
- m_annotateImplButton = new Button(parent, SWT.CHECK);
- m_annotateImplButton.setText(Texts.get("AnnotateImplClass", TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebServiceClient).getElementName()));
- m_annotateImplButton.setSelection(isAnnotateImplClass());
- m_annotateImplButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- setAnnotateImplClass(m_annotateImplButton.getSelection());
- }
- });
-
- m_containerAnnotation = new Composite(parent, SWT.NONE);
-
- m_descriptionScoutAnnotation = new Text(m_containerAnnotation, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
- m_descriptionScoutAnnotation.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- m_descriptionScoutAnnotation.setText(Texts.get("DescriptionScoutWebServiceClientAnnotation", TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebServiceClient).getElementName()));
-
- m_authenticationHandlerField = getFieldToolkit().createStyledTextField(m_containerAnnotation, Texts.get("AuthenticationMechanism"));
- m_authenticationHandlerField.setText(getAuthenticationHandler());
- m_authenticationHandlerField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setAuthenticationHandlerInternal(m_authenticationHandlerField.getText());
- pingStateChanging();
- }
- });
- m_tooltipAuthenticationFactory = new JavadocTooltip(m_authenticationHandlerField.getTextComponent());
-
- m_authenticationFactoryBrowseButton = new Button(m_containerAnnotation, SWT.PUSH | SWT.FLAT);
- m_authenticationFactoryBrowseButton.setText(Texts.get("Browse"));
- m_authenticationFactoryBrowseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- IJavaSearchScope searchScope = createSubClassesSearchScope(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer));
-
- SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*.*");
- dialog.setTitle(Texts.get("AuthenticationMechanism"));
- dialog.setMessage(Texts.get("ChooseXY", Texts.get("AuthenticationMechanism")));
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- IType type = (IType) dialog.getResult()[0];
- setAuthenticationHandler(type.getFullyQualifiedName());
- }
- }
- }
- catch (JavaModelException exception) {
- JaxWsSdk.logError(exception);
- }
- }
- });
-
- // layout
- parent.setLayout(new FormLayout());
-
- FormData formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_typeNameField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_typeNameField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_packageField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_packageField, 0, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_packageBrowseButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_packageField, 20, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_annotateImplButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_annotateImplButton, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_containerAnnotation.setLayoutData(formData);
-
- m_containerAnnotation.setLayout(new FormLayout());
-
- formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(40, 2);
- formData.right = new FormAttachment(100, 0);
- m_descriptionScoutAnnotation.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_descriptionScoutAnnotation, 10, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_authenticationHandlerField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_authenticationHandlerField, 0, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_authenticationFactoryBrowseButton.setLayoutData(formData);
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- if (m_bundle == null) { // not fully initialized yet
- return;
- }
-
- validateType(multiStatus);
-
- if (isAnnotateImplClass()) {
- validateFactoryType(multiStatus, Texts.get("AuthenticationFactory"), getAuthenticationHandler(), TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer));
- }
- }
-
- protected void validateType(MultiStatus multiStatus) {
- // package
- if (StringUtility.isNullOrEmpty(getPackageName())) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("UsageOfDefaultPackageDiscouraged")));
- }
- else {
- multiStatus.add(JavaConventionsUtil.validatePackageName(getPackageName(), m_bundle.getJavaProject()));
-
- String recommendedPackageName = JaxWsSdkUtility.getRecommendedConsumerImplPackageName(m_bundle);
- if (!getPackageName().equals(recommendedPackageName)) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("ByConventionXShouldByY", Texts.get("Package"), recommendedPackageName)));
- }
- }
- // name
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(JaxWsConstants.SUFFIX_WS_CONSUMER)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("MissingNameForImplementingClass")));
- }
- else {
- multiStatus.add(JavaConventionsUtil.validateJavaTypeName(getTypeName(), m_bundle.getJavaProject()));
-
- if (Character.isLowerCase(getTypeName().charAt(0))) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("LowerCaseTypeName")));
- }
- }
-
- // type
- if (multiStatus.getSeverity() < IStatus.ERROR) {
- String fullyQualifiedName = StringUtility.join(".", getPackageName(), getTypeName());
- try {
- if (TypeUtility.existsType(fullyQualifiedName)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("TypeAlreadyExsits", fullyQualifiedName)));
- }
- else if (m_illegalTypeNames.contains(getTypeName())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("AliasXAlreadyExists", getTypeName())));
- }
- }
- catch (Exception e) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidJavaType", fullyQualifiedName)));
- }
- }
- }
-
- protected void validateFactoryType(MultiStatus multiStatus, String label, String qualifiedName, IType interfaceType) {
- if (StringUtility.isNullOrEmpty(qualifiedName)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("NoClassSpecified", label)));
- return;
- }
-
- String packageName = Signature.getQualifier(qualifiedName);
- String className;
- if (StringUtility.isNullOrEmpty(packageName)) {
- className = qualifiedName;
- }
- else {
- className = Signature.getSimpleName(qualifiedName);
- }
-
- if (StringUtility.isNullOrEmpty(packageName)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("UsageOfDefaultPackageNotAllowed")));
- return;
- }
- else {
- multiStatus.add(JavaConventionsUtil.validatePackageName(packageName, m_bundle.getJavaProject()));
- }
-
- try {
- String fqn = StringUtility.join(".", packageName, className);
- if (TypeUtility.existsType(fqn)) {
- IType type = TypeUtility.getType(fqn);
- if (!type.newSupertypeHierarchy(new NullProgressMonitor()).contains(interfaceType)) {
- type.getJavadocRange().getOffset();
- type.getJavadocRange().getLength();
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustBeOfTheTypeY", label, interfaceType.getFullyQualifiedName())));
- }
- }
- else {
- String recommendedPackageName = JaxWsSdkUtility.getRecommendedConsumerSecurityPackageName(m_bundle);
- if (!packageName.equals(recommendedPackageName)) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("ByConventionXShouldByY", Texts.get("package"), recommendedPackageName)));
- }
- }
- }
- catch (Exception e) {
- // nop
- }
- }
-
- public void setTypeName(String typeName) {
- try {
- typeName = JaxWsSdkUtility.toStartWithUpperCase(typeName);
- setStateChanging(true);
- setTypeNameInternal(typeName);
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setTypeNameInternal(String typeName) {
- m_propertySupport.setProperty(PROP_TYPE_NAME, typeName);
- }
-
- public String getTypeName() {
- return m_propertySupport.getPropertyString(PROP_TYPE_NAME);
- }
-
- public void setPackageName(String packageName) {
- try {
- setStateChanging(true);
- setPackageNameInternal(packageName);
- if (isControlCreated()) {
- m_packageField.setText(packageName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setPackageNameInternal(String packageName) {
- m_propertySupport.setPropertyString(PROP_PACKAGE, packageName);
- }
-
- public String getPackageName() {
- return m_propertySupport.getPropertyString(PROP_PACKAGE);
- }
-
- public void setAnnotateImplClass(boolean annotateImplClass) {
- try {
- setStateChanging(true);
- setAnnotateImplClassInternal(annotateImplClass);
- if (isControlCreated()) {
- m_annotateImplButton.setSelection(annotateImplClass);
- JaxWsSdkUtility.setView(m_containerAnnotation, annotateImplClass);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setAnnotateImplClassInternal(boolean annotateImplClass) {
- m_propertySupport.setProperty(PROP_ANNOTATE_IMPL, annotateImplClass);
- }
-
- public boolean isAnnotateImplClass() {
- return m_propertySupport.getPropertyBool(PROP_ANNOTATE_IMPL);
- }
-
- public void setAuthenticationHandler(String authenticationHandler) {
- try {
- setStateChanging(true);
- setAuthenticationHandlerInternal(authenticationHandler);
- if (isControlCreated()) {
- m_authenticationHandlerField.setText(authenticationHandler);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setAuthenticationHandlerInternal(String authenticationHandler) {
- m_propertySupport.setPropertyString(PROP_AUTHENTICATION_HANDLER, authenticationHandler);
-
- if (isControlCreated()) {
- // display JavaDoc
- m_tooltipAuthenticationFactory.setMember(null);
- if (TypeUtility.existsType(authenticationHandler)) {
- IType type = TypeUtility.getType(authenticationHandler);
- try {
- if (type.newSupertypeHierarchy(new NullProgressMonitor()).contains(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer))) {
- m_tooltipAuthenticationFactory.setMember(type);
- }
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("Could not render tooltip", e);
- }
- }
- }
- }
-
- public String getAuthenticationHandler() {
- return m_propertySupport.getPropertyString(PROP_AUTHENTICATION_HANDLER);
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.addPropertyChangeListener(listener);
- super.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.removePropertyChangeListener(listener);
- super.removePropertyChangeListener(listener);
- }
-
- private IPackageFragment[] openBrowsePackagesDialog() {
- IPackageFragment[] packageFragments = null;
- IRunnableContext context = new BusyIndicatorRunnableContext();
- SelectionDialog dialog = JavaUI.createPackageDialog(ScoutSdkUi.getShell(), context, m_bundle.getSearchScope(), false, true, null);
- dialog.setTitle(Texts.get("Package"));
- dialog.setMessage(Texts.get("ChoosePackageForWsConsumer"));
-
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- packageFragments = Arrays.asList(dialog.getResult()).toArray(new IPackageFragment[0]);
- }
- }
- if (packageFragments != null) {
- return packageFragments;
- }
- else {
- return null;
- }
- }
-
- private Set<String> getIllegalTypeNames() {
- Set<String> illegalTypeNames = new HashSet<String>();
-
- XmlResource buildJaxWsResource = ResourceFactory.getBuildJaxWsResource(m_bundle);
- ScoutXmlDocument xmlDocument = buildJaxWsResource.loadXml();
- if (!buildJaxWsResource.existsFile()) {
- return illegalTypeNames;
- }
- if (xmlDocument.getRoot().hasChild(BuildJaxWsBean.XML_CONSUMER)) {
- ScoutXmlElement[] xmlElements = TypeCastUtility.castValue(xmlDocument.getRoot().getChildren(BuildJaxWsBean.XML_CONSUMER), ScoutXmlElement[].class);
-
- for (ScoutXmlElement xmlElement : xmlElements) {
- illegalTypeNames.add(xmlElement.getAttribute(BuildJaxWsBean.XML_ALIAS));
- }
- }
- return illegalTypeNames;
- }
-
- private IJavaSearchScope createSubClassesSearchScope(IType superType) {
- // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
- IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
- return SearchEngine.createJavaSearchScope(subTypes);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.beans.PropertyChangeListener;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
+import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
+import org.eclipse.jdt.ui.IJavaElementSearchConstants;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.TypeCastUtility;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.tooltip.JavadocTooltip;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+@SuppressWarnings("restriction")
+public class WsConsumerImplClassWizardPage extends AbstractWorkspaceWizardPage {
+
+ public static final String PROP_PACKAGE = "package";
+ public static final String PROP_TYPE_NAME = "name";
+ public static final String PROP_ANNOTATE_IMPL = "createScoutWsAnnotation";
+ public static final String PROP_AUTHENTICATION_HANDLER = "authenticationHandler";
+
+ private BasicPropertySupport m_propertySupport;
+
+ private IScoutBundle m_bundle;
+
+ private Button m_createImplClassButton;
+ private StyledTextField m_packageField;
+ private Button m_packageBrowseButton;
+ private StyledTextField m_typeNameField;
+ private Button m_annotateImplButton;
+ private Text m_descriptionScoutAnnotation;
+ private Composite m_containerAnnotation;
+ private StyledTextField m_authenticationHandlerField;
+ private Button m_authenticationFactoryBrowseButton;
+ private Set<String> m_illegalTypeNames;
+
+ private JavadocTooltip m_tooltipAuthenticationFactory;
+
+ public WsConsumerImplClassWizardPage(IScoutBundle bundle) {
+ super(WsConsumerImplClassWizardPage.class.getName());
+ setTitle(Texts.get("ConfigureImplementingClass"));
+ setDescription(Texts.get("ConfigureImplementingClass"));
+
+ m_propertySupport = new BasicPropertySupport(this);
+ m_bundle = bundle;
+ m_illegalTypeNames = getIllegalTypeNames();
+ applyDefaults();
+ }
+
+ private void applyDefaults() {
+ setAnnotateImplClass(true);
+ setAuthenticationHandler(TypeUtility.getType(JaxWsRuntimeClasses.NullAuthenticationHandlerConsumer).getFullyQualifiedName());
+ setPackageName(JaxWsSdkUtility.getRecommendedConsumerImplPackageName(m_bundle));
+ }
+
+ @Override
+ public void postActivate() {
+ // set value to intall tooltip
+ setAuthenticationHandler(getAuthenticationHandler());
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("Name"));
+ m_typeNameField.setReadOnlySuffix(JaxWsConstants.SUFFIX_WS_CONSUMER);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setTypeNameInternal(m_typeNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_packageField = getFieldToolkit().createStyledTextField(parent, Texts.get("Package"));
+ m_packageField.setText(getPackageName());
+ m_packageField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setPackageNameInternal(m_packageField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_packageBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
+ m_packageBrowseButton.setText(Texts.get("Browse"));
+ m_packageBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IPackageFragment[] packageFragment = openBrowsePackagesDialog();
+ if (packageFragment != null && packageFragment.length > 0) {
+ setPackageName(packageFragment[0].getElementName());
+ }
+ }
+ });
+
+ m_annotateImplButton = new Button(parent, SWT.CHECK);
+ m_annotateImplButton.setText(Texts.get("AnnotateImplClass", TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebServiceClient).getElementName()));
+ m_annotateImplButton.setSelection(isAnnotateImplClass());
+ m_annotateImplButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setAnnotateImplClass(m_annotateImplButton.getSelection());
+ }
+ });
+
+ m_containerAnnotation = new Composite(parent, SWT.NONE);
+
+ m_descriptionScoutAnnotation = new Text(m_containerAnnotation, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
+ m_descriptionScoutAnnotation.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
+ m_descriptionScoutAnnotation.setText(Texts.get("DescriptionScoutWebServiceClientAnnotation", TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebServiceClient).getElementName()));
+
+ m_authenticationHandlerField = getFieldToolkit().createStyledTextField(m_containerAnnotation, Texts.get("AuthenticationMechanism"));
+ m_authenticationHandlerField.setText(getAuthenticationHandler());
+ m_authenticationHandlerField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setAuthenticationHandlerInternal(m_authenticationHandlerField.getText());
+ pingStateChanging();
+ }
+ });
+ m_tooltipAuthenticationFactory = new JavadocTooltip(m_authenticationHandlerField.getTextComponent());
+
+ m_authenticationFactoryBrowseButton = new Button(m_containerAnnotation, SWT.PUSH | SWT.FLAT);
+ m_authenticationFactoryBrowseButton.setText(Texts.get("Browse"));
+ m_authenticationFactoryBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ IJavaSearchScope searchScope = createSubClassesSearchScope(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer));
+
+ SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*.*");
+ dialog.setTitle(Texts.get("AuthenticationMechanism"));
+ dialog.setMessage(Texts.get("ChooseXY", Texts.get("AuthenticationMechanism")));
+ dialog.setBlockOnOpen(true);
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ IType type = (IType) dialog.getResult()[0];
+ setAuthenticationHandler(type.getFullyQualifiedName());
+ }
+ }
+ }
+ catch (JavaModelException exception) {
+ JaxWsSdk.logError(exception);
+ }
+ }
+ });
+
+ // layout
+ parent.setLayout(new FormLayout());
+
+ FormData formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_typeNameField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_typeNameField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_packageField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_packageField, 0, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_packageBrowseButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_packageField, 20, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_annotateImplButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_annotateImplButton, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_containerAnnotation.setLayoutData(formData);
+
+ m_containerAnnotation.setLayout(new FormLayout());
+
+ formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(40, 2);
+ formData.right = new FormAttachment(100, 0);
+ m_descriptionScoutAnnotation.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_descriptionScoutAnnotation, 10, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_authenticationHandlerField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_authenticationHandlerField, 0, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_authenticationFactoryBrowseButton.setLayoutData(formData);
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ if (m_bundle == null) { // not fully initialized yet
+ return;
+ }
+
+ validateType(multiStatus);
+
+ if (isAnnotateImplClass()) {
+ validateFactoryType(multiStatus, Texts.get("AuthenticationFactory"), getAuthenticationHandler(), TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer));
+ }
+ }
+
+ protected void validateType(MultiStatus multiStatus) {
+ // package
+ if (StringUtility.isNullOrEmpty(getPackageName())) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("UsageOfDefaultPackageDiscouraged")));
+ }
+ else {
+ multiStatus.add(JavaConventionsUtil.validatePackageName(getPackageName(), m_bundle.getJavaProject()));
+
+ String recommendedPackageName = JaxWsSdkUtility.getRecommendedConsumerImplPackageName(m_bundle);
+ if (!getPackageName().equals(recommendedPackageName)) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("ByConventionXShouldByY", Texts.get("Package"), recommendedPackageName)));
+ }
+ }
+ // name
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(JaxWsConstants.SUFFIX_WS_CONSUMER)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("MissingNameForImplementingClass")));
+ }
+ else {
+ multiStatus.add(JavaConventionsUtil.validateJavaTypeName(getTypeName(), m_bundle.getJavaProject()));
+
+ if (Character.isLowerCase(getTypeName().charAt(0))) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("LowerCaseTypeName")));
+ }
+ }
+
+ // type
+ if (multiStatus.getSeverity() < IStatus.ERROR) {
+ String fullyQualifiedName = StringUtility.join(".", getPackageName(), getTypeName());
+ try {
+ if (TypeUtility.existsType(fullyQualifiedName)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("TypeAlreadyExsits", fullyQualifiedName)));
+ }
+ else if (m_illegalTypeNames.contains(getTypeName())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("AliasXAlreadyExists", getTypeName())));
+ }
+ }
+ catch (Exception e) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidJavaType", fullyQualifiedName)));
+ }
+ }
+ }
+
+ protected void validateFactoryType(MultiStatus multiStatus, String label, String qualifiedName, IType interfaceType) {
+ if (StringUtility.isNullOrEmpty(qualifiedName)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("NoClassSpecified", label)));
+ return;
+ }
+
+ String packageName = Signature.getQualifier(qualifiedName);
+ String className;
+ if (StringUtility.isNullOrEmpty(packageName)) {
+ className = qualifiedName;
+ }
+ else {
+ className = Signature.getSimpleName(qualifiedName);
+ }
+
+ if (StringUtility.isNullOrEmpty(packageName)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("UsageOfDefaultPackageNotAllowed")));
+ return;
+ }
+ else {
+ multiStatus.add(JavaConventionsUtil.validatePackageName(packageName, m_bundle.getJavaProject()));
+ }
+
+ try {
+ String fqn = StringUtility.join(".", packageName, className);
+ if (TypeUtility.existsType(fqn)) {
+ IType type = TypeUtility.getType(fqn);
+ if (!type.newSupertypeHierarchy(new NullProgressMonitor()).contains(interfaceType)) {
+ type.getJavadocRange().getOffset();
+ type.getJavadocRange().getLength();
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustBeOfTheTypeY", label, interfaceType.getFullyQualifiedName())));
+ }
+ }
+ else {
+ String recommendedPackageName = JaxWsSdkUtility.getRecommendedConsumerSecurityPackageName(m_bundle);
+ if (!packageName.equals(recommendedPackageName)) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("ByConventionXShouldByY", Texts.get("package"), recommendedPackageName)));
+ }
+ }
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ typeName = JaxWsSdkUtility.toStartWithUpperCase(typeName);
+ setStateChanging(true);
+ setTypeNameInternal(typeName);
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setTypeNameInternal(String typeName) {
+ m_propertySupport.setProperty(PROP_TYPE_NAME, typeName);
+ }
+
+ public String getTypeName() {
+ return m_propertySupport.getPropertyString(PROP_TYPE_NAME);
+ }
+
+ public void setPackageName(String packageName) {
+ try {
+ setStateChanging(true);
+ setPackageNameInternal(packageName);
+ if (isControlCreated()) {
+ m_packageField.setText(packageName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setPackageNameInternal(String packageName) {
+ m_propertySupport.setPropertyString(PROP_PACKAGE, packageName);
+ }
+
+ public String getPackageName() {
+ return m_propertySupport.getPropertyString(PROP_PACKAGE);
+ }
+
+ public void setAnnotateImplClass(boolean annotateImplClass) {
+ try {
+ setStateChanging(true);
+ setAnnotateImplClassInternal(annotateImplClass);
+ if (isControlCreated()) {
+ m_annotateImplButton.setSelection(annotateImplClass);
+ JaxWsSdkUtility.setView(m_containerAnnotation, annotateImplClass);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setAnnotateImplClassInternal(boolean annotateImplClass) {
+ m_propertySupport.setProperty(PROP_ANNOTATE_IMPL, annotateImplClass);
+ }
+
+ public boolean isAnnotateImplClass() {
+ return m_propertySupport.getPropertyBool(PROP_ANNOTATE_IMPL);
+ }
+
+ public void setAuthenticationHandler(String authenticationHandler) {
+ try {
+ setStateChanging(true);
+ setAuthenticationHandlerInternal(authenticationHandler);
+ if (isControlCreated()) {
+ m_authenticationHandlerField.setText(authenticationHandler);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setAuthenticationHandlerInternal(String authenticationHandler) {
+ m_propertySupport.setPropertyString(PROP_AUTHENTICATION_HANDLER, authenticationHandler);
+
+ if (isControlCreated()) {
+ // display JavaDoc
+ m_tooltipAuthenticationFactory.setMember(null);
+ if (TypeUtility.existsType(authenticationHandler)) {
+ IType type = TypeUtility.getType(authenticationHandler);
+ try {
+ if (type.newSupertypeHierarchy(new NullProgressMonitor()).contains(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerConsumer))) {
+ m_tooltipAuthenticationFactory.setMember(type);
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("Could not render tooltip", e);
+ }
+ }
+ }
+ }
+
+ public String getAuthenticationHandler() {
+ return m_propertySupport.getPropertyString(PROP_AUTHENTICATION_HANDLER);
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.addPropertyChangeListener(listener);
+ super.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.removePropertyChangeListener(listener);
+ super.removePropertyChangeListener(listener);
+ }
+
+ private IPackageFragment[] openBrowsePackagesDialog() {
+ IPackageFragment[] packageFragments = null;
+ IRunnableContext context = new BusyIndicatorRunnableContext();
+ SelectionDialog dialog = JavaUI.createPackageDialog(ScoutSdkUi.getShell(), context, m_bundle.getSearchScope(), false, true, null);
+ dialog.setTitle(Texts.get("Package"));
+ dialog.setMessage(Texts.get("ChoosePackageForWsConsumer"));
+
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ packageFragments = Arrays.asList(dialog.getResult()).toArray(new IPackageFragment[0]);
+ }
+ }
+ if (packageFragments != null) {
+ return packageFragments;
+ }
+ else {
+ return null;
+ }
+ }
+
+ private Set<String> getIllegalTypeNames() {
+ Set<String> illegalTypeNames = new HashSet<String>();
+
+ XmlResource buildJaxWsResource = ResourceFactory.getBuildJaxWsResource(m_bundle);
+ ScoutXmlDocument xmlDocument = buildJaxWsResource.loadXml();
+ if (!buildJaxWsResource.existsFile()) {
+ return illegalTypeNames;
+ }
+ if (xmlDocument.getRoot().hasChild(BuildJaxWsBean.XML_CONSUMER)) {
+ ScoutXmlElement[] xmlElements = TypeCastUtility.castValue(xmlDocument.getRoot().getChildren(BuildJaxWsBean.XML_CONSUMER), ScoutXmlElement[].class);
+
+ for (ScoutXmlElement xmlElement : xmlElements) {
+ illegalTypeNames.add(xmlElement.getAttribute(BuildJaxWsBean.XML_ALIAS));
+ }
+ }
+ return illegalTypeNames;
+ }
+
+ private IJavaSearchScope createSubClassesSearchScope(IType superType) {
+ // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
+ IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
+ return SearchEngine.createJavaSearchScope(subTypes);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsPropertiesExistingWsdlWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsPropertiesExistingWsdlWizardPage.java
index b2614f515..d34139e02 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsPropertiesExistingWsdlWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsPropertiesExistingWsdlWizardPage.java
@@ -1,603 +1,603 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
-import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
-import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
-import org.eclipse.scout.sdk.ui.fields.proposal.SimpleLabelProvider;
-import org.eclipse.scout.sdk.ui.fields.proposal.SimpleProposal;
-import org.eclipse.scout.sdk.ui.fields.proposal.SimpleProposalProvider;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-
-public class WsPropertiesExistingWsdlWizardPage extends AbstractWorkspaceWizardPage {
-
- public static final String PROP_SERVICE = "service";
- public static final String PROP_PORT = "port";
- public static final String PROP_PORT_TYPE = "portType";
- public static final String PROP_DERIVE_OTHER_NAME = "deriveOtherNames";
- public static final String PROP_ALIAS = "alias";
- public static final String PROP_URL_PATTERN = "urlPattern";
- public static final String PROP_WSDL_DEFINITION = "wsdlDefinition";
-
- private BasicPropertySupport m_propertySupport;
-
- private IScoutBundle m_bundle;
- private String m_jaxWsServletAlias;
-
- private ProposalTextField m_serviceField;
- private ProposalTextField m_portField;
- private StyledTextField m_portTypeField;
- private Button m_deriveOtherNameButton;
- private StyledTextField m_alias;
- private StyledTextField m_urlPattern;
-
- private ScoutXmlDocument m_sunJaxWsXml;
- private Set<String> m_illegalAliasNames;
- private Set<String> m_illegalUrlPatterns;
-
- private WebserviceEnum m_webserviceEnum;
-
- public WsPropertiesExistingWsdlWizardPage(IScoutBundle bundle, WebserviceEnum webserviceEnum) {
- super(WsPropertiesExistingWsdlWizardPage.class.getName());
- setTitle(Texts.get("ConfigureWebserviceProperties"));
- setDescription(Texts.get("ConfigureWebserviceProperties"));
-
- m_bundle = bundle;
- m_webserviceEnum = webserviceEnum;
- m_propertySupport = new BasicPropertySupport(this);
- m_sunJaxWsXml = ResourceFactory.getSunJaxWsResource(bundle).loadXml();
- m_jaxWsServletAlias = JaxWsConstants.JAX_WS_ALIAS;
-
- setDeriveOtherNames(true);
- loadIllegalValues();
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_serviceField = getFieldToolkit().createProposalField(parent, Texts.get("Service"));
- m_serviceField.setLabelProvider(new SimpleLabelProvider());
- m_serviceField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- Object proposal = event.proposal;
- if (proposal != null) {
- setServiceInternal(((P_ServiceProposal) proposal).getService());
- }
- else {
- setServiceInternal(null);
- }
- pingStateChanging();
- }
- });
-
- m_portField = getFieldToolkit().createProposalField(parent, Texts.get("Port"));
- m_portField.setLabelProvider(new SimpleLabelProvider());
- m_portField.addProposalAdapterListener(new IProposalAdapterListener() {
- @Override
- public void proposalAccepted(ContentProposalEvent event) {
- Object proposal = event.proposal;
- if (proposal != null) {
- setPortInternal(((P_PortProposal) proposal).getPort());
- }
- else {
- setPortInternal(null);
- }
- pingStateChanging();
- }
- });
- m_portField.setEnabled(false);
-
- m_portTypeField = getFieldToolkit().createStyledTextField(parent, Texts.get("PortType"));
- m_portTypeField.setEnabled(false);
-
- if (m_webserviceEnum == WebserviceEnum.Provider) {
- m_deriveOtherNameButton = new Button(parent, SWT.CHECK);
- m_deriveOtherNameButton.setSelection(isDeriveOtherNames());
- m_deriveOtherNameButton.setText(Texts.get("DeriveOtherNamesFormPortTypeChosen"));
- m_deriveOtherNameButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- setDeriveOtherNames(m_deriveOtherNameButton.getSelection());
- if (isDeriveOtherNames()) {
- deriveOtherNames();
- }
- }
- });
-
- m_alias = getFieldToolkit().createStyledTextField(parent, Texts.get("Alias"));
- m_alias.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setAliasInternal(m_alias.getText());
- pingStateChanging();
- }
- });
-
- m_urlPattern = getFieldToolkit().createStyledTextField(parent, Texts.get("UrlPattern"));
- m_urlPattern.setReadOnlyPrefix(JaxWsSdkUtility.normalizePath(m_jaxWsServletAlias, SeparatorType.BothType));
- m_urlPattern.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setUrlPatternInternal(m_urlPattern.getText());
- pingStateChanging();
- }
- });
- }
-
- // layout
- parent.setLayout(new FormLayout());
-
- FormData formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_serviceField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_serviceField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_portField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_portField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_portTypeField.setLayoutData(formData);
-
- if (m_webserviceEnum == WebserviceEnum.Provider) {
- formData = new FormData();
- formData.top = new FormAttachment(m_portTypeField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_deriveOtherNameButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_deriveOtherNameButton, 30, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_alias.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_alias, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_urlPattern.setLayoutData(formData);
- }
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- if (!isControlCreated()) {
- return;
- }
-
- if (getWsdlDefinition() == null) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("WsdlCouldNotBeParsed")));
- return;
- }
-
- if (getServiceProposals().length == 0) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, "WSDL definition must contain one service element at least.\nPlease ensure to have specified the main WSDL file and not an imported, dependent one."));
- return;
- }
-
- // alias
- if (m_alias != null) {
- if (StringUtility.isNullOrEmpty(getAlias())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_alias.getLabelText())));
- }
- else if (m_illegalAliasNames.contains(getAlias())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XWithYDoesAlreadyExist", m_alias.getLabelText(), getAlias())));
- }
- else {
- IStatus status = m_bundle.getProject().getWorkspace().validateName(getAlias(), IResource.FILE);
- if (status.isOK() == false) {
- multiStatus.add(status);
- }
- }
- }
- if (m_urlPattern != null) {
- // URL pattern
- if (StringUtility.isNullOrEmpty(getUrlPattern()) || getUrlPattern().equals(m_jaxWsServletAlias)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_urlPattern.getLabelText())));
- }
- else if (!getUrlPattern().startsWith(m_jaxWsServletAlias)) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("XshouldStartWithY", m_urlPattern.getLabelText(), m_jaxWsServletAlias)));
- }
- else if (getUrlPattern().matches(".*\\s+.*")) { // check for whitespaces
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("UrlXshouldNotContainWhitespaces", getUrlPattern())));
- }
- else if (m_illegalUrlPatterns.contains(getUrlPattern())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XWithYDoesAlreadyExist", m_urlPattern.getLabelText(), getUrlPattern())));
- }
- }
-
- if (getService() == null) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_serviceField.getLabelText())));
- }
- else if (getPort() == null) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_portField.getLabelText())));
- }
- else if (getPortType() == null) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_portTypeField.getLabelText())));
- }
- }
-
- public Definition getWsdlDefinition() {
- return (Definition) m_propertySupport.getProperty(PROP_WSDL_DEFINITION);
- }
-
- /**
- * Main input for wizard page
- *
- * @param wsdlDefinition
- */
- public void setWsdlDefinition(Definition wsdlDefinition) {
- m_propertySupport.setProperty(PROP_WSDL_DEFINITION, wsdlDefinition);
-
- setStateChanging(true);
- try {
- setService(null);
- setPort(null);
- setPortType(null);
-
- // reload proposals of service
- P_ServiceProposal[] serviceProposals = getServiceProposals();
- SimpleProposalProvider serviceProvider = new SimpleProposalProvider(serviceProposals);
- m_serviceField.setContentProvider(serviceProvider);
-
- // default proposal for service --> ports are reloaded by setting the service
- if (serviceProposals.length > 0) {
- setService(serviceProposals[0].getService());
- }
- else {
- setService(null);
- }
-
- m_serviceField.setEnabled(serviceProposals.length > 0);
- }
- finally {
- setStateChanging(false);
- }
- }
-
- public void setAlias(String alias) {
- try {
- setStateChanging(true);
- setAliasInternal(alias);
- if (isControlCreated() && m_alias != null) {
- m_alias.setText(alias);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setAliasInternal(String alias) {
- m_propertySupport.setPropertyString(PROP_ALIAS, alias);
- }
-
- public String getAlias() {
- return m_propertySupport.getPropertyString(PROP_ALIAS);
- }
-
- public void setUrlPattern(String urlPattern) {
- try {
- setStateChanging(true);
- setUrlPatternInternal(urlPattern);
- if (isControlCreated() && m_urlPattern != null) {
- m_urlPattern.setText(urlPattern);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setUrlPatternInternal(String urlPattern) {
- m_propertySupport.setPropertyString(PROP_URL_PATTERN, urlPattern);
- }
-
- public String getUrlPattern() {
- return m_propertySupport.getPropertyString(PROP_URL_PATTERN);
- }
-
- public void setJaxWsServletAlias(String jaxWsServletAlias) {
- m_jaxWsServletAlias = jaxWsServletAlias;
- if (isControlCreated()) {
- m_urlPattern.setReadOnlyPrefix(JaxWsSdkUtility.normalizePath(m_jaxWsServletAlias, SeparatorType.BothType));
- }
- }
-
- public void setService(Service service) {
- try {
- setStateChanging(true);
- setServiceInternal(service);
-
- if (isControlCreated()) {
- if (service != null) {
- m_serviceField.acceptProposal(new P_ServiceProposal(service));
- }
- else {
- m_serviceField.acceptProposal(null);
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setServiceInternal(Service service) {
- m_propertySupport.setProperty(PROP_SERVICE, service);
-
- // reload proposals of port
- P_PortProposal[] portProposals = getPortProposals();
- SimpleProposalProvider portProvider = new SimpleProposalProvider(portProposals);
- if (isControlCreated()) {
- m_portField.setEnabled(service != null);
- m_portField.setContentProvider(portProvider);
- }
-
- // default proposal
- if (portProposals.length > 0) {
- setPort(portProposals[0].getPort());
- }
- else {
- setPort(null);
- }
- }
-
- public Service getService() {
- return (Service) m_propertySupport.getProperty(PROP_SERVICE);
- }
-
- public void setPort(Port port) {
- try {
- setStateChanging(true);
- setPortInternal(port);
- if (isControlCreated()) {
- if (port != null) {
- m_portField.acceptProposal(new P_PortProposal(port));
- }
- else {
- m_portField.acceptProposal(null);
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setPortInternal(Port port) {
- m_propertySupport.setProperty(PROP_PORT, port);
-
- // set port type
- if (port != null && port.getBinding() != null && port.getBinding().getPortType() != null) {
- setPortType(port.getBinding().getPortType());
- }
- else {
- setPortType(null);
- }
- }
-
- public Port getPort() {
- return (Port) m_propertySupport.getProperty(PROP_PORT);
- }
-
- public void setPortType(PortType portType) {
- try {
- setStateChanging(true);
- setPortTypeInternal(portType);
- if (isControlCreated()) {
- if (portType != null) {
- m_portTypeField.setText(StringUtility.nvl(portType.getQName().getLocalPart(), ""));
- m_portTypeField.setToolTipText(StringUtility.nvl(portType.getQName().toString(), ""));
- }
- else {
- m_portTypeField.setText("");
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setPortTypeInternal(PortType portType) {
- m_propertySupport.setProperty(PROP_PORT_TYPE, portType);
- if (isControlCreated() && m_deriveOtherNameButton != null) {
- m_deriveOtherNameButton.setEnabled(portType != null);
- m_deriveOtherNameButton.setSelection(portType != null);
- }
- deriveOtherNames();
- }
-
- public PortType getPortType() {
- return (PortType) m_propertySupport.getProperty(PROP_PORT_TYPE);
- }
-
- public void setDeriveOtherNames(boolean deriveOtherNames) {
- try {
- setStateChanging(true);
- setDeriveOtherNamesInternal(deriveOtherNames);
- if (isControlCreated()) {
- m_deriveOtherNameButton.setSelection(deriveOtherNames);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setDeriveOtherNamesInternal(boolean deriveOtherNames) {
- m_propertySupport.setPropertyBool(PROP_DERIVE_OTHER_NAME, deriveOtherNames);
- }
-
- public boolean isDeriveOtherNames() {
- return m_propertySupport.getPropertyBool(PROP_DERIVE_OTHER_NAME);
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.removePropertyChangeListener(listener);
- }
-
- private void loadIllegalValues() {
- Set<String> illegalAliases = new HashSet<String>();
- Set<String> illegalUrlPatterns = new HashSet<String>();
-
- if (m_sunJaxWsXml != null) {
- for (ScoutXmlElement xmlSunJaxWs : m_sunJaxWsXml.getRoot().getChildren(StringUtility.join(":", m_sunJaxWsXml.getRoot().getNamePrefix(), SunJaxWsBean.XML_ENDPOINT))) {
- SunJaxWsBean sunJaxWsBean = new SunJaxWsBean(xmlSunJaxWs);
- illegalAliases.add(sunJaxWsBean.getAlias());
- illegalUrlPatterns.add(sunJaxWsBean.getUrlPattern());
- }
- }
-
- m_illegalAliasNames = illegalAliases;
- m_illegalUrlPatterns = illegalUrlPatterns;
- }
-
- private void deriveOtherNames() {
- if (!isDeriveOtherNames()) {
- return;
- }
-
- String portTypeName = null;
- PortType portType = getPortType();
-
- if (portType != null) {
- portTypeName = portType.getQName().getLocalPart();
- if (portTypeName != null) {
- portTypeName = JaxWsSdkUtility.getPlainPortTypeName(portTypeName) + "Service";
- }
- }
-
- setAlias(portTypeName);
- setUrlPattern(portTypeName);
- }
-
- private P_ServiceProposal[] getServiceProposals() {
- if (getWsdlDefinition() != null) {
- Collection services = getWsdlDefinition().getServices().values();
- List<P_ServiceProposal> proposals = new ArrayList<P_ServiceProposal>(services.size());
- for (Object service : services) {
- proposals.add(new P_ServiceProposal((Service) service));
- }
- return proposals.toArray(new P_ServiceProposal[proposals.size()]);
- }
- return new P_ServiceProposal[0];
- }
-
- private P_PortProposal[] getPortProposals() {
- if (getService() != null) {
- Collection ports = getService().getPorts().values();
- List<P_PortProposal> proposals = new ArrayList<P_PortProposal>(ports.size());
- for (Object port : ports) {
- proposals.add(new P_PortProposal((Port) port));
- }
- return proposals.toArray(new P_PortProposal[proposals.size()]);
- }
- return new P_PortProposal[0];
- }
-
- private class P_ServiceProposal extends SimpleProposal {
-
- private static final String DATA_SERVICE = "dataService";
-
- private P_ServiceProposal(Service service) {
- super(service.getQName().getLocalPart(), JaxWsSdk.getImage(JaxWsIcons.Service));
- setData(DATA_SERVICE, service);
- }
-
- @Override
- public String getTextSelected() {
- return getService().getQName().toString();
- }
-
- public Service getService() {
- return (Service) getData(DATA_SERVICE);
- }
- }
-
- private class P_PortProposal extends SimpleProposal {
-
- private static final String DATA_PORT = "dataPort";
-
- private P_PortProposal(Port port) {
- super(port.getName(), JaxWsSdk.getImage(JaxWsIcons.Port));
- setData(DATA_PORT, port);
- }
-
- @Override
- public String getTextSelected() {
- Port port = getPort();
- return "{" + port.getBinding().getPortType().getQName().getNamespaceURI() + "}" + port.getName();
- }
-
- public Port getPort() {
- return (Port) getData(DATA_PORT);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.beans.PropertyChangeListener;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.ContentProposalEvent;
+import org.eclipse.scout.sdk.ui.fields.proposal.IProposalAdapterListener;
+import org.eclipse.scout.sdk.ui.fields.proposal.ProposalTextField;
+import org.eclipse.scout.sdk.ui.fields.proposal.SimpleLabelProvider;
+import org.eclipse.scout.sdk.ui.fields.proposal.SimpleProposal;
+import org.eclipse.scout.sdk.ui.fields.proposal.SimpleProposalProvider;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+
+public class WsPropertiesExistingWsdlWizardPage extends AbstractWorkspaceWizardPage {
+
+ public static final String PROP_SERVICE = "service";
+ public static final String PROP_PORT = "port";
+ public static final String PROP_PORT_TYPE = "portType";
+ public static final String PROP_DERIVE_OTHER_NAME = "deriveOtherNames";
+ public static final String PROP_ALIAS = "alias";
+ public static final String PROP_URL_PATTERN = "urlPattern";
+ public static final String PROP_WSDL_DEFINITION = "wsdlDefinition";
+
+ private BasicPropertySupport m_propertySupport;
+
+ private IScoutBundle m_bundle;
+ private String m_jaxWsServletAlias;
+
+ private ProposalTextField m_serviceField;
+ private ProposalTextField m_portField;
+ private StyledTextField m_portTypeField;
+ private Button m_deriveOtherNameButton;
+ private StyledTextField m_alias;
+ private StyledTextField m_urlPattern;
+
+ private ScoutXmlDocument m_sunJaxWsXml;
+ private Set<String> m_illegalAliasNames;
+ private Set<String> m_illegalUrlPatterns;
+
+ private WebserviceEnum m_webserviceEnum;
+
+ public WsPropertiesExistingWsdlWizardPage(IScoutBundle bundle, WebserviceEnum webserviceEnum) {
+ super(WsPropertiesExistingWsdlWizardPage.class.getName());
+ setTitle(Texts.get("ConfigureWebserviceProperties"));
+ setDescription(Texts.get("ConfigureWebserviceProperties"));
+
+ m_bundle = bundle;
+ m_webserviceEnum = webserviceEnum;
+ m_propertySupport = new BasicPropertySupport(this);
+ m_sunJaxWsXml = ResourceFactory.getSunJaxWsResource(bundle).loadXml();
+ m_jaxWsServletAlias = JaxWsConstants.JAX_WS_ALIAS;
+
+ setDeriveOtherNames(true);
+ loadIllegalValues();
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_serviceField = getFieldToolkit().createProposalField(parent, Texts.get("Service"));
+ m_serviceField.setLabelProvider(new SimpleLabelProvider());
+ m_serviceField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ Object proposal = event.proposal;
+ if (proposal != null) {
+ setServiceInternal(((P_ServiceProposal) proposal).getService());
+ }
+ else {
+ setServiceInternal(null);
+ }
+ pingStateChanging();
+ }
+ });
+
+ m_portField = getFieldToolkit().createProposalField(parent, Texts.get("Port"));
+ m_portField.setLabelProvider(new SimpleLabelProvider());
+ m_portField.addProposalAdapterListener(new IProposalAdapterListener() {
+ @Override
+ public void proposalAccepted(ContentProposalEvent event) {
+ Object proposal = event.proposal;
+ if (proposal != null) {
+ setPortInternal(((P_PortProposal) proposal).getPort());
+ }
+ else {
+ setPortInternal(null);
+ }
+ pingStateChanging();
+ }
+ });
+ m_portField.setEnabled(false);
+
+ m_portTypeField = getFieldToolkit().createStyledTextField(parent, Texts.get("PortType"));
+ m_portTypeField.setEnabled(false);
+
+ if (m_webserviceEnum == WebserviceEnum.Provider) {
+ m_deriveOtherNameButton = new Button(parent, SWT.CHECK);
+ m_deriveOtherNameButton.setSelection(isDeriveOtherNames());
+ m_deriveOtherNameButton.setText(Texts.get("DeriveOtherNamesFormPortTypeChosen"));
+ m_deriveOtherNameButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setDeriveOtherNames(m_deriveOtherNameButton.getSelection());
+ if (isDeriveOtherNames()) {
+ deriveOtherNames();
+ }
+ }
+ });
+
+ m_alias = getFieldToolkit().createStyledTextField(parent, Texts.get("Alias"));
+ m_alias.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setAliasInternal(m_alias.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_urlPattern = getFieldToolkit().createStyledTextField(parent, Texts.get("UrlPattern"));
+ m_urlPattern.setReadOnlyPrefix(JaxWsSdkUtility.normalizePath(m_jaxWsServletAlias, SeparatorType.BothType));
+ m_urlPattern.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setUrlPatternInternal(m_urlPattern.getText());
+ pingStateChanging();
+ }
+ });
+ }
+
+ // layout
+ parent.setLayout(new FormLayout());
+
+ FormData formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_serviceField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_serviceField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_portField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_portField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_portTypeField.setLayoutData(formData);
+
+ if (m_webserviceEnum == WebserviceEnum.Provider) {
+ formData = new FormData();
+ formData.top = new FormAttachment(m_portTypeField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_deriveOtherNameButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_deriveOtherNameButton, 30, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_alias.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_alias, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_urlPattern.setLayoutData(formData);
+ }
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ if (!isControlCreated()) {
+ return;
+ }
+
+ if (getWsdlDefinition() == null) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("WsdlCouldNotBeParsed")));
+ return;
+ }
+
+ if (getServiceProposals().length == 0) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, "WSDL definition must contain one service element at least.\nPlease ensure to have specified the main WSDL file and not an imported, dependent one."));
+ return;
+ }
+
+ // alias
+ if (m_alias != null) {
+ if (StringUtility.isNullOrEmpty(getAlias())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_alias.getLabelText())));
+ }
+ else if (m_illegalAliasNames.contains(getAlias())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XWithYDoesAlreadyExist", m_alias.getLabelText(), getAlias())));
+ }
+ else {
+ IStatus status = m_bundle.getProject().getWorkspace().validateName(getAlias(), IResource.FILE);
+ if (status.isOK() == false) {
+ multiStatus.add(status);
+ }
+ }
+ }
+ if (m_urlPattern != null) {
+ // URL pattern
+ if (StringUtility.isNullOrEmpty(getUrlPattern()) || getUrlPattern().equals(m_jaxWsServletAlias)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_urlPattern.getLabelText())));
+ }
+ else if (!getUrlPattern().startsWith(m_jaxWsServletAlias)) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("XshouldStartWithY", m_urlPattern.getLabelText(), m_jaxWsServletAlias)));
+ }
+ else if (getUrlPattern().matches(".*\\s+.*")) { // check for whitespaces
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("UrlXshouldNotContainWhitespaces", getUrlPattern())));
+ }
+ else if (m_illegalUrlPatterns.contains(getUrlPattern())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XWithYDoesAlreadyExist", m_urlPattern.getLabelText(), getUrlPattern())));
+ }
+ }
+
+ if (getService() == null) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_serviceField.getLabelText())));
+ }
+ else if (getPort() == null) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_portField.getLabelText())));
+ }
+ else if (getPortType() == null) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_portTypeField.getLabelText())));
+ }
+ }
+
+ public Definition getWsdlDefinition() {
+ return (Definition) m_propertySupport.getProperty(PROP_WSDL_DEFINITION);
+ }
+
+ /**
+ * Main input for wizard page
+ *
+ * @param wsdlDefinition
+ */
+ public void setWsdlDefinition(Definition wsdlDefinition) {
+ m_propertySupport.setProperty(PROP_WSDL_DEFINITION, wsdlDefinition);
+
+ setStateChanging(true);
+ try {
+ setService(null);
+ setPort(null);
+ setPortType(null);
+
+ // reload proposals of service
+ P_ServiceProposal[] serviceProposals = getServiceProposals();
+ SimpleProposalProvider serviceProvider = new SimpleProposalProvider(serviceProposals);
+ m_serviceField.setContentProvider(serviceProvider);
+
+ // default proposal for service --> ports are reloaded by setting the service
+ if (serviceProposals.length > 0) {
+ setService(serviceProposals[0].getService());
+ }
+ else {
+ setService(null);
+ }
+
+ m_serviceField.setEnabled(serviceProposals.length > 0);
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ public void setAlias(String alias) {
+ try {
+ setStateChanging(true);
+ setAliasInternal(alias);
+ if (isControlCreated() && m_alias != null) {
+ m_alias.setText(alias);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setAliasInternal(String alias) {
+ m_propertySupport.setPropertyString(PROP_ALIAS, alias);
+ }
+
+ public String getAlias() {
+ return m_propertySupport.getPropertyString(PROP_ALIAS);
+ }
+
+ public void setUrlPattern(String urlPattern) {
+ try {
+ setStateChanging(true);
+ setUrlPatternInternal(urlPattern);
+ if (isControlCreated() && m_urlPattern != null) {
+ m_urlPattern.setText(urlPattern);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setUrlPatternInternal(String urlPattern) {
+ m_propertySupport.setPropertyString(PROP_URL_PATTERN, urlPattern);
+ }
+
+ public String getUrlPattern() {
+ return m_propertySupport.getPropertyString(PROP_URL_PATTERN);
+ }
+
+ public void setJaxWsServletAlias(String jaxWsServletAlias) {
+ m_jaxWsServletAlias = jaxWsServletAlias;
+ if (isControlCreated()) {
+ m_urlPattern.setReadOnlyPrefix(JaxWsSdkUtility.normalizePath(m_jaxWsServletAlias, SeparatorType.BothType));
+ }
+ }
+
+ public void setService(Service service) {
+ try {
+ setStateChanging(true);
+ setServiceInternal(service);
+
+ if (isControlCreated()) {
+ if (service != null) {
+ m_serviceField.acceptProposal(new P_ServiceProposal(service));
+ }
+ else {
+ m_serviceField.acceptProposal(null);
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setServiceInternal(Service service) {
+ m_propertySupport.setProperty(PROP_SERVICE, service);
+
+ // reload proposals of port
+ P_PortProposal[] portProposals = getPortProposals();
+ SimpleProposalProvider portProvider = new SimpleProposalProvider(portProposals);
+ if (isControlCreated()) {
+ m_portField.setEnabled(service != null);
+ m_portField.setContentProvider(portProvider);
+ }
+
+ // default proposal
+ if (portProposals.length > 0) {
+ setPort(portProposals[0].getPort());
+ }
+ else {
+ setPort(null);
+ }
+ }
+
+ public Service getService() {
+ return (Service) m_propertySupport.getProperty(PROP_SERVICE);
+ }
+
+ public void setPort(Port port) {
+ try {
+ setStateChanging(true);
+ setPortInternal(port);
+ if (isControlCreated()) {
+ if (port != null) {
+ m_portField.acceptProposal(new P_PortProposal(port));
+ }
+ else {
+ m_portField.acceptProposal(null);
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setPortInternal(Port port) {
+ m_propertySupport.setProperty(PROP_PORT, port);
+
+ // set port type
+ if (port != null && port.getBinding() != null && port.getBinding().getPortType() != null) {
+ setPortType(port.getBinding().getPortType());
+ }
+ else {
+ setPortType(null);
+ }
+ }
+
+ public Port getPort() {
+ return (Port) m_propertySupport.getProperty(PROP_PORT);
+ }
+
+ public void setPortType(PortType portType) {
+ try {
+ setStateChanging(true);
+ setPortTypeInternal(portType);
+ if (isControlCreated()) {
+ if (portType != null) {
+ m_portTypeField.setText(StringUtility.nvl(portType.getQName().getLocalPart(), ""));
+ m_portTypeField.setToolTipText(StringUtility.nvl(portType.getQName().toString(), ""));
+ }
+ else {
+ m_portTypeField.setText("");
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setPortTypeInternal(PortType portType) {
+ m_propertySupport.setProperty(PROP_PORT_TYPE, portType);
+ if (isControlCreated() && m_deriveOtherNameButton != null) {
+ m_deriveOtherNameButton.setEnabled(portType != null);
+ m_deriveOtherNameButton.setSelection(portType != null);
+ }
+ deriveOtherNames();
+ }
+
+ public PortType getPortType() {
+ return (PortType) m_propertySupport.getProperty(PROP_PORT_TYPE);
+ }
+
+ public void setDeriveOtherNames(boolean deriveOtherNames) {
+ try {
+ setStateChanging(true);
+ setDeriveOtherNamesInternal(deriveOtherNames);
+ if (isControlCreated()) {
+ m_deriveOtherNameButton.setSelection(deriveOtherNames);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setDeriveOtherNamesInternal(boolean deriveOtherNames) {
+ m_propertySupport.setPropertyBool(PROP_DERIVE_OTHER_NAME, deriveOtherNames);
+ }
+
+ public boolean isDeriveOtherNames() {
+ return m_propertySupport.getPropertyBool(PROP_DERIVE_OTHER_NAME);
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.removePropertyChangeListener(listener);
+ }
+
+ private void loadIllegalValues() {
+ Set<String> illegalAliases = new HashSet<String>();
+ Set<String> illegalUrlPatterns = new HashSet<String>();
+
+ if (m_sunJaxWsXml != null) {
+ for (ScoutXmlElement xmlSunJaxWs : m_sunJaxWsXml.getRoot().getChildren(StringUtility.join(":", m_sunJaxWsXml.getRoot().getNamePrefix(), SunJaxWsBean.XML_ENDPOINT))) {
+ SunJaxWsBean sunJaxWsBean = new SunJaxWsBean(xmlSunJaxWs);
+ illegalAliases.add(sunJaxWsBean.getAlias());
+ illegalUrlPatterns.add(sunJaxWsBean.getUrlPattern());
+ }
+ }
+
+ m_illegalAliasNames = illegalAliases;
+ m_illegalUrlPatterns = illegalUrlPatterns;
+ }
+
+ private void deriveOtherNames() {
+ if (!isDeriveOtherNames()) {
+ return;
+ }
+
+ String portTypeName = null;
+ PortType portType = getPortType();
+
+ if (portType != null) {
+ portTypeName = portType.getQName().getLocalPart();
+ if (portTypeName != null) {
+ portTypeName = JaxWsSdkUtility.getPlainPortTypeName(portTypeName) + "Service";
+ }
+ }
+
+ setAlias(portTypeName);
+ setUrlPattern(portTypeName);
+ }
+
+ private P_ServiceProposal[] getServiceProposals() {
+ if (getWsdlDefinition() != null) {
+ Collection services = getWsdlDefinition().getServices().values();
+ List<P_ServiceProposal> proposals = new ArrayList<P_ServiceProposal>(services.size());
+ for (Object service : services) {
+ proposals.add(new P_ServiceProposal((Service) service));
+ }
+ return proposals.toArray(new P_ServiceProposal[proposals.size()]);
+ }
+ return new P_ServiceProposal[0];
+ }
+
+ private P_PortProposal[] getPortProposals() {
+ if (getService() != null) {
+ Collection ports = getService().getPorts().values();
+ List<P_PortProposal> proposals = new ArrayList<P_PortProposal>(ports.size());
+ for (Object port : ports) {
+ proposals.add(new P_PortProposal((Port) port));
+ }
+ return proposals.toArray(new P_PortProposal[proposals.size()]);
+ }
+ return new P_PortProposal[0];
+ }
+
+ private class P_ServiceProposal extends SimpleProposal {
+
+ private static final String DATA_SERVICE = "dataService";
+
+ private P_ServiceProposal(Service service) {
+ super(service.getQName().getLocalPart(), JaxWsSdk.getImage(JaxWsIcons.Service));
+ setData(DATA_SERVICE, service);
+ }
+
+ @Override
+ public String getTextSelected() {
+ return getService().getQName().toString();
+ }
+
+ public Service getService() {
+ return (Service) getData(DATA_SERVICE);
+ }
+ }
+
+ private class P_PortProposal extends SimpleProposal {
+
+ private static final String DATA_PORT = "dataPort";
+
+ private P_PortProposal(Port port) {
+ super(port.getName(), JaxWsSdk.getImage(JaxWsIcons.Port));
+ setData(DATA_PORT, port);
+ }
+
+ @Override
+ public String getTextSelected() {
+ Port port = getPort();
+ return "{" + port.getBinding().getPortType().getQName().getNamespaceURI() + "}" + port.getName();
+ }
+
+ public Port getPort() {
+ return (Port) getData(DATA_PORT);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsPropertiesNewWsdlWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsPropertiesNewWsdlWizardPage.java
index 18f021573..4f4164d84 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsPropertiesNewWsdlWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsPropertiesNewWsdlWizardPage.java
@@ -1,745 +1,745 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.beans.PropertyChangeListener;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.HashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Set;
-
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.operation.WsdlStyleEnum;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-
-@SuppressWarnings("restriction")
-public class WsPropertiesNewWsdlWizardPage extends AbstractWorkspaceWizardPage {
-
- public static final String PROP_WSDL_NAME = "wsdlName";
- public static final String PROP_DERIVE_OTHER_NAME = "deriveOtherNames";
- public static final String PROP_ALIAS = "alias";
- public static final String PROP_URL_PATTERN = "urlPattern";
- public static final String PROP_TARGET_NAMESPACE = "targetNamespace";
- public static final String PROP_SERVICE_NAME = "serviceName";
- public static final String PROP_PORT_NAME = "port";
- public static final String PROP_BINDING_NAME = "bindingName";
- public static final String PROP_PORT_TYPE_NAME = "portTypeName";
- public static final String PROP_SERVICE_OPERATION_NAME = "serviceOperationName";
- public static final String PROP_WSDL_STYLE = "wsdlStyle";
-
- private BasicPropertySupport m_propertySupport;
-
- private IScoutBundle m_bundle;
- private String m_jaxWsServletAlias;
-
- private StyledTextField m_wsdlNameField;
- private Button m_deriveOtherNameButton;
- private StyledTextField m_alias;
- private StyledTextField m_urlPattern;
- private StyledTextField m_targetNamespaceField;
- private StyledTextField m_serviceNameField;
- private StyledTextField m_portNameField;
- private StyledTextField m_bindingNameField;
- private StyledTextField m_portTypeNameField;
- private StyledTextField m_serviceOperationNameField;
- private Composite m_wsdlStyleRadioComposite;
- private List<Button> m_wsdlStyleRadioButtons;
-
- private ScoutXmlDocument m_sunJaxWsXml;
- private Set<String> m_illegalAliasNames;
- private Set<String> m_illegalUrlPatterns;
-
- private boolean m_showOnlyWsdlProperties;
-
- public WsPropertiesNewWsdlWizardPage(IScoutBundle bundle) {
- super(WsPropertiesNewWsdlWizardPage.class.getName());
- setTitle(Texts.get("ConfigureWebserviceProperties"));
- setDescription(Texts.get("ConfigureWebserviceProperties"));
-
- m_bundle = bundle;
- m_propertySupport = new BasicPropertySupport(this);
- m_sunJaxWsXml = ResourceFactory.getSunJaxWsResource(bundle).loadXml();
- m_wsdlStyleRadioButtons = new LinkedList<Button>();
- m_jaxWsServletAlias = JaxWsConstants.JAX_WS_ALIAS;
-
- loadIllegalValues();
- applyDefaults();
- }
-
- private void applyDefaults() {
- setDeriveOtherNames(true);
- setWsdlStyle(WsdlStyleEnum.DocumentLiteralWrapped);
- }
-
- @Override
- public void postActivate() {
- if (isShowOnlyWsdlProperties()) {
- deriveOtherNames();
- }
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_wsdlNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("WsdlName"));
- m_wsdlNameField.setText(getWsdlName());
- m_wsdlNameField.setReadOnlySuffix("WebService.wsdl");
- m_wsdlNameField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setWsdlNameInternal(m_wsdlNameField.getText());
- pingStateChanging();
- deriveOtherNames();
- }
- });
- m_wsdlNameField.setVisible(!isShowOnlyWsdlProperties());
-
- m_deriveOtherNameButton = new Button(parent, SWT.CHECK);
- m_deriveOtherNameButton.setSelection(isDeriveOtherNames());
- m_deriveOtherNameButton.setText(Texts.get("DeriveOtherNamesFormWsdlFileName"));
- m_deriveOtherNameButton.setVisible(!isShowOnlyWsdlProperties());
- m_deriveOtherNameButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- setDeriveOtherNames(m_deriveOtherNameButton.getSelection());
- deriveOtherNames();
- }
- });
-
- m_alias = getFieldToolkit().createStyledTextField(parent, Texts.get("Alias"));
- m_alias.setText(getWsdlName());
- m_alias.setVisible(!isShowOnlyWsdlProperties());
- m_alias.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setAliasInternal(m_alias.getText());
- pingStateChanging();
- }
- });
-
- m_urlPattern = getFieldToolkit().createStyledTextField(parent, Texts.get("UrlPattern"));
- m_urlPattern.setText(getWsdlName());
- m_urlPattern.setReadOnlyPrefix(JaxWsSdkUtility.normalizePath(m_jaxWsServletAlias, SeparatorType.BothType));
- m_urlPattern.setVisible(!isShowOnlyWsdlProperties());
- m_urlPattern.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setUrlPatternInternal(m_urlPattern.getText());
- pingStateChanging();
- }
- });
-
- m_targetNamespaceField = getFieldToolkit().createStyledTextField(parent, Texts.get("TargetNamespace"));
- m_targetNamespaceField.setText(getTargetNamespace());
- m_targetNamespaceField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setTargetNamespaceInternal(m_targetNamespaceField.getText());
- pingStateChanging();
- }
- });
-
- m_serviceNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("Service"));
- m_serviceNameField.setText(getServiceName());
- m_serviceNameField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setServiceNameInternal(m_serviceNameField.getText());
- pingStateChanging();
- }
- });
-
- m_portNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("Port"));
- m_portNameField.setText(getServiceName());
- m_portNameField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setPortNameInternal(m_portNameField.getText());
- pingStateChanging();
- }
- });
-
- m_bindingNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("Binding"));
- m_bindingNameField.setText(getBinding());
- m_bindingNameField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setBindingNameInternal(m_bindingNameField.getText());
- pingStateChanging();
- }
- });
-
- m_portTypeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("PortType"));
- m_portTypeNameField.setText(getPortTypeName());
- m_portTypeNameField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setPortTypeNameInternal(m_portTypeNameField.getText());
- pingStateChanging();
- }
- });
-
- m_serviceOperationNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("ServiceOperation"));
- m_serviceOperationNameField.setText(getPortTypeName());
- m_serviceOperationNameField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setServiceOperationNameInternal(m_serviceOperationNameField.getText());
- pingStateChanging();
- }
- });
-
- Label wsdlStyleLabel = new Label(parent, SWT.NONE);
- wsdlStyleLabel.setText(Texts.get("WsdlStyle"));
- m_wsdlStyleRadioComposite = new Composite(parent, SWT.NONE);
- m_wsdlStyleRadioComposite.setLayout(new GridLayout(1, true));
- for (WsdlStyleEnum wsdlStyleEnum : WsdlStyleEnum.values()) {
- createWsdlStyleRadioButton(wsdlStyleEnum);
- }
-
- // layout
- parent.setLayout(new FormLayout());
-
- Control previousWidget = null;
- if (!isShowOnlyWsdlProperties()) {
- FormData formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_wsdlNameField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_wsdlNameField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_deriveOtherNameButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_deriveOtherNameButton, 20, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_alias.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_alias, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_urlPattern.setLayoutData(formData);
- previousWidget = m_urlPattern;
- }
-
- FormData formData = new FormData();
- if (isShowOnlyWsdlProperties()) {
- formData.top = new FormAttachment(0, 0);
- }
- else {
- formData.top = new FormAttachment(previousWidget, 30, SWT.BOTTOM);
- }
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_targetNamespaceField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_targetNamespaceField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_serviceNameField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_serviceNameField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_portNameField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_portNameField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_bindingNameField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_bindingNameField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_portTypeNameField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_portTypeNameField, 30, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_serviceOperationNameField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_serviceOperationNameField, 30, SWT.BOTTOM);
- formData.right = new FormAttachment(40, 0);
- wsdlStyleLabel.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(wsdlStyleLabel, -5, SWT.TOP);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_wsdlStyleRadioComposite.setLayoutData(formData);
- }
-
- protected void createWsdlStyleRadioButton(WsdlStyleEnum wsdlStyleEnum) {
- Button button = new Button(m_wsdlStyleRadioComposite, SWT.RADIO);
- button.setData("ID", wsdlStyleEnum);
- button.setText(wsdlStyleEnum.getLabel());
- button.setSelection((wsdlStyleEnum == getWsdlStyle()));
- button.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- setStateChanging(true);
- setWsdlStyle((WsdlStyleEnum) e.widget.getData("ID"));
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- // layout
- button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
- m_wsdlStyleRadioButtons.add(button);
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- if (!isControlCreated()) {
- return;
- }
-
- // WSDL name
- if (!isShowOnlyWsdlProperties()) {
- if (StringUtility.isNullOrEmpty(getWsdlName())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_wsdlNameField.getLabelText())));
- }
- IStatus validationStatus = m_bundle.getProject().getWorkspace().validateName(getWsdlName(), IResource.FILE);
- multiStatus.add(validationStatus);
-
- // alias
- if (StringUtility.isNullOrEmpty(getAlias())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_alias.getLabelText())));
- }
- else if (m_illegalAliasNames.contains(getAlias())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XWithYDoesAlreadyExist", m_alias.getLabelText(), getAlias())));
- }
- else {
- IStatus status = m_bundle.getProject().getWorkspace().validateName(getAlias(), IResource.FILE);
- if (status.isOK() == false) {
- multiStatus.add(status);
- }
- }
-
- // URL pattern
- if (StringUtility.isNullOrEmpty(getUrlPattern()) || getUrlPattern().equals(m_jaxWsServletAlias)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_urlPattern.getLabelText())));
- }
- else if (!getUrlPattern().startsWith(m_jaxWsServletAlias)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XshouldStartWithY", m_urlPattern.getLabelText(), m_jaxWsServletAlias)));
- }
- else if (!getUrlPattern().matches(".*[\\w\\-]+.*")) { // check for illegal characters
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidUrlX", getUrlPattern())));
- }
- else if (m_illegalUrlPatterns.contains(getUrlPattern())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XWithYDoesAlreadyExist", m_urlPattern.getLabelText(), getUrlPattern())));
- }
- }
-
- // targetName
- validateTargetNamespace(multiStatus);
- // service name
- validateJavaField(multiStatus, m_serviceNameField.getLabelText(), getServiceName());
- // port name
- validateJavaField(multiStatus, m_portNameField.getLabelText(), getPortName());
- // binding
- validateJavaField(multiStatus, m_bindingNameField.getLabelText(), getBinding());
- // port type
- validateJavaField(multiStatus, m_portTypeNameField.getLabelText(), getPortTypeName());
- // service operation name
- if (StringUtility.isNullOrEmpty(getServiceOperationName())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_serviceOperationNameField.getLabelText())));
- }
- else {
- IStatus validationStatus = JavaConventionsUtil.validateMethodName(getServiceOperationName(), m_bundle.getJavaProject());
- multiStatus.add(validationStatus);
- }
- }
-
- public void setWsdlName(String wsdlName) {
- try {
- setStateChanging(true);
- setWsdlNameInternal(wsdlName);
- if (isControlCreated()) {
- m_wsdlNameField.setText(wsdlName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setWsdlNameInternal(String wsdlName) {
- m_propertySupport.setPropertyString(PROP_WSDL_NAME, wsdlName);
- }
-
- public String getWsdlName() {
- return m_propertySupport.getPropertyString(PROP_WSDL_NAME);
- }
-
- public void setDeriveOtherNames(boolean deriveOtherNames) {
- try {
- setStateChanging(true);
- setDeriveOtherNamesInternal(deriveOtherNames);
- if (isControlCreated()) {
- m_deriveOtherNameButton.setSelection(deriveOtherNames);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setDeriveOtherNamesInternal(boolean deriveOtherNames) {
- m_propertySupport.setPropertyBool(PROP_DERIVE_OTHER_NAME, deriveOtherNames);
- }
-
- public boolean isDeriveOtherNames() {
- return m_propertySupport.getPropertyBool(PROP_DERIVE_OTHER_NAME);
- }
-
- public void setAlias(String alias) {
- try {
- setStateChanging(true);
- setAliasInternal(alias);
- if (isControlCreated()) {
- m_alias.setText(alias);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setAliasInternal(String alias) {
- m_propertySupport.setPropertyString(PROP_ALIAS, alias);
- }
-
- public String getAlias() {
- return m_propertySupport.getPropertyString(PROP_ALIAS);
- }
-
- public void setUrlPattern(String urlPattern) {
- try {
- setStateChanging(true);
- setUrlPatternInternal(urlPattern);
- if (isControlCreated()) {
- m_urlPattern.setText(urlPattern);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setUrlPatternInternal(String urlPattern) {
- m_propertySupport.setPropertyString(PROP_URL_PATTERN, urlPattern);
- }
-
- public String getUrlPattern() {
- return m_propertySupport.getPropertyString(PROP_URL_PATTERN);
- }
-
- public void setJaxWsServletAlias(String jaxWsServletAlias) {
- m_jaxWsServletAlias = jaxWsServletAlias;
- if (isControlCreated()) {
- m_urlPattern.setReadOnlyPrefix(JaxWsSdkUtility.normalizePath(m_jaxWsServletAlias, SeparatorType.BothType));
- }
- }
-
- public void setTargetNamespace(String targetNamespace) {
- try {
- setStateChanging(true);
- setTargetNamespaceInternal(targetNamespace);
- if (isControlCreated()) {
- m_targetNamespaceField.setText(targetNamespace);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setTargetNamespaceInternal(String targetNamespace) {
- m_propertySupport.setPropertyString(PROP_TARGET_NAMESPACE, targetNamespace);
- }
-
- public String getTargetNamespace() {
- return m_propertySupport.getPropertyString(PROP_TARGET_NAMESPACE);
- }
-
- public void setBindingName(String bindingName) {
- try {
- setStateChanging(true);
- setBindingNameInternal(bindingName);
- if (isControlCreated()) {
- m_bindingNameField.setText(bindingName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setBindingNameInternal(String bindingName) {
- m_propertySupport.setPropertyString(PROP_BINDING_NAME, bindingName);
- }
-
- public String getBinding() {
- return m_propertySupport.getPropertyString(PROP_BINDING_NAME);
- }
-
- public void setServiceName(String serviceName) {
- try {
- setStateChanging(true);
- setServiceNameInternal(serviceName);
- if (isControlCreated()) {
- m_serviceNameField.setText(serviceName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setServiceNameInternal(String serviceName) {
- m_propertySupport.setPropertyString(PROP_SERVICE_NAME, serviceName);
- }
-
- public String getServiceName() {
- return m_propertySupport.getPropertyString(PROP_SERVICE_NAME);
- }
-
- public void setPortTypeName(String portTypeName) {
- try {
- setStateChanging(true);
- setPortTypeNameInternal(portTypeName);
- if (isControlCreated()) {
- m_portTypeNameField.setText(portTypeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setPortTypeNameInternal(String portTypeName) {
- m_propertySupport.setPropertyString(PROP_PORT_TYPE_NAME, portTypeName);
- }
-
- public String getPortTypeName() {
- return m_propertySupport.getPropertyString(PROP_PORT_TYPE_NAME);
- }
-
- public void setPortName(String portName) {
- try {
- setStateChanging(true);
- setPortNameInternal(portName);
- if (isControlCreated()) {
- m_portNameField.setText(portName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setPortNameInternal(String portName) {
- m_propertySupport.setPropertyString(PROP_PORT_NAME, portName);
- }
-
- public String getPortName() {
- return m_propertySupport.getPropertyString(PROP_PORT_NAME);
- }
-
- public void setServiceOperationName(String serviceOperationName) {
- try {
- setStateChanging(true);
- setServiceOperationNameInternal(serviceOperationName);
- if (isControlCreated()) {
- m_serviceOperationNameField.setText(serviceOperationName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setServiceOperationNameInternal(String serviceOperationName) {
- m_propertySupport.setPropertyString(PROP_SERVICE_OPERATION_NAME, serviceOperationName);
- }
-
- public String getServiceOperationName() {
- return m_propertySupport.getPropertyString(PROP_SERVICE_OPERATION_NAME);
- }
-
- public void setWsdlStyle(WsdlStyleEnum wsdlStyleEnum) {
- try {
- setStateChanging(true);
- setWsdlStyleInternal(wsdlStyleEnum);
- if (isControlCreated()) {
- for (Button radioButton : m_wsdlStyleRadioButtons) {
- radioButton.setSelection(wsdlStyleEnum == (WsdlStyleEnum) radioButton.getData("ID"));
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setWsdlStyleInternal(WsdlStyleEnum wsdlStyleEnum) {
- m_propertySupport.setProperty(PROP_WSDL_STYLE, wsdlStyleEnum);
- }
-
- public WsdlStyleEnum getWsdlStyle() {
- return (WsdlStyleEnum) m_propertySupport.getProperty(PROP_WSDL_STYLE);
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.removePropertyChangeListener(listener);
- }
-
- private void validateTargetNamespace(MultiStatus multiStatus) {
- if (StringUtility.isNullOrEmpty(m_targetNamespaceField.getText())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_targetNamespaceField.getLabelText())));
- }
- else {
- try {
- new URL(m_targetNamespaceField.getText());
- }
- catch (MalformedURLException e) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("TargetNamespaceMustBeValudUrl")));
- }
-
- if (!m_targetNamespaceField.getText().endsWith("/")) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, "Target Namespace must end with a slash"));
- }
- }
- }
-
- private void validateJavaField(MultiStatus multiStatus, String label, String text) {
- if (StringUtility.isNullOrEmpty(text)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", label)));
- return;
- }
- IStatus validationStatus = m_bundle.getProject().getWorkspace().validateName(text, IResource.FILE);
- multiStatus.add(validationStatus);
-
- validationStatus = JavaConventionsUtil.validateJavaTypeName(text, m_bundle.getJavaProject());
- multiStatus.add(validationStatus);
-
- if (Character.isLowerCase(text.charAt(0))) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("UpperCaseHint")));
- }
- }
-
- private void deriveOtherNames() {
- if (!isDeriveOtherNames()) {
- return;
- }
-
- String serviceName = getWsdlName().substring(0, getWsdlName().length() - ".wsdl".length());
- setTargetNamespace(JaxWsSdkUtility.getRecommendedTargetNamespace(m_bundle, serviceName));
- setServiceName(serviceName);
- setPortName(serviceName + "Port");
- setBindingName(serviceName + "PortSoapBinding");
- setPortTypeName(serviceName + "PortType");
- setAlias(serviceName);
- setUrlPattern(serviceName);
-
- setServiceOperationName(JaxWsSdkUtility.toStartWithLowerCase(serviceName.substring(0, serviceName.length() - "WebService".length())));
- }
-
- private void loadIllegalValues() {
- Set<String> illegalAliases = new HashSet<String>();
- Set<String> illegalUrlPatterns = new HashSet<String>();
-
- if (m_sunJaxWsXml != null) {
- for (ScoutXmlElement xmlSunJaxWs : m_sunJaxWsXml.getRoot().getChildren(StringUtility.join(":", m_sunJaxWsXml.getRoot().getNamePrefix(), SunJaxWsBean.XML_ENDPOINT))) {
- SunJaxWsBean sunJaxWsBean = new SunJaxWsBean(xmlSunJaxWs);
- illegalAliases.add(sunJaxWsBean.getAlias());
- illegalUrlPatterns.add(sunJaxWsBean.getUrlPattern());
- }
- }
-
- m_illegalAliasNames = illegalAliases;
- m_illegalUrlPatterns = illegalUrlPatterns;
- }
-
- public boolean isShowOnlyWsdlProperties() {
- return m_showOnlyWsdlProperties;
- }
-
- public void setShowOnlyWsdlProperties(boolean showOnlyWsdlProperties) {
- m_showOnlyWsdlProperties = showOnlyWsdlProperties;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.beans.PropertyChangeListener;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.operation.WsdlStyleEnum;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.SunJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+
+@SuppressWarnings("restriction")
+public class WsPropertiesNewWsdlWizardPage extends AbstractWorkspaceWizardPage {
+
+ public static final String PROP_WSDL_NAME = "wsdlName";
+ public static final String PROP_DERIVE_OTHER_NAME = "deriveOtherNames";
+ public static final String PROP_ALIAS = "alias";
+ public static final String PROP_URL_PATTERN = "urlPattern";
+ public static final String PROP_TARGET_NAMESPACE = "targetNamespace";
+ public static final String PROP_SERVICE_NAME = "serviceName";
+ public static final String PROP_PORT_NAME = "port";
+ public static final String PROP_BINDING_NAME = "bindingName";
+ public static final String PROP_PORT_TYPE_NAME = "portTypeName";
+ public static final String PROP_SERVICE_OPERATION_NAME = "serviceOperationName";
+ public static final String PROP_WSDL_STYLE = "wsdlStyle";
+
+ private BasicPropertySupport m_propertySupport;
+
+ private IScoutBundle m_bundle;
+ private String m_jaxWsServletAlias;
+
+ private StyledTextField m_wsdlNameField;
+ private Button m_deriveOtherNameButton;
+ private StyledTextField m_alias;
+ private StyledTextField m_urlPattern;
+ private StyledTextField m_targetNamespaceField;
+ private StyledTextField m_serviceNameField;
+ private StyledTextField m_portNameField;
+ private StyledTextField m_bindingNameField;
+ private StyledTextField m_portTypeNameField;
+ private StyledTextField m_serviceOperationNameField;
+ private Composite m_wsdlStyleRadioComposite;
+ private List<Button> m_wsdlStyleRadioButtons;
+
+ private ScoutXmlDocument m_sunJaxWsXml;
+ private Set<String> m_illegalAliasNames;
+ private Set<String> m_illegalUrlPatterns;
+
+ private boolean m_showOnlyWsdlProperties;
+
+ public WsPropertiesNewWsdlWizardPage(IScoutBundle bundle) {
+ super(WsPropertiesNewWsdlWizardPage.class.getName());
+ setTitle(Texts.get("ConfigureWebserviceProperties"));
+ setDescription(Texts.get("ConfigureWebserviceProperties"));
+
+ m_bundle = bundle;
+ m_propertySupport = new BasicPropertySupport(this);
+ m_sunJaxWsXml = ResourceFactory.getSunJaxWsResource(bundle).loadXml();
+ m_wsdlStyleRadioButtons = new LinkedList<Button>();
+ m_jaxWsServletAlias = JaxWsConstants.JAX_WS_ALIAS;
+
+ loadIllegalValues();
+ applyDefaults();
+ }
+
+ private void applyDefaults() {
+ setDeriveOtherNames(true);
+ setWsdlStyle(WsdlStyleEnum.DocumentLiteralWrapped);
+ }
+
+ @Override
+ public void postActivate() {
+ if (isShowOnlyWsdlProperties()) {
+ deriveOtherNames();
+ }
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_wsdlNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("WsdlName"));
+ m_wsdlNameField.setText(getWsdlName());
+ m_wsdlNameField.setReadOnlySuffix("WebService.wsdl");
+ m_wsdlNameField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setWsdlNameInternal(m_wsdlNameField.getText());
+ pingStateChanging();
+ deriveOtherNames();
+ }
+ });
+ m_wsdlNameField.setVisible(!isShowOnlyWsdlProperties());
+
+ m_deriveOtherNameButton = new Button(parent, SWT.CHECK);
+ m_deriveOtherNameButton.setSelection(isDeriveOtherNames());
+ m_deriveOtherNameButton.setText(Texts.get("DeriveOtherNamesFormWsdlFileName"));
+ m_deriveOtherNameButton.setVisible(!isShowOnlyWsdlProperties());
+ m_deriveOtherNameButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setDeriveOtherNames(m_deriveOtherNameButton.getSelection());
+ deriveOtherNames();
+ }
+ });
+
+ m_alias = getFieldToolkit().createStyledTextField(parent, Texts.get("Alias"));
+ m_alias.setText(getWsdlName());
+ m_alias.setVisible(!isShowOnlyWsdlProperties());
+ m_alias.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setAliasInternal(m_alias.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_urlPattern = getFieldToolkit().createStyledTextField(parent, Texts.get("UrlPattern"));
+ m_urlPattern.setText(getWsdlName());
+ m_urlPattern.setReadOnlyPrefix(JaxWsSdkUtility.normalizePath(m_jaxWsServletAlias, SeparatorType.BothType));
+ m_urlPattern.setVisible(!isShowOnlyWsdlProperties());
+ m_urlPattern.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setUrlPatternInternal(m_urlPattern.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_targetNamespaceField = getFieldToolkit().createStyledTextField(parent, Texts.get("TargetNamespace"));
+ m_targetNamespaceField.setText(getTargetNamespace());
+ m_targetNamespaceField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setTargetNamespaceInternal(m_targetNamespaceField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_serviceNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("Service"));
+ m_serviceNameField.setText(getServiceName());
+ m_serviceNameField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setServiceNameInternal(m_serviceNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_portNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("Port"));
+ m_portNameField.setText(getServiceName());
+ m_portNameField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setPortNameInternal(m_portNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_bindingNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("Binding"));
+ m_bindingNameField.setText(getBinding());
+ m_bindingNameField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setBindingNameInternal(m_bindingNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_portTypeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("PortType"));
+ m_portTypeNameField.setText(getPortTypeName());
+ m_portTypeNameField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setPortTypeNameInternal(m_portTypeNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_serviceOperationNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("ServiceOperation"));
+ m_serviceOperationNameField.setText(getPortTypeName());
+ m_serviceOperationNameField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setServiceOperationNameInternal(m_serviceOperationNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ Label wsdlStyleLabel = new Label(parent, SWT.NONE);
+ wsdlStyleLabel.setText(Texts.get("WsdlStyle"));
+ m_wsdlStyleRadioComposite = new Composite(parent, SWT.NONE);
+ m_wsdlStyleRadioComposite.setLayout(new GridLayout(1, true));
+ for (WsdlStyleEnum wsdlStyleEnum : WsdlStyleEnum.values()) {
+ createWsdlStyleRadioButton(wsdlStyleEnum);
+ }
+
+ // layout
+ parent.setLayout(new FormLayout());
+
+ Control previousWidget = null;
+ if (!isShowOnlyWsdlProperties()) {
+ FormData formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_wsdlNameField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_wsdlNameField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_deriveOtherNameButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_deriveOtherNameButton, 20, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_alias.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_alias, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_urlPattern.setLayoutData(formData);
+ previousWidget = m_urlPattern;
+ }
+
+ FormData formData = new FormData();
+ if (isShowOnlyWsdlProperties()) {
+ formData.top = new FormAttachment(0, 0);
+ }
+ else {
+ formData.top = new FormAttachment(previousWidget, 30, SWT.BOTTOM);
+ }
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_targetNamespaceField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_targetNamespaceField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_serviceNameField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_serviceNameField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_portNameField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_portNameField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_bindingNameField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_bindingNameField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_portTypeNameField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_portTypeNameField, 30, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_serviceOperationNameField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_serviceOperationNameField, 30, SWT.BOTTOM);
+ formData.right = new FormAttachment(40, 0);
+ wsdlStyleLabel.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(wsdlStyleLabel, -5, SWT.TOP);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_wsdlStyleRadioComposite.setLayoutData(formData);
+ }
+
+ protected void createWsdlStyleRadioButton(WsdlStyleEnum wsdlStyleEnum) {
+ Button button = new Button(m_wsdlStyleRadioComposite, SWT.RADIO);
+ button.setData("ID", wsdlStyleEnum);
+ button.setText(wsdlStyleEnum.getLabel());
+ button.setSelection((wsdlStyleEnum == getWsdlStyle()));
+ button.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ setStateChanging(true);
+ setWsdlStyle((WsdlStyleEnum) e.widget.getData("ID"));
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ // layout
+ button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
+ m_wsdlStyleRadioButtons.add(button);
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ if (!isControlCreated()) {
+ return;
+ }
+
+ // WSDL name
+ if (!isShowOnlyWsdlProperties()) {
+ if (StringUtility.isNullOrEmpty(getWsdlName())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_wsdlNameField.getLabelText())));
+ }
+ IStatus validationStatus = m_bundle.getProject().getWorkspace().validateName(getWsdlName(), IResource.FILE);
+ multiStatus.add(validationStatus);
+
+ // alias
+ if (StringUtility.isNullOrEmpty(getAlias())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_alias.getLabelText())));
+ }
+ else if (m_illegalAliasNames.contains(getAlias())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XWithYDoesAlreadyExist", m_alias.getLabelText(), getAlias())));
+ }
+ else {
+ IStatus status = m_bundle.getProject().getWorkspace().validateName(getAlias(), IResource.FILE);
+ if (status.isOK() == false) {
+ multiStatus.add(status);
+ }
+ }
+
+ // URL pattern
+ if (StringUtility.isNullOrEmpty(getUrlPattern()) || getUrlPattern().equals(m_jaxWsServletAlias)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_urlPattern.getLabelText())));
+ }
+ else if (!getUrlPattern().startsWith(m_jaxWsServletAlias)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XshouldStartWithY", m_urlPattern.getLabelText(), m_jaxWsServletAlias)));
+ }
+ else if (!getUrlPattern().matches(".*[\\w\\-]+.*")) { // check for illegal characters
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidUrlX", getUrlPattern())));
+ }
+ else if (m_illegalUrlPatterns.contains(getUrlPattern())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XWithYDoesAlreadyExist", m_urlPattern.getLabelText(), getUrlPattern())));
+ }
+ }
+
+ // targetName
+ validateTargetNamespace(multiStatus);
+ // service name
+ validateJavaField(multiStatus, m_serviceNameField.getLabelText(), getServiceName());
+ // port name
+ validateJavaField(multiStatus, m_portNameField.getLabelText(), getPortName());
+ // binding
+ validateJavaField(multiStatus, m_bindingNameField.getLabelText(), getBinding());
+ // port type
+ validateJavaField(multiStatus, m_portTypeNameField.getLabelText(), getPortTypeName());
+ // service operation name
+ if (StringUtility.isNullOrEmpty(getServiceOperationName())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_serviceOperationNameField.getLabelText())));
+ }
+ else {
+ IStatus validationStatus = JavaConventionsUtil.validateMethodName(getServiceOperationName(), m_bundle.getJavaProject());
+ multiStatus.add(validationStatus);
+ }
+ }
+
+ public void setWsdlName(String wsdlName) {
+ try {
+ setStateChanging(true);
+ setWsdlNameInternal(wsdlName);
+ if (isControlCreated()) {
+ m_wsdlNameField.setText(wsdlName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setWsdlNameInternal(String wsdlName) {
+ m_propertySupport.setPropertyString(PROP_WSDL_NAME, wsdlName);
+ }
+
+ public String getWsdlName() {
+ return m_propertySupport.getPropertyString(PROP_WSDL_NAME);
+ }
+
+ public void setDeriveOtherNames(boolean deriveOtherNames) {
+ try {
+ setStateChanging(true);
+ setDeriveOtherNamesInternal(deriveOtherNames);
+ if (isControlCreated()) {
+ m_deriveOtherNameButton.setSelection(deriveOtherNames);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setDeriveOtherNamesInternal(boolean deriveOtherNames) {
+ m_propertySupport.setPropertyBool(PROP_DERIVE_OTHER_NAME, deriveOtherNames);
+ }
+
+ public boolean isDeriveOtherNames() {
+ return m_propertySupport.getPropertyBool(PROP_DERIVE_OTHER_NAME);
+ }
+
+ public void setAlias(String alias) {
+ try {
+ setStateChanging(true);
+ setAliasInternal(alias);
+ if (isControlCreated()) {
+ m_alias.setText(alias);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setAliasInternal(String alias) {
+ m_propertySupport.setPropertyString(PROP_ALIAS, alias);
+ }
+
+ public String getAlias() {
+ return m_propertySupport.getPropertyString(PROP_ALIAS);
+ }
+
+ public void setUrlPattern(String urlPattern) {
+ try {
+ setStateChanging(true);
+ setUrlPatternInternal(urlPattern);
+ if (isControlCreated()) {
+ m_urlPattern.setText(urlPattern);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setUrlPatternInternal(String urlPattern) {
+ m_propertySupport.setPropertyString(PROP_URL_PATTERN, urlPattern);
+ }
+
+ public String getUrlPattern() {
+ return m_propertySupport.getPropertyString(PROP_URL_PATTERN);
+ }
+
+ public void setJaxWsServletAlias(String jaxWsServletAlias) {
+ m_jaxWsServletAlias = jaxWsServletAlias;
+ if (isControlCreated()) {
+ m_urlPattern.setReadOnlyPrefix(JaxWsSdkUtility.normalizePath(m_jaxWsServletAlias, SeparatorType.BothType));
+ }
+ }
+
+ public void setTargetNamespace(String targetNamespace) {
+ try {
+ setStateChanging(true);
+ setTargetNamespaceInternal(targetNamespace);
+ if (isControlCreated()) {
+ m_targetNamespaceField.setText(targetNamespace);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setTargetNamespaceInternal(String targetNamespace) {
+ m_propertySupport.setPropertyString(PROP_TARGET_NAMESPACE, targetNamespace);
+ }
+
+ public String getTargetNamespace() {
+ return m_propertySupport.getPropertyString(PROP_TARGET_NAMESPACE);
+ }
+
+ public void setBindingName(String bindingName) {
+ try {
+ setStateChanging(true);
+ setBindingNameInternal(bindingName);
+ if (isControlCreated()) {
+ m_bindingNameField.setText(bindingName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setBindingNameInternal(String bindingName) {
+ m_propertySupport.setPropertyString(PROP_BINDING_NAME, bindingName);
+ }
+
+ public String getBinding() {
+ return m_propertySupport.getPropertyString(PROP_BINDING_NAME);
+ }
+
+ public void setServiceName(String serviceName) {
+ try {
+ setStateChanging(true);
+ setServiceNameInternal(serviceName);
+ if (isControlCreated()) {
+ m_serviceNameField.setText(serviceName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setServiceNameInternal(String serviceName) {
+ m_propertySupport.setPropertyString(PROP_SERVICE_NAME, serviceName);
+ }
+
+ public String getServiceName() {
+ return m_propertySupport.getPropertyString(PROP_SERVICE_NAME);
+ }
+
+ public void setPortTypeName(String portTypeName) {
+ try {
+ setStateChanging(true);
+ setPortTypeNameInternal(portTypeName);
+ if (isControlCreated()) {
+ m_portTypeNameField.setText(portTypeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setPortTypeNameInternal(String portTypeName) {
+ m_propertySupport.setPropertyString(PROP_PORT_TYPE_NAME, portTypeName);
+ }
+
+ public String getPortTypeName() {
+ return m_propertySupport.getPropertyString(PROP_PORT_TYPE_NAME);
+ }
+
+ public void setPortName(String portName) {
+ try {
+ setStateChanging(true);
+ setPortNameInternal(portName);
+ if (isControlCreated()) {
+ m_portNameField.setText(portName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setPortNameInternal(String portName) {
+ m_propertySupport.setPropertyString(PROP_PORT_NAME, portName);
+ }
+
+ public String getPortName() {
+ return m_propertySupport.getPropertyString(PROP_PORT_NAME);
+ }
+
+ public void setServiceOperationName(String serviceOperationName) {
+ try {
+ setStateChanging(true);
+ setServiceOperationNameInternal(serviceOperationName);
+ if (isControlCreated()) {
+ m_serviceOperationNameField.setText(serviceOperationName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setServiceOperationNameInternal(String serviceOperationName) {
+ m_propertySupport.setPropertyString(PROP_SERVICE_OPERATION_NAME, serviceOperationName);
+ }
+
+ public String getServiceOperationName() {
+ return m_propertySupport.getPropertyString(PROP_SERVICE_OPERATION_NAME);
+ }
+
+ public void setWsdlStyle(WsdlStyleEnum wsdlStyleEnum) {
+ try {
+ setStateChanging(true);
+ setWsdlStyleInternal(wsdlStyleEnum);
+ if (isControlCreated()) {
+ for (Button radioButton : m_wsdlStyleRadioButtons) {
+ radioButton.setSelection(wsdlStyleEnum == (WsdlStyleEnum) radioButton.getData("ID"));
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setWsdlStyleInternal(WsdlStyleEnum wsdlStyleEnum) {
+ m_propertySupport.setProperty(PROP_WSDL_STYLE, wsdlStyleEnum);
+ }
+
+ public WsdlStyleEnum getWsdlStyle() {
+ return (WsdlStyleEnum) m_propertySupport.getProperty(PROP_WSDL_STYLE);
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.removePropertyChangeListener(listener);
+ }
+
+ private void validateTargetNamespace(MultiStatus multiStatus) {
+ if (StringUtility.isNullOrEmpty(m_targetNamespaceField.getText())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_targetNamespaceField.getLabelText())));
+ }
+ else {
+ try {
+ new URL(m_targetNamespaceField.getText());
+ }
+ catch (MalformedURLException e) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("TargetNamespaceMustBeValudUrl")));
+ }
+
+ if (!m_targetNamespaceField.getText().endsWith("/")) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, "Target Namespace must end with a slash"));
+ }
+ }
+ }
+
+ private void validateJavaField(MultiStatus multiStatus, String label, String text) {
+ if (StringUtility.isNullOrEmpty(text)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", label)));
+ return;
+ }
+ IStatus validationStatus = m_bundle.getProject().getWorkspace().validateName(text, IResource.FILE);
+ multiStatus.add(validationStatus);
+
+ validationStatus = JavaConventionsUtil.validateJavaTypeName(text, m_bundle.getJavaProject());
+ multiStatus.add(validationStatus);
+
+ if (Character.isLowerCase(text.charAt(0))) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("UpperCaseHint")));
+ }
+ }
+
+ private void deriveOtherNames() {
+ if (!isDeriveOtherNames()) {
+ return;
+ }
+
+ String serviceName = getWsdlName().substring(0, getWsdlName().length() - ".wsdl".length());
+ setTargetNamespace(JaxWsSdkUtility.getRecommendedTargetNamespace(m_bundle, serviceName));
+ setServiceName(serviceName);
+ setPortName(serviceName + "Port");
+ setBindingName(serviceName + "PortSoapBinding");
+ setPortTypeName(serviceName + "PortType");
+ setAlias(serviceName);
+ setUrlPattern(serviceName);
+
+ setServiceOperationName(JaxWsSdkUtility.toStartWithLowerCase(serviceName.substring(0, serviceName.length() - "WebService".length())));
+ }
+
+ private void loadIllegalValues() {
+ Set<String> illegalAliases = new HashSet<String>();
+ Set<String> illegalUrlPatterns = new HashSet<String>();
+
+ if (m_sunJaxWsXml != null) {
+ for (ScoutXmlElement xmlSunJaxWs : m_sunJaxWsXml.getRoot().getChildren(StringUtility.join(":", m_sunJaxWsXml.getRoot().getNamePrefix(), SunJaxWsBean.XML_ENDPOINT))) {
+ SunJaxWsBean sunJaxWsBean = new SunJaxWsBean(xmlSunJaxWs);
+ illegalAliases.add(sunJaxWsBean.getAlias());
+ illegalUrlPatterns.add(sunJaxWsBean.getUrlPattern());
+ }
+ }
+
+ m_illegalAliasNames = illegalAliases;
+ m_illegalUrlPatterns = illegalUrlPatterns;
+ }
+
+ public boolean isShowOnlyWsdlProperties() {
+ return m_showOnlyWsdlProperties;
+ }
+
+ public void setShowOnlyWsdlProperties(boolean showOnlyWsdlProperties) {
+ m_showOnlyWsdlProperties = showOnlyWsdlProperties;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsProviderImplClassWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsProviderImplClassWizardPage.java
index 29b23e70b..be01dd379 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsProviderImplClassWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsProviderImplClassWizardPage.java
@@ -1,711 +1,711 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.beans.PropertyChangeListener;
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
-import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
-import org.eclipse.jdt.ui.IJavaElementSearchConstants;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.fields.tooltip.JavadocTooltip;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-@SuppressWarnings("restriction")
-public class WsProviderImplClassWizardPage extends AbstractWorkspaceWizardPage {
-
- public static final String PROP_PACKAGE = "package";
- public static final String PROP_TYPE_NAME = "name";
- public static final String PROP_ANNOTATE_IMPL = "createScoutWsAnnotation";
- public static final String PROP_SESSION = "session";
- public static final String PROP_AUTHENTICATION_HANDLER = "authenticationHandler";
- public static final String PROP_CREDENTIAL_VALIDATION_STRATEGY = "credentialValidationStrategy";
-
- private BasicPropertySupport m_propertySupport;
-
- private IScoutBundle m_bundle;
-
- private Button m_createImplClassButton;
- private StyledTextField m_packageField;
- private Button m_packageBrowseButton;
- private StyledTextField m_typeNameField;
- private Button m_annotateImplButton;
- private Text m_descriptionScoutAnnotation;
- private Text m_descriptionSessionFactory;
- private Text m_descriptionAuthenticationHandler;
- private Text m_descriptionCredentialValidationStrategy;
- private Composite m_containerAnnotation;
- private StyledTextField m_sessionFactoryField;
- private Button m_sessionFactoryBrowseButton;
- private StyledTextField m_authenticationHandlerField;
- private Button m_authenticationHandlerBrowseButton;
- private StyledTextField m_credentialValidationStrategyField;
- private Button m_credentialValidationStrategyButton;
-
- private JavadocTooltip m_tooltipSessionFactory;
- private JavadocTooltip m_tooltipAuthenticationHandler;
- private JavadocTooltip m_tooltipCredentialValidationStrategy;
-
- public WsProviderImplClassWizardPage(IScoutBundle bundle) {
- super(WsProviderImplClassWizardPage.class.getName());
- setTitle(Texts.get("ConfigureImplementingClass"));
- setDescription(Texts.get("ConfigureImplementingClass"));
-
- m_propertySupport = new BasicPropertySupport(this);
- m_bundle = bundle;
- applyDefaults();
- }
-
- private void applyDefaults() {
- setAnnotateImplClass(true);
- setSessionFactory(TypeUtility.getType(JaxWsRuntimeClasses.DefaultServerSessionFactory).getFullyQualifiedName());
- setAuthenticationHandler(TypeUtility.getType(JaxWsRuntimeClasses.BasicAuthenticationHandlerProvider).getFullyQualifiedName());
- setCredentialValidationStrategy(TypeUtility.getType(JaxWsRuntimeClasses.ConfigIniCredentialValidationStrategy).getFullyQualifiedName());
-
- setPackageName(JaxWsSdkUtility.getRecommendedProviderImplPackageName(m_bundle));
- }
-
- @Override
- public void postActivate() {
- // set value to intall tooltip
- setSessionFactory(getSessionFactory());
- setAuthenticationHandler(getAuthenticationHandler());
- setCredentialValidationStrategy(getCredentialValidationStrategy());
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("Name"));
- m_typeNameField.setReadOnlySuffix(JaxWsConstants.SUFFIX_WS_PROVIDER);
- m_typeNameField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setTypeNameInternal(m_typeNameField.getText());
- pingStateChanging();
- }
- });
-
- m_packageField = getFieldToolkit().createStyledTextField(parent, Texts.get("Package"));
- m_packageField.setText(getPackageName());
- m_packageField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setPackageNameInternal(m_packageField.getText());
- pingStateChanging();
- }
- });
-
- m_packageBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
- m_packageBrowseButton.setText(Texts.get("Browse"));
- m_packageBrowseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IPackageFragment[] packageFragment = openBrowsePackagesDialog();
- if (packageFragment != null && packageFragment.length > 0) {
- setPackageName(packageFragment[0].getElementName());
- }
- }
- });
-
- m_annotateImplButton = new Button(parent, SWT.CHECK);
- m_annotateImplButton.setText(Texts.get("AnnotateImplClass", TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName()));
- m_annotateImplButton.setSelection(isAnnotateImplClass());
- m_annotateImplButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- setAnnotateImplClass(m_annotateImplButton.getSelection());
- }
- });
-
- m_containerAnnotation = new Composite(parent, SWT.NONE);
-
- m_descriptionScoutAnnotation = new Text(m_containerAnnotation, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
- m_descriptionScoutAnnotation.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- m_descriptionScoutAnnotation.setText(Texts.get("DescriptionScoutWebServiceAnnotation", TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName()));
-
- m_descriptionSessionFactory = new Text(m_containerAnnotation, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
- m_descriptionSessionFactory.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- m_descriptionSessionFactory.setText(Texts.get("DescriptionSessionFactory"));
-
- m_sessionFactoryField = getFieldToolkit().createStyledTextField(m_containerAnnotation, Texts.get("SessionFactory"));
- m_sessionFactoryField.setText(getSessionFactory());
- m_sessionFactoryField.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- setSessionFactoryInternal(m_sessionFactoryField.getText());
- pingStateChanging();
- }
- });
- m_tooltipSessionFactory = new JavadocTooltip(m_sessionFactoryField.getTextComponent());
-
- m_sessionFactoryBrowseButton = new Button(m_containerAnnotation, SWT.PUSH | SWT.FLAT);
- m_sessionFactoryBrowseButton.setText(Texts.get("Browse"));
- m_sessionFactoryBrowseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- IJavaSearchScope searchScope = createSubClassesSearchScope(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory));
-
- SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*.*");
- dialog.setTitle(Texts.get("SessionFactory"));
- dialog.setMessage(Texts.get("ChooseXY", Texts.get("SessionFactory")));
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- IType type = (IType) dialog.getResult()[0];
- setSessionFactory(type.getFullyQualifiedName());
- }
- }
- }
- catch (JavaModelException exception) {
- JaxWsSdk.logError(exception);
- }
- }
- });
-
- m_descriptionAuthenticationHandler = new Text(m_containerAnnotation, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
- m_descriptionAuthenticationHandler.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- m_descriptionAuthenticationHandler.setText(Texts.get("DescriptionAuthenticationMechanism"));
-
- m_authenticationHandlerField = getFieldToolkit().createStyledTextField(m_containerAnnotation, Texts.get("AuthenticationMechanism"));
- m_authenticationHandlerField.setText(getAuthenticationHandler());
- m_authenticationHandlerField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setAuthenticationHandlerInternal(m_authenticationHandlerField.getText());
- pingStateChanging();
- }
- });
- m_tooltipAuthenticationHandler = new JavadocTooltip(m_authenticationHandlerField.getTextComponent());
-
- m_authenticationHandlerBrowseButton = new Button(m_containerAnnotation, SWT.PUSH | SWT.FLAT);
- m_authenticationHandlerBrowseButton.setText(Texts.get("Browse"));
- m_authenticationHandlerBrowseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- IJavaSearchScope searchScope = createSubClassesSearchScope(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider));
-
- SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*.*");
- dialog.setTitle(Texts.get("AuthenticationMechanism"));
- dialog.setMessage(Texts.get("ChooseXY", Texts.get("AuthenticationMechanism")));
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- IType type = (IType) dialog.getResult()[0];
- setAuthenticationHandler(type.getFullyQualifiedName());
- }
- }
- }
- catch (JavaModelException exception) {
- JaxWsSdk.logError(exception);
- }
- }
- });
-
- m_descriptionCredentialValidationStrategy = new Text(m_containerAnnotation, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
- m_descriptionCredentialValidationStrategy.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- m_descriptionCredentialValidationStrategy.setText(Texts.get("DescriptionCredentialValidationValidation"));
-
- m_credentialValidationStrategyField = getFieldToolkit().createStyledTextField(m_containerAnnotation, Texts.get("CredentialValidationStrategy"));
- m_credentialValidationStrategyField.setText(getCredentialValidationStrategy());
- m_credentialValidationStrategyField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setCredentialValidationStrategyInternal(m_credentialValidationStrategyField.getText());
- pingStateChanging();
- }
- });
- m_tooltipCredentialValidationStrategy = new JavadocTooltip(m_credentialValidationStrategyField.getTextComponent());
-
- m_credentialValidationStrategyButton = new Button(m_containerAnnotation, SWT.PUSH | SWT.FLAT);
- m_credentialValidationStrategyButton.setText(Texts.get("Browse"));
- m_credentialValidationStrategyButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- IJavaSearchScope searchScope = createSubClassesSearchScope(TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy));
-
- SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*.*");
- dialog.setTitle(Texts.get("CredentialValidationStrategy"));
- dialog.setMessage(Texts.get("ChooseXY", Texts.get("CredentialValidationStrategy")));
- dialog.setBlockOnOpen(true);
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- IType type = (IType) dialog.getResult()[0];
- setCredentialValidationStrategy(type.getFullyQualifiedName());
- }
- }
- }
- catch (JavaModelException exception) {
- JaxWsSdk.logError(exception);
- }
- }
- });
- // layout
- parent.setLayout(new FormLayout());
-
- FormData formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_typeNameField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_typeNameField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_packageField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_packageField, 0, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_packageBrowseButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_packageField, 20, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_annotateImplButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_annotateImplButton, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_containerAnnotation.setLayoutData(formData);
-
- m_containerAnnotation.setLayout(new FormLayout());
-
- formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(40, 2);
- formData.right = new FormAttachment(100, 0);
- m_descriptionScoutAnnotation.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_descriptionScoutAnnotation, 10, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 2);
- formData.right = new FormAttachment(100, 0);
- m_descriptionSessionFactory.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_descriptionSessionFactory, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_sessionFactoryField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_sessionFactoryField, 0, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_sessionFactoryBrowseButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_sessionFactoryBrowseButton, 10, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 2);
- formData.right = new FormAttachment(100, 0);
- m_descriptionAuthenticationHandler.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_descriptionAuthenticationHandler, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_authenticationHandlerField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_authenticationHandlerField, 0, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_authenticationHandlerBrowseButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_authenticationHandlerBrowseButton, 10, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 2);
- formData.right = new FormAttachment(100, 0);
- m_descriptionCredentialValidationStrategy.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_descriptionCredentialValidationStrategy, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_credentialValidationStrategyField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_credentialValidationStrategyField, 0, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_credentialValidationStrategyButton.setLayoutData(formData);
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- if (m_bundle == null) { // not fully initialized yet
- return;
- }
-
- validateType(multiStatus);
-
- if (isAnnotateImplClass()) {
- validateFactoryType(multiStatus, Texts.get("SessionFactory"), getSessionFactory(), TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory), JaxWsSdkUtility.getRecommendedSessionPackageName(m_bundle));
- validateFactoryType(multiStatus, Texts.get("AuthenticationFactory"), getAuthenticationHandler(), TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider), JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
- validateFactoryType(multiStatus, Texts.get("CredentialValidationFactory"), getCredentialValidationStrategy(), TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy), JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
- }
- }
-
- protected void validateType(MultiStatus multiStatus) {
- // package
- if (StringUtility.isNullOrEmpty(getPackageName())) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("UsageOfDefaultPackageDiscouraged")));
- }
- else {
- multiStatus.add(JavaConventionsUtil.validatePackageName(getPackageName(), m_bundle.getJavaProject()));
-
- String recommendedPackageName = JaxWsSdkUtility.getRecommendedProviderImplPackageName(m_bundle);
- if (!getPackageName().equals(recommendedPackageName)) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("ByConventionXShouldByY", Texts.get("Package"), recommendedPackageName)));
- }
- }
- // name
- if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(JaxWsConstants.SUFFIX_WS_PROVIDER)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("MissingNameForImplementingClass")));
- }
- else {
- multiStatus.add(JavaConventionsUtil.validateJavaTypeName(getTypeName(), m_bundle.getJavaProject()));
-
- if (Character.isLowerCase(getTypeName().charAt(0))) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("LowerCaseTypeName")));
- }
- }
-
- // type
- if (multiStatus.getSeverity() < IStatus.ERROR) {
- String fullyQualifiedName = StringUtility.join(".", getPackageName(), getTypeName());
- try {
- if (TypeUtility.existsType(fullyQualifiedName)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("TypeAlreadyExsits", fullyQualifiedName)));
- }
- }
- catch (Exception e) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidJavaType", fullyQualifiedName)));
- }
- }
- }
-
- protected void validateFactoryType(MultiStatus multiStatus, String label, String qualifiedName, IType interfaceType, String recommendedPackage) {
- if (StringUtility.isNullOrEmpty(qualifiedName)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("NoClassSpecified", label)));
- return;
- }
-
- String packageName = Signature.getQualifier(qualifiedName);
- String className;
- if (StringUtility.isNullOrEmpty(packageName)) {
- className = qualifiedName;
- }
- else {
- className = Signature.getSimpleName(qualifiedName);
- }
-
- if (StringUtility.isNullOrEmpty(packageName)) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("UsageOfDefaultPackageNotAllowed")));
- return;
- }
- else {
- multiStatus.add(JavaConventionsUtil.validatePackageName(packageName, m_bundle.getJavaProject()));
- }
-
- try {
- String fqn = StringUtility.join(".", packageName, className);
- if (TypeUtility.existsType(fqn)) {
- IType type = TypeUtility.getType(fqn);
- if (!type.newSupertypeHierarchy(new NullProgressMonitor()).contains(interfaceType)) {
- type.getJavadocRange().getOffset();
- type.getJavadocRange().getLength();
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustBeOfTheTypeY", label, interfaceType.getFullyQualifiedName())));
- }
- }
- else {
- if (!packageName.equals(recommendedPackage)) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("ByConventionXShouldByY", Texts.get("package"), recommendedPackage)));
- }
- }
- }
- catch (Exception e) {
- // nop
- }
- }
-
- public void setTypeName(String typeName) {
- try {
- typeName = JaxWsSdkUtility.toStartWithUpperCase(typeName);
-
- setStateChanging(true);
- setTypeNameInternal(typeName);
- if (isControlCreated()) {
- m_typeNameField.setText(typeName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setTypeNameInternal(String typeName) {
- m_propertySupport.setProperty(PROP_TYPE_NAME, typeName);
- }
-
- public String getTypeName() {
- return m_propertySupport.getPropertyString(PROP_TYPE_NAME);
- }
-
- public void setPackageName(String packageName) {
- try {
- setStateChanging(true);
- setPackageNameInternal(packageName);
- if (isControlCreated()) {
- m_packageField.setText(packageName);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setPackageNameInternal(String packageName) {
- m_propertySupport.setPropertyString(PROP_PACKAGE, packageName);
- }
-
- public String getPackageName() {
- return m_propertySupport.getPropertyString(PROP_PACKAGE);
- }
-
- public void setAnnotateImplClass(boolean annotateImplClass) {
- try {
- setStateChanging(true);
- setAnnotateImplClassInternal(annotateImplClass);
- if (isControlCreated()) {
- m_annotateImplButton.setSelection(annotateImplClass);
- JaxWsSdkUtility.setView(m_containerAnnotation, annotateImplClass);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setAnnotateImplClassInternal(boolean annotateImplClass) {
- m_propertySupport.setProperty(PROP_ANNOTATE_IMPL, annotateImplClass);
- }
-
- public boolean isAnnotateImplClass() {
- return m_propertySupport.getPropertyBool(PROP_ANNOTATE_IMPL);
- }
-
- public void setSessionFactory(String sessionFactory) {
- try {
- setStateChanging(true);
- setSessionFactoryInternal(sessionFactory);
- if (isControlCreated()) {
- m_sessionFactoryField.setText(sessionFactory);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setSessionFactoryInternal(String sessionFactory) {
- m_propertySupport.setPropertyString(PROP_SESSION, sessionFactory);
-
- if (isControlCreated()) {
- // display JavaDoc
- try {
- m_tooltipSessionFactory.setMember(null);
-
- if (TypeUtility.existsType(sessionFactory)) {
- IType type = TypeUtility.getType(sessionFactory);
- if (type.newSupertypeHierarchy(new NullProgressMonitor()).contains(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory))) {
- m_tooltipSessionFactory.setMember(type);
- }
- }
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("Could not render tooltip", e);
- }
- }
- }
-
- public String getSessionFactory() {
- return m_propertySupport.getPropertyString(PROP_SESSION);
- }
-
- public void setAuthenticationHandler(String authenticationHandler) {
- try {
- setStateChanging(true);
- setAuthenticationHandlerInternal(authenticationHandler);
- if (isControlCreated()) {
- m_authenticationHandlerField.setText(authenticationHandler);
-
- if (isAnnotateImplClass()) {
- boolean authenticationSet = JaxWsSdkUtility.isProviderAuthenticationSet(authenticationHandler);
- m_credentialValidationStrategyField.setEnabled(authenticationSet);
- m_credentialValidationStrategyButton.setEnabled(authenticationSet);
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setAuthenticationHandlerInternal(String authenticationHandler) {
- m_propertySupport.setPropertyString(PROP_AUTHENTICATION_HANDLER, authenticationHandler);
-
- if (isControlCreated()) {
- // display JavaDoc
- m_tooltipAuthenticationHandler.setMember(null);
- if (TypeUtility.existsType(authenticationHandler)) {
- IType type = TypeUtility.getType(authenticationHandler);
- try {
- if (type.newSupertypeHierarchy(new NullProgressMonitor()).contains(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider))) {
- m_tooltipAuthenticationHandler.setMember(type);
- }
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("Could not render tooltip", e);
- }
- }
- }
- }
-
- public String getAuthenticationHandler() {
- return m_propertySupport.getPropertyString(PROP_AUTHENTICATION_HANDLER);
- }
-
- public void setCredentialValidationStrategy(String credentialValidationStrategy) {
- try {
- setStateChanging(true);
- setCredentialValidationStrategyInternal(credentialValidationStrategy);
- if (isControlCreated()) {
- m_credentialValidationStrategyField.setText(credentialValidationStrategy);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setCredentialValidationStrategyInternal(String credentialValidationStrategy) {
- m_propertySupport.setPropertyString(PROP_CREDENTIAL_VALIDATION_STRATEGY, credentialValidationStrategy);
-
- if (isControlCreated()) {
- // display JavaDoc
- m_tooltipCredentialValidationStrategy.setMember(null);
- if (TypeUtility.existsType(credentialValidationStrategy)) {
- IType type = TypeUtility.getType(credentialValidationStrategy);
- try {
- if (type.newSupertypeHierarchy(new NullProgressMonitor()).contains(TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy))) {
- m_tooltipCredentialValidationStrategy.setMember(type);
- }
- }
- catch (Exception e) {
- JaxWsSdk.logWarning("Could not render tooltip", e);
- }
- }
- }
- }
-
- public String getCredentialValidationStrategy() {
- return m_propertySupport.getPropertyString(PROP_CREDENTIAL_VALIDATION_STRATEGY);
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.removePropertyChangeListener(listener);
- }
-
- private IPackageFragment[] openBrowsePackagesDialog() {
- IPackageFragment[] packageFragments = null;
- IRunnableContext context = new BusyIndicatorRunnableContext();
- SelectionDialog dialog = JavaUI.createPackageDialog(ScoutSdkUi.getShell(), context, m_bundle.getSearchScope(), false, true, null);
- dialog.setTitle(Texts.get("Package"));
- dialog.setMessage(Texts.get("ChoosePackageForImplementingClass"));
-
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- packageFragments = Arrays.asList(dialog.getResult()).toArray(new IPackageFragment[0]);
- }
- }
- if (packageFragments != null) {
- return packageFragments;
- }
- else {
- return null;
- }
- }
-
- private IJavaSearchScope createSubClassesSearchScope(IType superType) {
- // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
- IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
- return SearchEngine.createJavaSearchScope(subTypes);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.beans.PropertyChangeListener;
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
+import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
+import org.eclipse.jdt.ui.IJavaElementSearchConstants;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.fields.tooltip.JavadocTooltip;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+@SuppressWarnings("restriction")
+public class WsProviderImplClassWizardPage extends AbstractWorkspaceWizardPage {
+
+ public static final String PROP_PACKAGE = "package";
+ public static final String PROP_TYPE_NAME = "name";
+ public static final String PROP_ANNOTATE_IMPL = "createScoutWsAnnotation";
+ public static final String PROP_SESSION = "session";
+ public static final String PROP_AUTHENTICATION_HANDLER = "authenticationHandler";
+ public static final String PROP_CREDENTIAL_VALIDATION_STRATEGY = "credentialValidationStrategy";
+
+ private BasicPropertySupport m_propertySupport;
+
+ private IScoutBundle m_bundle;
+
+ private Button m_createImplClassButton;
+ private StyledTextField m_packageField;
+ private Button m_packageBrowseButton;
+ private StyledTextField m_typeNameField;
+ private Button m_annotateImplButton;
+ private Text m_descriptionScoutAnnotation;
+ private Text m_descriptionSessionFactory;
+ private Text m_descriptionAuthenticationHandler;
+ private Text m_descriptionCredentialValidationStrategy;
+ private Composite m_containerAnnotation;
+ private StyledTextField m_sessionFactoryField;
+ private Button m_sessionFactoryBrowseButton;
+ private StyledTextField m_authenticationHandlerField;
+ private Button m_authenticationHandlerBrowseButton;
+ private StyledTextField m_credentialValidationStrategyField;
+ private Button m_credentialValidationStrategyButton;
+
+ private JavadocTooltip m_tooltipSessionFactory;
+ private JavadocTooltip m_tooltipAuthenticationHandler;
+ private JavadocTooltip m_tooltipCredentialValidationStrategy;
+
+ public WsProviderImplClassWizardPage(IScoutBundle bundle) {
+ super(WsProviderImplClassWizardPage.class.getName());
+ setTitle(Texts.get("ConfigureImplementingClass"));
+ setDescription(Texts.get("ConfigureImplementingClass"));
+
+ m_propertySupport = new BasicPropertySupport(this);
+ m_bundle = bundle;
+ applyDefaults();
+ }
+
+ private void applyDefaults() {
+ setAnnotateImplClass(true);
+ setSessionFactory(TypeUtility.getType(JaxWsRuntimeClasses.DefaultServerSessionFactory).getFullyQualifiedName());
+ setAuthenticationHandler(TypeUtility.getType(JaxWsRuntimeClasses.BasicAuthenticationHandlerProvider).getFullyQualifiedName());
+ setCredentialValidationStrategy(TypeUtility.getType(JaxWsRuntimeClasses.ConfigIniCredentialValidationStrategy).getFullyQualifiedName());
+
+ setPackageName(JaxWsSdkUtility.getRecommendedProviderImplPackageName(m_bundle));
+ }
+
+ @Override
+ public void postActivate() {
+ // set value to intall tooltip
+ setSessionFactory(getSessionFactory());
+ setAuthenticationHandler(getAuthenticationHandler());
+ setCredentialValidationStrategy(getCredentialValidationStrategy());
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_typeNameField = getFieldToolkit().createStyledTextField(parent, Texts.get("Name"));
+ m_typeNameField.setReadOnlySuffix(JaxWsConstants.SUFFIX_WS_PROVIDER);
+ m_typeNameField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setTypeNameInternal(m_typeNameField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_packageField = getFieldToolkit().createStyledTextField(parent, Texts.get("Package"));
+ m_packageField.setText(getPackageName());
+ m_packageField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setPackageNameInternal(m_packageField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_packageBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
+ m_packageBrowseButton.setText(Texts.get("Browse"));
+ m_packageBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IPackageFragment[] packageFragment = openBrowsePackagesDialog();
+ if (packageFragment != null && packageFragment.length > 0) {
+ setPackageName(packageFragment[0].getElementName());
+ }
+ }
+ });
+
+ m_annotateImplButton = new Button(parent, SWT.CHECK);
+ m_annotateImplButton.setText(Texts.get("AnnotateImplClass", TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName()));
+ m_annotateImplButton.setSelection(isAnnotateImplClass());
+ m_annotateImplButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setAnnotateImplClass(m_annotateImplButton.getSelection());
+ }
+ });
+
+ m_containerAnnotation = new Composite(parent, SWT.NONE);
+
+ m_descriptionScoutAnnotation = new Text(m_containerAnnotation, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
+ m_descriptionScoutAnnotation.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
+ m_descriptionScoutAnnotation.setText(Texts.get("DescriptionScoutWebServiceAnnotation", TypeUtility.getType(JaxWsRuntimeClasses.ScoutWebService).getElementName()));
+
+ m_descriptionSessionFactory = new Text(m_containerAnnotation, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
+ m_descriptionSessionFactory.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
+ m_descriptionSessionFactory.setText(Texts.get("DescriptionSessionFactory"));
+
+ m_sessionFactoryField = getFieldToolkit().createStyledTextField(m_containerAnnotation, Texts.get("SessionFactory"));
+ m_sessionFactoryField.setText(getSessionFactory());
+ m_sessionFactoryField.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setSessionFactoryInternal(m_sessionFactoryField.getText());
+ pingStateChanging();
+ }
+ });
+ m_tooltipSessionFactory = new JavadocTooltip(m_sessionFactoryField.getTextComponent());
+
+ m_sessionFactoryBrowseButton = new Button(m_containerAnnotation, SWT.PUSH | SWT.FLAT);
+ m_sessionFactoryBrowseButton.setText(Texts.get("Browse"));
+ m_sessionFactoryBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ IJavaSearchScope searchScope = createSubClassesSearchScope(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory));
+
+ SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*.*");
+ dialog.setTitle(Texts.get("SessionFactory"));
+ dialog.setMessage(Texts.get("ChooseXY", Texts.get("SessionFactory")));
+ dialog.setBlockOnOpen(true);
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ IType type = (IType) dialog.getResult()[0];
+ setSessionFactory(type.getFullyQualifiedName());
+ }
+ }
+ }
+ catch (JavaModelException exception) {
+ JaxWsSdk.logError(exception);
+ }
+ }
+ });
+
+ m_descriptionAuthenticationHandler = new Text(m_containerAnnotation, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
+ m_descriptionAuthenticationHandler.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
+ m_descriptionAuthenticationHandler.setText(Texts.get("DescriptionAuthenticationMechanism"));
+
+ m_authenticationHandlerField = getFieldToolkit().createStyledTextField(m_containerAnnotation, Texts.get("AuthenticationMechanism"));
+ m_authenticationHandlerField.setText(getAuthenticationHandler());
+ m_authenticationHandlerField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setAuthenticationHandlerInternal(m_authenticationHandlerField.getText());
+ pingStateChanging();
+ }
+ });
+ m_tooltipAuthenticationHandler = new JavadocTooltip(m_authenticationHandlerField.getTextComponent());
+
+ m_authenticationHandlerBrowseButton = new Button(m_containerAnnotation, SWT.PUSH | SWT.FLAT);
+ m_authenticationHandlerBrowseButton.setText(Texts.get("Browse"));
+ m_authenticationHandlerBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ IJavaSearchScope searchScope = createSubClassesSearchScope(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider));
+
+ SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*.*");
+ dialog.setTitle(Texts.get("AuthenticationMechanism"));
+ dialog.setMessage(Texts.get("ChooseXY", Texts.get("AuthenticationMechanism")));
+ dialog.setBlockOnOpen(true);
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ IType type = (IType) dialog.getResult()[0];
+ setAuthenticationHandler(type.getFullyQualifiedName());
+ }
+ }
+ }
+ catch (JavaModelException exception) {
+ JaxWsSdk.logError(exception);
+ }
+ }
+ });
+
+ m_descriptionCredentialValidationStrategy = new Text(m_containerAnnotation, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
+ m_descriptionCredentialValidationStrategy.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
+ m_descriptionCredentialValidationStrategy.setText(Texts.get("DescriptionCredentialValidationValidation"));
+
+ m_credentialValidationStrategyField = getFieldToolkit().createStyledTextField(m_containerAnnotation, Texts.get("CredentialValidationStrategy"));
+ m_credentialValidationStrategyField.setText(getCredentialValidationStrategy());
+ m_credentialValidationStrategyField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setCredentialValidationStrategyInternal(m_credentialValidationStrategyField.getText());
+ pingStateChanging();
+ }
+ });
+ m_tooltipCredentialValidationStrategy = new JavadocTooltip(m_credentialValidationStrategyField.getTextComponent());
+
+ m_credentialValidationStrategyButton = new Button(m_containerAnnotation, SWT.PUSH | SWT.FLAT);
+ m_credentialValidationStrategyButton.setText(Texts.get("Browse"));
+ m_credentialValidationStrategyButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ IJavaSearchScope searchScope = createSubClassesSearchScope(TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy));
+
+ SelectionDialog dialog = JavaUI.createTypeDialog(ScoutSdkUi.getShell(), null, searchScope, IJavaElementSearchConstants.CONSIDER_CLASSES, false, "*.*");
+ dialog.setTitle(Texts.get("CredentialValidationStrategy"));
+ dialog.setMessage(Texts.get("ChooseXY", Texts.get("CredentialValidationStrategy")));
+ dialog.setBlockOnOpen(true);
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ IType type = (IType) dialog.getResult()[0];
+ setCredentialValidationStrategy(type.getFullyQualifiedName());
+ }
+ }
+ }
+ catch (JavaModelException exception) {
+ JaxWsSdk.logError(exception);
+ }
+ }
+ });
+ // layout
+ parent.setLayout(new FormLayout());
+
+ FormData formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_typeNameField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_typeNameField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_packageField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_packageField, 0, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_packageBrowseButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_packageField, 20, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_annotateImplButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_annotateImplButton, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_containerAnnotation.setLayoutData(formData);
+
+ m_containerAnnotation.setLayout(new FormLayout());
+
+ formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(40, 2);
+ formData.right = new FormAttachment(100, 0);
+ m_descriptionScoutAnnotation.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_descriptionScoutAnnotation, 10, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 2);
+ formData.right = new FormAttachment(100, 0);
+ m_descriptionSessionFactory.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_descriptionSessionFactory, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_sessionFactoryField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_sessionFactoryField, 0, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_sessionFactoryBrowseButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_sessionFactoryBrowseButton, 10, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 2);
+ formData.right = new FormAttachment(100, 0);
+ m_descriptionAuthenticationHandler.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_descriptionAuthenticationHandler, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_authenticationHandlerField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_authenticationHandlerField, 0, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_authenticationHandlerBrowseButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_authenticationHandlerBrowseButton, 10, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 2);
+ formData.right = new FormAttachment(100, 0);
+ m_descriptionCredentialValidationStrategy.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_descriptionCredentialValidationStrategy, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_credentialValidationStrategyField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_credentialValidationStrategyField, 0, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_credentialValidationStrategyButton.setLayoutData(formData);
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ if (m_bundle == null) { // not fully initialized yet
+ return;
+ }
+
+ validateType(multiStatus);
+
+ if (isAnnotateImplClass()) {
+ validateFactoryType(multiStatus, Texts.get("SessionFactory"), getSessionFactory(), TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory), JaxWsSdkUtility.getRecommendedSessionPackageName(m_bundle));
+ validateFactoryType(multiStatus, Texts.get("AuthenticationFactory"), getAuthenticationHandler(), TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider), JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
+ validateFactoryType(multiStatus, Texts.get("CredentialValidationFactory"), getCredentialValidationStrategy(), TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy), JaxWsSdkUtility.getRecommendedProviderSecurityPackageName(m_bundle));
+ }
+ }
+
+ protected void validateType(MultiStatus multiStatus) {
+ // package
+ if (StringUtility.isNullOrEmpty(getPackageName())) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("UsageOfDefaultPackageDiscouraged")));
+ }
+ else {
+ multiStatus.add(JavaConventionsUtil.validatePackageName(getPackageName(), m_bundle.getJavaProject()));
+
+ String recommendedPackageName = JaxWsSdkUtility.getRecommendedProviderImplPackageName(m_bundle);
+ if (!getPackageName().equals(recommendedPackageName)) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("ByConventionXShouldByY", Texts.get("Package"), recommendedPackageName)));
+ }
+ }
+ // name
+ if (StringUtility.isNullOrEmpty(getTypeName()) || getTypeName().equals(JaxWsConstants.SUFFIX_WS_PROVIDER)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("MissingNameForImplementingClass")));
+ }
+ else {
+ multiStatus.add(JavaConventionsUtil.validateJavaTypeName(getTypeName(), m_bundle.getJavaProject()));
+
+ if (Character.isLowerCase(getTypeName().charAt(0))) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("LowerCaseTypeName")));
+ }
+ }
+
+ // type
+ if (multiStatus.getSeverity() < IStatus.ERROR) {
+ String fullyQualifiedName = StringUtility.join(".", getPackageName(), getTypeName());
+ try {
+ if (TypeUtility.existsType(fullyQualifiedName)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("TypeAlreadyExsits", fullyQualifiedName)));
+ }
+ }
+ catch (Exception e) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("InvalidJavaType", fullyQualifiedName)));
+ }
+ }
+ }
+
+ protected void validateFactoryType(MultiStatus multiStatus, String label, String qualifiedName, IType interfaceType, String recommendedPackage) {
+ if (StringUtility.isNullOrEmpty(qualifiedName)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("NoClassSpecified", label)));
+ return;
+ }
+
+ String packageName = Signature.getQualifier(qualifiedName);
+ String className;
+ if (StringUtility.isNullOrEmpty(packageName)) {
+ className = qualifiedName;
+ }
+ else {
+ className = Signature.getSimpleName(qualifiedName);
+ }
+
+ if (StringUtility.isNullOrEmpty(packageName)) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("UsageOfDefaultPackageNotAllowed")));
+ return;
+ }
+ else {
+ multiStatus.add(JavaConventionsUtil.validatePackageName(packageName, m_bundle.getJavaProject()));
+ }
+
+ try {
+ String fqn = StringUtility.join(".", packageName, className);
+ if (TypeUtility.existsType(fqn)) {
+ IType type = TypeUtility.getType(fqn);
+ if (!type.newSupertypeHierarchy(new NullProgressMonitor()).contains(interfaceType)) {
+ type.getJavadocRange().getOffset();
+ type.getJavadocRange().getLength();
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustBeOfTheTypeY", label, interfaceType.getFullyQualifiedName())));
+ }
+ }
+ else {
+ if (!packageName.equals(recommendedPackage)) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("ByConventionXShouldByY", Texts.get("package"), recommendedPackage)));
+ }
+ }
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+
+ public void setTypeName(String typeName) {
+ try {
+ typeName = JaxWsSdkUtility.toStartWithUpperCase(typeName);
+
+ setStateChanging(true);
+ setTypeNameInternal(typeName);
+ if (isControlCreated()) {
+ m_typeNameField.setText(typeName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setTypeNameInternal(String typeName) {
+ m_propertySupport.setProperty(PROP_TYPE_NAME, typeName);
+ }
+
+ public String getTypeName() {
+ return m_propertySupport.getPropertyString(PROP_TYPE_NAME);
+ }
+
+ public void setPackageName(String packageName) {
+ try {
+ setStateChanging(true);
+ setPackageNameInternal(packageName);
+ if (isControlCreated()) {
+ m_packageField.setText(packageName);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setPackageNameInternal(String packageName) {
+ m_propertySupport.setPropertyString(PROP_PACKAGE, packageName);
+ }
+
+ public String getPackageName() {
+ return m_propertySupport.getPropertyString(PROP_PACKAGE);
+ }
+
+ public void setAnnotateImplClass(boolean annotateImplClass) {
+ try {
+ setStateChanging(true);
+ setAnnotateImplClassInternal(annotateImplClass);
+ if (isControlCreated()) {
+ m_annotateImplButton.setSelection(annotateImplClass);
+ JaxWsSdkUtility.setView(m_containerAnnotation, annotateImplClass);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setAnnotateImplClassInternal(boolean annotateImplClass) {
+ m_propertySupport.setProperty(PROP_ANNOTATE_IMPL, annotateImplClass);
+ }
+
+ public boolean isAnnotateImplClass() {
+ return m_propertySupport.getPropertyBool(PROP_ANNOTATE_IMPL);
+ }
+
+ public void setSessionFactory(String sessionFactory) {
+ try {
+ setStateChanging(true);
+ setSessionFactoryInternal(sessionFactory);
+ if (isControlCreated()) {
+ m_sessionFactoryField.setText(sessionFactory);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setSessionFactoryInternal(String sessionFactory) {
+ m_propertySupport.setPropertyString(PROP_SESSION, sessionFactory);
+
+ if (isControlCreated()) {
+ // display JavaDoc
+ try {
+ m_tooltipSessionFactory.setMember(null);
+
+ if (TypeUtility.existsType(sessionFactory)) {
+ IType type = TypeUtility.getType(sessionFactory);
+ if (type.newSupertypeHierarchy(new NullProgressMonitor()).contains(TypeUtility.getType(JaxWsRuntimeClasses.IServerSessionFactory))) {
+ m_tooltipSessionFactory.setMember(type);
+ }
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("Could not render tooltip", e);
+ }
+ }
+ }
+
+ public String getSessionFactory() {
+ return m_propertySupport.getPropertyString(PROP_SESSION);
+ }
+
+ public void setAuthenticationHandler(String authenticationHandler) {
+ try {
+ setStateChanging(true);
+ setAuthenticationHandlerInternal(authenticationHandler);
+ if (isControlCreated()) {
+ m_authenticationHandlerField.setText(authenticationHandler);
+
+ if (isAnnotateImplClass()) {
+ boolean authenticationSet = JaxWsSdkUtility.isProviderAuthenticationSet(authenticationHandler);
+ m_credentialValidationStrategyField.setEnabled(authenticationSet);
+ m_credentialValidationStrategyButton.setEnabled(authenticationSet);
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setAuthenticationHandlerInternal(String authenticationHandler) {
+ m_propertySupport.setPropertyString(PROP_AUTHENTICATION_HANDLER, authenticationHandler);
+
+ if (isControlCreated()) {
+ // display JavaDoc
+ m_tooltipAuthenticationHandler.setMember(null);
+ if (TypeUtility.existsType(authenticationHandler)) {
+ IType type = TypeUtility.getType(authenticationHandler);
+ try {
+ if (type.newSupertypeHierarchy(new NullProgressMonitor()).contains(TypeUtility.getType(JaxWsRuntimeClasses.IAuthenticationHandlerProvider))) {
+ m_tooltipAuthenticationHandler.setMember(type);
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("Could not render tooltip", e);
+ }
+ }
+ }
+ }
+
+ public String getAuthenticationHandler() {
+ return m_propertySupport.getPropertyString(PROP_AUTHENTICATION_HANDLER);
+ }
+
+ public void setCredentialValidationStrategy(String credentialValidationStrategy) {
+ try {
+ setStateChanging(true);
+ setCredentialValidationStrategyInternal(credentialValidationStrategy);
+ if (isControlCreated()) {
+ m_credentialValidationStrategyField.setText(credentialValidationStrategy);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setCredentialValidationStrategyInternal(String credentialValidationStrategy) {
+ m_propertySupport.setPropertyString(PROP_CREDENTIAL_VALIDATION_STRATEGY, credentialValidationStrategy);
+
+ if (isControlCreated()) {
+ // display JavaDoc
+ m_tooltipCredentialValidationStrategy.setMember(null);
+ if (TypeUtility.existsType(credentialValidationStrategy)) {
+ IType type = TypeUtility.getType(credentialValidationStrategy);
+ try {
+ if (type.newSupertypeHierarchy(new NullProgressMonitor()).contains(TypeUtility.getType(JaxWsRuntimeClasses.ICredentialValidationStrategy))) {
+ m_tooltipCredentialValidationStrategy.setMember(type);
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logWarning("Could not render tooltip", e);
+ }
+ }
+ }
+ }
+
+ public String getCredentialValidationStrategy() {
+ return m_propertySupport.getPropertyString(PROP_CREDENTIAL_VALIDATION_STRATEGY);
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.removePropertyChangeListener(listener);
+ }
+
+ private IPackageFragment[] openBrowsePackagesDialog() {
+ IPackageFragment[] packageFragments = null;
+ IRunnableContext context = new BusyIndicatorRunnableContext();
+ SelectionDialog dialog = JavaUI.createPackageDialog(ScoutSdkUi.getShell(), context, m_bundle.getSearchScope(), false, true, null);
+ dialog.setTitle(Texts.get("Package"));
+ dialog.setMessage(Texts.get("ChoosePackageForImplementingClass"));
+
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ packageFragments = Arrays.asList(dialog.getResult()).toArray(new IPackageFragment[0]);
+ }
+ }
+ if (packageFragments != null) {
+ return packageFragments;
+ }
+ else {
+ return null;
+ }
+ }
+
+ private IJavaSearchScope createSubClassesSearchScope(IType superType) {
+ // do not use PrimaryTypeHierarchy to get subtypes due to static inner classes
+ IType[] subTypes = JaxWsSdkUtility.getJdtSubTypes(m_bundle, superType.getFullyQualifiedName(), false, false, true, false);
+ return SearchEngine.createJavaSearchScope(subTypes);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsStubWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsStubWizardPage.java
index 597547e7d..d78e3e7c6 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsStubWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsStubWizardPage.java
@@ -1,243 +1,243 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.beans.PropertyChangeListener;
-import java.util.Arrays;
-
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
-import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
-import org.eclipse.jdt.ui.JavaUI;
-import org.eclipse.jface.operation.IRunnableContext;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.sdk.ui.fields.StyledTextField;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.dialogs.SelectionDialog;
-
-@SuppressWarnings("restriction")
-public class WsStubWizardPage extends AbstractWorkspaceWizardPage {
-
- public static final String PROP_STUB_FOLDER = "stubFolder";
- public static final String PROP_PACKAGE = "package";
- public static final String PROP_CREATE_BINDING_FILE = "createBindingFile";
-
- private BasicPropertySupport m_propertySupport;
-
- private IScoutBundle m_bundle;
-
- private StyledTextField m_packageField;
- private Button m_packageBrowseButton;
- private Button m_createBindingFileButton;
-
- private String m_serviceName;
- private String m_defaultPackageName;
-
- public WsStubWizardPage(IScoutBundle bundle) {
- super(WsStubWizardPage.class.getName());
- setTitle(Texts.get("ConfigureWebServiceStub"));
- setDescription(Texts.get("ConfigureWebServiceStub"));
-
- m_bundle = bundle;
- m_propertySupport = new BasicPropertySupport(this);
- applyDefaults();
- }
-
- private void applyDefaults() {
- setCreateBindingFile(true);
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_packageField = getFieldToolkit().createStyledTextField(parent, Texts.get("StubPackage"));
- m_packageField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setPackageNameInternal(m_packageField.getText());
- pingStateChanging();
- }
- });
-
- m_packageBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
- m_packageBrowseButton.setText(Texts.get("Browse"));
- m_packageBrowseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IPackageFragment[] packageFragment = openBrowsePackagesDialog();
- if (packageFragment != null && packageFragment.length > 0) {
- setPackageName(packageFragment[0].getElementName());
- }
- }
- });
-
- m_createBindingFileButton = new Button(parent, SWT.CHECK);
- m_createBindingFileButton.setText(Texts.get("CreateBindingFile"));
- m_createBindingFileButton.setSelection(isCreateBindingFile());
- m_createBindingFileButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- setCreateBindingFileInternal(m_createBindingFileButton.getSelection());
- }
- });
-
- // layout
- parent.setLayout(new FormLayout());
-
- FormData formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_packageField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_packageField, 0, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_packageBrowseButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_packageBrowseButton, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_createBindingFileButton.setLayoutData(formData);
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- if (m_bundle == null) { // not fully initialized yet
- return;
- }
-
- validatePackage(multiStatus);
- }
-
- public void setPackageName(String packageName) {
- try {
- setStateChanging(true);
- setPackageNameInternal(packageName);
- if (isControlCreated()) {
- m_packageField.setText(StringUtility.nvl(packageName, ""));
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setPackageNameInternal(String packageName) {
- m_propertySupport.setProperty(PROP_PACKAGE, packageName);
- }
-
- public String getPackageName() {
- return m_propertySupport.getPropertyString(PROP_PACKAGE);
- }
-
- public String getDefaultPackageName() {
- return m_defaultPackageName;
- }
-
- public void setDefaultPackageName(String defaultPackageName) {
- m_defaultPackageName = defaultPackageName;
- }
-
- public void setCreateBindingFile(boolean createBindingFile) {
- try {
- setStateChanging(true);
- setCreateBindingFileInternal(createBindingFile);
- if (isControlCreated()) {
- m_createBindingFileButton.setSelection(createBindingFile);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setCreateBindingFileInternal(boolean createBindingFile) {
- m_propertySupport.setPropertyBool(PROP_CREATE_BINDING_FILE, createBindingFile);
- }
-
- public boolean isCreateBindingFile() {
- return m_propertySupport.getPropertyBool(PROP_CREATE_BINDING_FILE);
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.removePropertyChangeListener(listener);
- }
-
- private IPackageFragment[] openBrowsePackagesDialog() {
- IPackageFragment[] packageFragments = null;
- IRunnableContext context = new BusyIndicatorRunnableContext();
-
- SelectionDialog dialog = JavaUI.createPackageDialog(ScoutSdkUi.getShell(), context, m_bundle.getSearchScope(), false, true, null);
- dialog.setTitle(Texts.get("Package"));
- dialog.setMessage(Texts.get("ChoosePackageForImplementingClass"));
-
- if (dialog.open() == Window.OK) {
- if (dialog.getResult() != null) {
- packageFragments = Arrays.asList(dialog.getResult()).toArray(new IPackageFragment[0]);
- }
- }
- if (packageFragments != null) {
- return packageFragments;
- }
- else {
- return null;
- }
- }
-
- private void validatePackage(MultiStatus multiStatus) {
- if (!StringUtility.hasText(getPackageName()) && m_defaultPackageName == null) {
- //in some rare situation, package name cannot be derived from target namespace / WSDL definition
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("JaxWsCannotDerivePackageNameFromTargetNamespace")));
- }
-
- if (!CompareUtility.equals(m_defaultPackageName, getPackageName())) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("ConventionPackageNameEqualsToTargetNamespaceX")));
-
- // validate custom package name
- multiStatus.add(JavaConventionsUtil.validatePackageName(getPackageName(), m_bundle.getJavaProject()));
-
- if (StringUtility.isNullOrEmpty(getPackageName())) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("UsageOfDefaultPackageDiscouraged")));
- }
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.beans.PropertyChangeListener;
+import java.util.Arrays;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.internal.corext.util.JavaConventionsUtil;
+import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
+import org.eclipse.jdt.ui.JavaUI;
+import org.eclipse.jface.operation.IRunnableContext;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.sdk.ui.fields.StyledTextField;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.dialogs.SelectionDialog;
+
+@SuppressWarnings("restriction")
+public class WsStubWizardPage extends AbstractWorkspaceWizardPage {
+
+ public static final String PROP_STUB_FOLDER = "stubFolder";
+ public static final String PROP_PACKAGE = "package";
+ public static final String PROP_CREATE_BINDING_FILE = "createBindingFile";
+
+ private BasicPropertySupport m_propertySupport;
+
+ private IScoutBundle m_bundle;
+
+ private StyledTextField m_packageField;
+ private Button m_packageBrowseButton;
+ private Button m_createBindingFileButton;
+
+ private String m_serviceName;
+ private String m_defaultPackageName;
+
+ public WsStubWizardPage(IScoutBundle bundle) {
+ super(WsStubWizardPage.class.getName());
+ setTitle(Texts.get("ConfigureWebServiceStub"));
+ setDescription(Texts.get("ConfigureWebServiceStub"));
+
+ m_bundle = bundle;
+ m_propertySupport = new BasicPropertySupport(this);
+ applyDefaults();
+ }
+
+ private void applyDefaults() {
+ setCreateBindingFile(true);
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_packageField = getFieldToolkit().createStyledTextField(parent, Texts.get("StubPackage"));
+ m_packageField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setPackageNameInternal(m_packageField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_packageBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
+ m_packageBrowseButton.setText(Texts.get("Browse"));
+ m_packageBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IPackageFragment[] packageFragment = openBrowsePackagesDialog();
+ if (packageFragment != null && packageFragment.length > 0) {
+ setPackageName(packageFragment[0].getElementName());
+ }
+ }
+ });
+
+ m_createBindingFileButton = new Button(parent, SWT.CHECK);
+ m_createBindingFileButton.setText(Texts.get("CreateBindingFile"));
+ m_createBindingFileButton.setSelection(isCreateBindingFile());
+ m_createBindingFileButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setCreateBindingFileInternal(m_createBindingFileButton.getSelection());
+ }
+ });
+
+ // layout
+ parent.setLayout(new FormLayout());
+
+ FormData formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_packageField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_packageField, 0, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_packageBrowseButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_packageBrowseButton, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_createBindingFileButton.setLayoutData(formData);
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ if (m_bundle == null) { // not fully initialized yet
+ return;
+ }
+
+ validatePackage(multiStatus);
+ }
+
+ public void setPackageName(String packageName) {
+ try {
+ setStateChanging(true);
+ setPackageNameInternal(packageName);
+ if (isControlCreated()) {
+ m_packageField.setText(StringUtility.nvl(packageName, ""));
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setPackageNameInternal(String packageName) {
+ m_propertySupport.setProperty(PROP_PACKAGE, packageName);
+ }
+
+ public String getPackageName() {
+ return m_propertySupport.getPropertyString(PROP_PACKAGE);
+ }
+
+ public String getDefaultPackageName() {
+ return m_defaultPackageName;
+ }
+
+ public void setDefaultPackageName(String defaultPackageName) {
+ m_defaultPackageName = defaultPackageName;
+ }
+
+ public void setCreateBindingFile(boolean createBindingFile) {
+ try {
+ setStateChanging(true);
+ setCreateBindingFileInternal(createBindingFile);
+ if (isControlCreated()) {
+ m_createBindingFileButton.setSelection(createBindingFile);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setCreateBindingFileInternal(boolean createBindingFile) {
+ m_propertySupport.setPropertyBool(PROP_CREATE_BINDING_FILE, createBindingFile);
+ }
+
+ public boolean isCreateBindingFile() {
+ return m_propertySupport.getPropertyBool(PROP_CREATE_BINDING_FILE);
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.removePropertyChangeListener(listener);
+ }
+
+ private IPackageFragment[] openBrowsePackagesDialog() {
+ IPackageFragment[] packageFragments = null;
+ IRunnableContext context = new BusyIndicatorRunnableContext();
+
+ SelectionDialog dialog = JavaUI.createPackageDialog(ScoutSdkUi.getShell(), context, m_bundle.getSearchScope(), false, true, null);
+ dialog.setTitle(Texts.get("Package"));
+ dialog.setMessage(Texts.get("ChoosePackageForImplementingClass"));
+
+ if (dialog.open() == Window.OK) {
+ if (dialog.getResult() != null) {
+ packageFragments = Arrays.asList(dialog.getResult()).toArray(new IPackageFragment[0]);
+ }
+ }
+ if (packageFragments != null) {
+ return packageFragments;
+ }
+ else {
+ return null;
+ }
+ }
+
+ private void validatePackage(MultiStatus multiStatus) {
+ if (!StringUtility.hasText(getPackageName()) && m_defaultPackageName == null) {
+ //in some rare situation, package name cannot be derived from target namespace / WSDL definition
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("JaxWsCannotDerivePackageNameFromTargetNamespace")));
+ }
+
+ if (!CompareUtility.equals(m_defaultPackageName, getPackageName())) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("ConventionPackageNameEqualsToTargetNamespaceX")));
+
+ // validate custom package name
+ multiStatus.add(JavaConventionsUtil.validatePackageName(getPackageName(), m_bundle.getJavaProject()));
+
+ if (StringUtility.isNullOrEmpty(getPackageName())) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("UsageOfDefaultPackageDiscouraged")));
+ }
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlFolderViewerFilter.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlFolderViewerFilter.java
index dee87a7dd..07d9fe212 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlFolderViewerFilter.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlFolderViewerFilter.java
@@ -1,53 +1,53 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-
-public class WsdlFolderViewerFilter extends ViewerFilter {
-
- private IScoutBundle m_bundle;
- private IFolder m_rootFolder;
-
- public WsdlFolderViewerFilter(IScoutBundle bundle, IFolder rootFolder) {
- m_bundle = bundle;
- m_rootFolder = rootFolder;
- }
-
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- if (!(element instanceof IFolder)) {
- return false;
- }
- IFolder candidateFolder = (IFolder) element;
- // exclude hidden folders
- if (candidateFolder.getName().startsWith(".")) {
- return false;
- }
-
- if (m_rootFolder == null || !m_rootFolder.exists()) {
- return false;
- }
-
- // only accept subfolders of WSDL root folder
- IPath wsdlRootPath = m_rootFolder.getProjectRelativePath();
- IPath candidatePath = candidateFolder.getProjectRelativePath();
- candidatePath = candidatePath.makeRelativeTo(wsdlRootPath);
- if (candidatePath.toPortableString().startsWith("..")) {
- return false;
- }
- return m_rootFolder.exists(candidatePath);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+
+public class WsdlFolderViewerFilter extends ViewerFilter {
+
+ private IScoutBundle m_bundle;
+ private IFolder m_rootFolder;
+
+ public WsdlFolderViewerFilter(IScoutBundle bundle, IFolder rootFolder) {
+ m_bundle = bundle;
+ m_rootFolder = rootFolder;
+ }
+
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ if (!(element instanceof IFolder)) {
+ return false;
+ }
+ IFolder candidateFolder = (IFolder) element;
+ // exclude hidden folders
+ if (candidateFolder.getName().startsWith(".")) {
+ return false;
+ }
+
+ if (m_rootFolder == null || !m_rootFolder.exists()) {
+ return false;
+ }
+
+ // only accept subfolders of WSDL root folder
+ IPath wsdlRootPath = m_rootFolder.getProjectRelativePath();
+ IPath candidatePath = candidateFolder.getProjectRelativePath();
+ candidatePath = candidatePath.makeRelativeTo(wsdlRootPath);
+ if (candidatePath.toPortableString().startsWith("..")) {
+ return false;
+ }
+ return m_rootFolder.exists(candidatePath);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlLocationWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlLocationWizardPage.java
index 25b67e91e..fba1ee9f3 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlLocationWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlLocationWizardPage.java
@@ -1,786 +1,786 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.beans.PropertyChangeListener;
-import java.io.File;
-import java.io.InputStream;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.security.SecureRandom;
-import java.security.cert.CertificateException;
-import java.security.cert.X509Certificate;
-import java.util.ArrayList;
-import java.util.LinkedList;
-import java.util.List;
-
-import javax.net.ssl.HostnameVerifier;
-import javax.net.ssl.HttpsURLConnection;
-import javax.net.ssl.SSLContext;
-import javax.net.ssl.SSLSession;
-import javax.net.ssl.SSLSocketFactory;
-import javax.net.ssl.TrustManager;
-import javax.net.ssl.X509TrustManager;
-import javax.wsdl.Definition;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.resource.ImageDescriptor;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.commons.BooleanUtility;
-import org.eclipse.scout.commons.IOUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.commons.exception.ProcessingException;
-import org.eclipse.scout.sdk.ui.fields.TextField;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
-import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.AdditionalResourcesWizard;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.Artefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaImportArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaIncludeArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.forms.events.HyperlinkAdapter;
-import org.eclipse.ui.forms.events.HyperlinkEvent;
-import org.eclipse.ui.forms.widgets.Hyperlink;
-
-public class WsdlLocationWizardPage extends AbstractWorkspaceWizardPage {
-
- public static final String PROP_FILE_SYSTEM = "fileSystem";
- public static final String PROP_PATH = "path";
- public static final String PROP_URL = "url";
- public static final String PROP_WSDL_FILE = "wsdlFile";
- public static final String PROP_WSDL_DEFINITION = "wsdlDefinition";
- public static final String PROP_REBUILD_STUB = "rebuilStub";
- public static final String PROP_ADDITIONAL_FILES = "additionalFiles";
- public static final String PROP_WSDL_FOLDER = "wsdlFolder";
-
- private BasicPropertySupport m_propertySupport;
-
- private IScoutBundle m_bundle;
-
- private Button m_fileSystemRadioButton;
- private Composite m_fileSystemContainer;
- private TextField m_pathField;
- private Button m_browseButton;
- private Hyperlink m_addFilesLink;
-
- private Button m_urlRadioButton;
- private Composite m_urlContainer;
- private TextField m_urlField;
-
- private Button m_rebuidStubButton;
-
- // visible
- private boolean m_rebuildStubOptionVisible;
- private boolean m_wsdlFolderVisible;
-
- private Text m_wsdlFolderDescriptionField;
- private TextField m_wsdlFolderField;
- private Button m_wsdlFolderBrowseButton;
- private IFolder m_rootWsdlFolder;
-
- public WsdlLocationWizardPage(IScoutBundle bundle) {
- super(WsdlLocationWizardPage.class.getName());
- setTitle(Texts.get("SpecifyWsdlLocation"));
- setDescription(Texts.get("SpecifyWsdlLocation"));
-
- m_bundle = bundle;
- m_propertySupport = new BasicPropertySupport(this);
- applyDefaults();
- }
-
- private void applyDefaults() {
- setFileSystem(true);
- setAdditionalFiles(new File[0]);
- if (isRebuildStubOptionVisible()) {
- setRebuildStub(true);
- }
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_fileSystemRadioButton = new Button(parent, SWT.RADIO);
- m_fileSystemRadioButton.setText(Texts.get("ChooseWsdlFileFromFilesystem"));
- m_fileSystemRadioButton.setSelection(isFileSystem());
- m_fileSystemRadioButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- setStateChanging(true);
- setFileSystem(m_fileSystemRadioButton.getSelection());
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_fileSystemContainer = new Composite(parent, SWT.NONE);
- m_pathField = new TextField(m_fileSystemContainer);
- m_pathField.setLabelText("Path");
- m_pathField.addModifyListener(new ModifyListener() {
-
- @Override
- public void modifyText(ModifyEvent e) {
- setPathInternal(m_pathField.getText());
- pingStateChanging();
- }
- });
-
- m_browseButton = new Button(m_fileSystemContainer, SWT.PUSH | SWT.FLAT);
- m_browseButton.setText(Texts.get("Browse"));
- m_browseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
- String[] filterNames = new String[]{"wsdl"};
- String[] filterExtensions = new String[]{"*.wsdl"};
- dialog.setFilterNames(filterNames);
- dialog.setFilterExtensions(filterExtensions);
- String path = dialog.open();
- if (path != null) {
- setPath(path);
-
- // help the user by determing the referenced files
- Artefact[] artefacts = SchemaUtility.getArtefacts(new Path(path).toFile(), false);
- if (artefacts.length > 0) {
- P_ReferencedFilesFoundWizard wizard = new P_ReferencedFilesFoundWizard(artefacts);
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.setPageSize(450, 350);
- wizardDialog.open();
- }
- }
- }
- });
-
- m_addFilesLink = new Hyperlink(m_fileSystemContainer, SWT.NONE);
- m_addFilesLink.setText(Texts.get("AddRelatedFiles"));
- m_addFilesLink.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_BLUE));
- m_addFilesLink.setToolTipText(Texts.get("ClickToAddAdditionalResources"));
- m_addFilesLink.setUnderlined(true);
- m_addFilesLink.addHyperlinkListener(new HyperlinkAdapter() {
-
- @Override
- public void linkActivated(HyperlinkEvent event) {
- AdditionalResourcesWizard wizard = new AdditionalResourcesWizard(getAdditionalFiles());
- ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
- wizardDialog.setPageSize(650, 350);
- if (wizardDialog.open() == Window.OK) {
- setAdditionalFiles(wizard.getFiles());
- }
- }
- });
-
- m_urlRadioButton = new Button(parent, SWT.RADIO);
- m_urlRadioButton.setText(Texts.get("ChooseWsdlFromUrl"));
- m_urlRadioButton.setSelection(!isFileSystem());
-
- m_urlContainer = new Composite(parent, SWT.NONE);
-
- m_urlField = new TextField(m_urlContainer);
- m_urlField.setLabelText("Url");
- m_urlField.setEnabled(!isFileSystem());
- m_urlField.addFocusListener(new FocusListener() {
-
- @Override
- public void focusGained(FocusEvent e) {
- // nop
- }
-
- @Override
- public void focusLost(FocusEvent e) {
- setUrlInternal(m_urlField.getText());
- pingStateChanging();
- }
- });
-
- if (isRebuildStubOptionVisible()) {
- m_rebuidStubButton = new Button(parent, SWT.CHECK);
- m_rebuidStubButton.setText(Texts.get("RebuildWebserviceStub"));
- m_rebuidStubButton.setSelection(isRebuildStub());
- m_rebuidStubButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- setRebuildStubInternal(m_rebuidStubButton.getSelection());
- }
- });
- }
-
- // WSDL folder
- if (isWsdlFolderVisible()) {
- m_wsdlFolderDescriptionField = new Text(parent, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
- m_wsdlFolderDescriptionField.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- m_wsdlFolderDescriptionField.setText(Texts.get("ChooseFolderForWsdlFileAndArtefacts"));
-
- m_wsdlFolderField = new TextField(parent);
- m_wsdlFolderField.setLabelText(Texts.get("WsdlFolder"));
- m_wsdlFolderField.getTextComponent().setBackground(JaxWsSdkUtility.getColorLightGray());
- m_wsdlFolderField.setEditable(false);
-
- m_wsdlFolderBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
- m_wsdlFolderBrowseButton.setText(Texts.get("Browse"));
- m_wsdlFolderBrowseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IFolder folder = JaxWsSdkUtility.openProjectFolderDialog(
- m_bundle,
- new WsdlFolderViewerFilter(m_bundle, getRootWsdlFolder()),
- Texts.get("WsdlFolder"),
- Texts.get("ChooseFolderForWsdlFileAndArtefacts"),
- getRootWsdlFolder(),
- getWsdlFolder());
- if (folder != null) {
- setWsdlFolder(folder);
- }
- }
-
- });
- IFolder folder = getWsdlFolder();
- if (folder != null) {
- m_wsdlFolderField.setText(folder.getProjectRelativePath().toPortableString());
- }
- }
-
- // layout
- parent.setLayout(new FormLayout());
- m_fileSystemContainer.setLayout(new FormLayout());
- m_urlContainer.setLayout(new FormLayout());
-
- FormData formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_fileSystemRadioButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_fileSystemRadioButton, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_fileSystemContainer.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_pathField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_browseButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_browseButton, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_addFilesLink.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_fileSystemContainer, 10, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_urlRadioButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_urlRadioButton, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_urlContainer.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(0, 0);
- formData.right = new FormAttachment(100, 0);
- m_urlField.setLayoutData(formData);
-
- Control referenceControl = m_urlContainer;
- if (isWsdlFolderVisible()) {
- formData = new FormData();
- formData.top = new FormAttachment(m_urlContainer, 20, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_wsdlFolderDescriptionField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_wsdlFolderDescriptionField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_wsdlFolderField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_wsdlFolderField, 0, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_wsdlFolderBrowseButton.setLayoutData(formData);
-
- referenceControl = m_wsdlFolderField;
- }
-
- if (isRebuildStubOptionVisible()) {
- formData = new FormData();
- formData.top = new FormAttachment(referenceControl, 20, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_rebuidStubButton.setLayoutData(formData);
- }
-
- JaxWsSdkUtility.setView(m_fileSystemContainer, isFileSystem());
- JaxWsSdkUtility.setView(m_urlContainer, !isFileSystem());
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- if (isFileSystem()) {
- validatePath(multiStatus);
- }
- else {
- validateUrl(multiStatus);
- }
-
- IFolder wsdlFolder = getWsdlFolder();
- // check whether file already exists
- if (getWsdlFile() != null && wsdlFolder != null) {
- String wsdlFolderPath = JaxWsSdkUtility.normalizePath(wsdlFolder.getProjectRelativePath().toPortableString(), SeparatorType.BothType);
-
- IFile conflictingFile = m_bundle.getProject().getFile(wsdlFolderPath + getWsdlFile().getName());
- if (conflictingFile != null && conflictingFile.exists()) {
- IPath conflictingFilePath = new Path(conflictingFile.getLocationURI().getRawPath());
- IPath wsdlFilePath = new Path(getWsdlFile().getAbsolutePath());
-
- if (!conflictingFilePath.equals(wsdlFilePath)) {
- multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("WSDLFileAlreadyExists", conflictingFile.getName(), wsdlFolderPath)));
- }
- }
- }
-
- if (isWsdlFolderVisible() && getWsdlFolder() == null) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_wsdlFolderField.getText())));
- }
- }
-
- public void setFileSystem(boolean fileSystem) {
- try {
- setStateChanging(true);
- setFileSystemInternal(fileSystem);
-
- if (isFileSystem()) {
- setUrl(null);
- }
- else {
- setPath(null);
- }
-
- if (isControlCreated()) {
- m_fileSystemRadioButton.setSelection(fileSystem);
- JaxWsSdkUtility.setView(m_fileSystemContainer, fileSystem);
- JaxWsSdkUtility.setView(m_urlContainer, !fileSystem);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setFileSystemInternal(boolean fileSystem) {
- m_propertySupport.setProperty(PROP_FILE_SYSTEM, fileSystem);
- }
-
- public boolean isFileSystem() {
- return m_propertySupport.getPropertyBool(PROP_FILE_SYSTEM);
- }
-
- private void setWsdlDefinition(Definition wsdlDefinition) {
- m_propertySupport.setProperty(PROP_WSDL_DEFINITION, wsdlDefinition);
- }
-
- public Definition getWsdlDefinition() {
- return (Definition) m_propertySupport.getProperty(PROP_WSDL_DEFINITION);
- }
-
- public void setPath(String path) {
- try {
- setStateChanging(true);
- setPathInternal(path);
- if (isControlCreated()) {
- m_pathField.setText(path);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setPathInternal(String path) {
- m_propertySupport.setPropertyString(PROP_PATH, path);
- }
-
- public String getPath() {
- return m_propertySupport.getPropertyString(PROP_PATH);
- }
-
- public void setAdditionalFiles(File[] files) {
- m_propertySupport.setProperty(PROP_ADDITIONAL_FILES, files);
- }
-
- public File[] getAdditionalFiles() {
- File[] files = (File[]) m_propertySupport.getProperty(PROP_ADDITIONAL_FILES);
- if (files == null) {
- files = new File[0];
- }
- return files;
- }
-
- public void setUrl(String url) {
- try {
- setStateChanging(true);
- setPathInternal(url);
- if (isControlCreated()) {
- m_urlField.setText(url);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setUrlInternal(String url) {
- m_propertySupport.setPropertyString(PROP_URL, url);
- }
-
- public String getUrl() {
- return m_propertySupport.getPropertyString(PROP_URL);
- }
-
- private void setWsdlFile(File wsdlFile) {
- m_propertySupport.setProperty(PROP_WSDL_FILE, wsdlFile);
- }
-
- public File getWsdlFile() {
- return (File) m_propertySupport.getProperty(PROP_WSDL_FILE);
- }
-
- public void setRebuildStub(boolean rebuildStub) {
- try {
- setStateChanging(true);
- setRebuildStubInternal(rebuildStub);
- if (isControlCreated()) {
- m_rebuidStubButton.setSelection(rebuildStub);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setRebuildStubInternal(boolean rebuildStub) {
- m_propertySupport.setPropertyBool(PROP_REBUILD_STUB, rebuildStub);
- }
-
- public boolean isRebuildStub() {
- return BooleanUtility.nvl(m_propertySupport.getPropertyBool(PROP_REBUILD_STUB), false);
- }
-
- public void setWsdlFolder(IFolder wsdlFolder) {
- try {
- setStateChanging(true);
- setWsdlFolderInternal(wsdlFolder);
- if (isControlCreated() && m_wsdlFolderField != null) {
- if (wsdlFolder != null) {
- m_wsdlFolderField.setText(wsdlFolder.getProjectRelativePath().toPortableString());
- }
- else {
- m_wsdlFolderField.setText("");
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setWsdlFolderInternal(IFolder wsdlFolder) {
- m_propertySupport.setProperty(PROP_WSDL_FOLDER, wsdlFolder);
- }
-
- public IFolder getWsdlFolder() {
- return (IFolder) m_propertySupport.getProperty(PROP_WSDL_FOLDER);
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.addPropertyChangeListener(listener);
- super.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.removePropertyChangeListener(listener);
- super.removePropertyChangeListener(listener);
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- private void validatePath(MultiStatus multiStatus) {
- if (StringUtility.isNullOrEmpty(getPath())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("PleaseChooseFileFromFilesystem")));
- return;
- }
-
- File file = new File(getPath());
- if (!file.exists()) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("FileDoesNotExistOrIsCorrupt")));
- return;
- }
-
- Definition wsdlDefinition = loadWsdlDefinition(file);
- setWsdlDefinition(wsdlDefinition);
- if (wsdlDefinition == null) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("WsdlCorrupt", getPath())));
- }
- else {
- setWsdlFile(file);
- }
- }
-
- private void validateUrl(MultiStatus multiStatus) {
- if (StringUtility.isNullOrEmpty(getUrl())) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("PleaseEnterValidUrl")));
- return;
- }
- URL url;
- try {
- url = new URL(getUrl());
- }
- catch (MalformedURLException e) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("PleaseEnterValidUrl")));
- return;
- }
-
- InputStream is;
- // temporarily trust all HTTPS certificates
- SSLSocketFactory defaultSSLSocketFactory = HttpsURLConnection.getDefaultSSLSocketFactory();
- HostnameVerifier defaultHostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
- try {
- HttpsURLConnection.setDefaultHostnameVerifier(new P_DummyHostnameVerifier());
-
- SSLContext sslContext = SSLContext.getInstance("SSL");
- sslContext.init(null, new TrustManager[]{new P_DummyTrustManager()}, new SecureRandom());
- HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
-
- URLConnection connection = url.openConnection();
- connection.setAllowUserInteraction(true); // for credentials prompt if required
- connection.setDoOutput(true);
- is = url.openStream();
- }
- catch (Exception e) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("URLCouldNotBeAccessed"), e));
- return;
- }
- finally {
- HttpsURLConnection.setDefaultSSLSocketFactory(defaultSSLSocketFactory);
- HttpsURLConnection.setDefaultHostnameVerifier(defaultHostnameVerifier);
- }
-
- byte[] content;
- try {
- content = IOUtility.getContent(is, true);
- }
- catch (ProcessingException e) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("CouldNotDownloadWSDLFile")));
- return;
- }
-
- File tempFile;
- try {
- IPath path = new Path(url.getPath());
- if (path.getFileExtension() == null || !path.getFileExtension().equalsIgnoreCase("wsdl")) {
- path = path.addFileExtension("wsdl");
- }
- String filename = path.lastSegment();
- tempFile = IOUtility.createTempFile(filename, content);
- }
- catch (ProcessingException e) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("CreationOfTemporyFileFailed")));
- return;
- }
-
- Definition wsdlDefinition = loadWsdlDefinition(tempFile);
- setWsdlDefinition(wsdlDefinition);
- if (wsdlDefinition == null) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("WsdlCorrupt", getPath())));
- }
- else {
- setWsdlFile(tempFile);
- }
- }
-
- private Definition loadWsdlDefinition(File file) {
- try {
- WSDLFactory factory = WSDLFactory.newInstance();
- WSDLReader reader = factory.newWSDLReader();
- return reader.readWSDL(file.getAbsolutePath());
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- return null;
- }
- }
-
- public boolean isRebuildStubOptionVisible() {
- return m_rebuildStubOptionVisible;
- }
-
- public void setRebuildStubOptionVisible(boolean rebuildStubOptionVisible) {
- m_rebuildStubOptionVisible = rebuildStubOptionVisible;
- }
-
- public boolean isWsdlFolderVisible() {
- return m_wsdlFolderVisible;
- }
-
- public void setWsdlFolderVisible(boolean wsdlFolderVisible) {
- m_wsdlFolderVisible = wsdlFolderVisible;
- }
-
- public IFolder getRootWsdlFolder() {
- return m_rootWsdlFolder;
- }
-
- public void setRootWsdlFolder(IFolder rootWsdlFolder) {
- m_rootWsdlFolder = rootWsdlFolder;
- }
-
- private class P_DummyTrustManager implements X509TrustManager {
-
- @Override
- public void checkClientTrusted(X509Certificate[] ax509certificate, String s) throws CertificateException {
- }
-
- @Override
- public void checkServerTrusted(X509Certificate[] ax509certificate, String s) throws CertificateException {
- }
-
- @Override
- public X509Certificate[] getAcceptedIssuers() {
- return null;
- }
- }
-
- private class P_DummyHostnameVerifier implements HostnameVerifier {
-
- @Override
- public boolean verify(String s, SSLSession sslsession) {
- return true;
- }
- }
-
- private class P_ReferencedFilesFoundWizard extends AbstractWorkspaceWizard {
-
- private ResourceSelectionWizardPage m_wizardPage;
- private Artefact[] m_artefacts;
-
- public P_ReferencedFilesFoundWizard(Artefact[] artefacts) {
- setWindowTitle(Texts.get("ReferencedFilesFound"));
- m_artefacts = artefacts;
- }
-
- @Override
- public void addPages() {
- m_wizardPage = new ResourceSelectionWizardPage(Texts.get("ReferencedFilesFound"), Texts.get("QuestionReferencedFilesFound"));
-
- List<ElementBean> elements = new ArrayList<ElementBean>();
- for (Artefact artefact : m_artefacts) {
- String suffix = null;
- ImageDescriptor imageDescriptor = ScoutSdkUi.getImageDescriptor(ScoutSdkUi.File);
- if (artefact instanceof WsdlArtefact) {
- suffix = " (referenced WSDL file)";
- imageDescriptor = JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile);
- }
- else if (artefact instanceof SchemaIncludeArtefact) {
- suffix = " (included XSD schema)";
- imageDescriptor = JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema);
-
- }
- else if (artefact instanceof SchemaImportArtefact) {
- suffix = " (imported XSD schema)";
- imageDescriptor = JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema);
- }
-
- ElementBean elementBean = new ElementBean(0, artefact.getFile().getAbsoluteFile().getAbsolutePath() + suffix, imageDescriptor, false);
- elementBean.setData(artefact.getFile());
- elements.add(elementBean);
- }
- m_wizardPage.setElements(elements);
- addPage(m_wizardPage);
- }
-
- @Override
- protected boolean beforeFinish() throws CoreException {
- List<File> files = new LinkedList<File>();
- for (ElementBean element : m_wizardPage.getElements()) {
- if (element.isChecked() || element.isMandatory()) {
- files.add((File) element.getData());
- }
- }
- setAdditionalFiles(files.toArray(new File[files.size()]));
- return true;
- }
-
- @Override
- protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
- return true;
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.beans.PropertyChangeListener;
+import java.io.File;
+import java.io.InputStream;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.security.SecureRandom;
+import java.security.cert.CertificateException;
+import java.security.cert.X509Certificate;
+import java.util.ArrayList;
+import java.util.LinkedList;
+import java.util.List;
+
+import javax.net.ssl.HostnameVerifier;
+import javax.net.ssl.HttpsURLConnection;
+import javax.net.ssl.SSLContext;
+import javax.net.ssl.SSLSession;
+import javax.net.ssl.SSLSocketFactory;
+import javax.net.ssl.TrustManager;
+import javax.net.ssl.X509TrustManager;
+import javax.wsdl.Definition;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.commons.BooleanUtility;
+import org.eclipse.scout.commons.IOUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.commons.exception.ProcessingException;
+import org.eclipse.scout.sdk.ui.fields.TextField;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizard;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.ScoutWizardDialogEx;
+import org.eclipse.scout.sdk.ws.jaxws.swt.wizard.AdditionalResourcesWizard;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility.SeparatorType;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.Artefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaImportArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.SchemaIncludeArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.forms.events.HyperlinkAdapter;
+import org.eclipse.ui.forms.events.HyperlinkEvent;
+import org.eclipse.ui.forms.widgets.Hyperlink;
+
+public class WsdlLocationWizardPage extends AbstractWorkspaceWizardPage {
+
+ public static final String PROP_FILE_SYSTEM = "fileSystem";
+ public static final String PROP_PATH = "path";
+ public static final String PROP_URL = "url";
+ public static final String PROP_WSDL_FILE = "wsdlFile";
+ public static final String PROP_WSDL_DEFINITION = "wsdlDefinition";
+ public static final String PROP_REBUILD_STUB = "rebuilStub";
+ public static final String PROP_ADDITIONAL_FILES = "additionalFiles";
+ public static final String PROP_WSDL_FOLDER = "wsdlFolder";
+
+ private BasicPropertySupport m_propertySupport;
+
+ private IScoutBundle m_bundle;
+
+ private Button m_fileSystemRadioButton;
+ private Composite m_fileSystemContainer;
+ private TextField m_pathField;
+ private Button m_browseButton;
+ private Hyperlink m_addFilesLink;
+
+ private Button m_urlRadioButton;
+ private Composite m_urlContainer;
+ private TextField m_urlField;
+
+ private Button m_rebuidStubButton;
+
+ // visible
+ private boolean m_rebuildStubOptionVisible;
+ private boolean m_wsdlFolderVisible;
+
+ private Text m_wsdlFolderDescriptionField;
+ private TextField m_wsdlFolderField;
+ private Button m_wsdlFolderBrowseButton;
+ private IFolder m_rootWsdlFolder;
+
+ public WsdlLocationWizardPage(IScoutBundle bundle) {
+ super(WsdlLocationWizardPage.class.getName());
+ setTitle(Texts.get("SpecifyWsdlLocation"));
+ setDescription(Texts.get("SpecifyWsdlLocation"));
+
+ m_bundle = bundle;
+ m_propertySupport = new BasicPropertySupport(this);
+ applyDefaults();
+ }
+
+ private void applyDefaults() {
+ setFileSystem(true);
+ setAdditionalFiles(new File[0]);
+ if (isRebuildStubOptionVisible()) {
+ setRebuildStub(true);
+ }
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_fileSystemRadioButton = new Button(parent, SWT.RADIO);
+ m_fileSystemRadioButton.setText(Texts.get("ChooseWsdlFileFromFilesystem"));
+ m_fileSystemRadioButton.setSelection(isFileSystem());
+ m_fileSystemRadioButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ setStateChanging(true);
+ setFileSystem(m_fileSystemRadioButton.getSelection());
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_fileSystemContainer = new Composite(parent, SWT.NONE);
+ m_pathField = new TextField(m_fileSystemContainer);
+ m_pathField.setLabelText("Path");
+ m_pathField.addModifyListener(new ModifyListener() {
+
+ @Override
+ public void modifyText(ModifyEvent e) {
+ setPathInternal(m_pathField.getText());
+ pingStateChanging();
+ }
+ });
+
+ m_browseButton = new Button(m_fileSystemContainer, SWT.PUSH | SWT.FLAT);
+ m_browseButton.setText(Texts.get("Browse"));
+ m_browseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog dialog = new FileDialog(getShell(), SWT.OPEN);
+ String[] filterNames = new String[]{"wsdl"};
+ String[] filterExtensions = new String[]{"*.wsdl"};
+ dialog.setFilterNames(filterNames);
+ dialog.setFilterExtensions(filterExtensions);
+ String path = dialog.open();
+ if (path != null) {
+ setPath(path);
+
+ // help the user by determing the referenced files
+ Artefact[] artefacts = SchemaUtility.getArtefacts(new Path(path).toFile(), false);
+ if (artefacts.length > 0) {
+ P_ReferencedFilesFoundWizard wizard = new P_ReferencedFilesFoundWizard(artefacts);
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.setPageSize(450, 350);
+ wizardDialog.open();
+ }
+ }
+ }
+ });
+
+ m_addFilesLink = new Hyperlink(m_fileSystemContainer, SWT.NONE);
+ m_addFilesLink.setText(Texts.get("AddRelatedFiles"));
+ m_addFilesLink.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_BLUE));
+ m_addFilesLink.setToolTipText(Texts.get("ClickToAddAdditionalResources"));
+ m_addFilesLink.setUnderlined(true);
+ m_addFilesLink.addHyperlinkListener(new HyperlinkAdapter() {
+
+ @Override
+ public void linkActivated(HyperlinkEvent event) {
+ AdditionalResourcesWizard wizard = new AdditionalResourcesWizard(getAdditionalFiles());
+ ScoutWizardDialogEx wizardDialog = new ScoutWizardDialogEx(wizard);
+ wizardDialog.setPageSize(650, 350);
+ if (wizardDialog.open() == Window.OK) {
+ setAdditionalFiles(wizard.getFiles());
+ }
+ }
+ });
+
+ m_urlRadioButton = new Button(parent, SWT.RADIO);
+ m_urlRadioButton.setText(Texts.get("ChooseWsdlFromUrl"));
+ m_urlRadioButton.setSelection(!isFileSystem());
+
+ m_urlContainer = new Composite(parent, SWT.NONE);
+
+ m_urlField = new TextField(m_urlContainer);
+ m_urlField.setLabelText("Url");
+ m_urlField.setEnabled(!isFileSystem());
+ m_urlField.addFocusListener(new FocusListener() {
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ // nop
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ setUrlInternal(m_urlField.getText());
+ pingStateChanging();
+ }
+ });
+
+ if (isRebuildStubOptionVisible()) {
+ m_rebuidStubButton = new Button(parent, SWT.CHECK);
+ m_rebuidStubButton.setText(Texts.get("RebuildWebserviceStub"));
+ m_rebuidStubButton.setSelection(isRebuildStub());
+ m_rebuidStubButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ setRebuildStubInternal(m_rebuidStubButton.getSelection());
+ }
+ });
+ }
+
+ // WSDL folder
+ if (isWsdlFolderVisible()) {
+ m_wsdlFolderDescriptionField = new Text(parent, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
+ m_wsdlFolderDescriptionField.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
+ m_wsdlFolderDescriptionField.setText(Texts.get("ChooseFolderForWsdlFileAndArtefacts"));
+
+ m_wsdlFolderField = new TextField(parent);
+ m_wsdlFolderField.setLabelText(Texts.get("WsdlFolder"));
+ m_wsdlFolderField.getTextComponent().setBackground(JaxWsSdkUtility.getColorLightGray());
+ m_wsdlFolderField.setEditable(false);
+
+ m_wsdlFolderBrowseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
+ m_wsdlFolderBrowseButton.setText(Texts.get("Browse"));
+ m_wsdlFolderBrowseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IFolder folder = JaxWsSdkUtility.openProjectFolderDialog(
+ m_bundle,
+ new WsdlFolderViewerFilter(m_bundle, getRootWsdlFolder()),
+ Texts.get("WsdlFolder"),
+ Texts.get("ChooseFolderForWsdlFileAndArtefacts"),
+ getRootWsdlFolder(),
+ getWsdlFolder());
+ if (folder != null) {
+ setWsdlFolder(folder);
+ }
+ }
+
+ });
+ IFolder folder = getWsdlFolder();
+ if (folder != null) {
+ m_wsdlFolderField.setText(folder.getProjectRelativePath().toPortableString());
+ }
+ }
+
+ // layout
+ parent.setLayout(new FormLayout());
+ m_fileSystemContainer.setLayout(new FormLayout());
+ m_urlContainer.setLayout(new FormLayout());
+
+ FormData formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_fileSystemRadioButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_fileSystemRadioButton, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_fileSystemContainer.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_pathField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_browseButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_browseButton, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_addFilesLink.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_fileSystemContainer, 10, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_urlRadioButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_urlRadioButton, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_urlContainer.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(0, 0);
+ formData.right = new FormAttachment(100, 0);
+ m_urlField.setLayoutData(formData);
+
+ Control referenceControl = m_urlContainer;
+ if (isWsdlFolderVisible()) {
+ formData = new FormData();
+ formData.top = new FormAttachment(m_urlContainer, 20, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_wsdlFolderDescriptionField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_wsdlFolderDescriptionField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_wsdlFolderField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_wsdlFolderField, 0, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_wsdlFolderBrowseButton.setLayoutData(formData);
+
+ referenceControl = m_wsdlFolderField;
+ }
+
+ if (isRebuildStubOptionVisible()) {
+ formData = new FormData();
+ formData.top = new FormAttachment(referenceControl, 20, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_rebuidStubButton.setLayoutData(formData);
+ }
+
+ JaxWsSdkUtility.setView(m_fileSystemContainer, isFileSystem());
+ JaxWsSdkUtility.setView(m_urlContainer, !isFileSystem());
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ if (isFileSystem()) {
+ validatePath(multiStatus);
+ }
+ else {
+ validateUrl(multiStatus);
+ }
+
+ IFolder wsdlFolder = getWsdlFolder();
+ // check whether file already exists
+ if (getWsdlFile() != null && wsdlFolder != null) {
+ String wsdlFolderPath = JaxWsSdkUtility.normalizePath(wsdlFolder.getProjectRelativePath().toPortableString(), SeparatorType.BothType);
+
+ IFile conflictingFile = m_bundle.getProject().getFile(wsdlFolderPath + getWsdlFile().getName());
+ if (conflictingFile != null && conflictingFile.exists()) {
+ IPath conflictingFilePath = new Path(conflictingFile.getLocationURI().getRawPath());
+ IPath wsdlFilePath = new Path(getWsdlFile().getAbsolutePath());
+
+ if (!conflictingFilePath.equals(wsdlFilePath)) {
+ multiStatus.add(new Status(IStatus.WARNING, JaxWsSdk.PLUGIN_ID, Texts.get("WSDLFileAlreadyExists", conflictingFile.getName(), wsdlFolderPath)));
+ }
+ }
+ }
+
+ if (isWsdlFolderVisible() && getWsdlFolder() == null) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_wsdlFolderField.getText())));
+ }
+ }
+
+ public void setFileSystem(boolean fileSystem) {
+ try {
+ setStateChanging(true);
+ setFileSystemInternal(fileSystem);
+
+ if (isFileSystem()) {
+ setUrl(null);
+ }
+ else {
+ setPath(null);
+ }
+
+ if (isControlCreated()) {
+ m_fileSystemRadioButton.setSelection(fileSystem);
+ JaxWsSdkUtility.setView(m_fileSystemContainer, fileSystem);
+ JaxWsSdkUtility.setView(m_urlContainer, !fileSystem);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setFileSystemInternal(boolean fileSystem) {
+ m_propertySupport.setProperty(PROP_FILE_SYSTEM, fileSystem);
+ }
+
+ public boolean isFileSystem() {
+ return m_propertySupport.getPropertyBool(PROP_FILE_SYSTEM);
+ }
+
+ private void setWsdlDefinition(Definition wsdlDefinition) {
+ m_propertySupport.setProperty(PROP_WSDL_DEFINITION, wsdlDefinition);
+ }
+
+ public Definition getWsdlDefinition() {
+ return (Definition) m_propertySupport.getProperty(PROP_WSDL_DEFINITION);
+ }
+
+ public void setPath(String path) {
+ try {
+ setStateChanging(true);
+ setPathInternal(path);
+ if (isControlCreated()) {
+ m_pathField.setText(path);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setPathInternal(String path) {
+ m_propertySupport.setPropertyString(PROP_PATH, path);
+ }
+
+ public String getPath() {
+ return m_propertySupport.getPropertyString(PROP_PATH);
+ }
+
+ public void setAdditionalFiles(File[] files) {
+ m_propertySupport.setProperty(PROP_ADDITIONAL_FILES, files);
+ }
+
+ public File[] getAdditionalFiles() {
+ File[] files = (File[]) m_propertySupport.getProperty(PROP_ADDITIONAL_FILES);
+ if (files == null) {
+ files = new File[0];
+ }
+ return files;
+ }
+
+ public void setUrl(String url) {
+ try {
+ setStateChanging(true);
+ setPathInternal(url);
+ if (isControlCreated()) {
+ m_urlField.setText(url);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setUrlInternal(String url) {
+ m_propertySupport.setPropertyString(PROP_URL, url);
+ }
+
+ public String getUrl() {
+ return m_propertySupport.getPropertyString(PROP_URL);
+ }
+
+ private void setWsdlFile(File wsdlFile) {
+ m_propertySupport.setProperty(PROP_WSDL_FILE, wsdlFile);
+ }
+
+ public File getWsdlFile() {
+ return (File) m_propertySupport.getProperty(PROP_WSDL_FILE);
+ }
+
+ public void setRebuildStub(boolean rebuildStub) {
+ try {
+ setStateChanging(true);
+ setRebuildStubInternal(rebuildStub);
+ if (isControlCreated()) {
+ m_rebuidStubButton.setSelection(rebuildStub);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setRebuildStubInternal(boolean rebuildStub) {
+ m_propertySupport.setPropertyBool(PROP_REBUILD_STUB, rebuildStub);
+ }
+
+ public boolean isRebuildStub() {
+ return BooleanUtility.nvl(m_propertySupport.getPropertyBool(PROP_REBUILD_STUB), false);
+ }
+
+ public void setWsdlFolder(IFolder wsdlFolder) {
+ try {
+ setStateChanging(true);
+ setWsdlFolderInternal(wsdlFolder);
+ if (isControlCreated() && m_wsdlFolderField != null) {
+ if (wsdlFolder != null) {
+ m_wsdlFolderField.setText(wsdlFolder.getProjectRelativePath().toPortableString());
+ }
+ else {
+ m_wsdlFolderField.setText("");
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setWsdlFolderInternal(IFolder wsdlFolder) {
+ m_propertySupport.setProperty(PROP_WSDL_FOLDER, wsdlFolder);
+ }
+
+ public IFolder getWsdlFolder() {
+ return (IFolder) m_propertySupport.getProperty(PROP_WSDL_FOLDER);
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.addPropertyChangeListener(listener);
+ super.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.removePropertyChangeListener(listener);
+ super.removePropertyChangeListener(listener);
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ private void validatePath(MultiStatus multiStatus) {
+ if (StringUtility.isNullOrEmpty(getPath())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("PleaseChooseFileFromFilesystem")));
+ return;
+ }
+
+ File file = new File(getPath());
+ if (!file.exists()) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("FileDoesNotExistOrIsCorrupt")));
+ return;
+ }
+
+ Definition wsdlDefinition = loadWsdlDefinition(file);
+ setWsdlDefinition(wsdlDefinition);
+ if (wsdlDefinition == null) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("WsdlCorrupt", getPath())));
+ }
+ else {
+ setWsdlFile(file);
+ }
+ }
+
+ private void validateUrl(MultiStatus multiStatus) {
+ if (StringUtility.isNullOrEmpty(getUrl())) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("PleaseEnterValidUrl")));
+ return;
+ }
+ URL url;
+ try {
+ url = new URL(getUrl());
+ }
+ catch (MalformedURLException e) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("PleaseEnterValidUrl")));
+ return;
+ }
+
+ InputStream is;
+ // temporarily trust all HTTPS certificates
+ SSLSocketFactory defaultSSLSocketFactory = HttpsURLConnection.getDefaultSSLSocketFactory();
+ HostnameVerifier defaultHostnameVerifier = HttpsURLConnection.getDefaultHostnameVerifier();
+ try {
+ HttpsURLConnection.setDefaultHostnameVerifier(new P_DummyHostnameVerifier());
+
+ SSLContext sslContext = SSLContext.getInstance("SSL");
+ sslContext.init(null, new TrustManager[]{new P_DummyTrustManager()}, new SecureRandom());
+ HttpsURLConnection.setDefaultSSLSocketFactory(sslContext.getSocketFactory());
+
+ URLConnection connection = url.openConnection();
+ connection.setAllowUserInteraction(true); // for credentials prompt if required
+ connection.setDoOutput(true);
+ is = url.openStream();
+ }
+ catch (Exception e) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("URLCouldNotBeAccessed"), e));
+ return;
+ }
+ finally {
+ HttpsURLConnection.setDefaultSSLSocketFactory(defaultSSLSocketFactory);
+ HttpsURLConnection.setDefaultHostnameVerifier(defaultHostnameVerifier);
+ }
+
+ byte[] content;
+ try {
+ content = IOUtility.getContent(is, true);
+ }
+ catch (ProcessingException e) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("CouldNotDownloadWSDLFile")));
+ return;
+ }
+
+ File tempFile;
+ try {
+ IPath path = new Path(url.getPath());
+ if (path.getFileExtension() == null || !path.getFileExtension().equalsIgnoreCase("wsdl")) {
+ path = path.addFileExtension("wsdl");
+ }
+ String filename = path.lastSegment();
+ tempFile = IOUtility.createTempFile(filename, content);
+ }
+ catch (ProcessingException e) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("CreationOfTemporyFileFailed")));
+ return;
+ }
+
+ Definition wsdlDefinition = loadWsdlDefinition(tempFile);
+ setWsdlDefinition(wsdlDefinition);
+ if (wsdlDefinition == null) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("WsdlCorrupt", getPath())));
+ }
+ else {
+ setWsdlFile(tempFile);
+ }
+ }
+
+ private Definition loadWsdlDefinition(File file) {
+ try {
+ WSDLFactory factory = WSDLFactory.newInstance();
+ WSDLReader reader = factory.newWSDLReader();
+ return reader.readWSDL(file.getAbsolutePath());
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ return null;
+ }
+ }
+
+ public boolean isRebuildStubOptionVisible() {
+ return m_rebuildStubOptionVisible;
+ }
+
+ public void setRebuildStubOptionVisible(boolean rebuildStubOptionVisible) {
+ m_rebuildStubOptionVisible = rebuildStubOptionVisible;
+ }
+
+ public boolean isWsdlFolderVisible() {
+ return m_wsdlFolderVisible;
+ }
+
+ public void setWsdlFolderVisible(boolean wsdlFolderVisible) {
+ m_wsdlFolderVisible = wsdlFolderVisible;
+ }
+
+ public IFolder getRootWsdlFolder() {
+ return m_rootWsdlFolder;
+ }
+
+ public void setRootWsdlFolder(IFolder rootWsdlFolder) {
+ m_rootWsdlFolder = rootWsdlFolder;
+ }
+
+ private class P_DummyTrustManager implements X509TrustManager {
+
+ @Override
+ public void checkClientTrusted(X509Certificate[] ax509certificate, String s) throws CertificateException {
+ }
+
+ @Override
+ public void checkServerTrusted(X509Certificate[] ax509certificate, String s) throws CertificateException {
+ }
+
+ @Override
+ public X509Certificate[] getAcceptedIssuers() {
+ return null;
+ }
+ }
+
+ private class P_DummyHostnameVerifier implements HostnameVerifier {
+
+ @Override
+ public boolean verify(String s, SSLSession sslsession) {
+ return true;
+ }
+ }
+
+ private class P_ReferencedFilesFoundWizard extends AbstractWorkspaceWizard {
+
+ private ResourceSelectionWizardPage m_wizardPage;
+ private Artefact[] m_artefacts;
+
+ public P_ReferencedFilesFoundWizard(Artefact[] artefacts) {
+ setWindowTitle(Texts.get("ReferencedFilesFound"));
+ m_artefacts = artefacts;
+ }
+
+ @Override
+ public void addPages() {
+ m_wizardPage = new ResourceSelectionWizardPage(Texts.get("ReferencedFilesFound"), Texts.get("QuestionReferencedFilesFound"));
+
+ List<ElementBean> elements = new ArrayList<ElementBean>();
+ for (Artefact artefact : m_artefacts) {
+ String suffix = null;
+ ImageDescriptor imageDescriptor = ScoutSdkUi.getImageDescriptor(ScoutSdkUi.File);
+ if (artefact instanceof WsdlArtefact) {
+ suffix = " (referenced WSDL file)";
+ imageDescriptor = JaxWsSdk.getImageDescriptor(JaxWsIcons.WsdlFile);
+ }
+ else if (artefact instanceof SchemaIncludeArtefact) {
+ suffix = " (included XSD schema)";
+ imageDescriptor = JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema);
+
+ }
+ else if (artefact instanceof SchemaImportArtefact) {
+ suffix = " (imported XSD schema)";
+ imageDescriptor = JaxWsSdk.getImageDescriptor(JaxWsIcons.XsdSchema);
+ }
+
+ ElementBean elementBean = new ElementBean(0, artefact.getFile().getAbsoluteFile().getAbsolutePath() + suffix, imageDescriptor, false);
+ elementBean.setData(artefact.getFile());
+ elements.add(elementBean);
+ }
+ m_wizardPage.setElements(elements);
+ addPage(m_wizardPage);
+ }
+
+ @Override
+ protected boolean beforeFinish() throws CoreException {
+ List<File> files = new LinkedList<File>();
+ for (ElementBean element : m_wizardPage.getElements()) {
+ if (element.isChecked() || element.isMandatory()) {
+ files.add((File) element.getData());
+ }
+ }
+ setAdditionalFiles(files.toArray(new File[files.size()]));
+ return true;
+ }
+
+ @Override
+ protected boolean performFinish(IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException, IllegalArgumentException {
+ return true;
+ }
+ }
+
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlSelectionWizardPage.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlSelectionWizardPage.java
index 0d6d035ce..d77adf52e 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlSelectionWizardPage.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/swt/wizard/page/WsdlSelectionWizardPage.java
@@ -1,235 +1,235 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
-
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.scout.commons.beans.BasicPropertySupport;
-import org.eclipse.scout.sdk.ui.fields.TextField;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.Texts;
-import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.layout.FormAttachment;
-import org.eclipse.swt.layout.FormData;
-import org.eclipse.swt.layout.FormLayout;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Text;
-
-public class WsdlSelectionWizardPage extends AbstractWorkspaceWizardPage {
-
- public static final String PROP_CREATE_NEW_WSDL = "createNewWsdl";
- public static final String PROP_WSDL_FOLDER = "wsdlFolder";
-
- private BasicPropertySupport m_propertySupport;
-
- private IScoutBundle m_bundle;
-
- private Button m_newWsdlRadioButton;
- private Button m_existingWsdlRadioButton;
-
- private Text m_descriptionField;
- private TextField m_wsdlFolderField;
- private Button m_browseButton;
- private IFolder m_rootWsdlFolder;
-
- public WsdlSelectionWizardPage(IScoutBundle bundle) {
- super(WsdlSelectionWizardPage.class.getName());
- m_bundle = bundle;
- m_propertySupport = new BasicPropertySupport(this);
- setDescription(Texts.get("ChooseWsdlFile"));
- }
-
- @Override
- protected void createContent(Composite parent) {
- m_newWsdlRadioButton = new Button(parent, SWT.RADIO);
- m_newWsdlRadioButton.setText(Texts.get("CreateWsdlFromScratch"));
- m_newWsdlRadioButton.setSelection(isNewWsdl());
- m_newWsdlRadioButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- try {
- setStateChanging(true);
- setNewWsdl(m_newWsdlRadioButton.getSelection());
- }
- finally {
- setStateChanging(false);
- }
- }
- });
-
- m_existingWsdlRadioButton = new Button(parent, SWT.RADIO);
- m_existingWsdlRadioButton.setText(Texts.get("UseExistingWsdlFile"));
- m_existingWsdlRadioButton.setSelection(!isNewWsdl());
-
- // WSDL folder
- m_descriptionField = new Text(parent, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
- m_descriptionField.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
- m_descriptionField.setText(Texts.get("ChooseFolderForWsdlFileAndArtefacts"));
-
- m_wsdlFolderField = new TextField(parent);
- m_wsdlFolderField.setLabelText(Texts.get("WsdlFolder"));
- m_wsdlFolderField.getTextComponent().setBackground(JaxWsSdkUtility.getColorLightGray());
- m_wsdlFolderField.setEditable(false);
-
- m_browseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
- m_browseButton.setText(Texts.get("Browse"));
- m_browseButton.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- IFolder folder = JaxWsSdkUtility.openProjectFolderDialog(
- m_bundle,
- new WsdlFolderViewerFilter(m_bundle, getRootWsdlFolder()),
- Texts.get("WsdlFolder"),
- Texts.get("ChooseFolderForWsdlFileAndArtefacts"),
- m_rootWsdlFolder, // root folder
- getWsdlFolder());
- if (folder != null) {
- setWsdlFolder(folder);
- }
- }
-
- });
- IFolder folder = getWsdlFolder();
- if (folder != null) {
- m_wsdlFolderField.setText(folder.getProjectRelativePath().toPortableString());
- }
-
- // layout
- parent.setLayout(new FormLayout());
-
- FormData formData = new FormData();
- formData.top = new FormAttachment(0, 0);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_newWsdlRadioButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_newWsdlRadioButton, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_existingWsdlRadioButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_newWsdlRadioButton, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_existingWsdlRadioButton.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_existingWsdlRadioButton, 20, SWT.BOTTOM);
- formData.left = new FormAttachment(40, 5);
- formData.right = new FormAttachment(100, 0);
- m_descriptionField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_descriptionField, 5, SWT.BOTTOM);
- formData.left = new FormAttachment(0, 50);
- formData.right = new FormAttachment(100, -75);
- m_wsdlFolderField.setLayoutData(formData);
-
- formData = new FormData();
- formData.top = new FormAttachment(m_wsdlFolderField, 0, SWT.TOP);
- formData.left = new FormAttachment(100, -70);
- formData.right = new FormAttachment(100, 0);
- m_browseButton.setLayoutData(formData);
- }
-
- @Override
- protected void validatePage(MultiStatus multiStatus) {
- if (m_bundle == null) { // not fully initialized yet
- return;
- }
- if (getWsdlFolder() == null) {
- multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_wsdlFolderField.getText())));
- }
- }
-
- public void setNewWsdl(boolean newWsdl) {
- try {
- setStateChanging(true);
- setNewWsdlInternal(newWsdl);
- if (isControlCreated()) {
- m_newWsdlRadioButton.setSelection(newWsdl);
- m_existingWsdlRadioButton.setSelection(!newWsdl);
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setNewWsdlInternal(boolean newWsdl) {
- m_propertySupport.setProperty(PROP_CREATE_NEW_WSDL, newWsdl);
- }
-
- public boolean isNewWsdl() {
- return m_propertySupport.getPropertyBool(PROP_CREATE_NEW_WSDL);
- }
-
- public void setWsdlFolder(IFolder wsdlFolder) {
- try {
- setStateChanging(true);
- setWsdlFolderInternal(wsdlFolder);
- if (isControlCreated()) {
- if (wsdlFolder != null) {
- m_wsdlFolderField.setText(wsdlFolder.getProjectRelativePath().toPortableString());
- }
- else {
- m_wsdlFolderField.setText("");
- }
- }
- }
- finally {
- setStateChanging(false);
- }
- }
-
- private void setWsdlFolderInternal(IFolder wsdlFolder) {
- m_propertySupport.setProperty(PROP_WSDL_FOLDER, wsdlFolder);
- }
-
- public IFolder getWsdlFolder() {
- return (IFolder) m_propertySupport.getProperty(PROP_WSDL_FOLDER);
- }
-
- @Override
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.addPropertyChangeListener(listener);
- super.addPropertyChangeListener(listener);
- }
-
- @Override
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- m_propertySupport.removePropertyChangeListener(listener);
- super.removePropertyChangeListener(listener);
- }
-
- public IFolder getRootWsdlFolder() {
- return m_rootWsdlFolder;
- }
-
- public void setRootWsdlFolder(IFolder rootWsdlFolder) {
- m_rootWsdlFolder = rootWsdlFolder;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.swt.wizard.page;
+
+import java.beans.PropertyChangeListener;
+
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.MultiStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.scout.commons.beans.BasicPropertySupport;
+import org.eclipse.scout.sdk.ui.fields.TextField;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.wizard.AbstractWorkspaceWizardPage;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.Texts;
+import org.eclipse.scout.sdk.ws.jaxws.util.JaxWsSdkUtility;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.FormAttachment;
+import org.eclipse.swt.layout.FormData;
+import org.eclipse.swt.layout.FormLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+public class WsdlSelectionWizardPage extends AbstractWorkspaceWizardPage {
+
+ public static final String PROP_CREATE_NEW_WSDL = "createNewWsdl";
+ public static final String PROP_WSDL_FOLDER = "wsdlFolder";
+
+ private BasicPropertySupport m_propertySupport;
+
+ private IScoutBundle m_bundle;
+
+ private Button m_newWsdlRadioButton;
+ private Button m_existingWsdlRadioButton;
+
+ private Text m_descriptionField;
+ private TextField m_wsdlFolderField;
+ private Button m_browseButton;
+ private IFolder m_rootWsdlFolder;
+
+ public WsdlSelectionWizardPage(IScoutBundle bundle) {
+ super(WsdlSelectionWizardPage.class.getName());
+ m_bundle = bundle;
+ m_propertySupport = new BasicPropertySupport(this);
+ setDescription(Texts.get("ChooseWsdlFile"));
+ }
+
+ @Override
+ protected void createContent(Composite parent) {
+ m_newWsdlRadioButton = new Button(parent, SWT.RADIO);
+ m_newWsdlRadioButton.setText(Texts.get("CreateWsdlFromScratch"));
+ m_newWsdlRadioButton.setSelection(isNewWsdl());
+ m_newWsdlRadioButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ try {
+ setStateChanging(true);
+ setNewWsdl(m_newWsdlRadioButton.getSelection());
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+ });
+
+ m_existingWsdlRadioButton = new Button(parent, SWT.RADIO);
+ m_existingWsdlRadioButton.setText(Texts.get("UseExistingWsdlFile"));
+ m_existingWsdlRadioButton.setSelection(!isNewWsdl());
+
+ // WSDL folder
+ m_descriptionField = new Text(parent, SWT.WRAP | SWT.MULTI | SWT.READ_ONLY);
+ m_descriptionField.setForeground(ScoutSdkUi.getDisplay().getSystemColor(SWT.COLOR_DARK_GRAY));
+ m_descriptionField.setText(Texts.get("ChooseFolderForWsdlFileAndArtefacts"));
+
+ m_wsdlFolderField = new TextField(parent);
+ m_wsdlFolderField.setLabelText(Texts.get("WsdlFolder"));
+ m_wsdlFolderField.getTextComponent().setBackground(JaxWsSdkUtility.getColorLightGray());
+ m_wsdlFolderField.setEditable(false);
+
+ m_browseButton = new Button(parent, SWT.PUSH | SWT.FLAT);
+ m_browseButton.setText(Texts.get("Browse"));
+ m_browseButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IFolder folder = JaxWsSdkUtility.openProjectFolderDialog(
+ m_bundle,
+ new WsdlFolderViewerFilter(m_bundle, getRootWsdlFolder()),
+ Texts.get("WsdlFolder"),
+ Texts.get("ChooseFolderForWsdlFileAndArtefacts"),
+ m_rootWsdlFolder, // root folder
+ getWsdlFolder());
+ if (folder != null) {
+ setWsdlFolder(folder);
+ }
+ }
+
+ });
+ IFolder folder = getWsdlFolder();
+ if (folder != null) {
+ m_wsdlFolderField.setText(folder.getProjectRelativePath().toPortableString());
+ }
+
+ // layout
+ parent.setLayout(new FormLayout());
+
+ FormData formData = new FormData();
+ formData.top = new FormAttachment(0, 0);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_newWsdlRadioButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_newWsdlRadioButton, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_existingWsdlRadioButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_newWsdlRadioButton, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_existingWsdlRadioButton.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_existingWsdlRadioButton, 20, SWT.BOTTOM);
+ formData.left = new FormAttachment(40, 5);
+ formData.right = new FormAttachment(100, 0);
+ m_descriptionField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_descriptionField, 5, SWT.BOTTOM);
+ formData.left = new FormAttachment(0, 50);
+ formData.right = new FormAttachment(100, -75);
+ m_wsdlFolderField.setLayoutData(formData);
+
+ formData = new FormData();
+ formData.top = new FormAttachment(m_wsdlFolderField, 0, SWT.TOP);
+ formData.left = new FormAttachment(100, -70);
+ formData.right = new FormAttachment(100, 0);
+ m_browseButton.setLayoutData(formData);
+ }
+
+ @Override
+ protected void validatePage(MultiStatus multiStatus) {
+ if (m_bundle == null) { // not fully initialized yet
+ return;
+ }
+ if (getWsdlFolder() == null) {
+ multiStatus.add(new Status(IStatus.ERROR, JaxWsSdk.PLUGIN_ID, Texts.get("XMustNotBeEmpty", m_wsdlFolderField.getText())));
+ }
+ }
+
+ public void setNewWsdl(boolean newWsdl) {
+ try {
+ setStateChanging(true);
+ setNewWsdlInternal(newWsdl);
+ if (isControlCreated()) {
+ m_newWsdlRadioButton.setSelection(newWsdl);
+ m_existingWsdlRadioButton.setSelection(!newWsdl);
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setNewWsdlInternal(boolean newWsdl) {
+ m_propertySupport.setProperty(PROP_CREATE_NEW_WSDL, newWsdl);
+ }
+
+ public boolean isNewWsdl() {
+ return m_propertySupport.getPropertyBool(PROP_CREATE_NEW_WSDL);
+ }
+
+ public void setWsdlFolder(IFolder wsdlFolder) {
+ try {
+ setStateChanging(true);
+ setWsdlFolderInternal(wsdlFolder);
+ if (isControlCreated()) {
+ if (wsdlFolder != null) {
+ m_wsdlFolderField.setText(wsdlFolder.getProjectRelativePath().toPortableString());
+ }
+ else {
+ m_wsdlFolderField.setText("");
+ }
+ }
+ }
+ finally {
+ setStateChanging(false);
+ }
+ }
+
+ private void setWsdlFolderInternal(IFolder wsdlFolder) {
+ m_propertySupport.setProperty(PROP_WSDL_FOLDER, wsdlFolder);
+ }
+
+ public IFolder getWsdlFolder() {
+ return (IFolder) m_propertySupport.getProperty(PROP_WSDL_FOLDER);
+ }
+
+ @Override
+ public void addPropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.addPropertyChangeListener(listener);
+ super.addPropertyChangeListener(listener);
+ }
+
+ @Override
+ public void removePropertyChangeListener(PropertyChangeListener listener) {
+ m_propertySupport.removePropertyChangeListener(listener);
+ super.removePropertyChangeListener(listener);
+ }
+
+ public IFolder getRootWsdlFolder() {
+ return m_rootWsdlFolder;
+ }
+
+ public void setRootWsdlFolder(IFolder rootWsdlFolder) {
+ m_rootWsdlFolder = rootWsdlFolder;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/technology/JaxWsServerManifestTechnologyHandler.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/technology/JaxWsServerManifestTechnologyHandler.java
index 166336dc2..fb56c5cc7 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/technology/JaxWsServerManifestTechnologyHandler.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/technology/JaxWsServerManifestTechnologyHandler.java
@@ -1,52 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.technology;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.sdk.ui.extensions.technology.AbstractScoutTechnologyHandler;
-import org.eclipse.scout.sdk.ui.extensions.technology.IScoutTechnologyResource;
-import org.eclipse.scout.sdk.ui.internal.view.outline.pages.project.server.ServerNodePage;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutProject;
-
-public class JaxWsServerManifestTechnologyHandler extends AbstractScoutTechnologyHandler {
-
- public final static String JAXWS_RUNTIME_PLUGIN = "org.eclipse.scout.jaxws216";
-
- @Override
- public void selectionChanged(IScoutTechnologyResource[] resources, boolean selected, IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- selectionChangedManifest(resources, selected, JAXWS_RUNTIME_PLUGIN);
- }
-
- @Override
- public void postSelectionChanged(boolean selected, IProgressMonitor monitor) throws CoreException {
- refreshScoutExplorerPageAsync(ServerNodePage.class);
- }
-
- @Override
- public TriState getSelection(IScoutProject project) {
- return getSelectionManifest(project.getServerBundle(), JAXWS_RUNTIME_PLUGIN);
- }
-
- @Override
- public boolean isActive(IScoutProject project) {
- return project.getServerBundle() != null && project.getServerBundle().getProject().exists();
- }
-
- @Override
- protected void contributeResources(IScoutProject project, List<IScoutTechnologyResource> list) {
- contributeManifestFile(project.getServerBundle(), list);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.technology;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.sdk.ui.extensions.technology.AbstractScoutTechnologyHandler;
+import org.eclipse.scout.sdk.ui.extensions.technology.IScoutTechnologyResource;
+import org.eclipse.scout.sdk.ui.internal.view.outline.pages.project.server.ServerNodePage;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutProject;
+
+public class JaxWsServerManifestTechnologyHandler extends AbstractScoutTechnologyHandler {
+
+ public final static String JAXWS_RUNTIME_PLUGIN = "org.eclipse.scout.jaxws216";
+
+ @Override
+ public void selectionChanged(IScoutTechnologyResource[] resources, boolean selected, IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ selectionChangedManifest(resources, selected, JAXWS_RUNTIME_PLUGIN);
+ }
+
+ @Override
+ public void postSelectionChanged(boolean selected, IProgressMonitor monitor) throws CoreException {
+ refreshScoutExplorerPageAsync(ServerNodePage.class);
+ }
+
+ @Override
+ public TriState getSelection(IScoutProject project) {
+ return getSelectionManifest(project.getServerBundle(), JAXWS_RUNTIME_PLUGIN);
+ }
+
+ @Override
+ public boolean isActive(IScoutProject project) {
+ return project.getServerBundle() != null && project.getServerBundle().getProject().exists();
+ }
+
+ @Override
+ protected void contributeResources(IScoutProject project, List<IScoutTechnologyResource> list) {
+ contributeManifestFile(project.getServerBundle(), list);
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/technology/JaxWsServerProdTechnologyHandler.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/technology/JaxWsServerProdTechnologyHandler.java
index 755a3dcd9..1224e0b21 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/technology/JaxWsServerProdTechnologyHandler.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/technology/JaxWsServerProdTechnologyHandler.java
@@ -1,38 +1,38 @@
-package org.eclipse.scout.sdk.ws.jaxws.technology;
-
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.commons.TriState;
-import org.eclipse.scout.sdk.RuntimeClasses;
-import org.eclipse.scout.sdk.ui.extensions.technology.AbstractScoutTechnologyHandler;
-import org.eclipse.scout.sdk.ui.extensions.technology.IScoutTechnologyResource;
-import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
-import org.eclipse.scout.sdk.workspace.IScoutProject;
-
-public class JaxWsServerProdTechnologyHandler extends AbstractScoutTechnologyHandler {
-
- public JaxWsServerProdTechnologyHandler() {
- }
-
- @Override
- public void selectionChanged(IScoutTechnologyResource[] resources, boolean selected, IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
- selectionChangedProductFiles(resources, selected, new String[]{JaxWsServerManifestTechnologyHandler.JAXWS_RUNTIME_PLUGIN});
- }
-
- @Override
- public TriState getSelection(IScoutProject project) {
- return getSelectionProductFiles(project, new String[]{RuntimeClasses.ScoutServerBundleId}, new String[]{JaxWsServerManifestTechnologyHandler.JAXWS_RUNTIME_PLUGIN});
- }
-
- @Override
- protected void contributeResources(IScoutProject project, List<IScoutTechnologyResource> list) {
- contributeProductFiles(project, list, RuntimeClasses.ScoutServerBundleId);
- }
-
- @Override
- public boolean isActive(IScoutProject project) {
- return project.getServerBundle() != null && project.getServerBundle().getProject().exists();
- }
-}
+package org.eclipse.scout.sdk.ws.jaxws.technology;
+
+import java.util.List;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.commons.TriState;
+import org.eclipse.scout.sdk.RuntimeClasses;
+import org.eclipse.scout.sdk.ui.extensions.technology.AbstractScoutTechnologyHandler;
+import org.eclipse.scout.sdk.ui.extensions.technology.IScoutTechnologyResource;
+import org.eclipse.scout.sdk.util.typecache.IWorkingCopyManager;
+import org.eclipse.scout.sdk.workspace.IScoutProject;
+
+public class JaxWsServerProdTechnologyHandler extends AbstractScoutTechnologyHandler {
+
+ public JaxWsServerProdTechnologyHandler() {
+ }
+
+ @Override
+ public void selectionChanged(IScoutTechnologyResource[] resources, boolean selected, IProgressMonitor monitor, IWorkingCopyManager workingCopyManager) throws CoreException {
+ selectionChangedProductFiles(resources, selected, new String[]{JaxWsServerManifestTechnologyHandler.JAXWS_RUNTIME_PLUGIN});
+ }
+
+ @Override
+ public TriState getSelection(IScoutProject project) {
+ return getSelectionProductFiles(project, new String[]{RuntimeClasses.ScoutServerBundleId}, new String[]{JaxWsServerManifestTechnologyHandler.JAXWS_RUNTIME_PLUGIN});
+ }
+
+ @Override
+ protected void contributeResources(IScoutProject project, List<IScoutTechnologyResource> list) {
+ contributeProductFiles(project, list, RuntimeClasses.ScoutServerBundleId);
+ }
+
+ @Override
+ public boolean isActive(IScoutProject project) {
+ return project.getServerBundle() != null && project.getServerBundle().getProject().exists();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/GlobalBindingRegistrationHelper.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/GlobalBindingRegistrationHelper.java
index 2cc3cc74a..7a49a15c7 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/GlobalBindingRegistrationHelper.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/GlobalBindingRegistrationHelper.java
@@ -1,147 +1,147 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.util;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import javax.wsdl.extensions.schema.Schema;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.viewers.ViewerCell;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.SelectionDialog;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.Artefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
-import org.eclipse.swt.widgets.Shell;
-
-public class GlobalBindingRegistrationHelper {
-
- public static SchemaCandidate popupForSchema(IScoutBundle bundle, IFile wsdlFile) throws CoreException {
- // determine schema to use for global binding registration
- SchemaCandidate[] schemaCandidates = getSchemaCandidates(wsdlFile);
- if (schemaCandidates.length == 0) {
- JaxWsSdk.logWarning("No XML schema found to apply customized binding");
- return null;
- }
- else if (schemaCandidates.length == 1) {
- return schemaCandidates[0];
- }
- else {
- // let user choose which schema to apply global binding to
- P_SelectionDialog dialog = new P_SelectionDialog(ScoutSdkUi.getShell(), bundle);
- dialog.setElements(Arrays.asList(schemaCandidates));
- if (dialog.open() == Window.OK) {
- return dialog.getElement();
- }
- else {
- throw new CoreException(Status.CANCEL_STATUS);
- }
- }
- }
-
- public static SchemaCandidate[] getSchemaCandidates(IFile wsdlFile) {
- Artefact[] artefacts = SchemaUtility.getArtefacts(wsdlFile, true);
-
- List<SchemaCandidate> candidates = new ArrayList<SchemaCandidate>();
- for (Artefact artefact : artefacts) {
- if (artefact instanceof WsdlArtefact) {
- for (Schema inlineSchema : ((WsdlArtefact) artefact).getInlineSchemas()) {
- candidates.add(new SchemaCandidate(inlineSchema, (WsdlArtefact) artefact));
- }
- }
- }
- return candidates.toArray(new SchemaCandidate[candidates.size()]);
- }
-
- private static class P_SelectionDialog extends SelectionDialog<SchemaCandidate> {
-
- private IScoutBundle m_bundle;
-
- public P_SelectionDialog(Shell shell, IScoutBundle bundle) {
- super(shell, "XML schema selection", "Which XML schema should be customized?");
- m_bundle = bundle;
- }
-
- @Override
- protected String getConfiguredNameColumnText() {
- return "TargetNamespace";
- }
-
- @Override
- protected String getConfiguredDescriptionColumnText() {
- return "Schema defining WSDL file";
- }
-
- @Override
- protected boolean getConfiguredIsDescriptionColumnVisible() {
- return true;
- }
-
- @Override
- protected void execDecorateElement(SchemaCandidate candidate, ViewerCell cell) {
- if (cell.getColumnIndex() == 0) {
- cell.setText(StringUtility.nvl(SchemaUtility.getSchemaTargetNamespace(candidate.getSchema()), "?"));
- cell.setImage(JaxWsSdk.getImage(JaxWsIcons.WsdlFile));
- }
- else {
- String text;
- IFile wsdlLocationFile = JaxWsSdkUtility.toFile(m_bundle, candidate.getWsdlArtefact().getFile());
- if (wsdlLocationFile != null) {
- text = wsdlLocationFile.getName();
- }
- else {
- text = "?";
- }
-
- if (candidate.getWsdlArtefact().getTypeEnum() == TypeEnum.RootWsdl) {
- text += " (Root WSDL file)";
- }
- cell.setText(text);
- }
- }
- }
-
- public static class SchemaCandidate {
- private Schema m_schema;
- private WsdlArtefact m_wsdlArtefact;
-
- public SchemaCandidate(Schema schema, WsdlArtefact wsdlArtefact) {
- m_schema = schema;
- m_wsdlArtefact = wsdlArtefact;
- }
-
- public Schema getSchema() {
- return m_schema;
- }
-
- public void setSchema(Schema schema) {
- m_schema = schema;
- }
-
- public WsdlArtefact getWsdlArtefact() {
- return m_wsdlArtefact;
- }
-
- public void setWsdlArtefact(WsdlArtefact wsdlArtefact) {
- m_wsdlArtefact = wsdlArtefact;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import javax.wsdl.extensions.schema.Schema;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.ViewerCell;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsIcons;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.swt.dialog.SelectionDialog;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.Artefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
+import org.eclipse.swt.widgets.Shell;
+
+public class GlobalBindingRegistrationHelper {
+
+ public static SchemaCandidate popupForSchema(IScoutBundle bundle, IFile wsdlFile) throws CoreException {
+ // determine schema to use for global binding registration
+ SchemaCandidate[] schemaCandidates = getSchemaCandidates(wsdlFile);
+ if (schemaCandidates.length == 0) {
+ JaxWsSdk.logWarning("No XML schema found to apply customized binding");
+ return null;
+ }
+ else if (schemaCandidates.length == 1) {
+ return schemaCandidates[0];
+ }
+ else {
+ // let user choose which schema to apply global binding to
+ P_SelectionDialog dialog = new P_SelectionDialog(ScoutSdkUi.getShell(), bundle);
+ dialog.setElements(Arrays.asList(schemaCandidates));
+ if (dialog.open() == Window.OK) {
+ return dialog.getElement();
+ }
+ else {
+ throw new CoreException(Status.CANCEL_STATUS);
+ }
+ }
+ }
+
+ public static SchemaCandidate[] getSchemaCandidates(IFile wsdlFile) {
+ Artefact[] artefacts = SchemaUtility.getArtefacts(wsdlFile, true);
+
+ List<SchemaCandidate> candidates = new ArrayList<SchemaCandidate>();
+ for (Artefact artefact : artefacts) {
+ if (artefact instanceof WsdlArtefact) {
+ for (Schema inlineSchema : ((WsdlArtefact) artefact).getInlineSchemas()) {
+ candidates.add(new SchemaCandidate(inlineSchema, (WsdlArtefact) artefact));
+ }
+ }
+ }
+ return candidates.toArray(new SchemaCandidate[candidates.size()]);
+ }
+
+ private static class P_SelectionDialog extends SelectionDialog<SchemaCandidate> {
+
+ private IScoutBundle m_bundle;
+
+ public P_SelectionDialog(Shell shell, IScoutBundle bundle) {
+ super(shell, "XML schema selection", "Which XML schema should be customized?");
+ m_bundle = bundle;
+ }
+
+ @Override
+ protected String getConfiguredNameColumnText() {
+ return "TargetNamespace";
+ }
+
+ @Override
+ protected String getConfiguredDescriptionColumnText() {
+ return "Schema defining WSDL file";
+ }
+
+ @Override
+ protected boolean getConfiguredIsDescriptionColumnVisible() {
+ return true;
+ }
+
+ @Override
+ protected void execDecorateElement(SchemaCandidate candidate, ViewerCell cell) {
+ if (cell.getColumnIndex() == 0) {
+ cell.setText(StringUtility.nvl(SchemaUtility.getSchemaTargetNamespace(candidate.getSchema()), "?"));
+ cell.setImage(JaxWsSdk.getImage(JaxWsIcons.WsdlFile));
+ }
+ else {
+ String text;
+ IFile wsdlLocationFile = JaxWsSdkUtility.toFile(m_bundle, candidate.getWsdlArtefact().getFile());
+ if (wsdlLocationFile != null) {
+ text = wsdlLocationFile.getName();
+ }
+ else {
+ text = "?";
+ }
+
+ if (candidate.getWsdlArtefact().getTypeEnum() == TypeEnum.RootWsdl) {
+ text += " (Root WSDL file)";
+ }
+ cell.setText(text);
+ }
+ }
+ }
+
+ public static class SchemaCandidate {
+ private Schema m_schema;
+ private WsdlArtefact m_wsdlArtefact;
+
+ public SchemaCandidate(Schema schema, WsdlArtefact wsdlArtefact) {
+ m_schema = schema;
+ m_wsdlArtefact = wsdlArtefact;
+ }
+
+ public Schema getSchema() {
+ return m_schema;
+ }
+
+ public void setSchema(Schema schema) {
+ m_schema = schema;
+ }
+
+ public WsdlArtefact getWsdlArtefact() {
+ return m_wsdlArtefact;
+ }
+
+ public void setWsdlArtefact(WsdlArtefact wsdlArtefact) {
+ m_wsdlArtefact = wsdlArtefact;
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/JaxWsSdkUtility.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/JaxWsSdkUtility.java
index 3a781b52e..daddb55a8 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/JaxWsSdkUtility.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/JaxWsSdkUtility.java
@@ -1,1606 +1,1606 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.util;
-
-import java.io.ByteArrayInputStream;
-import java.io.File;
-import java.io.InputStream;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Set;
-
-import javax.jws.WebService;
-import javax.wsdl.Binding;
-import javax.wsdl.Definition;
-import javax.wsdl.Port;
-import javax.wsdl.PortType;
-import javax.wsdl.Service;
-import javax.wsdl.extensions.UnknownExtensibilityElement;
-import javax.xml.namespace.QName;
-import javax.xml.ws.WebServiceClient;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jdt.core.Flags;
-import org.eclipse.jdt.core.IAnnotation;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IField;
-import org.eclipse.jdt.core.IJavaElement;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.IMemberValuePair;
-import org.eclipse.jdt.core.IMethod;
-import org.eclipse.jdt.core.IPackageFragment;
-import org.eclipse.jdt.core.IPackageFragmentRoot;
-import org.eclipse.jdt.core.ISourceRange;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.ITypeHierarchy;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.jdt.core.Signature;
-import org.eclipse.jdt.core.dom.CompilationUnit;
-import org.eclipse.jdt.core.search.IJavaSearchConstants;
-import org.eclipse.jdt.core.search.IJavaSearchScope;
-import org.eclipse.jdt.core.search.SearchEngine;
-import org.eclipse.jdt.core.search.SearchMatch;
-import org.eclipse.jdt.core.search.SearchParticipant;
-import org.eclipse.jdt.core.search.SearchPattern;
-import org.eclipse.jdt.core.search.SearchRequestor;
-import org.eclipse.jdt.core.search.TypeDeclarationMatch;
-import org.eclipse.jdt.core.search.TypeNameMatch;
-import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings;
-import org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation;
-import org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.IChooseImportQuery;
-import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
-import org.eclipse.jdt.internal.ui.wizards.buildpaths.FolderSelectionDialog;
-import org.eclipse.jdt.ui.SharedASTProvider;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.jface.window.Window;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.jobs.OperationJob;
-import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
-import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
-import org.eclipse.scout.sdk.util.pde.PluginModelHelper;
-import org.eclipse.scout.sdk.util.resources.ResourceUtility;
-import org.eclipse.scout.sdk.util.signature.CompilationUnitImportValidator;
-import org.eclipse.scout.sdk.util.signature.SignatureUtility;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.IScoutElement;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.operation.OverrideUnimplementedMethodsOperation;
-import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
-import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
-import org.eclipse.scout.sdk.ws.jaxws.swt.view.part.AnnotationProperty;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Color;
-import org.eclipse.swt.graphics.RGB;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.views.navigator.ResourceComparator;
-import org.w3c.dom.Element;
-import org.w3c.dom.NodeList;
-
-import com.sun.xml.internal.bind.api.impl.NameConverter;
-
-@SuppressWarnings("restriction")
-public final class JaxWsSdkUtility {
-
- private JaxWsSdkUtility() {
- }
-
- public static boolean isValidJavaIdentifier(String identifier) {
- if (StringUtility.isNullOrEmpty(identifier)) {
- return false;
- }
-
- char[] chars = identifier.toCharArray();
- for (int i = 0; i < chars.length; i++) {
- if (i == 0) {
- if (!Character.isJavaIdentifierStart(chars[i])) {
- return false;
- }
- }
- else {
- if (!Character.isJavaIdentifierPart(chars[i])) {
- return false;
- }
- }
- }
-
- return true;
- }
-
- public static boolean exists(IResource resource) {
- refreshLocal(resource, IResource.DEPTH_ONE);
- return resource != null && resource.exists() && resource.isSynchronized(IResource.DEPTH_ONE);
- }
-
- public static void refreshLocal(IResource resource, int depth) {
- try {
- if (resource != null && !resource.isSynchronized(depth)) {
- resource.refreshLocal(depth, new NullProgressMonitor());
- }
- }
- catch (CoreException e) {
- JaxWsSdk.logWarning("The 'resource '" + resource.getFullPath().toPortableString() + "' could not be synchronized with the filesystem.");
- }
- }
-
- public static IFile toFile(IScoutBundle bundle, File file) {
- if (bundle == null || file == null) {
- return null;
- }
-
- IPath path = new Path(file.getAbsolutePath()).makeRelativeTo(bundle.getProject().getLocation());
- return JaxWsSdkUtility.getFile(bundle, path.toPortableString(), false);
- }
-
- public static File toFile(IFile file) {
- if (file == null) {
- return null;
- }
- return new File(file.getLocationURI());
- }
-
- public static IFile getFile(IScoutBundle scoutBundle, String path, boolean autoCreate) {
- return getFile(scoutBundle, null, path, autoCreate);
- }
-
- public static IFile getFile(IScoutBundle scoutBundle, String projectRelativePath, String fileName, boolean autoCreate) {
- if (fileName == null) {
- return null;
- }
- IPath path;
- if (StringUtility.isNullOrEmpty(projectRelativePath)) {
- path = new Path(fileName);
- }
- else {
- // ensure that the path begins and ends with a slash
- projectRelativePath = normalizePath(projectRelativePath, SeparatorType.BothType);
- path = new Path(projectRelativePath + fileName);
- }
-
- IFile file = scoutBundle.getProject().getFile(path);
- prepareFileAccess(file, autoCreate);
- return file;
- }
-
- public static void prepareFileAccess(IFile file, boolean autoCreate) {
- refreshLocal(file, IResource.DEPTH_ZERO);
-
- if (!exists(file) && autoCreate) {
- try {
- // create the folders if they do not exist yet
- if (file.getParent() instanceof IFolder) {
- ResourceUtility.mkdirs(file.getParent(), new NullProgressMonitor());
- }
- // the file does not already exist. Therefore create an empty file
- InputStream inputStream = new ByteArrayInputStream(new byte[0]);
- file.create(inputStream, true, new NullProgressMonitor());
- }
- catch (CoreException e) {
- throw new RuntimeException("An unexpected error occured while creating empty file", e);
- }
- }
-
- // register folder in build properties
- if (autoCreate && file.getParent() instanceof IFolder) {
- IFolder folder = (IFolder) file.getParent();
- if (!folder.getProjectRelativePath().toPortableString().contains("build")) {
- try {
- PluginModelHelper h = new PluginModelHelper(file.getProject());
- h.BuildProperties.addBinaryBuildEntry(folder);
- h.save();
- }
- catch (CoreException e) {
- JaxWsSdk.logError("failed to register folder in build.properties", e);
- }
- }
- }
- }
-
- public static IFolder getFolder(IScoutBundle scoutBundle, String projectRelativePath, boolean autoCreate) {
- if (StringUtility.isNullOrEmpty(projectRelativePath)) {
- return null;
- }
- // ensure that the path begins and ends with a slash
- IPath path = new Path(normalizePath(projectRelativePath, SeparatorType.BothType));
- IFolder folder = scoutBundle.getProject().getFolder(path);
- prepareFolderAccess(folder, autoCreate);
- return folder;
- }
-
- public static void prepareFolderAccess(IFolder folder, boolean autoCreate) {
- refreshLocal(folder, IResource.DEPTH_INFINITE);
-
- if (!folder.exists() && autoCreate) {
- try {
- // create the folders if they do not exist yet
- ResourceUtility.mkdirs(folder, new NullProgressMonitor());
- }
- catch (CoreException e) {
- throw new RuntimeException("An unexpected error occured while creating the report design file", e);
- }
- }
-
- // register folder in build properties
- if (autoCreate && !folder.getProjectRelativePath().toPortableString().contains("build")) {
- try {
- PluginModelHelper h = new PluginModelHelper(folder.getProject());
- h.BuildProperties.addBinaryBuildEntry(folder);
- h.save();
- }
- catch (CoreException e) {
- JaxWsSdk.logError("failed to register folder in build.properties", e);
- }
- }
- }
-
- /**
- * Creates an import directive in the compilation unit for the given {@link IType}.
- * The directive is only created if necessary.
- *
- * @param declaringType
- * the type the directive is to be created in
- * @param typeForImportDirective
- * the type the directive is to be created for
- */
- public static void createImportDirective(IType declaringType, IType typeForImportDirective) {
- try {
- String resolveTypeName = JaxWsSdkUtility.resolveTypeName(declaringType, typeForImportDirective);
- if (resolveTypeName == null) {
- return;
- }
- if (typeForImportDirective.getFullyQualifiedName().equals(resolveTypeName)) {
- return; // no import directive necessary, as type must be used fully qualified
- }
- declaringType.getCompilationUnit().createImport(typeForImportDirective.getFullyQualifiedName().replaceAll("\\$", "."), null, new NullProgressMonitor());
- }
- catch (Exception e) {
- // nop
- }
- }
-
- /**
- * To obtain the fully qualified name
- *
- * @param declaringType
- * the type which contains possible import directives
- * @param signature
- * the signature obtained by {@link IField#getTypeSignature()} or {@link IMethod#getReturnType()},
- * respectively
- * @return the fully qualified name
- */
- public static String getFullyQualifiedNameFromSignature(IType declaringType, String signature) {
- return getFullyQualifiedNameFromName(declaringType, StringUtility.join(".", Signature.getSignatureQualifier(signature), Signature.getSignatureSimpleName(signature)));
- }
-
- /**
- * To obtain the fully qualified name
- *
- * @param declaringType
- * the type which contains possible import directives
- * @param name
- * the name as in declaring type
- * @return the fully qualified name
- */
- public static String getFullyQualifiedNameFromName(IType declaringType, String name) {
- try {
- String[][] fullyQualifiedSignature = declaringType.resolveType(name);
- if (fullyQualifiedSignature != null && fullyQualifiedSignature.length > 0) {
- if (!StringUtility.isNullOrEmpty(fullyQualifiedSignature[0][0])) {
- return fullyQualifiedSignature[0][0] + "." + fullyQualifiedSignature[0][1];
- }
- else {
- return fullyQualifiedSignature[0][1];
- }
- }
- }
- catch (Exception e) {
- JaxWsSdk.logError(e);
- }
- return null;
- }
-
- public static String getFullyQualifiedSignature(IType declaringType, String signature) {
- return Signature.createTypeSignature(JaxWsSdkUtility.getFullyQualifiedNameFromSignature(declaringType, signature), true);
- }
-
- public static void organizeImports(IType type) {
- try {
- CodeGenerationSettings settings = JavaPreferencesSettings.getCodeGenerationSettings(type.getJavaProject());
- CompilationUnit astRoot = SharedASTProvider.getAST(type.getCompilationUnit(), SharedASTProvider.WAIT_ACTIVE_ONLY, null);
-
- IChooseImportQuery chooseImportQuery = new IChooseImportQuery() {
- @Override
- public TypeNameMatch[] chooseImports(TypeNameMatch[][] openChoices, ISourceRange[] ranges) {
- return new TypeNameMatch[0];
- }
- };
-
- OrganizeImportsOperation op = new OrganizeImportsOperation(type.getCompilationUnit(), astRoot, settings.importIgnoreLowercase, !type.getCompilationUnit().isWorkingCopy(), true, chooseImportQuery);
- op.run(new NullProgressMonitor());
- }
- catch (Throwable e) {
- JaxWsSdk.logError(e);
- }
- }
-
- public static String getFileNameWithoutExtension(IFile file) {
- if (file.getFileExtension() != null) {
- return file.getName().substring(0, file.getName().length() - file.getFileExtension().length() - 1);
- }
- else {
- return file.getName();
- }
- }
-
- public static String toStartWithLowerCase(String property) {
- if (!StringUtility.hasText(property)) {
- return null;
- }
- if (property.length() == 1) {
- return property.toLowerCase();
- }
-
- return property.substring(0, 1).toLowerCase() + property.substring(1);
- }
-
- public static String toStartWithUpperCase(String property) {
- if (!StringUtility.hasText(property)) {
- return null;
- }
- if (property.length() == 1) {
- return property.toUpperCase();
- }
-
- return property.substring(0, 1).toUpperCase() + property.substring(1);
- }
-
- public static String normalizePath(String path, SeparatorType separatorType) {
- if (path == null) {
- return null;
- }
- if (separatorType == SeparatorType.BothType || separatorType == SeparatorType.LeadingType) {
- if (!path.startsWith("/")) {
- path = "/" + path;
- }
- }
- else {
- if (path.startsWith("/")) {
- path = path.substring(1);
- }
- }
-
- if (separatorType == SeparatorType.BothType || separatorType == SeparatorType.TrailingType) {
- if (!path.endsWith("/")) {
- path += "/";
- }
- }
- else {
- if (path.endsWith("/")) {
- path = path.substring(0, path.length() - 1);
- }
- }
- return path;
- }
-
- /**
- * Excludes the composite from the layout manager if it does not contain any children and triggers to relayout the
- * composite.
- *
- * @param composite
- */
- public static void doLayout(Composite composite) {
- if (composite != null && !composite.isDisposed()) {
- if (composite.getLayoutData() instanceof GridData) {
- if (composite.getChildren().length == 0) {
-// ((GridData) composite.getLayoutData()).exclude = true; // exclude does not work properly
- ((GridData) composite.getLayoutData()).heightHint = 0; // therefore this workaround is used, but as a drawback, the section has to collapsed and expanded
- }
- else {
-// ((GridData) composite.getLayoutData()).exclude = false; // exclude does not work properly
- ((GridData) composite.getLayoutData()).heightHint = SWT.DEFAULT; // therefore this workaround is used, but as a drawback, the section has to collapsed and expanded
- }
- }
- composite.layout(true, true);
- }
- }
-
- /**
- * workaround for proper redraw of sections which contain composites to be excluded / included depending one some
- * conditions.
- * This must take place when getForm()#redraw=true!
- *
- * @param section
- */
- public static void doLayoutSection(ISection section) {
- if (section.isExpanded()) {
- section.setExpanded(false);
- section.setExpanded(true);
- }
- }
-
- public static void disposeChildControls(Composite composite) {
- if (composite != null && !composite.isDisposed()) {
- for (Control child : composite.getChildren()) {
- child.dispose();
- }
- }
- }
-
- public static void setView(Composite composite, boolean enabled) {
- if (composite != null && !composite.isDisposed()) {
- composite.setEnabled(enabled);
- for (Control child : composite.getChildren()) {
- if (child instanceof Composite) {
- setView((Composite) child, enabled);
- }
- else {
- child.setEnabled(enabled);
- }
- }
- }
- }
-
- public static Set<IResource> createResourceSet(IResource... resources) {
- Set<IResource> resourceSet = new HashSet<IResource>();
- for (IResource resource : resources) {
- if (resource != null) {
- resourceSet.add(resource);
- }
- }
- return resourceSet;
- }
-
- public static PortType getPortType(Definition wsdlDefinition, QName serviceQName, String portName) {
- if (wsdlDefinition == null || serviceQName == null || portName == null) {
- return null;
- }
-
- portName = QName.valueOf(portName).getLocalPart();
-
- Service service = wsdlDefinition.getService(serviceQName);
- if (service == null) {
- return null;
- }
- Port port = service.getPort(portName);
- if (port == null) {
- return null;
- }
- Binding binding = port.getBinding();
- if (binding == null) {
- return null;
- }
- return port.getBinding().getPortType();
- }
-
- /**
- * Resolves the requested PortType interface type located in the given jar file
- *
- * @param portTypeQName
- * the PortType to be resolved or null to get all PortTypes
- * @param jarFile
- * the jar file the PortType interface type to be searched in
- * @return
- */
- public static IType resolvePortTypeInterfaceType(final QName portTypeQName, IFile jarFile) {
- if (portTypeQName == null) {
- return null;
- }
- IType[] types = resolvePortTypeInterfaceTypes(portTypeQName, jarFile);
- if (types.length == 0) {
- return null;
- }
- else if (types.length > 1) {
- JaxWsSdk.logWarning("Multiple PortType interface types found for port type '" + portTypeQName + "'");
- }
- return types[0];
- }
-
- /**
- * Resolves PortType interface types located in the given jar file
- *
- * @param portTypeQName
- * the PortType to be resolved or null to get all PortTypes
- * @param jarFile
- * the jar file the PortType interface type to be searched in
- * @return
- */
- public static IType[] resolvePortTypeInterfaceTypes(final QName portTypeQName, IFile jarFile) {
- if (jarFile == null) {
- return new IType[0];
- }
- final Set<IType> types = new HashSet<IType>();
- try {
- new SearchEngine().search(
- SearchPattern.createPattern("*", IJavaSearchConstants.INTERFACE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_PATTERN_MATCH),
- new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},
- new JarFileSearchScope(jarFile), //SearchEngine.createWorkspaceScope(),
- new SearchRequestor() {
-
- @Override
- public final void acceptSearchMatch(SearchMatch match) throws CoreException {
- if (!(match instanceof TypeDeclarationMatch)) {
- return;
- }
- IType candidate = (IType) match.getElement();
- if (!TypeUtility.exists(candidate) || !candidate.isBinary()) {
- // type must be binary
- return;
- }
- // candidates must be annotated WebService annotation
- IAnnotation annotation = JaxWsSdkUtility.getAnnotation(candidate, WebService.class.getName(), false);
- if (!TypeUtility.exists(annotation)) {
- return;
- }
- if (portTypeQName == null) {
- types.add(candidate);
- return;
- }
- // candidate must match the port type
- IMemberValuePair[] properties = annotation.getMemberValuePairs();
- for (IMemberValuePair property : properties) {
- if (property.getMemberName().equals("name") && property.getValue().equals(portTypeQName.getLocalPart())) {
- types.add(candidate);
- return;
- }
- }
- }
- },
- null
- );
- }
- catch (Exception e) {
- JaxWsSdk.logError("Failed to resolve portType interface type", e);
- }
- return types.toArray(new IType[types.size()]);
- }
-
- /**
- * Resolves the requested service type located in the given jar file
- *
- * @param serviceQName
- * @param jarFile
- * @return
- */
- public static IType resolveServiceType(final QName serviceQName, IFile jarFile) {
- if (serviceQName == null) {
- return null;
- }
- IType[] types = resolveServiceTypes(serviceQName, jarFile);
- if (types.length == 0) {
- return null;
- }
- else if (types.length > 1) {
- JaxWsSdk.logWarning("Multiple service types found for service '" + serviceQName + "'");
- }
- return types[0];
- }
-
- /**
- * Resolves service types located in the given jar file
- *
- * @param serviceQName
- * the service to be resolved or null to get all service types
- * @param jarFile
- * the jar file the service type to be searched in
- * @return
- */
- public static IType[] resolveServiceTypes(final QName serviceQName, IFile jarFile) {
- final Set<IType> types = new HashSet<IType>();
- try {
- new SearchEngine().search(
- SearchPattern.createPattern("*", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_PATTERN_MATCH),
- new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},
- new JarFileSearchScope(jarFile), //SearchEngine.createWorkspaceScope(),
- new SearchRequestor() {
-
- @Override
- public final void acceptSearchMatch(SearchMatch match) throws CoreException {
- if (!(match instanceof TypeDeclarationMatch)) {
- return;
- }
- IType candidate = (IType) match.getElement();
- if (!TypeUtility.exists(candidate) || !candidate.isBinary()) {
- // candidate must be binary
- return;
- }
-
- // candidate must be a concrete type
- if (!candidate.isClass() || Flags.isAbstract(candidate.getFlags())) {
- return;
- }
-
- // candidate must be of the type 'javax.xml.ws.Service'
- if (!JaxWsSdkUtility.isJdtSubType(javax.xml.ws.Service.class.getName(), candidate)) {
- return;
- }
- // candidates must be annotated WebServiceClient annotation
- IAnnotation annotation = JaxWsSdkUtility.getAnnotation(candidate, WebServiceClient.class.getName(), false);
- if (!TypeUtility.exists(annotation)) {
- return;
- }
- if (serviceQName == null) {
- types.add(candidate);
- return;
- }
- // candidate must match the service type
- IMemberValuePair[] properties = annotation.getMemberValuePairs();
- for (IMemberValuePair property : properties) {
- if (property.getMemberName().equals("name") && property.getValue().equals(serviceQName.getLocalPart())) {
- types.add(candidate);
- return;
- }
- }
- }
- },
- null
- );
- }
- catch (Exception e) {
- JaxWsSdk.logError("Failed to resolve portType interface type", e);
- }
- return types.toArray(new IType[types.size()]);
- }
-
- public static boolean isProviderAuthenticationSet(String fqn) {
- if (!StringUtility.hasText(fqn)) {
- return false;
- }
- fqn = fqn.replaceAll("\\$", "\\.");
- String noneAuthFqn = TypeUtility.getType(JaxWsRuntimeClasses.NullAuthenticationHandlerProvider).getFullyQualifiedName().replaceAll("\\$", "\\.");
- return TypeUtility.existsType(fqn) && !fqn.equals(noneAuthFqn);
- }
-
- private static class TypeEntry {
- private IType m_sourceType;
- private IType m_binaryType;
-
- public IType getSourceType() {
- return m_sourceType;
- }
-
- public void setSourceType(IType sourceType) {
- m_sourceType = sourceType;
- }
-
- public IType getBinaryType() {
- return m_binaryType;
- }
-
- public void setBinaryType(IType binaryType) {
- m_binaryType = binaryType;
- }
- }
-
- public static IType extractGenericSuperType(IType type, int index) {
- try {
- if (!TypeUtility.exists(type)) {
- return null;
- }
- String superTypeSignature = type.getSuperclassTypeSignature();
- if (superTypeSignature == null) {
- return null;
- }
- String[] typeArguments = Signature.getTypeArguments(superTypeSignature);
- if (typeArguments.length == 0 || index >= typeArguments.length) {
- return null;
- }
- String signature = typeArguments[index];
- String fullyQualifiedName = JaxWsSdkUtility.getFullyQualifiedNameFromSignature(type, signature);
-
- if (TypeUtility.existsType(fullyQualifiedName)) {
- return TypeUtility.getType(fullyQualifiedName);
- }
- return null;
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("could not extract generic super type", e);
- }
- return null;
- }
-
- public static QName extractServiceQNameFromWsClient(IType webserviceClientType) {
- IType serviceType = extractGenericSuperType(webserviceClientType, JaxWsConstants.GENERICS_WEBSERVICE_CLIENT_SERVICE_INDEX);
- if (!TypeUtility.exists(serviceType)) {
- return null;
- }
-
- // ensure service to be a subtype of {@link Service}
- if (!JaxWsSdkUtility.isJdtSubType(javax.xml.ws.Service.class.getName(), serviceType)) {
- return null;
- }
-
- IAnnotation annotation = JaxWsSdkUtility.getAnnotation(serviceType, WebServiceClient.class.getName(), false);
- return extractQNameFromAnnotation(annotation);
- }
-
- public static QName extractPortTypeQNameFromWsClient(IType webserviceClientType) {
- IType portTypeInterfaceType = extractGenericSuperType(webserviceClientType, JaxWsConstants.GENERICS_WEBSERVICE_CLIENT_PORT_TYPE_INDEX);
- if (!TypeUtility.exists(portTypeInterfaceType)) {
- return null;
- }
-
- IAnnotation annotation = JaxWsSdkUtility.getAnnotation(portTypeInterfaceType, WebService.class.getName(), false);
- return extractQNameFromAnnotation(annotation);
- }
-
- private static QName extractQNameFromAnnotation(IAnnotation annotation) {
- if (annotation == null || !annotation.exists()) {
- return null;
- }
-
- String localPart = null;
- String namespaceURI = null;
- try {
- for (IMemberValuePair pair : annotation.getMemberValuePairs()) {
- if (pair.getMemberName().equals("name")) {
- localPart = (String) pair.getValue();
- }
- else if (pair.getMemberName().equals("targetNamespace")) {
- namespaceURI = (String) pair.getValue();
- }
- if (namespaceURI != null && localPart != null) {
- break;
- }
- }
-
- QName qname = null;
- if (namespaceURI != null && localPart != null) {
- qname = new QName(namespaceURI, localPart);
- }
- else if (localPart != null) {
- qname = new QName(localPart);
- }
-
- if (qname != null) {
- return qname;
- }
- }
- catch (Exception e) {
- JaxWsSdk.logError("could not extract QName from annotation '" + annotation.getElementName() + "'", e);
- }
- return null;
- }
-
- public static boolean hasPackageElements(IScoutBundle bundle, String sourceFolder, String packageName) {
- if (!isValidSourceFolder(bundle, sourceFolder) || packageName == null) {
- return false;
- }
-
- try {
- IPath rootPath = bundle.getProject().getFullPath().append(sourceFolder);
-
- IPackageFragmentRoot root = bundle.getJavaProject().findPackageFragmentRoot(rootPath);
- if (root == null || !root.exists()) {
- return false;
- }
- IPackageFragment packageFragment = root.getPackageFragment(StringUtility.nvl(packageName, "")); // "" for default package
- return packageFragment != null && packageFragment.exists() && (packageFragment.hasChildren() || packageFragment.hasSubpackages());
- }
- catch (JavaModelException e) {
- return false;
- }
- }
-
- public static IPackageFragment toPackageFragment(IScoutBundle bundle, String sourceFolder, String packageName) {
- try {
- if (!isValidSourceFolder(bundle, sourceFolder)) {
- return null;
- }
-
- IPath rootPath = bundle.getProject().getFullPath().append(sourceFolder);
-
- IPackageFragmentRoot root = bundle.getJavaProject().findPackageFragmentRoot(rootPath);
- if (root == null || !root.exists()) {
- return null;
- }
- IPackageFragment packageFragment = root.getPackageFragment(StringUtility.nvl(packageName, "")); // "" for default package
- if (packageFragment != null && packageFragment.exists()) {
- return packageFragment;
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("could not obtain package fragment", e);
- }
- return null;
- }
-
- public static void clearPackage(IScoutBundle bundle, String sourceFolder, String packageName) {
- try {
- IPackageFragment packageFragment = toPackageFragment(bundle, sourceFolder, packageName);
- if (packageFragment != null && packageFragment.exists()) {
- packageFragment.delete(true, new NullProgressMonitor());
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("could not clear package", e);
- }
- }
-
- public static void createSourceFolder(IScoutBundle bundle, String sourceFolder) throws JavaModelException {
- List<IClasspathEntry> list = new LinkedList<IClasspathEntry>();
- IClasspathEntry[] entries = bundle.getJavaProject().getRawClasspath();
- for (IClasspathEntry entry : entries) {
- if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
- if (JaxWsSdkUtility.getFolder(bundle, sourceFolder, false).getFullPath().equals(entry.getPath())) {
- // source folder already exists
- return;
- }
- }
- list.add(entry);
- }
-
- IFolder srcFolder = JaxWsSdkUtility.getFolder(bundle, "/" + sourceFolder, true);
- IClasspathEntry newEntry = JavaCore.newSourceEntry(srcFolder.getFullPath());
- list.add(newEntry);
- bundle.getJavaProject().setRawClasspath(list.toArray(new IClasspathEntry[0]), bundle.getJavaProject().getOutputLocation(), new NullProgressMonitor());
- }
-
- public static boolean isValidSourceFolder(IScoutBundle bundle, String sourceFolder) {
- if (sourceFolder == null) {
- return false;
- }
-
- try {
- for (IClasspathEntry classpathEntry : bundle.getJavaProject().getRawClasspath()) {
- if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE && sourceFolder.equals(classpathEntry.getPath().lastSegment())) {
- return true;
- }
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("Failed to validate source folder.", e);
- }
- return false;
- }
-
- public static String getPlainPortTypeName(String portTypeName) {
- if (portTypeName == null) {
- return null;
- }
- while (true) {
- if (portTypeName.toLowerCase().endsWith("porttype")) {
- portTypeName = portTypeName.substring(0, portTypeName.length() - "porttype".length());
- continue;
- }
- if (portTypeName.toLowerCase().endsWith("webservice")) {
- portTypeName = portTypeName.substring(0, portTypeName.length() - "webservice".length());
- continue;
- }
- if (portTypeName.toLowerCase().endsWith("service")) {
- portTypeName = portTypeName.substring(0, portTypeName.length() - "service".length());
- continue;
- }
- return portTypeName;
- }
- }
-
- public static String getRecommendedProviderImplPackageName(IScoutBundle bundle) {
- return StringUtility.join(".", bundle.getBundleName(), "services", "ws", "provider");
- }
-
- public static String getRecommendedHandlerPackageName(IScoutBundle bundle) {
- return StringUtility.join(".", bundle.getBundleName(), "services", "ws", "handler");
- }
-
- public static String getRecommendedConsumerImplPackageName(IScoutBundle bundle) {
- return StringUtility.join(".", bundle.getBundleName(), "services", "ws", "consumer");
- }
-
- public static String getRecommendedProviderSecurityPackageName(IScoutBundle bundle) {
- return StringUtility.join(".", bundle.getBundleName(), "services", "ws", "provider", "security");
- }
-
- public static String getRecommendedConsumerSecurityPackageName(IScoutBundle bundle) {
- return StringUtility.join(".", bundle.getBundleName(), "services", "ws", "consumer", "security");
- }
-
- public static String getRecommendedSessionPackageName(IScoutBundle bundle) {
- return StringUtility.join(".", bundle.getBundleName(), "services", "ws", "session");
- }
-
- public static String getRecommendedTargetNamespace(IScoutBundle bundle, String serviceName) {
- String[] segments = bundle.getBundleName().split("\\.");
- String projectSuffex = null;
- for (int i = segments.length - 1; i >= 0; i--) {
- String segment = segments[i];
- // exclude node segment
- if (segment.toLowerCase().equals("server") ||
- segment.toLowerCase().equals("online") ||
- segment.toLowerCase().equals("offline")) {
- continue;
- }
- projectSuffex = StringUtility.join(".", projectSuffex, segments[i]);
- }
-
- return "http://ws.services." + projectSuffex + "/" + serviceName + "/"; //trailing slash is required
- }
-
- /**
- * @param buildProperties
- * to primary evaluate -p option of build properties. If null, JAX-WS mechanism is used to resolve package
- * name
- * @param wsdlDefinition
- * WSDL definition to resolve package name
- * @return
- */
- public static String resolveStubPackageName(Map<String, List<String>> buildProperties, Definition wsdlDefinition) {
- // global package specified by -p option in build properties
- String globalPackageName = JaxWsSdkUtility.getBuildProperty(buildProperties, JaxWsConstants.OPTION_PACKAGE);
- if (!StringUtility.isNullOrEmpty(globalPackageName)) {
- return globalPackageName;
- }
-
- if (wsdlDefinition == null) {
- return null;
- }
-
- // global package binding in WSDL file
- globalPackageName = getWsdlBindingPackageName(wsdlDefinition);
- if (!StringUtility.isNullOrEmpty(globalPackageName)) {
- return globalPackageName;
- }
-
- String targetNamespace = wsdlDefinition.getTargetNamespace();
- return JaxWsSdkUtility.targetNamespaceToPackageName(targetNamespace);
- }
-
- private static String getWsdlBindingPackageName(Definition definition) {
- if (definition == null) {
- return null;
- }
- for (Object e : definition.getExtensibilityElements()) {
- if (e instanceof UnknownExtensibilityElement) {
- UnknownExtensibilityElement uee = (UnknownExtensibilityElement) e;
- if (uee.getElementType().equals(new QName("http://java.sun.com/xml/ns/jaxws", "bindings"))) {
- Element element = uee.getElement();
- NodeList nodes = element.getElementsByTagNameNS("http://java.sun.com/xml/ns/jaxws", "package");
- if (nodes.getLength() > 0) {
- Element globalPackageBindingElement = (Element) nodes.item(0);
- return globalPackageBindingElement.getAttribute("name");
- }
- }
- }
- }
- return null;
- }
-
- public static String targetNamespaceToPackageName(String targetNamespace) {
- if (targetNamespace == null) {
- return null;
- }
-
- NameConverter nameConverter = NameConverter.standard;
- try {
- return nameConverter.toPackageName(targetNamespace); // same mechanism as JAX-WS uses. See @{link WSDLModeler#getJavaPackage} and @{link XJC#getDefaultPackageName()}
- }
- catch (Exception e) {
- JaxWsSdk.logError("failed to convert targetNamespace into package name");
- }
- return null;
- }
-
- public static Binding getBinding(Definition wsdlDefinition, QName serviceQName, String portName) {
- if (wsdlDefinition == null || serviceQName == null || portName == null) {
- return null;
- }
-
- portName = QName.valueOf(portName).getLocalPart();
-
- Service service = wsdlDefinition.getService(serviceQName);
- if (service == null) {
- return null;
- }
- Port port = service.getPort(portName);
- if (port == null) {
- return null;
- }
- return port.getBinding();
- }
-
- /**
- * To get an annotation on the given type. This is just a workaround as {@link IType#getAnnotation(String)} does not
- * work properly (changes are not reflected, e.g. after removing the annotation, it is still returned)
- *
- * @param declaringType
- * @param annotationName
- * @return
- */
- public static IAnnotation getAnnotation(IType declaringType, String fqnAnnotationName, boolean recursively) {
- try {
- if (!TypeUtility.exists(declaringType)) {
- return null;
- }
- IAnnotation[] annotations = declaringType.getAnnotations();
- for (IAnnotation annotation : annotations) {
- if (declaringType.isBinary()) {
- // annotation name is always fully qualified name if coming from a class file
- if (annotation.getElementName().equals(fqnAnnotationName)) {
- return annotation;
- }
- }
- else {
- if (annotation.getElementName().equals(fqnAnnotationName) || annotation.getElementName().equals(Signature.getSimpleName(fqnAnnotationName))) {
- return annotation;
- }
- }
- }
-
- if (recursively) {
- IType superType = declaringType.newSupertypeHierarchy(new NullProgressMonitor()).getSuperclass(declaringType);
- return getAnnotation(superType, fqnAnnotationName, recursively);
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("failed to resolve annotations", e);
- }
- return null;
- }
-
- public static boolean isAnnotationOnDeclaringType(IType declaringType, IAnnotation annotation) {
- if (annotation == null || declaringType == null) {
- return false;
- }
- IJavaElement parent = annotation.getParent();
- if (parent.getElementType() != IJavaElement.TYPE) {
- return false;
- }
- IType candidateType = (IType) parent;
- return candidateType.getFullyQualifiedName().equals(declaringType.getFullyQualifiedName());
- }
-
- public static Map<String, List<String>> getDefaultBuildProperties() {
- Map<String, List<String>> map = new HashMap<String, List<String>>();
- map.put("Xdebug", null);
- map.put("keep", null);
- map.put("verbose", null);
-
- List<String> values = new LinkedList<String>();
- values.add("2.0");
- map.put("target", values);
- return map;
- }
-
- public static IFile[] getBindingFiles(IScoutBundle bundle, Map<String, List<String>> buildProperties) {
- if (buildProperties == null || buildProperties.size() == 0) {
- return new IFile[0];
- }
-
- List<IFile> bindingFiles = new LinkedList<IFile>();
- for (Entry<String, List<String>> property : buildProperties.entrySet()) {
- if (property.getKey() == null || !property.getKey().equals(JaxWsConstants.OPTION_BINDING_FILE) || property.getValue() == null || property.getValue().size() == 0) {
- continue;
- }
-
- for (String bindingFileRaw : property.getValue()) {
- IFile bindingFile = JaxWsSdkUtility.getFile(bundle, bindingFileRaw, false);
- bindingFiles.add(bindingFile);
- }
- }
- return bindingFiles.toArray(new IFile[bindingFiles.size()]);
- }
-
- public static void addBuildProperty(Map<String, List<String>> buildProperties, String propertyName, String propertyValue) {
- if (!buildProperties.containsKey(propertyName)) {
- buildProperties.put(propertyName, new LinkedList<String>());
- }
-
- buildProperties.get(propertyName).add(propertyValue);
- }
-
- public static String getBuildProperty(Map<String, List<String>> buildProperties, String propertyName) {
- if (buildProperties == null || buildProperties.size() == 0) {
- return null;
- }
-
- for (Entry<String, List<String>> property : buildProperties.entrySet()) {
- if (CompareUtility.equals(property.getKey(), propertyName)) {
- List<String> values = property.getValue();
- if (values != null && values.size() > 0) {
- return values.get(0);
- }
- }
- }
-
- return null;
- }
-
- /**
- * To append an index to the markerGroupUUI
- *
- * @param markerGroupUUID
- * @param index
- * @return
- */
- public static String toMarkerGroupUUID(String markerGroupUUID, int index) {
- return StringUtility.join("_", markerGroupUUID, String.valueOf(index));
- }
-
- /**
- * To get a unique binding file name path within the build path
- *
- * @param bundle
- * @param alias
- * @return
- */
- public static String createUniqueBindingFileNamePath(IScoutBundle bundle, String alias, String schemaTargetNamespace) {
- String filename = StringUtility.join("-", alias, schemaTargetNamespace, "bindings");
- filename = JaxWsSdkUtility.toValidFileName(filename);
-
- String bindingFileName = JaxWsSdkUtility.normalizePath(JaxWsConstants.PATH_BUILD, SeparatorType.TrailingType) + filename;
- String candiate = bindingFileName;
-
- IFile file = JaxWsSdkUtility.getFile(bundle, candiate + ".xml", false);
- int i = 0;
- while (file != null && file.exists()) {
- i++;
- candiate = bindingFileName + " (" + i + ")";
- file = JaxWsSdkUtility.getFile(bundle, candiate + ".xml", false);
- }
-
- return candiate + ".xml";
- }
-
- public static Color getColorLightGray() {
- Color color = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry().get("lightGray");
- if (color == null) {
- PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry().put("lightGray", new RGB(245, 245, 245));
- color = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry().get("lightGray");
- }
- return color;
- }
-
- public static AnnotationProperty parseAnnotationTypeValue(IType declaringType, IAnnotation annotation, String property) {
- AnnotationProperty propertyValue = new AnnotationProperty();
- if (!TypeUtility.exists(declaringType)) {
- return propertyValue;
- }
-
- if (!TypeUtility.exists(annotation)) {
- return propertyValue;
- }
-
- try {
- for (IMemberValuePair pair : annotation.getMemberValuePairs()) {
- if (pair.getMemberName().equals(property)) {
- String propertySignature = Signature.createTypeSignature((String) pair.getValue(), true);
- String fullyQualifiedName = JaxWsSdkUtility.getFullyQualifiedNameFromSignature(declaringType, propertySignature);
-
- propertyValue.setInherited(false);
- propertyValue.setFullyQualifiedName(fullyQualifiedName);
- return propertyValue;
- }
- }
-
- // get default value
- propertyValue.setInherited(true);
-
- String fqnAnnotationType = getFullyQualifiedNameFromName(declaringType, annotation.getElementName());
- IType type = TypeUtility.getType(fqnAnnotationType);
- if (TypeUtility.exists(type)) {
- propertyValue.setFullyQualifiedName((String) type.getMethod(property, new String[0]).getDefaultValue().getValue());
- }
- return propertyValue;
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("failed to parse annotation property value", e);
- }
- return propertyValue;
- }
-
- /**
- * Supports SuperTypes to be at multiple locations
- *
- * @param bundle
- * @param superType
- * @return
- */
- public static IType[] getJdtSubTypes(IScoutBundle bundle, String fqnSuperType, boolean includeInterfaces, boolean includeAbstractTypes, boolean includeFinalTypes, boolean sameProject) {
- List<IType> types = new LinkedList<IType>();
- try {
- IType[] superTypes = TypeUtility.getTypes(fqnSuperType);
- for (IType superType : superTypes) {
- ITypeHierarchy hierarchy = superType.newTypeHierarchy(new NullProgressMonitor());
- IType[] candidates = hierarchy.getAllSubtypes(superType);
- for (IType candidate : candidates) {
- if (TypeUtility.exists(candidate)) {
- if (!includeInterfaces && Flags.isInterface(candidate.getFlags())) {
- continue;
- }
- if (!includeAbstractTypes && Flags.isAbstract(candidate.getFlags())) {
- continue;
- }
- if (!includeFinalTypes && Flags.isFinal(candidate.getFlags())) {
- continue;
- }
- if (sameProject && !bundle.getJavaProject().equals(candidate.getJavaProject())) {
- continue;
- }
- if (TypeUtility.isOnClasspath(candidate, bundle.getJavaProject())) {
- types.add(candidate);
- }
- }
- }
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError("failed to get subclasses of '" + fqnSuperType + "'", e);
- }
-
- JaxWsSdkUtility.sortTypesByName(types, true);
- return types.toArray(new IType[types.size()]);
- }
-
- /**
- * Supports SuperTypes to be at multiple locations.
- * E.g. JAX-WS classes (i.e. javax.xml.ws.Service) which is defined in JRE but also might be defined in a WLS specific
- * library fragment.
- *
- * @param candidateToCheck
- * @param fqnSuperType
- * @return
- */
- public static boolean isJdtSubType(String fqnSuperType, IType candidateToCheck) {
- if (candidateToCheck == null) {
- return false;
- }
- IType[] superTypes = TypeUtility.getTypes(fqnSuperType);
- try {
- ITypeHierarchy superTypeHierarchy = candidateToCheck.newSupertypeHierarchy(new NullProgressMonitor());
- for (IType superType : superTypes) {
- if (superTypeHierarchy.contains(superType)) {
- return true;
- }
- }
- }
- catch (JavaModelException e) {
- JaxWsSdk.logError(e);
- }
- return false;
- }
-
- public static String resolveTypeName(IType declaringType, IType typeToBeResolved) throws JavaModelException {
- String typeSignature = Signature.createTypeSignature(typeToBeResolved.getFullyQualifiedName(), true);
- CompilationUnitImportValidator validator = new CompilationUnitImportValidator(declaringType.getCompilationUnit());
- return SignatureUtility.getTypeReference(typeSignature, declaringType, validator);
- }
-
- public static String toValidFileName(String name) {
- return name.replaceAll("[\\\\/\\:\\*\\?\\<\\>\"]", "");
- }
-
- public static boolean containsGlobalBindingSection(IScoutBundle bundle, Map<String, List<String>> propertiers, boolean checkForMultipleOccurences) {
- IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(bundle, propertiers);
-
- List<XmlResource> bindingFileResources = new LinkedList<XmlResource>();
- for (IFile bindingFile : bindingFiles) {
- XmlResource xmlResource = new XmlResource(bundle);
- xmlResource.setFile(bindingFile);
- bindingFileResources.add(xmlResource);
- }
-
- return containsGlobalBindingSection(bindingFileResources.toArray(new XmlResource[bindingFileResources.size()]), checkForMultipleOccurences);
- }
-
- public static boolean containsGlobalBindingSection(XmlResource[] bindingFileResources, boolean checkForMultipleOccurences) {
- int count = 0;
- try {
- for (XmlResource bindingFileResource : bindingFileResources) {
- ScoutXmlDocument xmlBindingFile = bindingFileResource.loadXml();
-
- List<ScoutXmlElement> candidates = xmlBindingFile.getRoot().getDescendants("*:globalBindings");
- for (ScoutXmlElement candidate : candidates) {
- String prefix = candidate.getNamePrefix();
- String namespace = candidate.getNamespace(prefix);
- if (namespace.equals("http://java.sun.com/xml/ns/jaxb")) {
- count++;
- if (checkForMultipleOccurences) {
- if (count > 1) {
- return true;
- }
- }
- else {
- return true;
- }
- break;
- }
- }
- }
- }
- catch (Exception e) {
- // nop
- }
- return false;
- }
-
- private static String getStubJarFilePath(String jarFileName) {
- if (jarFileName == null) {
- return null;
- }
- // ensure no file extension set
- jarFileName = new Path(jarFileName).removeFileExtension().lastSegment();
- // ensure valid filename
- jarFileName = JaxWsSdkUtility.toValidFileName(jarFileName);
- String folder = JaxWsSdkUtility.normalizePath(JaxWsConstants.STUB_FOLDER, SeparatorType.BothType);
- return StringUtility.join("/", folder, jarFileName + ".jar");
- }
-
- public static IFile getStubJarFile(IScoutBundle bundle, BuildJaxWsBean buildJaxWsBean, String wsdlFileName) {
- Map<String, List<String>> buildProperties = null;
- if (buildJaxWsBean != null) {
- buildProperties = buildJaxWsBean.getPropertiers();
- }
- return JaxWsSdkUtility.getStubJarFile(bundle, buildProperties, wsdlFileName);
- }
-
- /**
- * <p>
- * To get the stub file for a provider or consumer. The stub file is resolved as follows:
- * </p>
- * <ol>
- * <li>build properties are looked for a {@link JaxWsConstants#OPTION_JAR} entry</li>
- * <li>JAR file name is derived from WSDL file name</li>
- * </ol>
- *
- * @param bundle
- * @param buildProperties
- * @param wsdlFileName
- * @return
- */
- public static IFile getStubJarFile(IScoutBundle bundle, Map<String, List<String>> buildProperties, String wsdlFileName) {
- String jarFileName = null;
- if (buildProperties != null) {
- // custom JAR name specified by -jar option in build properties
- String customJarFileName = JaxWsSdkUtility.getBuildProperty(buildProperties, JaxWsConstants.OPTION_JAR);
- if (StringUtility.hasText(customJarFileName)) {
- jarFileName = new Path(customJarFileName).removeFileExtension().lastSegment();
- }
- }
- // default jar name derived from WSDL file name
- if (jarFileName == null && wsdlFileName != null) {
- jarFileName = new Path(wsdlFileName).removeFileExtension().lastSegment();
- }
- if (jarFileName == null) {
- JaxWsSdk.logWarning("Failed to derive stub JAR file name. Ensure WSDL file to exist or specify the build property '" + JaxWsConstants.OPTION_JAR + "' with the JAR file name as its value");
- return null;
- }
-
- String path = JaxWsSdkUtility.getStubJarFilePath(jarFileName);
- return JaxWsSdkUtility.getFile(bundle, path, false);
- }
-
- public static IScoutBundle getRootBundle(IScoutBundle serverBundle) {
- if (serverBundle.getType() != IScoutElement.BUNDLE_SERVER) {
- return null;
- }
- IScoutBundle bundle = serverBundle;
-
- while (bundle.getScoutProject().getParentProject() != null) {
- IScoutBundle candidate = bundle.getScoutProject().getParentProject().getServerBundle();
- if (candidate == null || !serverBundle.isOnClasspath(candidate)) {
- break;
- }
- bundle = bundle.getScoutProject().getParentProject().getServerBundle();
- }
- return bundle;
- }
-
- public static boolean registerJarLib(IScoutBundle bundle, IFile jarFile, boolean remove, IProgressMonitor monitor) {
- boolean success = true;
- JaxWsSdkUtility.refreshLocal(jarFile, IResource.DEPTH_ONE);
-
- String jarFilePath = JaxWsSdkUtility.normalizePath(jarFile.getProjectRelativePath().toPortableString(), SeparatorType.None);
- IJavaProject javaProject = bundle.getJavaProject();
- IProject project = bundle.getProject();
-
- // update Java class path in .classpath file
- try {
- List<IClasspathEntry> cpeList = new ArrayList<IClasspathEntry>();
- for (IClasspathEntry cpe : javaProject.getRawClasspath()) {
- if (cpe.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
- if (!cpe.getPath().equals(project.getFullPath().append(jarFilePath))) {
- cpeList.add(cpe);
- }
- }
- else {
- cpeList.add(cpe);
- }
- }
- if (!remove) {
- cpeList.add(JavaCore.newLibraryEntry(project.getFullPath().append(jarFilePath), null, null, true));
- }
- javaProject.setRawClasspath(cpeList.toArray(new IClasspathEntry[cpeList.size()]), monitor);
- }
- catch (Exception e) {
- JaxWsSdk.logError("could not update Java class path in .classpath file", e);
- }
-
- // update Bundle-ClassPath in MANIFEST.MF
- PluginModelHelper h = new PluginModelHelper(project);
- try {
- if (remove) {
- h.Manifest.removeClasspathEntry(jarFile);
- }
- else {
- h.Manifest.addClasspathEntry(jarFile);
- }
- h.Manifest.addClasspathDefaultEntry();
- }
- catch (Exception e) {
- JaxWsSdk.logError("could not update Bundle-ClassPath in MANIFEST.MF", e);
- success = false;
- }
-
- // update bin.includes in build.properties
- try {
- // remove JAR file registration as folder is registered anyway
- h.BuildProperties.removeBinaryBuildEntry(jarFile);
- if (!remove) {
- // register folder, not file
- h.BuildProperties.addBinaryBuildEntry(JaxWsSdkUtility.getParentFolder(bundle, jarFile));
- }
- }
- catch (Exception e) {
- JaxWsSdk.logError("could not update bin.includes in build.properties", e);
- success = false;
- }
- h.save();
-
- return success;
- }
-
- public static void overrideUnimplementedMethodsAsync(IType type) {
- OverrideUnimplementedMethodsOperation op = new OverrideUnimplementedMethodsOperation();
- op.setType(type);
- new OperationJob(op).schedule();
- }
-
- public static <T> void removeDuplicateEntries(List<T> list) {
- Set<T> elementsVisited = new HashSet<T>();
- Iterator<T> iterator = list.iterator();
- while (iterator.hasNext()) {
- T element = iterator.next();
- if (elementsVisited.contains(element)) {
- iterator.remove();
- }
- elementsVisited.add(element);
- }
- }
-
- public static void sortTypesByName(List<IType> list, boolean removeDuplicates) {
- if (removeDuplicates) {
- JaxWsSdkUtility.removeDuplicateEntries(list);
- }
-
- Collections.sort(list, new Comparator<IType>() {
-
- @Override
- public int compare(IType type1, IType type2) {
- return CompareUtility.compareTo(type1.getElementName(), type2.getElementName());
- }
- });
- }
-
- public static IFolder getParentFolder(IScoutBundle bundle, IFile file) {
- if (file == null) {
- return null;
- }
- IPath parentFolderPath = file.getProjectRelativePath().removeLastSegments(1);
- if (parentFolderPath.segmentCount() == 0) {
- return null;
- }
- return JaxWsSdkUtility.getFolder(bundle, parentFolderPath.toPortableString(), false);
- }
-
- public static IFolder openProjectFolderDialog(IScoutBundle bundle, ViewerFilter filter, String title, String description, IFolder rootFolder, IFolder initialFolder) {
- if (!JaxWsSdkUtility.exists(rootFolder)) {
- rootFolder = JaxWsSdkUtility.getFolder(bundle, rootFolder.getProjectRelativePath().toPortableString(), true);
- }
- ILabelProvider labelProvider = new WorkbenchLabelProvider();
- ITreeContentProvider contentProvider = new WorkbenchContentProvider();
- FolderSelectionDialog dialog = new FolderSelectionDialog(ScoutSdkUi.getShell(), labelProvider, contentProvider);
- dialog.setTitle(title);
- dialog.setMessage(description);
- dialog.addFilter(filter);
- dialog.setHelpAvailable(false);
- dialog.setAllowMultiple(false);
- if (initialFolder != null) {
- dialog.setInitialSelection(initialFolder);
- }
- String parentFolderPath = rootFolder.getProjectRelativePath().removeLastSegments(1).toPortableString();
- dialog.setInput(JaxWsSdkUtility.getFolder(bundle, parentFolderPath, true));
- dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
-
- if (dialog.open() == Window.OK) {
- return (IFolder) dialog.getFirstResult();
- }
- return null;
- }
-
- public static enum SeparatorType {
- LeadingType, TrailingType, BothType, None;
- }
-
- private static class JarFileSearchScope implements IJavaSearchScope {
-
- private IFile m_jarFile;
-
- public JarFileSearchScope(IFile jarFile) {
- m_jarFile = jarFile;
- }
-
- @Override
- public boolean encloses(String resourcePath) {
- return true;
- }
-
- @Override
- public boolean encloses(IJavaElement element) {
- return (element.getElementType() == IJavaElement.TYPE);
- }
-
- @Override
- public IPath[] enclosingProjectsAndJars() {
- return new IPath[]{m_jarFile.getFullPath()};
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public boolean includesBinaries() {
- return true;
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public boolean includesClasspaths() {
- return false;
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void setIncludesBinaries(boolean includesBinaries) {
- }
-
- @SuppressWarnings("deprecation")
- @Override
- public void setIncludesClasspaths(boolean includesClasspaths) {
- }
-
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.util;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import javax.jws.WebService;
+import javax.wsdl.Binding;
+import javax.wsdl.Definition;
+import javax.wsdl.Port;
+import javax.wsdl.PortType;
+import javax.wsdl.Service;
+import javax.wsdl.extensions.UnknownExtensibilityElement;
+import javax.xml.namespace.QName;
+import javax.xml.ws.WebServiceClient;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jdt.core.Flags;
+import org.eclipse.jdt.core.IAnnotation;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IField;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.IMemberValuePair;
+import org.eclipse.jdt.core.IMethod;
+import org.eclipse.jdt.core.IPackageFragment;
+import org.eclipse.jdt.core.IPackageFragmentRoot;
+import org.eclipse.jdt.core.ISourceRange;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.ITypeHierarchy;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.jdt.core.Signature;
+import org.eclipse.jdt.core.dom.CompilationUnit;
+import org.eclipse.jdt.core.search.IJavaSearchConstants;
+import org.eclipse.jdt.core.search.IJavaSearchScope;
+import org.eclipse.jdt.core.search.SearchEngine;
+import org.eclipse.jdt.core.search.SearchMatch;
+import org.eclipse.jdt.core.search.SearchParticipant;
+import org.eclipse.jdt.core.search.SearchPattern;
+import org.eclipse.jdt.core.search.SearchRequestor;
+import org.eclipse.jdt.core.search.TypeDeclarationMatch;
+import org.eclipse.jdt.core.search.TypeNameMatch;
+import org.eclipse.jdt.internal.corext.codemanipulation.CodeGenerationSettings;
+import org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation;
+import org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.IChooseImportQuery;
+import org.eclipse.jdt.internal.ui.preferences.JavaPreferencesSettings;
+import org.eclipse.jdt.internal.ui.wizards.buildpaths.FolderSelectionDialog;
+import org.eclipse.jdt.ui.SharedASTProvider;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.window.Window;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.jobs.OperationJob;
+import org.eclipse.scout.sdk.ui.internal.ScoutSdkUi;
+import org.eclipse.scout.sdk.ui.view.properties.part.ISection;
+import org.eclipse.scout.sdk.util.pde.PluginModelHelper;
+import org.eclipse.scout.sdk.util.resources.ResourceUtility;
+import org.eclipse.scout.sdk.util.signature.CompilationUnitImportValidator;
+import org.eclipse.scout.sdk.util.signature.SignatureUtility;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.IScoutElement;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.operation.OverrideUnimplementedMethodsOperation;
+import org.eclipse.scout.sdk.ws.jaxws.resource.XmlResource;
+import org.eclipse.scout.sdk.ws.jaxws.swt.model.BuildJaxWsBean;
+import org.eclipse.scout.sdk.ws.jaxws.swt.view.part.AnnotationProperty;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Color;
+import org.eclipse.swt.graphics.RGB;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.views.navigator.ResourceComparator;
+import org.w3c.dom.Element;
+import org.w3c.dom.NodeList;
+
+import com.sun.xml.internal.bind.api.impl.NameConverter;
+
+@SuppressWarnings("restriction")
+public final class JaxWsSdkUtility {
+
+ private JaxWsSdkUtility() {
+ }
+
+ public static boolean isValidJavaIdentifier(String identifier) {
+ if (StringUtility.isNullOrEmpty(identifier)) {
+ return false;
+ }
+
+ char[] chars = identifier.toCharArray();
+ for (int i = 0; i < chars.length; i++) {
+ if (i == 0) {
+ if (!Character.isJavaIdentifierStart(chars[i])) {
+ return false;
+ }
+ }
+ else {
+ if (!Character.isJavaIdentifierPart(chars[i])) {
+ return false;
+ }
+ }
+ }
+
+ return true;
+ }
+
+ public static boolean exists(IResource resource) {
+ refreshLocal(resource, IResource.DEPTH_ONE);
+ return resource != null && resource.exists() && resource.isSynchronized(IResource.DEPTH_ONE);
+ }
+
+ public static void refreshLocal(IResource resource, int depth) {
+ try {
+ if (resource != null && !resource.isSynchronized(depth)) {
+ resource.refreshLocal(depth, new NullProgressMonitor());
+ }
+ }
+ catch (CoreException e) {
+ JaxWsSdk.logWarning("The 'resource '" + resource.getFullPath().toPortableString() + "' could not be synchronized with the filesystem.");
+ }
+ }
+
+ public static IFile toFile(IScoutBundle bundle, File file) {
+ if (bundle == null || file == null) {
+ return null;
+ }
+
+ IPath path = new Path(file.getAbsolutePath()).makeRelativeTo(bundle.getProject().getLocation());
+ return JaxWsSdkUtility.getFile(bundle, path.toPortableString(), false);
+ }
+
+ public static File toFile(IFile file) {
+ if (file == null) {
+ return null;
+ }
+ return new File(file.getLocationURI());
+ }
+
+ public static IFile getFile(IScoutBundle scoutBundle, String path, boolean autoCreate) {
+ return getFile(scoutBundle, null, path, autoCreate);
+ }
+
+ public static IFile getFile(IScoutBundle scoutBundle, String projectRelativePath, String fileName, boolean autoCreate) {
+ if (fileName == null) {
+ return null;
+ }
+ IPath path;
+ if (StringUtility.isNullOrEmpty(projectRelativePath)) {
+ path = new Path(fileName);
+ }
+ else {
+ // ensure that the path begins and ends with a slash
+ projectRelativePath = normalizePath(projectRelativePath, SeparatorType.BothType);
+ path = new Path(projectRelativePath + fileName);
+ }
+
+ IFile file = scoutBundle.getProject().getFile(path);
+ prepareFileAccess(file, autoCreate);
+ return file;
+ }
+
+ public static void prepareFileAccess(IFile file, boolean autoCreate) {
+ refreshLocal(file, IResource.DEPTH_ZERO);
+
+ if (!exists(file) && autoCreate) {
+ try {
+ // create the folders if they do not exist yet
+ if (file.getParent() instanceof IFolder) {
+ ResourceUtility.mkdirs(file.getParent(), new NullProgressMonitor());
+ }
+ // the file does not already exist. Therefore create an empty file
+ InputStream inputStream = new ByteArrayInputStream(new byte[0]);
+ file.create(inputStream, true, new NullProgressMonitor());
+ }
+ catch (CoreException e) {
+ throw new RuntimeException("An unexpected error occured while creating empty file", e);
+ }
+ }
+
+ // register folder in build properties
+ if (autoCreate && file.getParent() instanceof IFolder) {
+ IFolder folder = (IFolder) file.getParent();
+ if (!folder.getProjectRelativePath().toPortableString().contains("build")) {
+ try {
+ PluginModelHelper h = new PluginModelHelper(file.getProject());
+ h.BuildProperties.addBinaryBuildEntry(folder);
+ h.save();
+ }
+ catch (CoreException e) {
+ JaxWsSdk.logError("failed to register folder in build.properties", e);
+ }
+ }
+ }
+ }
+
+ public static IFolder getFolder(IScoutBundle scoutBundle, String projectRelativePath, boolean autoCreate) {
+ if (StringUtility.isNullOrEmpty(projectRelativePath)) {
+ return null;
+ }
+ // ensure that the path begins and ends with a slash
+ IPath path = new Path(normalizePath(projectRelativePath, SeparatorType.BothType));
+ IFolder folder = scoutBundle.getProject().getFolder(path);
+ prepareFolderAccess(folder, autoCreate);
+ return folder;
+ }
+
+ public static void prepareFolderAccess(IFolder folder, boolean autoCreate) {
+ refreshLocal(folder, IResource.DEPTH_INFINITE);
+
+ if (!folder.exists() && autoCreate) {
+ try {
+ // create the folders if they do not exist yet
+ ResourceUtility.mkdirs(folder, new NullProgressMonitor());
+ }
+ catch (CoreException e) {
+ throw new RuntimeException("An unexpected error occured while creating the report design file", e);
+ }
+ }
+
+ // register folder in build properties
+ if (autoCreate && !folder.getProjectRelativePath().toPortableString().contains("build")) {
+ try {
+ PluginModelHelper h = new PluginModelHelper(folder.getProject());
+ h.BuildProperties.addBinaryBuildEntry(folder);
+ h.save();
+ }
+ catch (CoreException e) {
+ JaxWsSdk.logError("failed to register folder in build.properties", e);
+ }
+ }
+ }
+
+ /**
+ * Creates an import directive in the compilation unit for the given {@link IType}.
+ * The directive is only created if necessary.
+ *
+ * @param declaringType
+ * the type the directive is to be created in
+ * @param typeForImportDirective
+ * the type the directive is to be created for
+ */
+ public static void createImportDirective(IType declaringType, IType typeForImportDirective) {
+ try {
+ String resolveTypeName = JaxWsSdkUtility.resolveTypeName(declaringType, typeForImportDirective);
+ if (resolveTypeName == null) {
+ return;
+ }
+ if (typeForImportDirective.getFullyQualifiedName().equals(resolveTypeName)) {
+ return; // no import directive necessary, as type must be used fully qualified
+ }
+ declaringType.getCompilationUnit().createImport(typeForImportDirective.getFullyQualifiedName().replaceAll("\\$", "."), null, new NullProgressMonitor());
+ }
+ catch (Exception e) {
+ // nop
+ }
+ }
+
+ /**
+ * To obtain the fully qualified name
+ *
+ * @param declaringType
+ * the type which contains possible import directives
+ * @param signature
+ * the signature obtained by {@link IField#getTypeSignature()} or {@link IMethod#getReturnType()},
+ * respectively
+ * @return the fully qualified name
+ */
+ public static String getFullyQualifiedNameFromSignature(IType declaringType, String signature) {
+ return getFullyQualifiedNameFromName(declaringType, StringUtility.join(".", Signature.getSignatureQualifier(signature), Signature.getSignatureSimpleName(signature)));
+ }
+
+ /**
+ * To obtain the fully qualified name
+ *
+ * @param declaringType
+ * the type which contains possible import directives
+ * @param name
+ * the name as in declaring type
+ * @return the fully qualified name
+ */
+ public static String getFullyQualifiedNameFromName(IType declaringType, String name) {
+ try {
+ String[][] fullyQualifiedSignature = declaringType.resolveType(name);
+ if (fullyQualifiedSignature != null && fullyQualifiedSignature.length > 0) {
+ if (!StringUtility.isNullOrEmpty(fullyQualifiedSignature[0][0])) {
+ return fullyQualifiedSignature[0][0] + "." + fullyQualifiedSignature[0][1];
+ }
+ else {
+ return fullyQualifiedSignature[0][1];
+ }
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError(e);
+ }
+ return null;
+ }
+
+ public static String getFullyQualifiedSignature(IType declaringType, String signature) {
+ return Signature.createTypeSignature(JaxWsSdkUtility.getFullyQualifiedNameFromSignature(declaringType, signature), true);
+ }
+
+ public static void organizeImports(IType type) {
+ try {
+ CodeGenerationSettings settings = JavaPreferencesSettings.getCodeGenerationSettings(type.getJavaProject());
+ CompilationUnit astRoot = SharedASTProvider.getAST(type.getCompilationUnit(), SharedASTProvider.WAIT_ACTIVE_ONLY, null);
+
+ IChooseImportQuery chooseImportQuery = new IChooseImportQuery() {
+ @Override
+ public TypeNameMatch[] chooseImports(TypeNameMatch[][] openChoices, ISourceRange[] ranges) {
+ return new TypeNameMatch[0];
+ }
+ };
+
+ OrganizeImportsOperation op = new OrganizeImportsOperation(type.getCompilationUnit(), astRoot, settings.importIgnoreLowercase, !type.getCompilationUnit().isWorkingCopy(), true, chooseImportQuery);
+ op.run(new NullProgressMonitor());
+ }
+ catch (Throwable e) {
+ JaxWsSdk.logError(e);
+ }
+ }
+
+ public static String getFileNameWithoutExtension(IFile file) {
+ if (file.getFileExtension() != null) {
+ return file.getName().substring(0, file.getName().length() - file.getFileExtension().length() - 1);
+ }
+ else {
+ return file.getName();
+ }
+ }
+
+ public static String toStartWithLowerCase(String property) {
+ if (!StringUtility.hasText(property)) {
+ return null;
+ }
+ if (property.length() == 1) {
+ return property.toLowerCase();
+ }
+
+ return property.substring(0, 1).toLowerCase() + property.substring(1);
+ }
+
+ public static String toStartWithUpperCase(String property) {
+ if (!StringUtility.hasText(property)) {
+ return null;
+ }
+ if (property.length() == 1) {
+ return property.toUpperCase();
+ }
+
+ return property.substring(0, 1).toUpperCase() + property.substring(1);
+ }
+
+ public static String normalizePath(String path, SeparatorType separatorType) {
+ if (path == null) {
+ return null;
+ }
+ if (separatorType == SeparatorType.BothType || separatorType == SeparatorType.LeadingType) {
+ if (!path.startsWith("/")) {
+ path = "/" + path;
+ }
+ }
+ else {
+ if (path.startsWith("/")) {
+ path = path.substring(1);
+ }
+ }
+
+ if (separatorType == SeparatorType.BothType || separatorType == SeparatorType.TrailingType) {
+ if (!path.endsWith("/")) {
+ path += "/";
+ }
+ }
+ else {
+ if (path.endsWith("/")) {
+ path = path.substring(0, path.length() - 1);
+ }
+ }
+ return path;
+ }
+
+ /**
+ * Excludes the composite from the layout manager if it does not contain any children and triggers to relayout the
+ * composite.
+ *
+ * @param composite
+ */
+ public static void doLayout(Composite composite) {
+ if (composite != null && !composite.isDisposed()) {
+ if (composite.getLayoutData() instanceof GridData) {
+ if (composite.getChildren().length == 0) {
+// ((GridData) composite.getLayoutData()).exclude = true; // exclude does not work properly
+ ((GridData) composite.getLayoutData()).heightHint = 0; // therefore this workaround is used, but as a drawback, the section has to collapsed and expanded
+ }
+ else {
+// ((GridData) composite.getLayoutData()).exclude = false; // exclude does not work properly
+ ((GridData) composite.getLayoutData()).heightHint = SWT.DEFAULT; // therefore this workaround is used, but as a drawback, the section has to collapsed and expanded
+ }
+ }
+ composite.layout(true, true);
+ }
+ }
+
+ /**
+ * workaround for proper redraw of sections which contain composites to be excluded / included depending one some
+ * conditions.
+ * This must take place when getForm()#redraw=true!
+ *
+ * @param section
+ */
+ public static void doLayoutSection(ISection section) {
+ if (section.isExpanded()) {
+ section.setExpanded(false);
+ section.setExpanded(true);
+ }
+ }
+
+ public static void disposeChildControls(Composite composite) {
+ if (composite != null && !composite.isDisposed()) {
+ for (Control child : composite.getChildren()) {
+ child.dispose();
+ }
+ }
+ }
+
+ public static void setView(Composite composite, boolean enabled) {
+ if (composite != null && !composite.isDisposed()) {
+ composite.setEnabled(enabled);
+ for (Control child : composite.getChildren()) {
+ if (child instanceof Composite) {
+ setView((Composite) child, enabled);
+ }
+ else {
+ child.setEnabled(enabled);
+ }
+ }
+ }
+ }
+
+ public static Set<IResource> createResourceSet(IResource... resources) {
+ Set<IResource> resourceSet = new HashSet<IResource>();
+ for (IResource resource : resources) {
+ if (resource != null) {
+ resourceSet.add(resource);
+ }
+ }
+ return resourceSet;
+ }
+
+ public static PortType getPortType(Definition wsdlDefinition, QName serviceQName, String portName) {
+ if (wsdlDefinition == null || serviceQName == null || portName == null) {
+ return null;
+ }
+
+ portName = QName.valueOf(portName).getLocalPart();
+
+ Service service = wsdlDefinition.getService(serviceQName);
+ if (service == null) {
+ return null;
+ }
+ Port port = service.getPort(portName);
+ if (port == null) {
+ return null;
+ }
+ Binding binding = port.getBinding();
+ if (binding == null) {
+ return null;
+ }
+ return port.getBinding().getPortType();
+ }
+
+ /**
+ * Resolves the requested PortType interface type located in the given jar file
+ *
+ * @param portTypeQName
+ * the PortType to be resolved or null to get all PortTypes
+ * @param jarFile
+ * the jar file the PortType interface type to be searched in
+ * @return
+ */
+ public static IType resolvePortTypeInterfaceType(final QName portTypeQName, IFile jarFile) {
+ if (portTypeQName == null) {
+ return null;
+ }
+ IType[] types = resolvePortTypeInterfaceTypes(portTypeQName, jarFile);
+ if (types.length == 0) {
+ return null;
+ }
+ else if (types.length > 1) {
+ JaxWsSdk.logWarning("Multiple PortType interface types found for port type '" + portTypeQName + "'");
+ }
+ return types[0];
+ }
+
+ /**
+ * Resolves PortType interface types located in the given jar file
+ *
+ * @param portTypeQName
+ * the PortType to be resolved or null to get all PortTypes
+ * @param jarFile
+ * the jar file the PortType interface type to be searched in
+ * @return
+ */
+ public static IType[] resolvePortTypeInterfaceTypes(final QName portTypeQName, IFile jarFile) {
+ if (jarFile == null) {
+ return new IType[0];
+ }
+ final Set<IType> types = new HashSet<IType>();
+ try {
+ new SearchEngine().search(
+ SearchPattern.createPattern("*", IJavaSearchConstants.INTERFACE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_PATTERN_MATCH),
+ new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},
+ new JarFileSearchScope(jarFile), //SearchEngine.createWorkspaceScope(),
+ new SearchRequestor() {
+
+ @Override
+ public final void acceptSearchMatch(SearchMatch match) throws CoreException {
+ if (!(match instanceof TypeDeclarationMatch)) {
+ return;
+ }
+ IType candidate = (IType) match.getElement();
+ if (!TypeUtility.exists(candidate) || !candidate.isBinary()) {
+ // type must be binary
+ return;
+ }
+ // candidates must be annotated WebService annotation
+ IAnnotation annotation = JaxWsSdkUtility.getAnnotation(candidate, WebService.class.getName(), false);
+ if (!TypeUtility.exists(annotation)) {
+ return;
+ }
+ if (portTypeQName == null) {
+ types.add(candidate);
+ return;
+ }
+ // candidate must match the port type
+ IMemberValuePair[] properties = annotation.getMemberValuePairs();
+ for (IMemberValuePair property : properties) {
+ if (property.getMemberName().equals("name") && property.getValue().equals(portTypeQName.getLocalPart())) {
+ types.add(candidate);
+ return;
+ }
+ }
+ }
+ },
+ null
+ );
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("Failed to resolve portType interface type", e);
+ }
+ return types.toArray(new IType[types.size()]);
+ }
+
+ /**
+ * Resolves the requested service type located in the given jar file
+ *
+ * @param serviceQName
+ * @param jarFile
+ * @return
+ */
+ public static IType resolveServiceType(final QName serviceQName, IFile jarFile) {
+ if (serviceQName == null) {
+ return null;
+ }
+ IType[] types = resolveServiceTypes(serviceQName, jarFile);
+ if (types.length == 0) {
+ return null;
+ }
+ else if (types.length > 1) {
+ JaxWsSdk.logWarning("Multiple service types found for service '" + serviceQName + "'");
+ }
+ return types[0];
+ }
+
+ /**
+ * Resolves service types located in the given jar file
+ *
+ * @param serviceQName
+ * the service to be resolved or null to get all service types
+ * @param jarFile
+ * the jar file the service type to be searched in
+ * @return
+ */
+ public static IType[] resolveServiceTypes(final QName serviceQName, IFile jarFile) {
+ final Set<IType> types = new HashSet<IType>();
+ try {
+ new SearchEngine().search(
+ SearchPattern.createPattern("*", IJavaSearchConstants.TYPE, IJavaSearchConstants.DECLARATIONS, SearchPattern.R_PATTERN_MATCH),
+ new SearchParticipant[]{SearchEngine.getDefaultSearchParticipant()},
+ new JarFileSearchScope(jarFile), //SearchEngine.createWorkspaceScope(),
+ new SearchRequestor() {
+
+ @Override
+ public final void acceptSearchMatch(SearchMatch match) throws CoreException {
+ if (!(match instanceof TypeDeclarationMatch)) {
+ return;
+ }
+ IType candidate = (IType) match.getElement();
+ if (!TypeUtility.exists(candidate) || !candidate.isBinary()) {
+ // candidate must be binary
+ return;
+ }
+
+ // candidate must be a concrete type
+ if (!candidate.isClass() || Flags.isAbstract(candidate.getFlags())) {
+ return;
+ }
+
+ // candidate must be of the type 'javax.xml.ws.Service'
+ if (!JaxWsSdkUtility.isJdtSubType(javax.xml.ws.Service.class.getName(), candidate)) {
+ return;
+ }
+ // candidates must be annotated WebServiceClient annotation
+ IAnnotation annotation = JaxWsSdkUtility.getAnnotation(candidate, WebServiceClient.class.getName(), false);
+ if (!TypeUtility.exists(annotation)) {
+ return;
+ }
+ if (serviceQName == null) {
+ types.add(candidate);
+ return;
+ }
+ // candidate must match the service type
+ IMemberValuePair[] properties = annotation.getMemberValuePairs();
+ for (IMemberValuePair property : properties) {
+ if (property.getMemberName().equals("name") && property.getValue().equals(serviceQName.getLocalPart())) {
+ types.add(candidate);
+ return;
+ }
+ }
+ }
+ },
+ null
+ );
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("Failed to resolve portType interface type", e);
+ }
+ return types.toArray(new IType[types.size()]);
+ }
+
+ public static boolean isProviderAuthenticationSet(String fqn) {
+ if (!StringUtility.hasText(fqn)) {
+ return false;
+ }
+ fqn = fqn.replaceAll("\\$", "\\.");
+ String noneAuthFqn = TypeUtility.getType(JaxWsRuntimeClasses.NullAuthenticationHandlerProvider).getFullyQualifiedName().replaceAll("\\$", "\\.");
+ return TypeUtility.existsType(fqn) && !fqn.equals(noneAuthFqn);
+ }
+
+ private static class TypeEntry {
+ private IType m_sourceType;
+ private IType m_binaryType;
+
+ public IType getSourceType() {
+ return m_sourceType;
+ }
+
+ public void setSourceType(IType sourceType) {
+ m_sourceType = sourceType;
+ }
+
+ public IType getBinaryType() {
+ return m_binaryType;
+ }
+
+ public void setBinaryType(IType binaryType) {
+ m_binaryType = binaryType;
+ }
+ }
+
+ public static IType extractGenericSuperType(IType type, int index) {
+ try {
+ if (!TypeUtility.exists(type)) {
+ return null;
+ }
+ String superTypeSignature = type.getSuperclassTypeSignature();
+ if (superTypeSignature == null) {
+ return null;
+ }
+ String[] typeArguments = Signature.getTypeArguments(superTypeSignature);
+ if (typeArguments.length == 0 || index >= typeArguments.length) {
+ return null;
+ }
+ String signature = typeArguments[index];
+ String fullyQualifiedName = JaxWsSdkUtility.getFullyQualifiedNameFromSignature(type, signature);
+
+ if (TypeUtility.existsType(fullyQualifiedName)) {
+ return TypeUtility.getType(fullyQualifiedName);
+ }
+ return null;
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("could not extract generic super type", e);
+ }
+ return null;
+ }
+
+ public static QName extractServiceQNameFromWsClient(IType webserviceClientType) {
+ IType serviceType = extractGenericSuperType(webserviceClientType, JaxWsConstants.GENERICS_WEBSERVICE_CLIENT_SERVICE_INDEX);
+ if (!TypeUtility.exists(serviceType)) {
+ return null;
+ }
+
+ // ensure service to be a subtype of {@link Service}
+ if (!JaxWsSdkUtility.isJdtSubType(javax.xml.ws.Service.class.getName(), serviceType)) {
+ return null;
+ }
+
+ IAnnotation annotation = JaxWsSdkUtility.getAnnotation(serviceType, WebServiceClient.class.getName(), false);
+ return extractQNameFromAnnotation(annotation);
+ }
+
+ public static QName extractPortTypeQNameFromWsClient(IType webserviceClientType) {
+ IType portTypeInterfaceType = extractGenericSuperType(webserviceClientType, JaxWsConstants.GENERICS_WEBSERVICE_CLIENT_PORT_TYPE_INDEX);
+ if (!TypeUtility.exists(portTypeInterfaceType)) {
+ return null;
+ }
+
+ IAnnotation annotation = JaxWsSdkUtility.getAnnotation(portTypeInterfaceType, WebService.class.getName(), false);
+ return extractQNameFromAnnotation(annotation);
+ }
+
+ private static QName extractQNameFromAnnotation(IAnnotation annotation) {
+ if (annotation == null || !annotation.exists()) {
+ return null;
+ }
+
+ String localPart = null;
+ String namespaceURI = null;
+ try {
+ for (IMemberValuePair pair : annotation.getMemberValuePairs()) {
+ if (pair.getMemberName().equals("name")) {
+ localPart = (String) pair.getValue();
+ }
+ else if (pair.getMemberName().equals("targetNamespace")) {
+ namespaceURI = (String) pair.getValue();
+ }
+ if (namespaceURI != null && localPart != null) {
+ break;
+ }
+ }
+
+ QName qname = null;
+ if (namespaceURI != null && localPart != null) {
+ qname = new QName(namespaceURI, localPart);
+ }
+ else if (localPart != null) {
+ qname = new QName(localPart);
+ }
+
+ if (qname != null) {
+ return qname;
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("could not extract QName from annotation '" + annotation.getElementName() + "'", e);
+ }
+ return null;
+ }
+
+ public static boolean hasPackageElements(IScoutBundle bundle, String sourceFolder, String packageName) {
+ if (!isValidSourceFolder(bundle, sourceFolder) || packageName == null) {
+ return false;
+ }
+
+ try {
+ IPath rootPath = bundle.getProject().getFullPath().append(sourceFolder);
+
+ IPackageFragmentRoot root = bundle.getJavaProject().findPackageFragmentRoot(rootPath);
+ if (root == null || !root.exists()) {
+ return false;
+ }
+ IPackageFragment packageFragment = root.getPackageFragment(StringUtility.nvl(packageName, "")); // "" for default package
+ return packageFragment != null && packageFragment.exists() && (packageFragment.hasChildren() || packageFragment.hasSubpackages());
+ }
+ catch (JavaModelException e) {
+ return false;
+ }
+ }
+
+ public static IPackageFragment toPackageFragment(IScoutBundle bundle, String sourceFolder, String packageName) {
+ try {
+ if (!isValidSourceFolder(bundle, sourceFolder)) {
+ return null;
+ }
+
+ IPath rootPath = bundle.getProject().getFullPath().append(sourceFolder);
+
+ IPackageFragmentRoot root = bundle.getJavaProject().findPackageFragmentRoot(rootPath);
+ if (root == null || !root.exists()) {
+ return null;
+ }
+ IPackageFragment packageFragment = root.getPackageFragment(StringUtility.nvl(packageName, "")); // "" for default package
+ if (packageFragment != null && packageFragment.exists()) {
+ return packageFragment;
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("could not obtain package fragment", e);
+ }
+ return null;
+ }
+
+ public static void clearPackage(IScoutBundle bundle, String sourceFolder, String packageName) {
+ try {
+ IPackageFragment packageFragment = toPackageFragment(bundle, sourceFolder, packageName);
+ if (packageFragment != null && packageFragment.exists()) {
+ packageFragment.delete(true, new NullProgressMonitor());
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("could not clear package", e);
+ }
+ }
+
+ public static void createSourceFolder(IScoutBundle bundle, String sourceFolder) throws JavaModelException {
+ List<IClasspathEntry> list = new LinkedList<IClasspathEntry>();
+ IClasspathEntry[] entries = bundle.getJavaProject().getRawClasspath();
+ for (IClasspathEntry entry : entries) {
+ if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) {
+ if (JaxWsSdkUtility.getFolder(bundle, sourceFolder, false).getFullPath().equals(entry.getPath())) {
+ // source folder already exists
+ return;
+ }
+ }
+ list.add(entry);
+ }
+
+ IFolder srcFolder = JaxWsSdkUtility.getFolder(bundle, "/" + sourceFolder, true);
+ IClasspathEntry newEntry = JavaCore.newSourceEntry(srcFolder.getFullPath());
+ list.add(newEntry);
+ bundle.getJavaProject().setRawClasspath(list.toArray(new IClasspathEntry[0]), bundle.getJavaProject().getOutputLocation(), new NullProgressMonitor());
+ }
+
+ public static boolean isValidSourceFolder(IScoutBundle bundle, String sourceFolder) {
+ if (sourceFolder == null) {
+ return false;
+ }
+
+ try {
+ for (IClasspathEntry classpathEntry : bundle.getJavaProject().getRawClasspath()) {
+ if (classpathEntry.getEntryKind() == IClasspathEntry.CPE_SOURCE && sourceFolder.equals(classpathEntry.getPath().lastSegment())) {
+ return true;
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("Failed to validate source folder.", e);
+ }
+ return false;
+ }
+
+ public static String getPlainPortTypeName(String portTypeName) {
+ if (portTypeName == null) {
+ return null;
+ }
+ while (true) {
+ if (portTypeName.toLowerCase().endsWith("porttype")) {
+ portTypeName = portTypeName.substring(0, portTypeName.length() - "porttype".length());
+ continue;
+ }
+ if (portTypeName.toLowerCase().endsWith("webservice")) {
+ portTypeName = portTypeName.substring(0, portTypeName.length() - "webservice".length());
+ continue;
+ }
+ if (portTypeName.toLowerCase().endsWith("service")) {
+ portTypeName = portTypeName.substring(0, portTypeName.length() - "service".length());
+ continue;
+ }
+ return portTypeName;
+ }
+ }
+
+ public static String getRecommendedProviderImplPackageName(IScoutBundle bundle) {
+ return StringUtility.join(".", bundle.getBundleName(), "services", "ws", "provider");
+ }
+
+ public static String getRecommendedHandlerPackageName(IScoutBundle bundle) {
+ return StringUtility.join(".", bundle.getBundleName(), "services", "ws", "handler");
+ }
+
+ public static String getRecommendedConsumerImplPackageName(IScoutBundle bundle) {
+ return StringUtility.join(".", bundle.getBundleName(), "services", "ws", "consumer");
+ }
+
+ public static String getRecommendedProviderSecurityPackageName(IScoutBundle bundle) {
+ return StringUtility.join(".", bundle.getBundleName(), "services", "ws", "provider", "security");
+ }
+
+ public static String getRecommendedConsumerSecurityPackageName(IScoutBundle bundle) {
+ return StringUtility.join(".", bundle.getBundleName(), "services", "ws", "consumer", "security");
+ }
+
+ public static String getRecommendedSessionPackageName(IScoutBundle bundle) {
+ return StringUtility.join(".", bundle.getBundleName(), "services", "ws", "session");
+ }
+
+ public static String getRecommendedTargetNamespace(IScoutBundle bundle, String serviceName) {
+ String[] segments = bundle.getBundleName().split("\\.");
+ String projectSuffex = null;
+ for (int i = segments.length - 1; i >= 0; i--) {
+ String segment = segments[i];
+ // exclude node segment
+ if (segment.toLowerCase().equals("server") ||
+ segment.toLowerCase().equals("online") ||
+ segment.toLowerCase().equals("offline")) {
+ continue;
+ }
+ projectSuffex = StringUtility.join(".", projectSuffex, segments[i]);
+ }
+
+ return "http://ws.services." + projectSuffex + "/" + serviceName + "/"; //trailing slash is required
+ }
+
+ /**
+ * @param buildProperties
+ * to primary evaluate -p option of build properties. If null, JAX-WS mechanism is used to resolve package
+ * name
+ * @param wsdlDefinition
+ * WSDL definition to resolve package name
+ * @return
+ */
+ public static String resolveStubPackageName(Map<String, List<String>> buildProperties, Definition wsdlDefinition) {
+ // global package specified by -p option in build properties
+ String globalPackageName = JaxWsSdkUtility.getBuildProperty(buildProperties, JaxWsConstants.OPTION_PACKAGE);
+ if (!StringUtility.isNullOrEmpty(globalPackageName)) {
+ return globalPackageName;
+ }
+
+ if (wsdlDefinition == null) {
+ return null;
+ }
+
+ // global package binding in WSDL file
+ globalPackageName = getWsdlBindingPackageName(wsdlDefinition);
+ if (!StringUtility.isNullOrEmpty(globalPackageName)) {
+ return globalPackageName;
+ }
+
+ String targetNamespace = wsdlDefinition.getTargetNamespace();
+ return JaxWsSdkUtility.targetNamespaceToPackageName(targetNamespace);
+ }
+
+ private static String getWsdlBindingPackageName(Definition definition) {
+ if (definition == null) {
+ return null;
+ }
+ for (Object e : definition.getExtensibilityElements()) {
+ if (e instanceof UnknownExtensibilityElement) {
+ UnknownExtensibilityElement uee = (UnknownExtensibilityElement) e;
+ if (uee.getElementType().equals(new QName("http://java.sun.com/xml/ns/jaxws", "bindings"))) {
+ Element element = uee.getElement();
+ NodeList nodes = element.getElementsByTagNameNS("http://java.sun.com/xml/ns/jaxws", "package");
+ if (nodes.getLength() > 0) {
+ Element globalPackageBindingElement = (Element) nodes.item(0);
+ return globalPackageBindingElement.getAttribute("name");
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ public static String targetNamespaceToPackageName(String targetNamespace) {
+ if (targetNamespace == null) {
+ return null;
+ }
+
+ NameConverter nameConverter = NameConverter.standard;
+ try {
+ return nameConverter.toPackageName(targetNamespace); // same mechanism as JAX-WS uses. See @{link WSDLModeler#getJavaPackage} and @{link XJC#getDefaultPackageName()}
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("failed to convert targetNamespace into package name");
+ }
+ return null;
+ }
+
+ public static Binding getBinding(Definition wsdlDefinition, QName serviceQName, String portName) {
+ if (wsdlDefinition == null || serviceQName == null || portName == null) {
+ return null;
+ }
+
+ portName = QName.valueOf(portName).getLocalPart();
+
+ Service service = wsdlDefinition.getService(serviceQName);
+ if (service == null) {
+ return null;
+ }
+ Port port = service.getPort(portName);
+ if (port == null) {
+ return null;
+ }
+ return port.getBinding();
+ }
+
+ /**
+ * To get an annotation on the given type. This is just a workaround as {@link IType#getAnnotation(String)} does not
+ * work properly (changes are not reflected, e.g. after removing the annotation, it is still returned)
+ *
+ * @param declaringType
+ * @param annotationName
+ * @return
+ */
+ public static IAnnotation getAnnotation(IType declaringType, String fqnAnnotationName, boolean recursively) {
+ try {
+ if (!TypeUtility.exists(declaringType)) {
+ return null;
+ }
+ IAnnotation[] annotations = declaringType.getAnnotations();
+ for (IAnnotation annotation : annotations) {
+ if (declaringType.isBinary()) {
+ // annotation name is always fully qualified name if coming from a class file
+ if (annotation.getElementName().equals(fqnAnnotationName)) {
+ return annotation;
+ }
+ }
+ else {
+ if (annotation.getElementName().equals(fqnAnnotationName) || annotation.getElementName().equals(Signature.getSimpleName(fqnAnnotationName))) {
+ return annotation;
+ }
+ }
+ }
+
+ if (recursively) {
+ IType superType = declaringType.newSupertypeHierarchy(new NullProgressMonitor()).getSuperclass(declaringType);
+ return getAnnotation(superType, fqnAnnotationName, recursively);
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("failed to resolve annotations", e);
+ }
+ return null;
+ }
+
+ public static boolean isAnnotationOnDeclaringType(IType declaringType, IAnnotation annotation) {
+ if (annotation == null || declaringType == null) {
+ return false;
+ }
+ IJavaElement parent = annotation.getParent();
+ if (parent.getElementType() != IJavaElement.TYPE) {
+ return false;
+ }
+ IType candidateType = (IType) parent;
+ return candidateType.getFullyQualifiedName().equals(declaringType.getFullyQualifiedName());
+ }
+
+ public static Map<String, List<String>> getDefaultBuildProperties() {
+ Map<String, List<String>> map = new HashMap<String, List<String>>();
+ map.put("Xdebug", null);
+ map.put("keep", null);
+ map.put("verbose", null);
+
+ List<String> values = new LinkedList<String>();
+ values.add("2.0");
+ map.put("target", values);
+ return map;
+ }
+
+ public static IFile[] getBindingFiles(IScoutBundle bundle, Map<String, List<String>> buildProperties) {
+ if (buildProperties == null || buildProperties.size() == 0) {
+ return new IFile[0];
+ }
+
+ List<IFile> bindingFiles = new LinkedList<IFile>();
+ for (Entry<String, List<String>> property : buildProperties.entrySet()) {
+ if (property.getKey() == null || !property.getKey().equals(JaxWsConstants.OPTION_BINDING_FILE) || property.getValue() == null || property.getValue().size() == 0) {
+ continue;
+ }
+
+ for (String bindingFileRaw : property.getValue()) {
+ IFile bindingFile = JaxWsSdkUtility.getFile(bundle, bindingFileRaw, false);
+ bindingFiles.add(bindingFile);
+ }
+ }
+ return bindingFiles.toArray(new IFile[bindingFiles.size()]);
+ }
+
+ public static void addBuildProperty(Map<String, List<String>> buildProperties, String propertyName, String propertyValue) {
+ if (!buildProperties.containsKey(propertyName)) {
+ buildProperties.put(propertyName, new LinkedList<String>());
+ }
+
+ buildProperties.get(propertyName).add(propertyValue);
+ }
+
+ public static String getBuildProperty(Map<String, List<String>> buildProperties, String propertyName) {
+ if (buildProperties == null || buildProperties.size() == 0) {
+ return null;
+ }
+
+ for (Entry<String, List<String>> property : buildProperties.entrySet()) {
+ if (CompareUtility.equals(property.getKey(), propertyName)) {
+ List<String> values = property.getValue();
+ if (values != null && values.size() > 0) {
+ return values.get(0);
+ }
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * To append an index to the markerGroupUUI
+ *
+ * @param markerGroupUUID
+ * @param index
+ * @return
+ */
+ public static String toMarkerGroupUUID(String markerGroupUUID, int index) {
+ return StringUtility.join("_", markerGroupUUID, String.valueOf(index));
+ }
+
+ /**
+ * To get a unique binding file name path within the build path
+ *
+ * @param bundle
+ * @param alias
+ * @return
+ */
+ public static String createUniqueBindingFileNamePath(IScoutBundle bundle, String alias, String schemaTargetNamespace) {
+ String filename = StringUtility.join("-", alias, schemaTargetNamespace, "bindings");
+ filename = JaxWsSdkUtility.toValidFileName(filename);
+
+ String bindingFileName = JaxWsSdkUtility.normalizePath(JaxWsConstants.PATH_BUILD, SeparatorType.TrailingType) + filename;
+ String candiate = bindingFileName;
+
+ IFile file = JaxWsSdkUtility.getFile(bundle, candiate + ".xml", false);
+ int i = 0;
+ while (file != null && file.exists()) {
+ i++;
+ candiate = bindingFileName + " (" + i + ")";
+ file = JaxWsSdkUtility.getFile(bundle, candiate + ".xml", false);
+ }
+
+ return candiate + ".xml";
+ }
+
+ public static Color getColorLightGray() {
+ Color color = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry().get("lightGray");
+ if (color == null) {
+ PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry().put("lightGray", new RGB(245, 245, 245));
+ color = PlatformUI.getWorkbench().getThemeManager().getCurrentTheme().getColorRegistry().get("lightGray");
+ }
+ return color;
+ }
+
+ public static AnnotationProperty parseAnnotationTypeValue(IType declaringType, IAnnotation annotation, String property) {
+ AnnotationProperty propertyValue = new AnnotationProperty();
+ if (!TypeUtility.exists(declaringType)) {
+ return propertyValue;
+ }
+
+ if (!TypeUtility.exists(annotation)) {
+ return propertyValue;
+ }
+
+ try {
+ for (IMemberValuePair pair : annotation.getMemberValuePairs()) {
+ if (pair.getMemberName().equals(property)) {
+ String propertySignature = Signature.createTypeSignature((String) pair.getValue(), true);
+ String fullyQualifiedName = JaxWsSdkUtility.getFullyQualifiedNameFromSignature(declaringType, propertySignature);
+
+ propertyValue.setInherited(false);
+ propertyValue.setFullyQualifiedName(fullyQualifiedName);
+ return propertyValue;
+ }
+ }
+
+ // get default value
+ propertyValue.setInherited(true);
+
+ String fqnAnnotationType = getFullyQualifiedNameFromName(declaringType, annotation.getElementName());
+ IType type = TypeUtility.getType(fqnAnnotationType);
+ if (TypeUtility.exists(type)) {
+ propertyValue.setFullyQualifiedName((String) type.getMethod(property, new String[0]).getDefaultValue().getValue());
+ }
+ return propertyValue;
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("failed to parse annotation property value", e);
+ }
+ return propertyValue;
+ }
+
+ /**
+ * Supports SuperTypes to be at multiple locations
+ *
+ * @param bundle
+ * @param superType
+ * @return
+ */
+ public static IType[] getJdtSubTypes(IScoutBundle bundle, String fqnSuperType, boolean includeInterfaces, boolean includeAbstractTypes, boolean includeFinalTypes, boolean sameProject) {
+ List<IType> types = new LinkedList<IType>();
+ try {
+ IType[] superTypes = TypeUtility.getTypes(fqnSuperType);
+ for (IType superType : superTypes) {
+ ITypeHierarchy hierarchy = superType.newTypeHierarchy(new NullProgressMonitor());
+ IType[] candidates = hierarchy.getAllSubtypes(superType);
+ for (IType candidate : candidates) {
+ if (TypeUtility.exists(candidate)) {
+ if (!includeInterfaces && Flags.isInterface(candidate.getFlags())) {
+ continue;
+ }
+ if (!includeAbstractTypes && Flags.isAbstract(candidate.getFlags())) {
+ continue;
+ }
+ if (!includeFinalTypes && Flags.isFinal(candidate.getFlags())) {
+ continue;
+ }
+ if (sameProject && !bundle.getJavaProject().equals(candidate.getJavaProject())) {
+ continue;
+ }
+ if (TypeUtility.isOnClasspath(candidate, bundle.getJavaProject())) {
+ types.add(candidate);
+ }
+ }
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError("failed to get subclasses of '" + fqnSuperType + "'", e);
+ }
+
+ JaxWsSdkUtility.sortTypesByName(types, true);
+ return types.toArray(new IType[types.size()]);
+ }
+
+ /**
+ * Supports SuperTypes to be at multiple locations.
+ * E.g. JAX-WS classes (i.e. javax.xml.ws.Service) which is defined in JRE but also might be defined in a WLS specific
+ * library fragment.
+ *
+ * @param candidateToCheck
+ * @param fqnSuperType
+ * @return
+ */
+ public static boolean isJdtSubType(String fqnSuperType, IType candidateToCheck) {
+ if (candidateToCheck == null) {
+ return false;
+ }
+ IType[] superTypes = TypeUtility.getTypes(fqnSuperType);
+ try {
+ ITypeHierarchy superTypeHierarchy = candidateToCheck.newSupertypeHierarchy(new NullProgressMonitor());
+ for (IType superType : superTypes) {
+ if (superTypeHierarchy.contains(superType)) {
+ return true;
+ }
+ }
+ }
+ catch (JavaModelException e) {
+ JaxWsSdk.logError(e);
+ }
+ return false;
+ }
+
+ public static String resolveTypeName(IType declaringType, IType typeToBeResolved) throws JavaModelException {
+ String typeSignature = Signature.createTypeSignature(typeToBeResolved.getFullyQualifiedName(), true);
+ CompilationUnitImportValidator validator = new CompilationUnitImportValidator(declaringType.getCompilationUnit());
+ return SignatureUtility.getTypeReference(typeSignature, declaringType, validator);
+ }
+
+ public static String toValidFileName(String name) {
+ return name.replaceAll("[\\\\/\\:\\*\\?\\<\\>\"]", "");
+ }
+
+ public static boolean containsGlobalBindingSection(IScoutBundle bundle, Map<String, List<String>> propertiers, boolean checkForMultipleOccurences) {
+ IFile[] bindingFiles = JaxWsSdkUtility.getBindingFiles(bundle, propertiers);
+
+ List<XmlResource> bindingFileResources = new LinkedList<XmlResource>();
+ for (IFile bindingFile : bindingFiles) {
+ XmlResource xmlResource = new XmlResource(bundle);
+ xmlResource.setFile(bindingFile);
+ bindingFileResources.add(xmlResource);
+ }
+
+ return containsGlobalBindingSection(bindingFileResources.toArray(new XmlResource[bindingFileResources.size()]), checkForMultipleOccurences);
+ }
+
+ public static boolean containsGlobalBindingSection(XmlResource[] bindingFileResources, boolean checkForMultipleOccurences) {
+ int count = 0;
+ try {
+ for (XmlResource bindingFileResource : bindingFileResources) {
+ ScoutXmlDocument xmlBindingFile = bindingFileResource.loadXml();
+
+ List<ScoutXmlElement> candidates = xmlBindingFile.getRoot().getDescendants("*:globalBindings");
+ for (ScoutXmlElement candidate : candidates) {
+ String prefix = candidate.getNamePrefix();
+ String namespace = candidate.getNamespace(prefix);
+ if (namespace.equals("http://java.sun.com/xml/ns/jaxb")) {
+ count++;
+ if (checkForMultipleOccurences) {
+ if (count > 1) {
+ return true;
+ }
+ }
+ else {
+ return true;
+ }
+ break;
+ }
+ }
+ }
+ }
+ catch (Exception e) {
+ // nop
+ }
+ return false;
+ }
+
+ private static String getStubJarFilePath(String jarFileName) {
+ if (jarFileName == null) {
+ return null;
+ }
+ // ensure no file extension set
+ jarFileName = new Path(jarFileName).removeFileExtension().lastSegment();
+ // ensure valid filename
+ jarFileName = JaxWsSdkUtility.toValidFileName(jarFileName);
+ String folder = JaxWsSdkUtility.normalizePath(JaxWsConstants.STUB_FOLDER, SeparatorType.BothType);
+ return StringUtility.join("/", folder, jarFileName + ".jar");
+ }
+
+ public static IFile getStubJarFile(IScoutBundle bundle, BuildJaxWsBean buildJaxWsBean, String wsdlFileName) {
+ Map<String, List<String>> buildProperties = null;
+ if (buildJaxWsBean != null) {
+ buildProperties = buildJaxWsBean.getPropertiers();
+ }
+ return JaxWsSdkUtility.getStubJarFile(bundle, buildProperties, wsdlFileName);
+ }
+
+ /**
+ * <p>
+ * To get the stub file for a provider or consumer. The stub file is resolved as follows:
+ * </p>
+ * <ol>
+ * <li>build properties are looked for a {@link JaxWsConstants#OPTION_JAR} entry</li>
+ * <li>JAR file name is derived from WSDL file name</li>
+ * </ol>
+ *
+ * @param bundle
+ * @param buildProperties
+ * @param wsdlFileName
+ * @return
+ */
+ public static IFile getStubJarFile(IScoutBundle bundle, Map<String, List<String>> buildProperties, String wsdlFileName) {
+ String jarFileName = null;
+ if (buildProperties != null) {
+ // custom JAR name specified by -jar option in build properties
+ String customJarFileName = JaxWsSdkUtility.getBuildProperty(buildProperties, JaxWsConstants.OPTION_JAR);
+ if (StringUtility.hasText(customJarFileName)) {
+ jarFileName = new Path(customJarFileName).removeFileExtension().lastSegment();
+ }
+ }
+ // default jar name derived from WSDL file name
+ if (jarFileName == null && wsdlFileName != null) {
+ jarFileName = new Path(wsdlFileName).removeFileExtension().lastSegment();
+ }
+ if (jarFileName == null) {
+ JaxWsSdk.logWarning("Failed to derive stub JAR file name. Ensure WSDL file to exist or specify the build property '" + JaxWsConstants.OPTION_JAR + "' with the JAR file name as its value");
+ return null;
+ }
+
+ String path = JaxWsSdkUtility.getStubJarFilePath(jarFileName);
+ return JaxWsSdkUtility.getFile(bundle, path, false);
+ }
+
+ public static IScoutBundle getRootBundle(IScoutBundle serverBundle) {
+ if (serverBundle.getType() != IScoutElement.BUNDLE_SERVER) {
+ return null;
+ }
+ IScoutBundle bundle = serverBundle;
+
+ while (bundle.getScoutProject().getParentProject() != null) {
+ IScoutBundle candidate = bundle.getScoutProject().getParentProject().getServerBundle();
+ if (candidate == null || !serverBundle.isOnClasspath(candidate)) {
+ break;
+ }
+ bundle = bundle.getScoutProject().getParentProject().getServerBundle();
+ }
+ return bundle;
+ }
+
+ public static boolean registerJarLib(IScoutBundle bundle, IFile jarFile, boolean remove, IProgressMonitor monitor) {
+ boolean success = true;
+ JaxWsSdkUtility.refreshLocal(jarFile, IResource.DEPTH_ONE);
+
+ String jarFilePath = JaxWsSdkUtility.normalizePath(jarFile.getProjectRelativePath().toPortableString(), SeparatorType.None);
+ IJavaProject javaProject = bundle.getJavaProject();
+ IProject project = bundle.getProject();
+
+ // update Java class path in .classpath file
+ try {
+ List<IClasspathEntry> cpeList = new ArrayList<IClasspathEntry>();
+ for (IClasspathEntry cpe : javaProject.getRawClasspath()) {
+ if (cpe.getEntryKind() == IClasspathEntry.CPE_LIBRARY) {
+ if (!cpe.getPath().equals(project.getFullPath().append(jarFilePath))) {
+ cpeList.add(cpe);
+ }
+ }
+ else {
+ cpeList.add(cpe);
+ }
+ }
+ if (!remove) {
+ cpeList.add(JavaCore.newLibraryEntry(project.getFullPath().append(jarFilePath), null, null, true));
+ }
+ javaProject.setRawClasspath(cpeList.toArray(new IClasspathEntry[cpeList.size()]), monitor);
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("could not update Java class path in .classpath file", e);
+ }
+
+ // update Bundle-ClassPath in MANIFEST.MF
+ PluginModelHelper h = new PluginModelHelper(project);
+ try {
+ if (remove) {
+ h.Manifest.removeClasspathEntry(jarFile);
+ }
+ else {
+ h.Manifest.addClasspathEntry(jarFile);
+ }
+ h.Manifest.addClasspathDefaultEntry();
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("could not update Bundle-ClassPath in MANIFEST.MF", e);
+ success = false;
+ }
+
+ // update bin.includes in build.properties
+ try {
+ // remove JAR file registration as folder is registered anyway
+ h.BuildProperties.removeBinaryBuildEntry(jarFile);
+ if (!remove) {
+ // register folder, not file
+ h.BuildProperties.addBinaryBuildEntry(JaxWsSdkUtility.getParentFolder(bundle, jarFile));
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("could not update bin.includes in build.properties", e);
+ success = false;
+ }
+ h.save();
+
+ return success;
+ }
+
+ public static void overrideUnimplementedMethodsAsync(IType type) {
+ OverrideUnimplementedMethodsOperation op = new OverrideUnimplementedMethodsOperation();
+ op.setType(type);
+ new OperationJob(op).schedule();
+ }
+
+ public static <T> void removeDuplicateEntries(List<T> list) {
+ Set<T> elementsVisited = new HashSet<T>();
+ Iterator<T> iterator = list.iterator();
+ while (iterator.hasNext()) {
+ T element = iterator.next();
+ if (elementsVisited.contains(element)) {
+ iterator.remove();
+ }
+ elementsVisited.add(element);
+ }
+ }
+
+ public static void sortTypesByName(List<IType> list, boolean removeDuplicates) {
+ if (removeDuplicates) {
+ JaxWsSdkUtility.removeDuplicateEntries(list);
+ }
+
+ Collections.sort(list, new Comparator<IType>() {
+
+ @Override
+ public int compare(IType type1, IType type2) {
+ return CompareUtility.compareTo(type1.getElementName(), type2.getElementName());
+ }
+ });
+ }
+
+ public static IFolder getParentFolder(IScoutBundle bundle, IFile file) {
+ if (file == null) {
+ return null;
+ }
+ IPath parentFolderPath = file.getProjectRelativePath().removeLastSegments(1);
+ if (parentFolderPath.segmentCount() == 0) {
+ return null;
+ }
+ return JaxWsSdkUtility.getFolder(bundle, parentFolderPath.toPortableString(), false);
+ }
+
+ public static IFolder openProjectFolderDialog(IScoutBundle bundle, ViewerFilter filter, String title, String description, IFolder rootFolder, IFolder initialFolder) {
+ if (!JaxWsSdkUtility.exists(rootFolder)) {
+ rootFolder = JaxWsSdkUtility.getFolder(bundle, rootFolder.getProjectRelativePath().toPortableString(), true);
+ }
+ ILabelProvider labelProvider = new WorkbenchLabelProvider();
+ ITreeContentProvider contentProvider = new WorkbenchContentProvider();
+ FolderSelectionDialog dialog = new FolderSelectionDialog(ScoutSdkUi.getShell(), labelProvider, contentProvider);
+ dialog.setTitle(title);
+ dialog.setMessage(description);
+ dialog.addFilter(filter);
+ dialog.setHelpAvailable(false);
+ dialog.setAllowMultiple(false);
+ if (initialFolder != null) {
+ dialog.setInitialSelection(initialFolder);
+ }
+ String parentFolderPath = rootFolder.getProjectRelativePath().removeLastSegments(1).toPortableString();
+ dialog.setInput(JaxWsSdkUtility.getFolder(bundle, parentFolderPath, true));
+ dialog.setComparator(new ResourceComparator(ResourceComparator.NAME));
+
+ if (dialog.open() == Window.OK) {
+ return (IFolder) dialog.getFirstResult();
+ }
+ return null;
+ }
+
+ public static enum SeparatorType {
+ LeadingType, TrailingType, BothType, None;
+ }
+
+ private static class JarFileSearchScope implements IJavaSearchScope {
+
+ private IFile m_jarFile;
+
+ public JarFileSearchScope(IFile jarFile) {
+ m_jarFile = jarFile;
+ }
+
+ @Override
+ public boolean encloses(String resourcePath) {
+ return true;
+ }
+
+ @Override
+ public boolean encloses(IJavaElement element) {
+ return (element.getElementType() == IJavaElement.TYPE);
+ }
+
+ @Override
+ public IPath[] enclosingProjectsAndJars() {
+ return new IPath[]{m_jarFile.getFullPath()};
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public boolean includesBinaries() {
+ return true;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public boolean includesClasspaths() {
+ return false;
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void setIncludesBinaries(boolean includesBinaries) {
+ }
+
+ @SuppressWarnings("deprecation")
+ @Override
+ public void setIncludesClasspaths(boolean includesClasspaths) {
+ }
+
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/SchemaUtility.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/SchemaUtility.java
index 3383714df..162f88cfd 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/SchemaUtility.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/SchemaUtility.java
@@ -1,380 +1,380 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.util;
-
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map;
-
-import javax.wsdl.Definition;
-import javax.wsdl.Import;
-import javax.wsdl.Types;
-import javax.wsdl.extensions.schema.Schema;
-import javax.wsdl.extensions.schema.SchemaImport;
-import javax.wsdl.extensions.schema.SchemaReference;
-import javax.wsdl.factory.WSDLFactory;
-import javax.wsdl.xml.WSDLReader;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
-
-public final class SchemaUtility {
-
- private SchemaUtility() {
- }
-
- public static Artefact[] getArtefacts(IFile wsdlFile, boolean includeRootWsdl) {
- return getArtefacts(JaxWsSdkUtility.toFile(wsdlFile), includeRootWsdl);
- }
-
- public static Artefact[] getArtefacts(File wsdlFile, boolean includeRootWsdl) {
- if (wsdlFile == null || !wsdlFile.exists()) {
- return new Artefact[0];
- }
-
- Definition wsdlDefinition = loadWsdlDefinition(wsdlFile);
- if (wsdlDefinition == null) {
- return new Artefact[0];
- }
- List<Artefact> artefacts = new ArrayList<Artefact>();
-
- // root WSDL file
- WsdlArtefact rootWsdlArtefact = new WsdlArtefact(wsdlFile, TypeEnum.RootWsdl, wsdlDefinition);
- artefacts.add(rootWsdlArtefact);
- // referenced WSDL files
- artefacts.addAll(Arrays.asList(getReferencedWsdlResourcesRec(wsdlFile, wsdlDefinition)));
-
- // set inline schemas to WSDL resources and resolve referenced schema resources
- Artefact[] wsdlArtefacts = artefacts.toArray(new Artefact[artefacts.size()]);
- for (Artefact artefact : wsdlArtefacts) {
- if (!(artefact instanceof WsdlArtefact)) {
- continue;
- }
- WsdlArtefact wsdlArtefact = (WsdlArtefact) artefact;
-
- if (wsdlArtefact.getWsdlDefintion() == null) {
- JaxWsSdk.logWarning("Unexpected: WSDL definition should not be null '" + wsdlArtefact + "'");
- continue;
- }
-
- Types types = wsdlArtefact.getWsdlDefintion().getTypes();
- if (types != null) {
- List<Schema> inlineSchemas = new ArrayList<Schema>();
- for (Object type : types.getExtensibilityElements()) {
- if (type instanceof Schema) {
- Schema schema = (Schema) type;
- // inline schema
- inlineSchemas.add(schema);
- // referenced schema resources
- artefacts.addAll(Arrays.asList(getReferencedSchemaResourcesRec(wsdlArtefact.getFile(), schema)));
- }
- }
- wsdlArtefact.setInlineSchemas(inlineSchemas.toArray(new Schema[inlineSchemas.size()]));
- }
- }
-
- if (!includeRootWsdl) {
- artefacts.remove(rootWsdlArtefact);
- }
- JaxWsSdkUtility.removeDuplicateEntries(artefacts);
- return artefacts.toArray(new Artefact[artefacts.size()]);
- }
-
- public static String getSchemaTargetNamespace(Schema schema) {
- if (schema == null) {
- return null;
- }
- if (schema.getElement().hasAttribute("targetNamespace")) {
- return schema.getElement().getAttribute("targetNamespace");
- }
- return null;
- }
-
- private static WsdlArtefact[] getReferencedWsdlResourcesRec(File parentWsdlFile, Definition parentWsdlDefinition) {
- if (parentWsdlFile == null || !parentWsdlFile.exists() || parentWsdlDefinition == null) {
- return new WsdlArtefact[0];
- }
-
- List<WsdlArtefact> wsdlArtefacts = new ArrayList<WsdlArtefact>();
- Map<?, ?> importMap = parentWsdlDefinition.getImports();
-
- for (Object importValue : importMap.values()) {
- if (importValue instanceof List<?>) {
- List<?> importList = (List<?>) importValue;
- for (Object importObject : importList) {
- if (importObject instanceof Import) {
- Import importDirective = (Import) importObject;
-
- Definition wsdlDefinition = importDirective.getDefinition();
- File wsdlFile = toFile(parentWsdlFile.getParentFile(), importDirective.getLocationURI());
- if (wsdlFile != null) {
- wsdlArtefacts.add(new WsdlArtefact(wsdlFile, TypeEnum.ReferencedWsdl, wsdlDefinition));
-
- // recursion
- wsdlArtefacts.addAll(Arrays.asList(getReferencedWsdlResourcesRec(wsdlFile, wsdlDefinition)));
- }
- }
- }
- }
- }
-
- return wsdlArtefacts.toArray(new WsdlArtefact[wsdlArtefacts.size()]);
- }
-
- private static SchemaArtefact[] getReferencedSchemaResourcesRec(File file, Schema schema) {
- if (file == null || !file.exists() || schema == null) {
- return new SchemaArtefact[0];
- }
- File folder = file.getParentFile();
- List<Artefact> artefacts = new ArrayList<Artefact>();
-
- // Included schemas
- List<?> includes = schema.getIncludes();
- if (includes != null && includes.size() > 0) {
- for (Object include : includes) {
- if (include instanceof SchemaReference) {
- SchemaReference schemaInclude = (SchemaReference) include;
-
- File referencedSchemaFile = toFile(folder, schemaInclude.getSchemaLocationURI());
- if (referencedSchemaFile != null) {
- Schema referencedSchema = schemaInclude.getReferencedSchema();
- SchemaIncludeArtefact artefact = new SchemaIncludeArtefact(referencedSchemaFile, referencedSchema);
- artefacts.add(artefact);
-
- // recursion
- artefacts.addAll(Arrays.asList(getReferencedSchemaResourcesRec(referencedSchemaFile, referencedSchema)));
- }
- }
- }
- }
-
- // Imported schemas
- Map<?, ?> importMap = schema.getImports();
- if (importMap != null && importMap.size() > 0) {
- for (Object importObject : importMap.values()) {
- if (importObject instanceof List<?>) {
- List<?> importList = (List<?>) importObject;
-
- for (Object importDirective : importList) {
- if (importDirective instanceof SchemaImport) {
- SchemaImport schemaImport = (SchemaImport) importDirective;
- File referencedSchemaFile = toFile(folder, schemaImport.getSchemaLocationURI());
- if (referencedSchemaFile != null) {
- Schema referencedSchema = schemaImport.getReferencedSchema();
- SchemaImportArtefact artefact = new SchemaImportArtefact(referencedSchemaFile, referencedSchema, schemaImport.getNamespaceURI());
- artefacts.add(artefact);
-
- // recursion
- artefacts.addAll(Arrays.asList(getReferencedSchemaResourcesRec(referencedSchemaFile, referencedSchema)));
- }
- }
- }
- }
- }
- }
- return artefacts.toArray(new SchemaArtefact[artefacts.size()]);
- }
-
- private static Definition loadWsdlDefinition(File file) {
- if (file == null || !file.exists()) {
- return null;
- }
-
- try {
- WSDLFactory factory = WSDLFactory.newInstance();
- WSDLReader reader = factory.newWSDLReader();
- return reader.readWSDL(file.getAbsolutePath());
- }
- catch (Exception e) {
- JaxWsSdk.logError("Could not load WSDL file '" + file.getAbsolutePath() + "'", e);
- }
- return null;
- }
-
- private static File toFile(File folder, String locationUri) {
- if (locationUri == null) {
- return null;
- }
- if (folder != null && folder.exists()) {
- File file = new File(folder, locationUri);
- if (file.exists()) {
- return file;
- }
- }
- File file = new File(locationUri);
- if (file.exists()) {
- return file;
- }
- return null;
- }
-
- public static abstract class Artefact {
- private File m_file;
-
- public Artefact(File file) {
- m_file = file;
- }
-
- public File getFile() {
- return m_file;
- }
-
- public void setFile(File file) {
- m_file = file;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = 1;
- result = prime * result + ((m_file == null) ? 0 : m_file.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- Artefact other = (Artefact) obj;
- if (m_file == null) {
- if (other.m_file != null) {
- return false;
- }
- }
- else if (!m_file.equals(other.m_file)) {
- return false;
- }
- return true;
- }
- }
-
- public static class WsdlArtefact extends Artefact {
- private TypeEnum m_typeEnum;
- private Definition m_wsdlDefintion;
- private Schema[] m_inlineSchemas = new Schema[0];
-
- public WsdlArtefact(File wsdlFile, TypeEnum typeEnum, Definition wsdlDefintion) {
- super(wsdlFile);
- m_typeEnum = typeEnum;
- m_wsdlDefintion = wsdlDefintion;
- }
-
- public TypeEnum getTypeEnum() {
- return m_typeEnum;
- }
-
- public void setTypeEnum(TypeEnum typeEnum) {
- m_typeEnum = typeEnum;
- }
-
- public Definition getWsdlDefintion() {
- return m_wsdlDefintion;
- }
-
- public void setWsdlDefintion(Definition wsdlDefintion) {
- m_wsdlDefintion = wsdlDefintion;
- }
-
- public Schema[] getInlineSchemas() {
- if (m_inlineSchemas == null) {
- return new Schema[0];
- }
- else {
- return m_inlineSchemas;
- }
- }
-
- public void setInlineSchemas(Schema[] inlineSchemas) {
- m_inlineSchemas = inlineSchemas;
- }
-
- @Override
- public int hashCode() {
- final int prime = 31;
- int result = super.hashCode();
- result = prime * result + ((m_typeEnum == null) ? 0 : m_typeEnum.hashCode());
- return result;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (!super.equals(obj)) {
- return false;
- }
- if (getClass() != obj.getClass()) {
- return false;
- }
- WsdlArtefact other = (WsdlArtefact) obj;
- if (m_typeEnum != other.m_typeEnum) {
- return false;
- }
- return true;
- }
-
- public static enum TypeEnum {
- RootWsdl, ReferencedWsdl;
- }
- }
-
- public static abstract class SchemaArtefact extends Artefact {
- private Schema m_schema;
-
- public SchemaArtefact(File schemaFile, Schema schema) {
- super(schemaFile);
- m_schema = schema;
- }
-
- public Schema getSchema() {
- return m_schema;
- }
-
- public void setSchema(Schema schema) {
- m_schema = schema;
- }
- }
-
- public static class SchemaImportArtefact extends SchemaArtefact {
- private String m_namespaceUri;
-
- public SchemaImportArtefact(File schemaFile, Schema schema, String namespaceUri) {
- super(schemaFile, schema);
- m_namespaceUri = namespaceUri;
- }
-
- public String getNamespaceUri() {
- return m_namespaceUri;
- }
-
- public void setNamespaceUri(String namespaceUri) {
- m_namespaceUri = namespaceUri;
- }
- }
-
- public static class SchemaIncludeArtefact extends SchemaArtefact {
-
- public SchemaIncludeArtefact(File schemaFile, Schema schema) {
- super(schemaFile, schema);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.util;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map;
+
+import javax.wsdl.Definition;
+import javax.wsdl.Import;
+import javax.wsdl.Types;
+import javax.wsdl.extensions.schema.Schema;
+import javax.wsdl.extensions.schema.SchemaImport;
+import javax.wsdl.extensions.schema.SchemaReference;
+import javax.wsdl.factory.WSDLFactory;
+import javax.wsdl.xml.WSDLReader;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+import org.eclipse.scout.sdk.ws.jaxws.util.SchemaUtility.WsdlArtefact.TypeEnum;
+
+public final class SchemaUtility {
+
+ private SchemaUtility() {
+ }
+
+ public static Artefact[] getArtefacts(IFile wsdlFile, boolean includeRootWsdl) {
+ return getArtefacts(JaxWsSdkUtility.toFile(wsdlFile), includeRootWsdl);
+ }
+
+ public static Artefact[] getArtefacts(File wsdlFile, boolean includeRootWsdl) {
+ if (wsdlFile == null || !wsdlFile.exists()) {
+ return new Artefact[0];
+ }
+
+ Definition wsdlDefinition = loadWsdlDefinition(wsdlFile);
+ if (wsdlDefinition == null) {
+ return new Artefact[0];
+ }
+ List<Artefact> artefacts = new ArrayList<Artefact>();
+
+ // root WSDL file
+ WsdlArtefact rootWsdlArtefact = new WsdlArtefact(wsdlFile, TypeEnum.RootWsdl, wsdlDefinition);
+ artefacts.add(rootWsdlArtefact);
+ // referenced WSDL files
+ artefacts.addAll(Arrays.asList(getReferencedWsdlResourcesRec(wsdlFile, wsdlDefinition)));
+
+ // set inline schemas to WSDL resources and resolve referenced schema resources
+ Artefact[] wsdlArtefacts = artefacts.toArray(new Artefact[artefacts.size()]);
+ for (Artefact artefact : wsdlArtefacts) {
+ if (!(artefact instanceof WsdlArtefact)) {
+ continue;
+ }
+ WsdlArtefact wsdlArtefact = (WsdlArtefact) artefact;
+
+ if (wsdlArtefact.getWsdlDefintion() == null) {
+ JaxWsSdk.logWarning("Unexpected: WSDL definition should not be null '" + wsdlArtefact + "'");
+ continue;
+ }
+
+ Types types = wsdlArtefact.getWsdlDefintion().getTypes();
+ if (types != null) {
+ List<Schema> inlineSchemas = new ArrayList<Schema>();
+ for (Object type : types.getExtensibilityElements()) {
+ if (type instanceof Schema) {
+ Schema schema = (Schema) type;
+ // inline schema
+ inlineSchemas.add(schema);
+ // referenced schema resources
+ artefacts.addAll(Arrays.asList(getReferencedSchemaResourcesRec(wsdlArtefact.getFile(), schema)));
+ }
+ }
+ wsdlArtefact.setInlineSchemas(inlineSchemas.toArray(new Schema[inlineSchemas.size()]));
+ }
+ }
+
+ if (!includeRootWsdl) {
+ artefacts.remove(rootWsdlArtefact);
+ }
+ JaxWsSdkUtility.removeDuplicateEntries(artefacts);
+ return artefacts.toArray(new Artefact[artefacts.size()]);
+ }
+
+ public static String getSchemaTargetNamespace(Schema schema) {
+ if (schema == null) {
+ return null;
+ }
+ if (schema.getElement().hasAttribute("targetNamespace")) {
+ return schema.getElement().getAttribute("targetNamespace");
+ }
+ return null;
+ }
+
+ private static WsdlArtefact[] getReferencedWsdlResourcesRec(File parentWsdlFile, Definition parentWsdlDefinition) {
+ if (parentWsdlFile == null || !parentWsdlFile.exists() || parentWsdlDefinition == null) {
+ return new WsdlArtefact[0];
+ }
+
+ List<WsdlArtefact> wsdlArtefacts = new ArrayList<WsdlArtefact>();
+ Map<?, ?> importMap = parentWsdlDefinition.getImports();
+
+ for (Object importValue : importMap.values()) {
+ if (importValue instanceof List<?>) {
+ List<?> importList = (List<?>) importValue;
+ for (Object importObject : importList) {
+ if (importObject instanceof Import) {
+ Import importDirective = (Import) importObject;
+
+ Definition wsdlDefinition = importDirective.getDefinition();
+ File wsdlFile = toFile(parentWsdlFile.getParentFile(), importDirective.getLocationURI());
+ if (wsdlFile != null) {
+ wsdlArtefacts.add(new WsdlArtefact(wsdlFile, TypeEnum.ReferencedWsdl, wsdlDefinition));
+
+ // recursion
+ wsdlArtefacts.addAll(Arrays.asList(getReferencedWsdlResourcesRec(wsdlFile, wsdlDefinition)));
+ }
+ }
+ }
+ }
+ }
+
+ return wsdlArtefacts.toArray(new WsdlArtefact[wsdlArtefacts.size()]);
+ }
+
+ private static SchemaArtefact[] getReferencedSchemaResourcesRec(File file, Schema schema) {
+ if (file == null || !file.exists() || schema == null) {
+ return new SchemaArtefact[0];
+ }
+ File folder = file.getParentFile();
+ List<Artefact> artefacts = new ArrayList<Artefact>();
+
+ // Included schemas
+ List<?> includes = schema.getIncludes();
+ if (includes != null && includes.size() > 0) {
+ for (Object include : includes) {
+ if (include instanceof SchemaReference) {
+ SchemaReference schemaInclude = (SchemaReference) include;
+
+ File referencedSchemaFile = toFile(folder, schemaInclude.getSchemaLocationURI());
+ if (referencedSchemaFile != null) {
+ Schema referencedSchema = schemaInclude.getReferencedSchema();
+ SchemaIncludeArtefact artefact = new SchemaIncludeArtefact(referencedSchemaFile, referencedSchema);
+ artefacts.add(artefact);
+
+ // recursion
+ artefacts.addAll(Arrays.asList(getReferencedSchemaResourcesRec(referencedSchemaFile, referencedSchema)));
+ }
+ }
+ }
+ }
+
+ // Imported schemas
+ Map<?, ?> importMap = schema.getImports();
+ if (importMap != null && importMap.size() > 0) {
+ for (Object importObject : importMap.values()) {
+ if (importObject instanceof List<?>) {
+ List<?> importList = (List<?>) importObject;
+
+ for (Object importDirective : importList) {
+ if (importDirective instanceof SchemaImport) {
+ SchemaImport schemaImport = (SchemaImport) importDirective;
+ File referencedSchemaFile = toFile(folder, schemaImport.getSchemaLocationURI());
+ if (referencedSchemaFile != null) {
+ Schema referencedSchema = schemaImport.getReferencedSchema();
+ SchemaImportArtefact artefact = new SchemaImportArtefact(referencedSchemaFile, referencedSchema, schemaImport.getNamespaceURI());
+ artefacts.add(artefact);
+
+ // recursion
+ artefacts.addAll(Arrays.asList(getReferencedSchemaResourcesRec(referencedSchemaFile, referencedSchema)));
+ }
+ }
+ }
+ }
+ }
+ }
+ return artefacts.toArray(new SchemaArtefact[artefacts.size()]);
+ }
+
+ private static Definition loadWsdlDefinition(File file) {
+ if (file == null || !file.exists()) {
+ return null;
+ }
+
+ try {
+ WSDLFactory factory = WSDLFactory.newInstance();
+ WSDLReader reader = factory.newWSDLReader();
+ return reader.readWSDL(file.getAbsolutePath());
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("Could not load WSDL file '" + file.getAbsolutePath() + "'", e);
+ }
+ return null;
+ }
+
+ private static File toFile(File folder, String locationUri) {
+ if (locationUri == null) {
+ return null;
+ }
+ if (folder != null && folder.exists()) {
+ File file = new File(folder, locationUri);
+ if (file.exists()) {
+ return file;
+ }
+ }
+ File file = new File(locationUri);
+ if (file.exists()) {
+ return file;
+ }
+ return null;
+ }
+
+ public static abstract class Artefact {
+ private File m_file;
+
+ public Artefact(File file) {
+ m_file = file;
+ }
+
+ public File getFile() {
+ return m_file;
+ }
+
+ public void setFile(File file) {
+ m_file = file;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((m_file == null) ? 0 : m_file.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (obj == null) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ Artefact other = (Artefact) obj;
+ if (m_file == null) {
+ if (other.m_file != null) {
+ return false;
+ }
+ }
+ else if (!m_file.equals(other.m_file)) {
+ return false;
+ }
+ return true;
+ }
+ }
+
+ public static class WsdlArtefact extends Artefact {
+ private TypeEnum m_typeEnum;
+ private Definition m_wsdlDefintion;
+ private Schema[] m_inlineSchemas = new Schema[0];
+
+ public WsdlArtefact(File wsdlFile, TypeEnum typeEnum, Definition wsdlDefintion) {
+ super(wsdlFile);
+ m_typeEnum = typeEnum;
+ m_wsdlDefintion = wsdlDefintion;
+ }
+
+ public TypeEnum getTypeEnum() {
+ return m_typeEnum;
+ }
+
+ public void setTypeEnum(TypeEnum typeEnum) {
+ m_typeEnum = typeEnum;
+ }
+
+ public Definition getWsdlDefintion() {
+ return m_wsdlDefintion;
+ }
+
+ public void setWsdlDefintion(Definition wsdlDefintion) {
+ m_wsdlDefintion = wsdlDefintion;
+ }
+
+ public Schema[] getInlineSchemas() {
+ if (m_inlineSchemas == null) {
+ return new Schema[0];
+ }
+ else {
+ return m_inlineSchemas;
+ }
+ }
+
+ public void setInlineSchemas(Schema[] inlineSchemas) {
+ m_inlineSchemas = inlineSchemas;
+ }
+
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = super.hashCode();
+ result = prime * result + ((m_typeEnum == null) ? 0 : m_typeEnum.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) {
+ return true;
+ }
+ if (!super.equals(obj)) {
+ return false;
+ }
+ if (getClass() != obj.getClass()) {
+ return false;
+ }
+ WsdlArtefact other = (WsdlArtefact) obj;
+ if (m_typeEnum != other.m_typeEnum) {
+ return false;
+ }
+ return true;
+ }
+
+ public static enum TypeEnum {
+ RootWsdl, ReferencedWsdl;
+ }
+ }
+
+ public static abstract class SchemaArtefact extends Artefact {
+ private Schema m_schema;
+
+ public SchemaArtefact(File schemaFile, Schema schema) {
+ super(schemaFile);
+ m_schema = schema;
+ }
+
+ public Schema getSchema() {
+ return m_schema;
+ }
+
+ public void setSchema(Schema schema) {
+ m_schema = schema;
+ }
+ }
+
+ public static class SchemaImportArtefact extends SchemaArtefact {
+ private String m_namespaceUri;
+
+ public SchemaImportArtefact(File schemaFile, Schema schema, String namespaceUri) {
+ super(schemaFile, schema);
+ m_namespaceUri = namespaceUri;
+ }
+
+ public String getNamespaceUri() {
+ return m_namespaceUri;
+ }
+
+ public void setNamespaceUri(String namespaceUri) {
+ m_namespaceUri = namespaceUri;
+ }
+ }
+
+ public static class SchemaIncludeArtefact extends SchemaArtefact {
+
+ public SchemaIncludeArtefact(File schemaFile, Schema schema) {
+ super(schemaFile, schema);
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/ServletRegistrationUtility.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/ServletRegistrationUtility.java
index fdddb03c8..a7b0e4c6e 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/ServletRegistrationUtility.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/ServletRegistrationUtility.java
@@ -1,163 +1,163 @@
-/*******************************************************************************
- * Copyright (c) 2010 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * BSI Business Systems Integration AG - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.util;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Set;
-
-import org.eclipse.pde.core.plugin.IPluginAttribute;
-import org.eclipse.pde.core.plugin.IPluginElement;
-import org.eclipse.scout.commons.StringUtility;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
-import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
-import org.eclipse.scout.sdk.util.pde.PluginModelHelper;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.workspace.IScoutBundle;
-import org.eclipse.scout.sdk.workspace.IScoutBundleFilter;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
-import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
-
-public final class ServletRegistrationUtility {
-
- public static final String XML_SERVLET_BUNDLE = "servlet-bundle";
- public static final String XML_NAME = "name";
-
- private ServletRegistrationUtility() {
- }
-
- public static String getBuildJaxServletRegistrationBundleName(IScoutBundle bundle) {
- if (bundle == null) {
- return null;
- }
- if (bundle.getType() != IScoutBundle.BUNDLE_SERVER) {
- return null;
- }
-
- ScoutXmlDocument document = ResourceFactory.getBuildJaxWsResource(bundle).loadXml();
- if (document == null || document.getRoot() == null) {
- return null;
- }
-
- ScoutXmlElement xml = document.getRoot().getChild(XML_SERVLET_BUNDLE);
- if (xml == null) {
- return null;
- }
- if (!xml.hasAttribute(XML_NAME)) {
- return null;
- }
- final String bundleName = xml.getAttribute(XML_NAME);
- if (!StringUtility.hasText(bundleName)) {
- return null;
- }
-
- return bundleName;
- }
-
- public static Registration getServletRegistration(IScoutBundle bundle) {
- final String bundleName = getBuildJaxServletRegistrationBundleName(bundle);
-
- Registration[] registrations = getJaxWsServletRegistrationsOnClasspath(bundle);
- for (Registration registration : registrations) {
- if (registration.getBundle().getBundleName().equals(bundleName)) {
- return registration;
- }
- }
- return null;
- }
-
- public static IScoutBundle[] getJaxWsBundlesOnClasspath(IScoutBundle bundle) {
- // get bundles on classpath with JAX-WS dependency installed
- if (bundle == null) {
- return new IScoutBundle[0];
- }
-
- // find required bundles with JAX-WS on classpath
- return bundle.getRequiredBundles(new IScoutBundleFilter() {
-
- @Override
- public boolean accept(IScoutBundle candidate) {
- // ensure server bundle
- if (candidate.getType() != IScoutBundle.BUNDLE_SERVER) {
- return false;
- }
- // check whether JAX-WS dependency is installed on bundle
- if (!TypeUtility.exists(TypeUtility.getType(JaxWsRuntimeClasses.JaxWsActivator)) || !TypeUtility.isOnClasspath(TypeUtility.getType(JaxWsRuntimeClasses.JaxWsActivator), candidate.getJavaProject())) {
- return false;
- }
- return true;
- }
- }, true);
- }
-
- /**
- * All JAX-WS servlet registrations on the classpath of the given bundle
- *
- * @param bundle
- * @return
- */
- public static Registration[] getJaxWsServletRegistrationsOnClasspath(IScoutBundle bundle) {
- // filter bundles with JAX-WS servlet registration in plugin.xml
- Set<Registration> bundles = new HashSet<Registration>();
- for (IScoutBundle candidate : getJaxWsBundlesOnClasspath(bundle)) {
- String extensionPoint = JaxWsConstants.SERVER_EXTENSION_POINT_SERVLETS;
- HashMap<String, String> attributes = new HashMap<String, String>();
- attributes.put("class", TypeUtility.getType(JaxWsRuntimeClasses.JaxWsServlet).getFullyQualifiedName());
- PluginModelHelper h = new PluginModelHelper(candidate.getProject());
- IPluginElement ex = h.PluginXml.getSimpleExtension(extensionPoint, "servlet", attributes);
- if (ex == null) {
- continue;
- }
- IPluginAttribute a = ex.getAttribute("alias");
- if (a == null) {
- continue;
- }
- bundles.add(new Registration(candidate, a.getValue()));
- }
-
- return bundles.toArray(new Registration[bundles.size()]);
- }
-
- public static String getAlias(IScoutBundle bundle) {
- Registration registration = ServletRegistrationUtility.getServletRegistration(bundle);
- if (registration == null) {
- return null;
- }
- return registration.getAlias();
- }
-
- public static class Registration {
- private IScoutBundle m_bundle;
- private String m_alias;
-
- private Registration(IScoutBundle bundle, String alias) {
- m_bundle = bundle;
- m_alias = alias;
- }
-
- public IScoutBundle getBundle() {
- return m_bundle;
- }
-
- public void setBundle(IScoutBundle bundle) {
- m_bundle = bundle;
- }
-
- public String getAlias() {
- return m_alias;
- }
-
- public void setAlias(String alias) {
- m_alias = alias;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2010 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * BSI Business Systems Integration AG - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.util;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.eclipse.pde.core.plugin.IPluginAttribute;
+import org.eclipse.pde.core.plugin.IPluginElement;
+import org.eclipse.scout.commons.StringUtility;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument;
+import org.eclipse.scout.commons.xmlparser.ScoutXmlDocument.ScoutXmlElement;
+import org.eclipse.scout.sdk.util.pde.PluginModelHelper;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.workspace.IScoutBundle;
+import org.eclipse.scout.sdk.workspace.IScoutBundleFilter;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsConstants;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsRuntimeClasses;
+import org.eclipse.scout.sdk.ws.jaxws.resource.ResourceFactory;
+
+public final class ServletRegistrationUtility {
+
+ public static final String XML_SERVLET_BUNDLE = "servlet-bundle";
+ public static final String XML_NAME = "name";
+
+ private ServletRegistrationUtility() {
+ }
+
+ public static String getBuildJaxServletRegistrationBundleName(IScoutBundle bundle) {
+ if (bundle == null) {
+ return null;
+ }
+ if (bundle.getType() != IScoutBundle.BUNDLE_SERVER) {
+ return null;
+ }
+
+ ScoutXmlDocument document = ResourceFactory.getBuildJaxWsResource(bundle).loadXml();
+ if (document == null || document.getRoot() == null) {
+ return null;
+ }
+
+ ScoutXmlElement xml = document.getRoot().getChild(XML_SERVLET_BUNDLE);
+ if (xml == null) {
+ return null;
+ }
+ if (!xml.hasAttribute(XML_NAME)) {
+ return null;
+ }
+ final String bundleName = xml.getAttribute(XML_NAME);
+ if (!StringUtility.hasText(bundleName)) {
+ return null;
+ }
+
+ return bundleName;
+ }
+
+ public static Registration getServletRegistration(IScoutBundle bundle) {
+ final String bundleName = getBuildJaxServletRegistrationBundleName(bundle);
+
+ Registration[] registrations = getJaxWsServletRegistrationsOnClasspath(bundle);
+ for (Registration registration : registrations) {
+ if (registration.getBundle().getBundleName().equals(bundleName)) {
+ return registration;
+ }
+ }
+ return null;
+ }
+
+ public static IScoutBundle[] getJaxWsBundlesOnClasspath(IScoutBundle bundle) {
+ // get bundles on classpath with JAX-WS dependency installed
+ if (bundle == null) {
+ return new IScoutBundle[0];
+ }
+
+ // find required bundles with JAX-WS on classpath
+ return bundle.getRequiredBundles(new IScoutBundleFilter() {
+
+ @Override
+ public boolean accept(IScoutBundle candidate) {
+ // ensure server bundle
+ if (candidate.getType() != IScoutBundle.BUNDLE_SERVER) {
+ return false;
+ }
+ // check whether JAX-WS dependency is installed on bundle
+ if (!TypeUtility.exists(TypeUtility.getType(JaxWsRuntimeClasses.JaxWsActivator)) || !TypeUtility.isOnClasspath(TypeUtility.getType(JaxWsRuntimeClasses.JaxWsActivator), candidate.getJavaProject())) {
+ return false;
+ }
+ return true;
+ }
+ }, true);
+ }
+
+ /**
+ * All JAX-WS servlet registrations on the classpath of the given bundle
+ *
+ * @param bundle
+ * @return
+ */
+ public static Registration[] getJaxWsServletRegistrationsOnClasspath(IScoutBundle bundle) {
+ // filter bundles with JAX-WS servlet registration in plugin.xml
+ Set<Registration> bundles = new HashSet<Registration>();
+ for (IScoutBundle candidate : getJaxWsBundlesOnClasspath(bundle)) {
+ String extensionPoint = JaxWsConstants.SERVER_EXTENSION_POINT_SERVLETS;
+ HashMap<String, String> attributes = new HashMap<String, String>();
+ attributes.put("class", TypeUtility.getType(JaxWsRuntimeClasses.JaxWsServlet).getFullyQualifiedName());
+ PluginModelHelper h = new PluginModelHelper(candidate.getProject());
+ IPluginElement ex = h.PluginXml.getSimpleExtension(extensionPoint, "servlet", attributes);
+ if (ex == null) {
+ continue;
+ }
+ IPluginAttribute a = ex.getAttribute("alias");
+ if (a == null) {
+ continue;
+ }
+ bundles.add(new Registration(candidate, a.getValue()));
+ }
+
+ return bundles.toArray(new Registration[bundles.size()]);
+ }
+
+ public static String getAlias(IScoutBundle bundle) {
+ Registration registration = ServletRegistrationUtility.getServletRegistration(bundle);
+ if (registration == null) {
+ return null;
+ }
+ return registration.getAlias();
+ }
+
+ public static class Registration {
+ private IScoutBundle m_bundle;
+ private String m_alias;
+
+ private Registration(IScoutBundle bundle, String alias) {
+ m_bundle = bundle;
+ m_alias = alias;
+ }
+
+ public IScoutBundle getBundle() {
+ return m_bundle;
+ }
+
+ public void setBundle(IScoutBundle bundle) {
+ m_bundle = bundle;
+ }
+
+ public String getAlias() {
+ return m_alias;
+ }
+
+ public void setAlias(String alias) {
+ m_alias = alias;
+ }
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/AbstractTypeChangedListener.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/AbstractTypeChangedListener.java
index bea6179c3..c34166c5e 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/AbstractTypeChangedListener.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/AbstractTypeChangedListener.java
@@ -1,109 +1,109 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-package org.eclipse.scout.sdk.ws.jaxws.util.listener;
-
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.resources.IResourceDeltaVisitor;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.jdt.core.ICompilationUnit;
-import org.eclipse.jdt.core.IType;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.util.type.TypeUtility;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-
-public abstract class AbstractTypeChangedListener implements IResourceChangeListener {
-
- private IType m_type;
-
- @Override
- public void resourceChanged(IResourceChangeEvent event) {
- if (!shouldAnalayseForChange(event)) {
- return;
- }
-
- // there is only interest in POST_CHANGE events
- if (event.getType() != IResourceChangeEvent.POST_CHANGE) {
- return;
- }
-
- if (m_type == null) {
- return;
- }
-
- // if type does not exist anymore, it was removed (That is because delta kind 'removed' does not work)
- if (!m_type.exists()) {
- typeChanged();
- return;
- }
-
- try {
- IResourceDelta rootDelta = event.getDelta();
- rootDelta.accept(new IResourceDeltaVisitor() {
- @Override
- public boolean visit(IResourceDelta delta) throws CoreException {
- if (m_type == null) {
- return false;
- }
-
- if (delta.getKind() == IResourceDelta.ADDED || (delta.getKind() == IResourceDelta.CHANGED && (delta.getFlags() & IResourceDelta.CONTENT) != 0)) { // it is crucial to exclude marker update events
- IResource resource = delta.getResource();
-
- if (resource.getType() == IResource.FILE &&
- resource.getFileExtension() != null &&
- resource.getFileExtension().equalsIgnoreCase("java") &&
- resource.getName().endsWith(m_type.getElementName() + ".java") &&
- resource.getProject() == m_type.getJavaProject().getProject()) {
-
- ICompilationUnit cu = JavaCore.createCompilationUnitFrom((IFile) resource);
- if (cu == null) {
- JaxWsSdk.logError("Compilation unit of file '" + resource.getName() + "' could not be determined.");
- return true;
- }
-
- for (IType typeChanged : cu.getTypes()) {
- if (TypeUtility.exists(typeChanged)) {
- typeChanged = TypeUtility.getToplevelType(typeChanged);
- }
- if (TypeUtility.exists(typeChanged) && (CompareUtility.equals(typeChanged, m_type))) {
- typeChanged();
- return false;
- }
- }
- }
- }
- return true;
- }
- });
- }
- catch (Exception e) {
- JaxWsSdk.logError("Unexpected error occured while intercepting resource changed event.", e);
- }
- }
-
- protected boolean shouldAnalayseForChange(IResourceChangeEvent event) {
- return true;
- }
-
- protected abstract void typeChanged();
-
- public IType getType() {
- return m_type;
- }
-
- public void setType(IType type) {
- m_type = type;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.scout.sdk.ws.jaxws.util.listener;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.resources.IResourceDeltaVisitor;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IType;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.util.type.TypeUtility;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+
+public abstract class AbstractTypeChangedListener implements IResourceChangeListener {
+
+ private IType m_type;
+
+ @Override
+ public void resourceChanged(IResourceChangeEvent event) {
+ if (!shouldAnalayseForChange(event)) {
+ return;
+ }
+
+ // there is only interest in POST_CHANGE events
+ if (event.getType() != IResourceChangeEvent.POST_CHANGE) {
+ return;
+ }
+
+ if (m_type == null) {
+ return;
+ }
+
+ // if type does not exist anymore, it was removed (That is because delta kind 'removed' does not work)
+ if (!m_type.exists()) {
+ typeChanged();
+ return;
+ }
+
+ try {
+ IResourceDelta rootDelta = event.getDelta();
+ rootDelta.accept(new IResourceDeltaVisitor() {
+ @Override
+ public boolean visit(IResourceDelta delta) throws CoreException {
+ if (m_type == null) {
+ return false;
+ }
+
+ if (delta.getKind() == IResourceDelta.ADDED || (delta.getKind() == IResourceDelta.CHANGED && (delta.getFlags() & IResourceDelta.CONTENT) != 0)) { // it is crucial to exclude marker update events
+ IResource resource = delta.getResource();
+
+ if (resource.getType() == IResource.FILE &&
+ resource.getFileExtension() != null &&
+ resource.getFileExtension().equalsIgnoreCase("java") &&
+ resource.getName().endsWith(m_type.getElementName() + ".java") &&
+ resource.getProject() == m_type.getJavaProject().getProject()) {
+
+ ICompilationUnit cu = JavaCore.createCompilationUnitFrom((IFile) resource);
+ if (cu == null) {
+ JaxWsSdk.logError("Compilation unit of file '" + resource.getName() + "' could not be determined.");
+ return true;
+ }
+
+ for (IType typeChanged : cu.getTypes()) {
+ if (TypeUtility.exists(typeChanged)) {
+ typeChanged = TypeUtility.getToplevelType(typeChanged);
+ }
+ if (TypeUtility.exists(typeChanged) && (CompareUtility.equals(typeChanged, m_type))) {
+ typeChanged();
+ return false;
+ }
+ }
+ }
+ }
+ return true;
+ }
+ });
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("Unexpected error occured while intercepting resource changed event.", e);
+ }
+ }
+
+ protected boolean shouldAnalayseForChange(IResourceChangeEvent event) {
+ return true;
+ }
+
+ protected abstract void typeChanged();
+
+ public IType getType() {
+ return m_type;
+ }
+
+ public void setType(IType type) {
+ m_type = type;
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IOperationFinishedListener.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IOperationFinishedListener.java
index 1b0005171..2438e8eef 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IOperationFinishedListener.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IOperationFinishedListener.java
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.util.listener;
-
-public interface IOperationFinishedListener {
- void operationFinished(boolean success, Throwable e);
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.util.listener;
+
+public interface IOperationFinishedListener {
+ void operationFinished(boolean success, Throwable e);
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPageLoadedListener.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPageLoadedListener.java
index 840a07e0c..b565eea5b 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPageLoadedListener.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPageLoadedListener.java
@@ -1,18 +1,18 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.util.listener;
-
-public interface IPageLoadedListener {
- void pageLoaded();
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.util.listener;
+
+public interface IPageLoadedListener {
+ void pageLoaded();
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPageReloadNotification.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPageReloadNotification.java
index 5533ef015..a8c6c843e 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPageReloadNotification.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPageReloadNotification.java
@@ -1,30 +1,30 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.util.listener;
-
-public interface IPageReloadNotification {
- /**
- * @param markerGroupUUID
- * the groupUUID this page belongs to
- * @param dataMask
- * mask to describe data change (<em>bitwise OR</em>). Constants are defined on the respective page
- */
- void reloadPage(int dataMask);
-
- /**
- * @return the markerGroupUUID the page belongs to. The page is only notified if the notification belongs to this
- * markerGroupUUID.
- */
- String getMarkerGroupUUID();
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.util.listener;
+
+public interface IPageReloadNotification {
+ /**
+ * @param markerGroupUUID
+ * the groupUUID this page belongs to
+ * @param dataMask
+ * mask to describe data change (<em>bitwise OR</em>). Constants are defined on the respective page
+ */
+ void reloadPage(int dataMask);
+
+ /**
+ * @return the markerGroupUUID the page belongs to. The page is only notified if the notification belongs to this
+ * markerGroupUUID.
+ */
+ String getMarkerGroupUUID();
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPresenterValueChangedListener.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPresenterValueChangedListener.java
index 0cafe683d..b4c6a2783 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPresenterValueChangedListener.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/util/listener/IPresenterValueChangedListener.java
@@ -1,19 +1,19 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.util.listener;
-
-public interface IPresenterValueChangedListener {
-
- public void propertyChanged(int presenterId, Object value);
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.util.listener;
+
+public interface IPresenterValueChangedListener {
+
+ public void propertyChanged(int presenterId, Object value);
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/worker/AbstractQueueManager.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/worker/AbstractQueueManager.java
index 18782ab89..ca941db1e 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/worker/AbstractQueueManager.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/worker/AbstractQueueManager.java
@@ -1,178 +1,178 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.worker;
-
-import java.util.concurrent.ConcurrentLinkedQueue;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.locks.Lock;
-import java.util.concurrent.locks.ReentrantLock;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.scout.commons.CompareUtility;
-import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
-
-public abstract class AbstractQueueManager<T> {
-
- private final Lock m_workerLock;
- private final Lock m_suspendLock;
- private final Lock m_refuseLock;
- private final ConcurrentLinkedQueue<T> m_requests;
-
- private AtomicInteger m_suspendCounter;
- private AtomicInteger m_refuseCounter;
-
- public AbstractQueueManager() {
- m_workerLock = new ReentrantLock();
- m_suspendLock = new ReentrantLock();
- m_refuseLock = new ReentrantLock();
- m_requests = new ConcurrentLinkedQueue<T>();
- m_suspendCounter = new AtomicInteger();
- m_refuseCounter = new AtomicInteger();
- }
-
- public void queueRequest(T request) {
- if (!isRefuseRequests()) {
- if (!m_requests.contains(request)) {
- m_requests.offer(request); // put request into queue
- }
- startWorker();
- }
- }
-
- public void refuseRequests(boolean refuseRequests) {
- m_refuseLock.lock();
- try {
- if (refuseRequests) {
- m_refuseCounter.incrementAndGet();
- }
- else {
- if (m_refuseCounter.decrementAndGet() < 0) { // negative values are not allowed
- m_refuseCounter.set(0);
- }
- }
- }
- finally {
- m_refuseLock.unlock();
- }
- }
-
- public void resume() {
- m_suspendLock.lock();
- try {
- if (m_suspendCounter.decrementAndGet() < 0) { // negative values are not allowed
- m_suspendCounter.set(0);
- }
-
- if (m_suspendCounter.get() == 0) { // only notify the worker about the request if compilation is not suspended
- startWorker();
- }
- }
- finally {
- m_suspendLock.unlock();
- }
- }
-
- public void suspend() {
- m_suspendLock.lock();
- try {
- m_suspendCounter.incrementAndGet();
- cancelWorker();
- }
- finally {
- m_suspendLock.unlock();
- }
- }
-
- private void startWorker() {
- if (m_workerLock.tryLock()) {
- try {
- if (!isWorkerActive() && !isSuspend()) {
- Job worker = new P_Worker();
- worker.setSystem(true);
- worker.setUser(false);
- worker.setPriority(Job.BUILD);
- worker.schedule(200);
- }
- }
- finally {
- m_workerLock.unlock();
- }
- }
- }
-
- public void cancelWorker() {
- if (m_workerLock.tryLock()) {
- try {
- if (isWorkerActive()) {
- for (Job job : Job.getJobManager().find(AbstractQueueManager.this)) {
- job.cancel();
- }
- }
- }
- finally {
- m_workerLock.unlock();
- }
- }
- }
-
- private final class P_Worker extends Job {
-
- public P_Worker() {
- super(AbstractQueueManager.this.getClass().getSimpleName());
- }
-
- @Override
- public boolean belongsTo(Object family) {
- return CompareUtility.equals(family, AbstractQueueManager.this);
- }
-
- @Override
- protected IStatus run(IProgressMonitor monitor) {
- m_workerLock.lock();
- try {
- T request;
- while ((request = m_requests.poll()) != null) {
- if (monitor.isCanceled()) {
- return Status.CANCEL_STATUS;
- }
- handleRequest(request, monitor);
- }
- }
- catch (Exception e) {
- JaxWsSdk.logError("Error occured while processing queued job", e);
- }
- finally {
- m_workerLock.unlock();
- }
- return Status.OK_STATUS;
- }
- }
-
- private boolean isRefuseRequests() {
- return m_refuseCounter.get() > 0;
- }
-
- private boolean isSuspend() {
- return m_suspendCounter.get() > 0;
- }
-
- private boolean isWorkerActive() {
- return Job.getJobManager().find(AbstractQueueManager.this).length > 0;
- }
-
- protected abstract void handleRequest(T request, IProgressMonitor monitor) throws Exception;
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.worker;
+
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.scout.commons.CompareUtility;
+import org.eclipse.scout.sdk.ws.jaxws.JaxWsSdk;
+
+public abstract class AbstractQueueManager<T> {
+
+ private final Lock m_workerLock;
+ private final Lock m_suspendLock;
+ private final Lock m_refuseLock;
+ private final ConcurrentLinkedQueue<T> m_requests;
+
+ private AtomicInteger m_suspendCounter;
+ private AtomicInteger m_refuseCounter;
+
+ public AbstractQueueManager() {
+ m_workerLock = new ReentrantLock();
+ m_suspendLock = new ReentrantLock();
+ m_refuseLock = new ReentrantLock();
+ m_requests = new ConcurrentLinkedQueue<T>();
+ m_suspendCounter = new AtomicInteger();
+ m_refuseCounter = new AtomicInteger();
+ }
+
+ public void queueRequest(T request) {
+ if (!isRefuseRequests()) {
+ if (!m_requests.contains(request)) {
+ m_requests.offer(request); // put request into queue
+ }
+ startWorker();
+ }
+ }
+
+ public void refuseRequests(boolean refuseRequests) {
+ m_refuseLock.lock();
+ try {
+ if (refuseRequests) {
+ m_refuseCounter.incrementAndGet();
+ }
+ else {
+ if (m_refuseCounter.decrementAndGet() < 0) { // negative values are not allowed
+ m_refuseCounter.set(0);
+ }
+ }
+ }
+ finally {
+ m_refuseLock.unlock();
+ }
+ }
+
+ public void resume() {
+ m_suspendLock.lock();
+ try {
+ if (m_suspendCounter.decrementAndGet() < 0) { // negative values are not allowed
+ m_suspendCounter.set(0);
+ }
+
+ if (m_suspendCounter.get() == 0) { // only notify the worker about the request if compilation is not suspended
+ startWorker();
+ }
+ }
+ finally {
+ m_suspendLock.unlock();
+ }
+ }
+
+ public void suspend() {
+ m_suspendLock.lock();
+ try {
+ m_suspendCounter.incrementAndGet();
+ cancelWorker();
+ }
+ finally {
+ m_suspendLock.unlock();
+ }
+ }
+
+ private void startWorker() {
+ if (m_workerLock.tryLock()) {
+ try {
+ if (!isWorkerActive() && !isSuspend()) {
+ Job worker = new P_Worker();
+ worker.setSystem(true);
+ worker.setUser(false);
+ worker.setPriority(Job.BUILD);
+ worker.schedule(200);
+ }
+ }
+ finally {
+ m_workerLock.unlock();
+ }
+ }
+ }
+
+ public void cancelWorker() {
+ if (m_workerLock.tryLock()) {
+ try {
+ if (isWorkerActive()) {
+ for (Job job : Job.getJobManager().find(AbstractQueueManager.this)) {
+ job.cancel();
+ }
+ }
+ }
+ finally {
+ m_workerLock.unlock();
+ }
+ }
+ }
+
+ private final class P_Worker extends Job {
+
+ public P_Worker() {
+ super(AbstractQueueManager.this.getClass().getSimpleName());
+ }
+
+ @Override
+ public boolean belongsTo(Object family) {
+ return CompareUtility.equals(family, AbstractQueueManager.this);
+ }
+
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ m_workerLock.lock();
+ try {
+ T request;
+ while ((request = m_requests.poll()) != null) {
+ if (monitor.isCanceled()) {
+ return Status.CANCEL_STATUS;
+ }
+ handleRequest(request, monitor);
+ }
+ }
+ catch (Exception e) {
+ JaxWsSdk.logError("Error occured while processing queued job", e);
+ }
+ finally {
+ m_workerLock.unlock();
+ }
+ return Status.OK_STATUS;
+ }
+ }
+
+ private boolean isRefuseRequests() {
+ return m_refuseCounter.get() > 0;
+ }
+
+ private boolean isSuspend() {
+ return m_suspendCounter.get() > 0;
+ }
+
+ private boolean isWorkerActive() {
+ return Job.getJobManager().find(AbstractQueueManager.this).length > 0;
+ }
+
+ protected abstract void handleRequest(T request, IProgressMonitor monitor) throws Exception;
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/worker/MarkerQueueManager.java b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/worker/MarkerQueueManager.java
index 567ba3d22..055575a01 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/worker/MarkerQueueManager.java
+++ b/org.eclipse.scout.sdk.ws.jaxws/src/org/eclipse/scout/sdk/ws/jaxws/worker/MarkerQueueManager.java
@@ -1,25 +1,25 @@
-/*******************************************************************************
- * Copyright (c) 2011 BSI Business Systems Integration AG.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
- ******************************************************************************/
-/**
- *
- */
-package org.eclipse.scout.sdk.ws.jaxws.worker;
-
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.scout.sdk.ws.jaxws.marker.IMarkerRebuildListener;
-
-public class MarkerQueueManager extends AbstractQueueManager<IMarkerRebuildListener> {
-
- @Override
- protected void handleRequest(IMarkerRebuildListener request, IProgressMonitor monitor) throws Exception {
- request.rebuildMarkers();
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 BSI Business Systems Integration AG.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Daniel Wiehl (BSI Business Systems Integration AG) - initial API and implementation
+ ******************************************************************************/
+/**
+ *
+ */
+package org.eclipse.scout.sdk.ws.jaxws.worker;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.scout.sdk.ws.jaxws.marker.IMarkerRebuildListener;
+
+public class MarkerQueueManager extends AbstractQueueManager<IMarkerRebuildListener> {
+
+ @Override
+ protected void handleRequest(IMarkerRebuildListener request, IProgressMonitor monitor) throws Exception {
+ request.rebuildMarkers();
+ }
+}
diff --git a/org.eclipse.scout.sdk.ws.jaxws/translations.nls b/org.eclipse.scout.sdk.ws.jaxws/translations.nls
index 1115adcbf..ddb6404e9 100644
--- a/org.eclipse.scout.sdk.ws.jaxws/translations.nls
+++ b/org.eclipse.scout.sdk.ws.jaxws/translations.nls
@@ -1,9 +1,9 @@
-##################################################
-# This file is maintained by the nls editor #
-# To ensure a properly working nls support of #
-# keep this file untouched directly. #
-##################################################
-Nls-Type=dynamic
-Nls-Class=org.eclipse.scout.sdk.ws.jaxws.Texts
-Nls-File-Prefix=Texts
+##################################################
+# This file is maintained by the nls editor #
+# To ensure a properly working nls support of #
+# keep this file untouched directly. #
+##################################################
+Nls-Type=dynamic
+Nls-Class=org.eclipse.scout.sdk.ws.jaxws.Texts
+Nls-File-Prefix=Texts
Nls-Translation-Folder=resources/texts \ No newline at end of file
diff --git a/org.eclipse.scout.sdk/.classpath b/org.eclipse.scout.sdk/.classpath
index 8a8f1668c..ad32c83a7 100644
--- a/org.eclipse.scout.sdk/.classpath
+++ b/org.eclipse.scout.sdk/.classpath
@@ -1,7 +1,7 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<classpath>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="output" path="bin"/>
-</classpath>
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/org.eclipse.scout.sdk/.project b/org.eclipse.scout.sdk/.project
index 93c833092..0aeb4049f 100644
--- a/org.eclipse.scout.sdk/.project
+++ b/org.eclipse.scout.sdk/.project
@@ -1,35 +1,35 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<projectDescription>
- <name>org.eclipse.scout.sdk</name>
- <comment></comment>
- <projects>
- </projects>
- <buildSpec>
- <buildCommand>
- <name>org.eclipse.jdt.core.javabuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.ManifestBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- <buildCommand>
- <name>org.eclipse.pde.SchemaBuilder</name>
- <arguments>
- </arguments>
- </buildCommand>
- </buildSpec>
- <natures>
- <nature>org.eclipse.pde.PluginNature</nature>
- <nature>org.eclipse.jdt.core.javanature</nature>
- </natures>
- <linkedResources>
- <link>
- <name>.settings</name>
- <type>2</type>
- <locationURI>WORKSPACE_LOC/org.eclipse.scout.sdk.feature/.settings</locationURI>
- </link>
- </linkedResources>
-</projectDescription>
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.scout.sdk</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+ <linkedResources>
+ <link>
+ <name>.settings</name>
+ <type>2</type>
+ <locationURI>WORKSPACE_LOC/org.eclipse.scout.sdk.feature/.settings</locationURI>
+ </link>
+ </linkedResources>
+</projectDescription>
diff --git a/org.eclipse.scout.sdk/TODO.txt b/org.eclipse.scout.sdk/TODO.txt
index 57599e4c1..802d7143e 100644
--- a/org.eclipse.scout.sdk/TODO.txt
+++ b/org.eclipse.scout.sdk/TODO.txt
@@ -1,10 +1,10 @@
-Method override Operation
--------------------------
-org.eclipse.jdt.ui.text.java.CompletionProposalCollector.createMethodDeclarationProposal(CompletionProposal)
-org.eclipse.jdt.internal.corext.util.MethodOverrideTester.isSubsignature(IMethod, IMethod)
-
-Plugin Dependencies issues:
----------------------------
-TODO:
-- remove org.eclipse.jdt.ui;bundle-version="3.6.2"
+Method override Operation
+-------------------------
+org.eclipse.jdt.ui.text.java.CompletionProposalCollector.createMethodDeclarationProposal(CompletionProposal)
+org.eclipse.jdt.internal.corext.util.MethodOverrideTester.isSubsignature(IMethod, IMethod)
+
+Plugin Dependencies issues:
+---------------------------
+TODO:
+- remove org.eclipse.jdt.ui;bundle-version="3.6.2"
- remove org.eclipse.ui.ide;bundle-version="3.6.2" \ No newline at end of file
diff --git a/org.eclipse.scout.sdk/about_files/cpl1.0.txt b/org.eclipse.scout.sdk/about_files/cpl1.0.txt
index c1afe64fc..826ede589 100644
--- a/org.eclipse.scout.sdk/about_files/cpl1.0.txt
+++ b/org.eclipse.scout.sdk/about_files/cpl1.0.txt
@@ -1,214 +1,214 @@
-Common Public License Version 1.0
-[OSI Approved License]
-
-THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC
-LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
-CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
-
-1. DEFINITIONS
-
-"Contribution" means:
-
-a) in the case of the initial Contributor, the initial code and
-documentation distributed under this Agreement, and
-
-b) in the case of each subsequent Contributor:
-
-i) changes to the Program, and
-
-ii) additions to the Program;
-
-where such changes and/or additions to the Program originate from and are
-distributed by that particular Contributor. A Contribution 'originates' from a
-Contributor if it was added to the Program by such Contributor itself or anyone
-acting on such Contributor's behalf. Contributions do not include additions to
-the Program which: (i) are separate modules of software distributed in
-conjunction with the Program under their own license agreement, and (ii) are not
-derivative works of the Program.
-
-"Contributor" means any person or entity that distributes the Program.
-
-"Licensed Patents " mean patent claims licensable by a Contributor which are
-necessarily infringed by the use or sale of its Contribution alone or when
-combined with the Program.
-
-"Program" means the Contributions distributed in accordance with this Agreement.
-
-"Recipient" means anyone who receives the Program under this Agreement,
-including all Contributors.
-
-2. GRANT OF RIGHTS
-
-a) Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide, royalty-free copyright license to
-reproduce, prepare derivative works of, publicly display, publicly perform,
-distribute and sublicense the Contribution of such Contributor, if any, and such
-derivative works, in source code and object code form.
-
-b) Subject to the terms of this Agreement, each Contributor hereby grants
-Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed
-Patents to make, use, sell, offer to sell, import and otherwise transfer the
-Contribution of such Contributor, if any, in source code and object code form.
-This patent license shall apply to the combination of the Contribution and the
-Program if, at the time the Contribution is added by the Contributor, such
-addition of the Contribution causes such combination to be covered by the
-Licensed Patents. The patent license shall not apply to any other combinations
-which include the Contribution. No hardware per se is licensed hereunder.
-
-c) Recipient understands that although each Contributor grants the licenses
-to its Contributions set forth herein, no assurances are provided by any
-Contributor that the Program does not infringe the patent or other intellectual
-property rights of any other entity. Each Contributor disclaims any liability to
-Recipient for claims brought by any other entity based on infringement of
-intellectual property rights or otherwise. As a condition to exercising the
-rights and licenses granted hereunder, each Recipient hereby assumes sole
-responsibility to secure any other intellectual property rights needed, if any.
-For example, if a third party patent license is required to allow Recipient to
-distribute the Program, it is Recipient's responsibility to acquire that license
-before distributing the Program.
-
-d) Each Contributor represents that to its knowledge it has sufficient
-copyright rights in its Contribution, if any, to grant the copyright license set
-forth in this Agreement.
-
-3. REQUIREMENTS
-
-A Contributor may choose to distribute the Program in object code form under its
-own license agreement, provided that:
-
-a) it complies with the terms and conditions of this Agreement; and
-
-b) its license agreement:
-
-i) effectively disclaims on behalf of all Contributors all warranties and
-conditions, express and implied, including warranties or conditions of title and
-non-infringement, and implied warranties or conditions of merchantability and
-fitness for a particular purpose;
-
-ii) effectively excludes on behalf of all Contributors all liability for
-damages, including direct, indirect, special, incidental and consequential
-damages, such as lost profits;
-
-iii) states that any provisions which differ from this Agreement are offered
-by that Contributor alone and not by any other party; and
-
-iv) states that source code for the Program is available from such
-Contributor, and informs licensees how to obtain it in a reasonable manner on or
-through a medium customarily used for software exchange.
-
-When the Program is made available in source code form:
-
-a) it must be made available under this Agreement; and
-
-b) a copy of this Agreement must be included with each copy of the Program.
-
-Contributors may not remove or alter any copyright notices contained within the
-Program.
-
-Each Contributor must identify itself as the originator of its Contribution, if
-any, in a manner that reasonably allows subsequent Recipients to identify the
-originator of the Contribution.
-
-4. COMMERCIAL DISTRIBUTION
-
-Commercial distributors of software may accept certain responsibilities with
-respect to end users, business partners and the like. While this license is
-intended to facilitate the commercial use of the Program, the Contributor who
-includes the Program in a commercial product offering should do so in a manner
-which does not create potential liability for other Contributors. Therefore, if
-a Contributor includes the Program in a commercial product offering, such
-Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
-every other Contributor ("Indemnified Contributor") against any losses, damages
-and costs (collectively "Losses") arising from claims, lawsuits and other legal
-actions brought by a third party against the Indemnified Contributor to the
-extent caused by the acts or omissions of such Commercial Contributor in
-connection with its distribution of the Program in a commercial product
-offering. The obligations in this section do not apply to any claims or Losses
-relating to any actual or alleged intellectual property infringement. In order
-to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
-Contributor in writing of such claim, and b) allow the Commercial Contributor to
-control, and cooperate with the Commercial Contributor in, the defense and any
-related settlement negotiations. The Indemnified Contributor may participate in
-any such claim at its own expense.
-
-For example, a Contributor might include the Program in a commercial product
-offering, Product X. That Contributor is then a Commercial Contributor. If that
-Commercial Contributor then makes performance claims, or offers warranties
-related to Product X, those performance claims and warranties are such
-Commercial Contributor's responsibility alone. Under this section, the
-Commercial Contributor would have to defend claims against the other
-Contributors related to those performance claims and warranties, and if a court
-requires any other Contributor to pay any damages as a result, the Commercial
-Contributor must pay those damages.
-
-5. NO WARRANTY
-
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
-"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
-IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
-NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
-Recipient is solely responsible for determining the appropriateness of using and
-distributing the Program and assumes all risks associated with its exercise of
-rights under this Agreement, including but not limited to the risks and costs of
-program errors, compliance with applicable laws, damage to or loss of data,
-programs or equipment, and unavailability or interruption of operations.
-
-6. DISCLAIMER OF LIABILITY
-
-EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
-CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
-PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
-STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
-OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
-GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
-
-7. GENERAL
-
-If any provision of this Agreement is invalid or unenforceable under applicable
-law, it shall not affect the validity or enforceability of the remainder of the
-terms of this Agreement, and without further action by the parties hereto, such
-provision shall be reformed to the minimum extent necessary to make such
-provision valid and enforceable.
-
-If Recipient institutes patent litigation against a Contributor with respect to
-a patent applicable to software (including a cross-claim or counterclaim in a
-lawsuit), then any patent licenses granted by that Contributor to such Recipient
-under this Agreement shall terminate as of the date such litigation is filed. In
-addition, if Recipient institutes patent litigation against any entity
-(including a cross-claim or counterclaim in a lawsuit) alleging that the Program
-itself (excluding combinations of the Program with other software or hardware)
-infringes such Recipient's patent(s), then such Recipient's rights granted under
-Section 2(b) shall terminate as of the date such litigation is filed.
-
-All Recipient's rights under this Agreement shall terminate if it fails to
-comply with any of the material terms or conditions of this Agreement and does
-not cure such failure in a reasonable period of time after becoming aware of
-such noncompliance. If all Recipient's rights under this Agreement terminate,
-Recipient agrees to cease use and distribution of the Program as soon as
-reasonably practicable. However, Recipient's obligations under this Agreement
-and any licenses granted by Recipient relating to the Program shall continue and
-survive.
-
-Everyone is permitted to copy and distribute copies of this Agreement, but in
-order to avoid inconsistency the Agreement is copyrighted and may only be
-modified in the following manner. The Agreement Steward reserves the right to
-publish new versions (including revisions) of this Agreement from time to time.
-No one other than the Agreement Steward has the right to modify this Agreement.
-IBM is the initial Agreement Steward. IBM may assign the responsibility to serve
-as the Agreement Steward to a suitable separate entity. Each new version of the
-Agreement will be given a distinguishing version number. The Program (including
-Contributions) may always be distributed subject to the version of the Agreement
-under which it was received. In addition, after a new version of the Agreement
-is published, Contributor may elect to distribute the Program (including its
-Contributions) under the new version. Except as expressly stated in Sections
-2(a) and 2(b) above, Recipient receives no rights or licenses to the
-intellectual property of any Contributor under this Agreement, whether
-expressly, by implication, estoppel or otherwise. All rights in the Program not
-expressly granted under this Agreement are reserved.
-
-This Agreement is governed by the laws of the State of New York and the
-intellectual property laws of the United States of America. No party to this
-Agreement will bring a legal action under this Agreement more than one year
-after the cause of action arose. Each party waives its rights to a jury trial in
-any resulting litigation.
+Common Public License Version 1.0
+[OSI Approved License]
+
+THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS COMMON PUBLIC
+LICENSE ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM
+CONSTITUTES RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
+
+1. DEFINITIONS
+
+"Contribution" means:
+
+a) in the case of the initial Contributor, the initial code and
+documentation distributed under this Agreement, and
+
+b) in the case of each subsequent Contributor:
+
+i) changes to the Program, and
+
+ii) additions to the Program;
+
+where such changes and/or additions to the Program originate from and are
+distributed by that particular Contributor. A Contribution 'originates' from a
+Contributor if it was added to the Program by such Contributor itself or anyone
+acting on such Contributor's behalf. Contributions do not include additions to
+the Program which: (i) are separate modules of software distributed in
+conjunction with the Program under their own license agreement, and (ii) are not
+derivative works of the Program.
+
+"Contributor" means any person or entity that distributes the Program.
+
+"Licensed Patents " mean patent claims licensable by a Contributor which are
+necessarily infringed by the use or sale of its Contribution alone or when
+combined with the Program.
+
+"Program" means the Contributions distributed in accordance with this Agreement.
+
+"Recipient" means anyone who receives the Program under this Agreement,
+including all Contributors.
+
+2. GRANT OF RIGHTS
+
+a) Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide, royalty-free copyright license to
+reproduce, prepare derivative works of, publicly display, publicly perform,
+distribute and sublicense the Contribution of such Contributor, if any, and such
+derivative works, in source code and object code form.
+
+b) Subject to the terms of this Agreement, each Contributor hereby grants
+Recipient a non-exclusive, worldwide, royalty-free patent license under Licensed
+Patents to make, use, sell, offer to sell, import and otherwise transfer the
+Contribution of such Contributor, if any, in source code and object code form.
+This patent license shall apply to the combination of the Contribution and the
+Program if, at the time the Contribution is added by the Contributor, such
+addition of the Contribution causes such combination to be covered by the
+Licensed Patents. The patent license shall not apply to any other combinations
+which include the Contribution. No hardware per se is licensed hereunder.
+
+c) Recipient understands that although each Contributor grants the licenses
+to its Contributions set forth herein, no assurances are provided by any
+Contributor that the Program does not infringe the patent or other intellectual
+property rights of any other entity. Each Contributor disclaims any liability to
+Recipient for claims brought by any other entity based on infringement of
+intellectual property rights or otherwise. As a condition to exercising the
+rights and licenses granted hereunder, each Recipient hereby assumes sole
+responsibility to secure any other intellectual property rights needed, if any.
+For example, if a third party patent license is required to allow Recipient to
+distribute the Program, it is Recipient's responsibility to acquire that license
+before distributing the Program.
+
+d) Each Contributor represents that to its knowledge it has sufficient
+copyright rights in its Contribution, if any, to grant the copyright license set
+forth in this Agreement.
+
+3. REQUIREMENTS
+
+A Contributor may choose to distribute the Program in object code form under its
+own license agreement, provided that:
+
+a) it complies with the terms and conditions of this Agreement; and
+
+b) its license agreement:
+
+i) effectively disclaims on behalf of all Contributors all warranties and
+conditions, express and implied, including warranties or conditions of title and
+non-infringement, and implied warranties or conditions of merchantability and
+fitness for a particular purpose;
+
+ii) effectively excludes on behalf of all Contributors all liability for
+damages, including direct, indirect, special, incidental and consequential
+damages, such as lost profits;
+
+iii) states that any provisions which differ from this Agreement are offered
+by that Contributor alone and not by any other party; and
+
+iv) states that source code for the Program is available from such
+Contributor, and informs licensees how to obtain it in a reasonable manner on or
+through a medium customarily used for software exchange.
+
+When the Program is made available in source code form:
+
+a) it must be made available under this Agreement; and
+
+b) a copy of this Agreement must be included with each copy of the Program.
+
+Contributors may not remove or alter any copyright notices contained within the
+Program.
+
+Each Contributor must identify itself as the originator of its Contribution, if
+any, in a manner that reasonably allows subsequent Recipients to identify the
+originator of the Contribution.
+
+4. COMMERCIAL DISTRIBUTION
+
+Commercial distributors of software may accept certain responsibilities with
+respect to end users, business partners and the like. While this license is
+intended to facilitate the commercial use of the Program, the Contributor who
+includes the Program in a commercial product offering should do so in a manner
+which does not create potential liability for other Contributors. Therefore, if
+a Contributor includes the Program in a commercial product offering, such
+Contributor ("Commercial Contributor") hereby agrees to defend and indemnify
+every other Contributor ("Indemnified Contributor") against any losses, damages
+and costs (collectively "Losses") arising from claims, lawsuits and other legal
+actions brought by a third party against the Indemnified Contributor to the
+extent caused by the acts or omissions of such Commercial Contributor in
+connection with its distribution of the Program in a commercial product
+offering. The obligations in this section do not apply to any claims or Losses
+relating to any actual or alleged intellectual property infringement. In order
+to qualify, an Indemnified Contributor must: a) promptly notify the Commercial
+Contributor in writing of such claim, and b) allow the Commercial Contributor to
+control, and cooperate with the Commercial Contributor in, the defense and any
+related settlement negotiations. The Indemnified Contributor may participate in
+any such claim at its own expense.
+
+For example, a Contributor might include the Program in a commercial product
+offering, Product X. That Contributor is then a Commercial Contributor. If that
+Commercial Contributor then makes performance claims, or offers warranties
+related to Product X, those performance claims and warranties are such
+Commercial Contributor's responsibility alone. Under this section, the
+Commercial Contributor would have to defend claims against the other
+Contributors related to those performance claims and warranties, and if a court
+requires any other Contributor to pay any damages as a result, the Commercial
+Contributor must pay those damages.
+
+5. NO WARRANTY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, THE PROGRAM IS PROVIDED ON AN
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR
+IMPLIED INCLUDING, WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE,
+NON-INFRINGEMENT, MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each
+Recipient is solely responsible for determining the appropriateness of using and
+distributing the Program and assumes all risks associated with its exercise of
+rights under this Agreement, including but not limited to the risks and costs of
+program errors, compliance with applicable laws, damage to or loss of data,
+programs or equipment, and unavailability or interruption of operations.
+
+6. DISCLAIMER OF LIABILITY
+
+EXCEPT AS EXPRESSLY SET FORTH IN THIS AGREEMENT, NEITHER RECIPIENT NOR ANY
+CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING WITHOUT LIMITATION LOST
+PROFITS), HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
+STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OR DISTRIBUTION OF THE PROGRAM OR THE EXERCISE OF ANY RIGHTS
+GRANTED HEREUNDER, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
+
+7. GENERAL
+
+If any provision of this Agreement is invalid or unenforceable under applicable
+law, it shall not affect the validity or enforceability of the remainder of the
+terms of this Agreement, and without further action by the parties hereto, such
+provision shall be reformed to the minimum extent necessary to make such
+provision valid and enforceable.
+
+If Recipient institutes patent litigation against a Contributor with respect to
+a patent applicable to software (including a cross-claim or counterclaim in a
+lawsuit), then any patent licenses granted by that Contributor to such Recipient
+under this Agreement shall terminate as of the date such litigation is filed. In
+addition, if Recipient institutes patent litigation against any entity
+(including a cross-claim or counterclaim in a lawsuit) alleging that the Program
+itself (excluding combinations of the Program with other software or hardware)
+infringes such Recipient's patent(s), then such Recipient's rights granted under
+Section 2(b) shall terminate as of the date such litigation is filed.
+
+All Recipient's rights under this Agreement shall terminate if it fails to
+comply with any of the material terms or conditions of this Agreement and does
+not cure such failure in a reasonable period of time after becoming aware of
+such noncompliance. If all Recipient's rights under this Agreement terminate,
+Recipient agrees to cease use and distribution of the Program as soon as
+reasonably practicable. However, Recipient's obligations under this Agreement
+and any licenses granted by Recipient relating to the Program shall continue and
+survive.
+
+Everyone is permitted to copy and distribute copies of this Agreement, but in
+order to avoid inconsistency the Agreement is copyrighted and may only be
+modified in the following manner. The Agreement Steward reserves the right to
+publish new versions (including revisions) of this Agreement from time to time.
+No one other than the Agreement Steward has the right to modify this Agreement.
+IBM is the initial Agreement Steward. IBM may assign the responsibility to serve
+as the Agreement Steward to a suitable separate entity. Each new version of the
+Agreement will be given a distinguishing version number. The Program (including
+Contributions) may always be distributed subject to the version of the Agreement
+under which it was received. In addition, after a new version of the Agreement
+is published, Contributor may elect to distribute the Program (including its
+Contributions) under the new version. Except as expressly stated in Sections
+2(a) and 2(b) above, Recipient receives no rights or licenses to the
+intellectual property of any Contributor under this Agreement, whether
+expressly, by implication, estoppel or otherwise. All rights in the Program not
+expressly granted under this Agreement are reserved.
+
+This Agreement is governed by the laws of the State of New York and the
+intellectual property laws of the United States of America. No party to this
+Agreement will bring a legal action under this Agreement more than one year
+after the cause of action arose. Each party waives its rights to a jury trial in
+any resulting litigation.
diff --git a/org.eclipse.scout.sdk/build.properties b/org.eclipse.scout.sdk/build.properties
index 737b88ffb..99b9945ad 100644
--- a/org.eclipse.scout.sdk/build.properties
+++ b/org.eclipse.scout.sdk/build.properties
@@ -1,15 +1,15 @@
-source.. = src/
-output.. = bin/
-bin.includes = META-INF/,\
- .,\
- plugin.xml,\
- schema/,\
- templates/,\
- resources/,\
- about.html,\
- about_files/,\
- scout.jpg,\
- about.ini
-src.includes = about_files/,\
- about.html,\
- resources/
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ schema/,\
+ templates/,\
+ resources/,\
+ about.html,\
+ about_files/,\
+ scout.jpg,\
+ about.ini
+src.includes = about_files/,\
+ about.html,\
+ resources/
diff --git a/org.eclipse.scout.sdk/plugin.xml b/org.eclipse.scout.sdk/plugin.xml
index 9b2e35683..5ac8760a0 100644
--- a/org.eclipse.scout.sdk/plugin.xml
+++ b/org.eclipse.scout.sdk/plugin.xml
@@ -1,215 +1,215 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<?eclipse version="3.2"?>
-<plugin>
- <extension-point id="newProjectOperation" name="New Scout Project Operations" schema="schema/newProjectOperation.exsd"/>
- <extension
- id="org.eclipse.scout.sdk.ScoutNature"
- name="Scout Bundle"
- point="org.eclipse.core.resources.natures">
- <runtime>
- <run class="org.eclipse.scout.sdk.ScoutNature">
- </run>
- </runtime>
- <requires-nature
- id="org.eclipse.jdt.core.javanature">
- </requires-nature>
- <requires-nature
- id="org.eclipse.pde.PluginNature">
- </requires-nature>
- </extension>
- <extension
- id="formPropertyBean"
- name="Scout Problem"
- point="org.eclipse.core.resources.markers">
- <super
- type="org.eclipse.core.resources.problemmarker">
- </super>
- <super
- type="org.eclipse.core.resources.textmarker">
- </super>
- <attribute
- name="methodName">
- </attribute>
- <attribute
- name="methodSignature">
- </attribute>
- <attribute
- name="fullyQualifiedName">
- </attribute>
- </extension>
- <extension
- id="org.eclipse.scout.sdk.marker"
- name="Scout SDK Marker"
- point="org.eclipse.core.resources.markers">
- <persistent
- value="true">
- </persistent>
- <super
- type="org.eclipse.core.resources.marker">
- </super>
- <super
- type="org.eclipse.core.resources.problemmarker">
- </super>
- <super
- type="org.eclipse.core.resources.textmarker">
- </super>
- </extension>
- <extension
- id="org.eclipse.scout.sdk.formdata.sql.binding"
- name="SQL Binding markers"
- point="org.eclipse.core.resources.markers">
- <super
- type="org.eclipse.core.resources.marker">
- </super>
- <super
- type="org.eclipse.core.resources.textmarker">
- </super>
- <attribute
- name="method">
- </attribute>
- <persistent
- value="false">
- </persistent>
- </extension>
- <extension
- id="org.eclipse.scout.sdk.formdata.sql.binding.single"
- name="SQL Binding"
- point="org.eclipse.core.resources.markers">
- <persistent
- value="false">
- </persistent>
- <super
- type="org.eclipse.scout.sdk.formdata.sql.binding">
- </super>
- <super
- type="org.eclipse.core.resources.marker">
- </super>
- <super
- type="org.eclipse.core.resources.textmarker">
- </super>
- <super
- type="org.eclipse.core.resources.problemmarker">
- </super>
- <attribute
- name="method">
- </attribute>
- </extension>
- <extension
- id="org.eclipse.scout.sdk.formdata.sql.binding.multi"
- name="SQL Binding Multi"
- point="org.eclipse.core.resources.markers">
- <persistent
- value="false">
- </persistent>
- <super
- type="org.eclipse.scout.sdk.formdata.sql.binding">
- </super>
- <super
- type="org.eclipse.core.resources.marker">
- </super>
- <super
- type="org.eclipse.core.resources.textmarker">
- </super>
- <attribute
- name="method">
- </attribute>
- </extension>
- <extension
- point="org.eclipse.scout.sdk.newProjectOperation">
- <operation
- class="org.eclipse.scout.sdk.operation.project.CreateSharedPluginOperation"
- id="create.shared">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.CreateClientPluginOperation"
- id="create.client"
- referenceId="create.shared">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.CreateServerPluginOperation"
- id="create.server"
- referenceId="create.shared">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.CreateUiSwingPluginOperation"
- id="create.ui.swing"
- referenceId="create.client">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.CreateUiSwtPluginOperation"
- id="create.ui.swt"
- referenceId="create.client">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.FillClientPluginOperation"
- id="fill.client"
- referenceId="create.client">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.FillSharedPluginOperation"
- id="fill.shared"
- referenceId="create.shared">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.FillServerPluginOperation"
- id="fill.server"
- referenceId="create.server">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.FillUiSwingPluginOperation"
- id="fill.ui.swing"
- referenceId="create.ui.swing">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.FillUiSwtPluginOperation"
- id="fill.ui.swt"
- referenceId="create.ui.swt">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.template.SingleFormTemplateOperation"
- id="template.singleform"
- referenceId="fill.client">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.template.OutlineTemplateOperation"
- id="template.outline"
- referenceId="fill.client">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.ServerProductFileUpgradeOperation"
- id="finalize.server.products"
- referenceId="fill.server">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.SwtPluginXmlUpgradeOperation"
- id="finalize.ui.swt.plugin.xml"
- referenceId="fill.ui.swt">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.SwtProductFileMacOsXOperation"
- id="finalize.ui.swt.product.macosx"
- referenceId="fill.ui.swt">
- </operation>
- <operation
- class="org.eclipse.scout.sdk.operation.project.SwtProductFileUpgradeOperation"
- id="finalize.ui.swt.products"
- referenceId="fill.ui.swt">
- </operation>
- </extension>
- <extension
- id="org.eclipse.scout.sdk.ScoutLibraryNature"
- name="Scout Library Bundle"
- point="org.eclipse.core.resources.natures">
- <runtime>
- <run
- class="org.eclipse.scout.sdk.ScoutLibraryNature">
- </run>
- </runtime>
- <requires-nature
- id="org.eclipse.jdt.core.javanature">
- </requires-nature>
- <requires-nature
- id="org.eclipse.pde.PluginNature">
- </requires-nature>
- </extension>
-</plugin>
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension-point id="newProjectOperation" name="New Scout Project Operations" schema="schema/newProjectOperation.exsd"/>
+ <extension
+ id="org.eclipse.scout.sdk.ScoutNature"
+ name="Scout Bundle"
+ point="org.eclipse.core.resources.natures">
+ <runtime>
+ <run class="org.eclipse.scout.sdk.ScoutNature">
+ </run>
+ </runtime>
+ <requires-nature
+ id="org.eclipse.jdt.core.javanature">
+ </requires-nature>
+ <requires-nature
+ id="org.eclipse.pde.PluginNature">
+ </requires-nature>
+ </extension>
+ <extension
+ id="formPropertyBean"
+ name="Scout Problem"
+ point="org.eclipse.core.resources.markers">
+ <super
+ type="org.eclipse.core.resources.problemmarker">
+ </super>
+ <super
+ type="org.eclipse.core.resources.textmarker">
+ </super>
+ <attribute
+ name="methodName">
+ </attribute>
+ <attribute
+ name="methodSignature">
+ </attribute>
+ <attribute
+ name="fullyQualifiedName">
+ </attribute>
+ </extension>
+ <extension
+ id="org.eclipse.scout.sdk.marker"
+ name="Scout SDK Marker"
+ point="org.eclipse.core.resources.markers">
+ <persistent
+ value="true">
+ </persistent>
+ <super
+ type="org.eclipse.core.resources.marker">
+ </super>
+ <super
+ type="org.eclipse.core.resources.problemmarker">
+ </super>
+ <super
+ type="org.eclipse.core.resources.textmarker">
+ </super>
+ </extension>
+ <extension
+ id="org.eclipse.scout.sdk.formdata.sql.binding"
+ name="SQL Binding markers"
+ point="org.eclipse.core.resources.markers">
+ <super
+ type="org.eclipse.core.resources.marker">
+ </super>
+ <super
+ type="org.eclipse.core.resources.textmarker">
+ </super>
+ <attribute
+ name="method">
+ </attribute>
+ <persistent
+ value="false">
+ </persistent>
+ </extension>
+ <extension
+ id="org.eclipse.scout.sdk.formdata.sql.binding.single"
+ name="SQL Binding"
+ point="org.eclipse.core.resources.markers">
+ <persistent
+ value="false">
+ </persistent>
+ <super
+ type="org.eclipse.scout.sdk.formdata.sql.binding">
+ </super>
+ <super
+ type="org.eclipse.core.resources.marker">
+ </super>
+ <super
+ type="org.eclipse.core.resources.textmarker">
+ </super>
+ <super
+ type="org.eclipse.core.resources.problemmarker">
+ </super>
+ <attribute
+ name="method">
+ </attribute>
+ </extension>
+ <extension
+ id="org.eclipse.scout.sdk.formdata.sql.binding.multi"
+ name="SQL Binding Multi"
+ point="org.eclipse.core.resources.markers">
+ <persistent
+ value="false">
+ </persistent>
+ <super
+ type="org.eclipse.scout.sdk.formdata.sql.binding">
+ </super>
+ <super
+ type="org.eclipse.core.resources.marker">
+ </super>
+ <super
+ type="org.eclipse.core.resources.textmarker">
+ </super>
+ <attribute
+ name="method">
+ </attribute>
+ </extension>
+ <extension
+ point="org.eclipse.scout.sdk.newProjectOperation">
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.CreateSharedPluginOperation"
+ id="create.shared">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.CreateClientPluginOperation"
+ id="create.client"
+ referenceId="create.shared">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.CreateServerPluginOperation"
+ id="create.server"
+ referenceId="create.shared">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.CreateUiSwingPluginOperation"
+ id="create.ui.swing"
+ referenceId="create.client">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.CreateUiSwtPluginOperation"
+ id="create.ui.swt"
+ referenceId="create.client">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.FillClientPluginOperation"
+ id="fill.client"
+ referenceId="create.client">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.FillSharedPluginOperation"
+ id="fill.shared"
+ referenceId="create.shared">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.FillServerPluginOperation"
+ id="fill.server"
+ referenceId="create.server">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.FillUiSwingPluginOperation"
+ id="fill.ui.swing"
+ referenceId="create.ui.swing">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.FillUiSwtPluginOperation"
+ id="fill.ui.swt"
+ referenceId="create.ui.swt">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.template.SingleFormTemplateOperation"
+ id="template.singleform"
+ referenceId="fill.client">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.template.OutlineTemplateOperation"
+ id="template.outline"
+ referenceId="fill.client">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.ServerProductFileUpgradeOperation"
+ id="finalize.server.products"
+ referenceId="fill.server">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.SwtPluginXmlUpgradeOperation"
+ id="finalize.ui.swt.plugin.xml"
+ referenceId="fill.ui.swt">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.SwtProductFileMacOsXOperation"
+ id="finalize.ui.swt.product.macosx"
+ referenceId="fill.ui.swt">
+ </operation>
+ <operation
+ class="org.eclipse.scout.sdk.operation.project.SwtProductFileUpgradeOperation"
+ id="finalize.ui.swt.products"
+ referenceId="fill.ui.swt">
+ </operation>
+ </extension>
+ <extension
+ id="org.eclipse.scout.sdk.ScoutLibraryNature"
+ name="Scout Library Bundle"
+ point="org.eclipse.core.resources.natures">
+ <runtime>
+ <run
+ class="org.eclipse.scout.sdk.ScoutLibraryNature">
+ </run>
+ </runtime>
+ <requires-nature
+ id="org.eclipse.jdt.core.javanature">
+ </requires-nature>
+ <requires-nature
+ id="org.eclipse.pde.PluginNature">
+ </requires-nature>
+ </extension>
+</plugin>

Back to the top